diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 363111a26c0a9c..be2d372e88c177 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:32 + image: ghcr.io/project-chip/chip-build-k32w:33 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-tv-app.yaml b/.github/workflows/examples-tv-app.yaml new file mode 100644 index 00000000000000..fff6cbb39d1acb --- /dev/null +++ b/.github/workflows/examples-tv-app.yaml @@ -0,0 +1,72 @@ +# 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: Build example - TV App and TV Casting App + +on: + push: + pull_request: + merge_group: + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + cancel-in-progress: true + +env: + CHIP_NO_LOG_TIMESTAMPS: true + +jobs: + tv-app: + name: TV App + + env: + BUILD_TYPE: tv_app + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: ghcr.io/project-chip/chip-build-android:35 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: android + - name: Set up environment for size reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + - name: Build Android arm64-tv-casting-app + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --target android-arm64-tv-casting-app build" + - name: Clean out build output + run: rm -rf ./out examples/tv-casting-app/android/App/app/libs/jniLibs/* examples/tv-casting-app/android/App/app/libs/*.jar + - name: Build Android arm64-tv-server + 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 examples/tv-app/android/App/app/libs/jniLibs/* examples/tv-app/android/App/app/libs/*.jar + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: TVApp diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6b99456496d22a..189f63837c841e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -119,7 +119,6 @@ jobs: --known-failure app/reporting/tests/MockReportScheduler.h \ --known-failure app/server/AppDelegate.h \ --known-failure app/TestEventTriggerDelegate.h \ - --known-failure app/util/af-enums.h \ --known-failure app/util/af.h \ --known-failure app/util/af-types.h \ --known-failure app/util/attribute-metadata.h \ @@ -197,7 +196,7 @@ jobs: - name: Check for incorrect error use in VerifyOrExit if: always() run: | - git grep -n "VerifyOrExit(.*, [A-Za-z]*_ERROR" -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + git grep -I -n "VerifyOrExit(.*, [A-Za-z]*_ERROR" -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -205,7 +204,7 @@ jobs: - name: Check for use of PRI*8, which are not supported on some libcs. if: always() run: | - git grep -n "PRI.8" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 + git grep -I -n "PRI.8" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -213,7 +212,7 @@ jobs: - name: Check for use of PRI*16, which are not supported on some libcs. if: always() run: | - git grep -n "PRI.16" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 + git grep -I -n "PRI.16" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -226,7 +225,7 @@ jobs: # TODO: TLVDebug should ideally not be excluded here. # TODO: protocol_decoder.cpp should ideally not be excluded here. # TODO: PersistentStorageMacros.h should ideally not be excluded here. - git grep -n "PRI.64" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)examples/chip-tool' ':(exclude)examples/tv-casting-app' ':(exclude)src/app/MessageDef/MessageDefHelper.cpp' ':(exclude)src/app/tests/integration/chip_im_initiator.cpp' ':(exclude)src/lib/core/TLVDebug.cpp' ':(exclude)src/lib/dnssd/tests/TestTxtFields.cpp' ':(exclude)src/lib/format/protocol_decoder.cpp' ':(exclude)src/lib/support/PersistentStorageMacros.h' ':(exclude)src/messaging/tests/echo/echo_requester.cpp' ':(exclude)src/platform/Linux' ':(exclude)src/platform/Ameba' ':(exclude)src/platform/ESP32' ':(exclude)src/platform/webos' ':(exclude)zzz_generated/chip-tool' ':(exclude)src/tools/chip-cert/Cmd_PrintCert.cpp' && exit 1 || exit 0 + git grep -I -n "PRI.64" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)examples/chip-tool' ':(exclude)examples/tv-casting-app' ':(exclude)src/app/MessageDef/MessageDefHelper.cpp' ':(exclude)src/app/tests/integration/chip_im_initiator.cpp' ':(exclude)src/lib/core/TLVDebug.cpp' ':(exclude)src/lib/dnssd/tests/TestTxtFields.cpp' ':(exclude)src/lib/format/protocol_decoder.cpp' ':(exclude)src/lib/support/PersistentStorageMacros.h' ':(exclude)src/messaging/tests/echo/echo_requester.cpp' ':(exclude)src/platform/Linux' ':(exclude)src/platform/Ameba' ':(exclude)src/platform/ESP32' ':(exclude)src/platform/webos' ':(exclude)zzz_generated/chip-tool' ':(exclude)src/tools/chip-cert/Cmd_PrintCert.cpp' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -261,7 +260,7 @@ jobs: - name: Check for use of 0x%u and the like, which lead to misleading output. if: always() run: | - git grep -n '0x%[0-9l.-]*[^0-9lxX".-]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + git grep -I -n '0x%[0-9l.-]*[^0-9lxX".-]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -269,7 +268,7 @@ jobs: - name: Check for use of '"0x" PRIu*' and the like, which lead to misleading output. if: always() run: | - git grep -n '0x%[0-9-]*" *PRI[^xX]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + git grep -I -n '0x%[0-9-]*" *PRI[^xX]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. @@ -285,7 +284,7 @@ jobs: - name: Check for use of 'emberAfReadAttribute' instead of the type-safe getters if: always() run: | - git grep -n 'emberAfReadAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' && exit 1 || exit 0 + git grep -I -n 'emberAfReadAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -295,7 +294,7 @@ jobs: - name: Check for use of 'emberAfWriteAttribute' instead of the type-safe setters if: always() run: | - git grep -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0 + git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0 # Run python Linter (flake8) and verify python files # ignore some style errors, restyler should do that @@ -310,7 +309,7 @@ jobs: - name: Check for use of "SuccessOrExit(CHIP_ERROR_*)", which should probably be "SuccessOrExit(err = CHIP_ERROR_*)" if: always() run: | - git grep -n 'SuccessOrExit(CHIP_ERROR' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + git grep -I -n 'SuccessOrExit(CHIP_ERROR' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, @@ -318,4 +317,4 @@ jobs: - name: Check for use of "SuccessOrExit(something-without-assignment(", which should probably be "SuccessOrExit(err = something(" if: always() run: | - git grep -n 'SuccessOrExit([^=)]*(' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + git grep -I -n 'SuccessOrExit([^=)]*(' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index bd9ac282b78a79..05d2670edd665e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -500,7 +500,7 @@ jobs: scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.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 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_4_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' @@ -526,6 +526,18 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_1_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_1_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OVENOPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './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-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index f1be1a194a1b46..62231116bb92c1 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -65,7 +65,7 @@ jobs: "clang") GN_ARGS='is_clang=true';; "mbedtls") GN_ARGS='chip_crypto="mbedtls"';; "rotating_device_id") GN_ARGS='chip_crypto="boringssl" chip_enable_rotating_device_id=true';; - "icd") GN_ARGS='chip_enable_icd_server=true';; + "icd") GN_ARGS='chip_enable_icd_server=true chip_enable_icd_lit=true';; *) ;; esac diff --git a/BUILD.gn b/BUILD.gn index e201b56ceac00d..838ea743f348c8 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -626,8 +626,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (enable_linux_lit_icd_app_build) { group("linux_lit_icd_app") { - deps = - [ "${chip_root}/examples/lit-icd-app/linux(${standalone_toolchain})" ] + lit_icd_standalone_toolchain = + "${chip_root}/config/standalone/toolchain:lit_icd" + + deps = [ "${chip_root}/examples/lit-icd-app/linux(${lit_icd_standalone_toolchain})" ] } extra_build_deps += [ ":linux_lit_icd_app" ] diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 672bf5834da196..9b81d7cf30282e 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -139,6 +139,12 @@ matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_EN matter_add_gn_arg_bool ("chip_enable_factory_data" CONFIG_CHIP_FACTORY_DATA) matter_add_gn_arg_bool ("chip_enable_read_client" CONFIG_CHIP_ENABLE_READ_CLIENT) +if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) +endif() + if (CONFIG_CHIP_FACTORY_DATA OR CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND) matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE) matter_add_gn_arg_bool("chip_use_transitional_device_instance_info_provider" FALSE) diff --git a/config/nxp/chip-module/Kconfig b/config/nxp/chip-module/Kconfig index 88918a67450ad3..7ee0917ebec555 100644 --- a/config/nxp/chip-module/Kconfig +++ b/config/nxp/chip-module/Kconfig @@ -208,7 +208,7 @@ endif #CHIP_FACTORY_DATA_BUILD # See config/zephyr/Kconfig for full definition config CHIP_FACTORY_RESET_ERASE_NVS bool - default y if CHIP_FACTORY_DATA || CHIP_FACTORY_DATA_CUSTOM_BACKEND + default y endif diff --git a/config/nxp/chip-module/Kconfig.defaults b/config/nxp/chip-module/Kconfig.defaults index 56c82e3752900c..531a3f38245aad 100644 --- a/config/nxp/chip-module/Kconfig.defaults +++ b/config/nxp/chip-module/Kconfig.defaults @@ -87,7 +87,7 @@ config PTHREAD_IPC config POSIX_MAX_FDS int - default 16 + default 8 # Application stack size config MAIN_STACK_SIZE @@ -99,12 +99,21 @@ config INIT_STACKS config NET_MGMT_EVENT_STACK_SIZE default 2048 +config NET_MGMT_EVENT_QUEUE_SIZE + default 20 + config NET_IPV6_MLD default y config NET_IF_MCAST_IPV6_ADDR_COUNT default 14 +config NET_IF_MAX_IPV4_COUNT + default 2 + +config NET_IF_MAX_IPV6_COUNT + default 2 + config NET_TC_TX_COUNT default 1 @@ -129,10 +138,10 @@ config NET_TC_RX_THREAD_BASE_PRIO # Network buffers config NET_PKT_RX_COUNT - default 16 + default 60 config NET_PKT_TX_COUNT - default 16 + default 40 config NET_BUF_RX_COUNT default 60 @@ -141,7 +150,7 @@ config NET_BUF_TX_COUNT default 80 config NET_BUF_DATA_SIZE - default 1700 + default 1744 # Bluetooth Low Energy configs @@ -233,11 +242,14 @@ choice WPA_SUPP_LOG_LEVEL_CHOICE endchoice config WPA_SUPP_THREAD_STACK_SIZE - default 6144 + default 12288 config SYSTEM_WORKQUEUE_STACK_SIZE default 2048 +config NET_TCP_WORKQ_STACK_SIZE + default 2048 + # align these numbers to match the OpenThread config config NET_IF_UNICAST_IPV6_ADDR_COUNT default 6 @@ -246,7 +258,25 @@ config NET_IF_MCAST_IPV6_ADDR_COUNT default 8 config NET_SOCKETS_POLL_MAX - default 4 + default 8 + +config NET_IPV4_FRAGMENT_MAX_COUNT + default 3 + +config NET_IPV4_FRAGMENT_MAX_PKT + default 7 + +config NET_IPV4_FRAGMENT_TIMEOUT + default 3 + +config NET_IPV6_FRAGMENT_MAX_COUNT + default 3 + +config NET_IPV6_FRAGMENT_MAX_PKT + default 7 + +config NET_IPV6_FRAGMENT_TIMEOUT + default 3 # options managed by IP4/IP6 simultaneous support # aligned here to match OpenThread config @@ -260,7 +290,7 @@ config SHELL_STACK_SIZE default 2616 config HEAP_MEM_POOL_SIZE - default 65536 + default 122880 config CHIP_MALLOC_SYS_HEAP_SIZE default 28672 # 28 kB diff --git a/config/nxp/lib/pw_rpc/BUILD.gn b/config/nxp/lib/pw_rpc/BUILD.gn new file mode 100644 index 00000000000000..05962da9299912 --- /dev/null +++ b/config/nxp/lib/pw_rpc/BUILD.gn @@ -0,0 +1,38 @@ +# 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. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") +import("$dir_pw_build/target_types.gni") + +static_library("pw_rpc") { + output_name = "libPwRpc" + + public_configs = [ "${dir_pigweed}/pw_hdlc:default_config" ] + deps = [ + "$dir_pw_rpc:server", + "$dir_pw_rpc/nanopb:echo_service", + "${chip_root}/examples/platform/nxp/pw_sys_io:pw_sys_io_nxp", + "${dir_pigweed}/pw_hdlc:pw_rpc", + dir_pw_assert, + dir_pw_hdlc, + dir_pw_log, + ] + + deps += pw_build_LINK_DEPS + + output_dir = "${root_out_dir}/lib" + + complete_static_lib = true +} diff --git a/config/nxp/lib/pw_rpc/pw_rpc.gni b/config/nxp/lib/pw_rpc/pw_rpc.gni new file mode 100644 index 00000000000000..68255db8bb96da --- /dev/null +++ b/config/nxp/lib/pw_rpc/pw_rpc.gni @@ -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. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" +pw_sys_io_BACKEND = "${chip_root}/examples/platform/nxp/pw_sys_io:pw_sys_io_nxp" + +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] + +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" diff --git a/config/standalone/toolchain/BUILD.gn b/config/standalone/toolchain/BUILD.gn index 8e9160fe097216..58e284cdc38a77 100644 --- a/config/standalone/toolchain/BUILD.gn +++ b/config/standalone/toolchain/BUILD.gn @@ -25,3 +25,12 @@ gcc_toolchain("standalone") { import("${chip_root}/config/standalone/args.gni") } } + +gcc_toolchain("lit_icd") { + toolchain_args = { + current_os = host_os + current_cpu = host_cpu + is_clang = false + import("${chip_root}/examples/lit-icd-app/linux/args.gni") + } +} diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index 418dbc07e0ba0b..7862d5f8b95d8e 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -104,6 +104,12 @@ matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_ matter_add_gn_arg_bool ("chip_automation_logging" FALSE) matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT) +if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) +endif() + if (CONFIG_CHIP_FACTORY_DATA) matter_add_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false") matter_add_gn_arg_bool ("chip_enable_factory_data" "true") diff --git a/config/tizen/chip-gn/platform/BUILD.gn b/config/tizen/chip-gn/platform/BUILD.gn index bea16af373fd15..7d2f25e9bcf4f8 100644 --- a/config/tizen/chip-gn/platform/BUILD.gn +++ b/config/tizen/chip-gn/platform/BUILD.gn @@ -20,10 +20,6 @@ import("${chip_root}/config/tizen/chip-gn/args.gni") import("${build_root}/config/linux/pkg_config.gni") import("${chip_root}/src/platform/device.gni") -pkg_config("capi-system-peripheral-io") { - packages = [ "capi-system-peripheral-io" ] -} - pkg_config("dlog") { packages = [ "dlog" ] } @@ -73,7 +69,6 @@ source_set("tizen") { ":glib", ":capi-appfw-preference", ":capi-system-info", - ":capi-system-peripheral-io", ] if (chip_mdns == "platform") { diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 8df6c418aa42e3..ad36a663b5fd1f 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -334,6 +334,7 @@ if CHIP_ENABLE_ICD_SUPPORT config CHIP_ICD_SLOW_POLL_INTERVAL int "Intermittently Connected Device slow polling interval (ms)" + default 30000 if CHIP_ICD_LIT_SUPPORT default 1000 help Provides the Intermittently Connected Device slow polling interval in milliseconds while the @@ -347,33 +348,57 @@ config CHIP_ICD_FAST_POLLING_INTERVAL Provides the Intermittently Connected Device fast polling interval in milliseconds while the device is in the active mode. It determines the fastest frequency at which the device will be able to receive the messages in the active mode. The CHIP_ICD_FAST_POLLING_INTERVAL shall be smaller than - CHIP_ICD_ACTIVE_MODE_INTERVAL. + CHIP_ICD_ACTIVE_MODE_DURATION. -config CHIP_ICD_IDLE_MODE_INTERVAL - int "Intermittently Connected Device idle mode interval (s)" +config CHIP_ICD_IDLE_MODE_DURATION + int "Intermittently Connected Device idle mode duration (s)" + default 300 if CHIP_ICD_LIT_SUPPORT default 120 help - Provides the Intermittently Connected Device idle mode interval in seconds. + Provides the Intermittently Connected Device idle mode duration in seconds. It determines the maximum amount of time the device can stay in the idle mode, which means the device may be unreachable and not able to receive messages. -config CHIP_ICD_ACTIVE_MODE_INTERVAL - int "Intermittently Connected Device active mode interval (ms)" +config CHIP_ICD_ACTIVE_MODE_DURATION + int "Intermittently Connected Device active mode duration (ms)" default 300 help - Provides the Intermittently Connected Device active mode interval in milliseconds. + Provides the Intermittently Connected Device active mode duration in milliseconds. It determines the minimum amount of time the device shall stay in the active mode. config CHIP_ICD_ACTIVE_MODE_THRESHOLD int "Intermittently Connected Device active mode threshold (ms)" + default 5000 if CHIP_ICD_LIT_SUPPORT default 300 help Provides the Intermittently Connected Device active mode threshold in milliseconds. It determines the minimum amount of time the device shall stay in the active mode after the network activity. + For LIT devices it cannot be set to a value smaller than 5000 ms. + +config CHIP_ICD_LIT_SUPPORT + bool "Intermittenly Connected Device Long Idle Time support" + imply CHIP_ICD_CHECK_IN_SUPPORT + imply CHIP_ICD_UAT_SUPPORT + help + Enables the Intermittently Connected Device Long Idle Time support in Matter. + It also implies the ICD Check-In and UAT features support that are mandatory for LIT device. + +config CHIP_ICD_CHECK_IN_SUPPORT + bool "Intermittenly Connected Device Check-In protocol support" + help + Enables the Check-In protocol support in Matter. It allows an ICD device to notify the registered + ICD clients that it is available for communication. + +config CHIP_ICD_UAT_SUPPORT + bool "Intermittenly Connected Device User Active Mode Trigger support" + help + Enables the User Active Mode Trigger (UAT) support in Matter. It allows the User to use application specific + means (e.g. button press) to trigger an ICD device to enter the active mode and become responsive. config CHIP_ICD_CLIENTS_PER_FABRIC int "Intermittently Connected Device number of clients per fabric" default 2 + depends on CHIP_ICD_CHECK_IN_SUPPORT help Provides the Intermittently Connected Device number of clients per fabric. It determines the maximum number of clients per fabric that can be registered to receive notification from a device if their subscription is lost. diff --git a/data_model/clusters/ConcentrationMeasurement.xml b/data_model/clusters/ConcentrationMeasurement.xml index c5e2971406f676..4b51cffa124321 100644 --- a/data_model/clusters/ConcentrationMeasurement.xml +++ b/data_model/clusters/ConcentrationMeasurement.xml @@ -261,4 +261,4 @@ Davis, CA 95616, USA - + \ No newline at end of file diff --git a/data_model/clusters/DemandResponseLoadControl.xml b/data_model/clusters/DemandResponseLoadControl.xml index 170cde68e8acff..a5322bfb4f7206 100644 --- a/data_model/clusters/DemandResponseLoadControl.xml +++ b/data_model/clusters/DemandResponseLoadControl.xml @@ -248,17 +248,14 @@ Davis, CA 95616, USA - - - @@ -266,13 +263,11 @@ Davis, CA 95616, USA - - @@ -286,7 +281,6 @@ Davis, CA 95616, USA - @@ -294,7 +288,6 @@ Davis, CA 95616, USA - @@ -302,7 +295,6 @@ Davis, CA 95616, USA - @@ -310,7 +302,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/DeviceEnergyManagement.xml b/data_model/clusters/DeviceEnergyManagement.xml index 6d6477cc72fb7c..21f74a737d52cb 100644 --- a/data_model/clusters/DeviceEnergyManagement.xml +++ b/data_model/clusters/DeviceEnergyManagement.xml @@ -130,10 +130,10 @@ Davis, CA 95616, USA - + - + @@ -237,13 +237,13 @@ Davis, CA 95616, USA - + - + - + @@ -257,36 +257,31 @@ Davis, CA 95616, USA - + - - - - - @@ -294,181 +289,146 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -477,7 +437,6 @@ Davis, CA 95616, USA - @@ -486,7 +445,6 @@ Davis, CA 95616, USA - @@ -498,7 +456,6 @@ Davis, CA 95616, USA - diff --git a/data_model/clusters/DiagnosticsGeneral.xml b/data_model/clusters/DiagnosticsGeneral.xml index 3ea1b41fc62a75..072d75d64acc31 100644 --- a/data_model/clusters/DiagnosticsGeneral.xml +++ b/data_model/clusters/DiagnosticsGeneral.xml @@ -58,9 +58,14 @@ Davis, CA 95616, USA - + + + + + + @@ -176,40 +181,32 @@ Davis, CA 95616, USA - - - - - - - - @@ -289,6 +286,33 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data_model/clusters/ElectricalEnergyMeasurement.xml b/data_model/clusters/ElectricalEnergyMeasurement.xml index bcf229c0266009..c6bf8e73863c41 100644 --- a/data_model/clusters/ElectricalEnergyMeasurement.xml +++ b/data_model/clusters/ElectricalEnergyMeasurement.xml @@ -67,50 +67,21 @@ Davis, CA 95616, USA - - - - - - + + - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - + @@ -120,17 +91,7 @@ Davis, CA 95616, USA - - - - - - - - - - - + @@ -140,7 +101,7 @@ Davis, CA 95616, USA - + @@ -150,47 +111,7 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -200,122 +121,57 @@ Davis, CA 95616, USA - + - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - + - - - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + - - + + + + + + + - + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - + + + + + + + diff --git a/data_model/clusters/ElectricalPowerMeasurement.xml b/data_model/clusters/ElectricalPowerMeasurement.xml index 996fb0ce59ec11..aa5baeaf368cbb 100644 --- a/data_model/clusters/ElectricalPowerMeasurement.xml +++ b/data_model/clusters/ElectricalPowerMeasurement.xml @@ -59,238 +59,151 @@ Davis, CA 95616, USA - + - + - + - + - + - + - - - - - - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + - + - + + - + - + + + + + + + + + + + + + + + + + + - + + - + - + - + + - + - + - + + - + - + - + + - + - + - + + - + - + - + + + + + + + + + - + @@ -299,7 +212,7 @@ Davis, CA 95616, USA - + @@ -308,51 +221,28 @@ Davis, CA 95616, USA - - - - - - - + - + - - + + - + - - - + + + + - + - - - - - - - - - - - - - - - - - - - - + + diff --git a/data_model/clusters/EnergyCalendar.xml b/data_model/clusters/EnergyCalendar.xml index 0f9cf3c087ecf8..a21845d92c47c4 100644 --- a/data_model/clusters/EnergyCalendar.xml +++ b/data_model/clusters/EnergyCalendar.xml @@ -195,9 +195,21 @@ Davis, CA 95616, USA - - - + + + + + + + + + + + + + + + diff --git a/data_model/clusters/EnergyEVSE.xml b/data_model/clusters/EnergyEVSE.xml index c788edc054ede0..f59d41807d43e6 100644 --- a/data_model/clusters/EnergyEVSE.xml +++ b/data_model/clusters/EnergyEVSE.xml @@ -227,12 +227,10 @@ Davis, CA 95616, USA - - @@ -241,7 +239,6 @@ Davis, CA 95616, USA - @@ -277,19 +274,19 @@ Davis, CA 95616, USA - + - + - + @@ -297,7 +294,7 @@ Davis, CA 95616, USA - + @@ -421,11 +418,11 @@ Davis, CA 95616, USA - + - + @@ -439,7 +436,7 @@ Davis, CA 95616, USA - + @@ -512,7 +509,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/EnergyPreference.xml b/data_model/clusters/EnergyPreference.xml index fa50bbe839ae65..7156be8eafe025 100644 --- a/data_model/clusters/EnergyPreference.xml +++ b/data_model/clusters/EnergyPreference.xml @@ -85,11 +85,9 @@ Davis, CA 95616, USA - - diff --git a/data_model/clusters/EnergyPrice.xml b/data_model/clusters/EnergyPrice.xml index b358e75ab53a5c..23072a6a99ead5 100644 --- a/data_model/clusters/EnergyPrice.xml +++ b/data_model/clusters/EnergyPrice.xml @@ -113,15 +113,12 @@ Davis, CA 95616, USA - - - @@ -129,35 +126,28 @@ Davis, CA 95616, USA - - - - - - - diff --git a/data_model/clusters/Group-Key-Management-Cluster.xml b/data_model/clusters/Group-Key-Management-Cluster.xml index ad86b24e3bd387..43e7a395ac8467 100644 --- a/data_model/clusters/Group-Key-Management-Cluster.xml +++ b/data_model/clusters/Group-Key-Management-Cluster.xml @@ -87,16 +87,13 @@ Davis, CA 95616, USA - - - diff --git a/data_model/clusters/ICDManagement.xml b/data_model/clusters/ICDManagement.xml index f138e7037687b6..3cc6c9bfab4416 100644 --- a/data_model/clusters/ICDManagement.xml +++ b/data_model/clusters/ICDManagement.xml @@ -79,11 +79,11 @@ Davis, CA 95616, USA - + - + @@ -185,7 +185,7 @@ Davis, CA 95616, USA - + @@ -197,7 +197,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/Messages.xml b/data_model/clusters/Messages.xml index a976e7d260f0ff..9dd223d9a63f46 100644 --- a/data_model/clusters/Messages.xml +++ b/data_model/clusters/Messages.xml @@ -193,35 +193,35 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + @@ -248,10 +248,32 @@ Davis, CA 95616, USA - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -262,4 +284,44 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/ModeBase.xml b/data_model/clusters/ModeBase.xml index 1e6a81807e29a2..5774a7fec0c5a5 100644 --- a/data_model/clusters/ModeBase.xml +++ b/data_model/clusters/ModeBase.xml @@ -70,29 +70,24 @@ Require at least one standard mode tag. Define reserved ranges for base/derived - - - - - diff --git a/data_model/clusters/ModeSelect.xml b/data_model/clusters/ModeSelect.xml index 2fff860458f0e5..19fe502c1fcfe2 100644 --- a/data_model/clusters/ModeSelect.xml +++ b/data_model/clusters/ModeSelect.xml @@ -69,29 +69,24 @@ Davis, CA 95616, USA - - - - - diff --git a/data_model/clusters/Mode_DeviceEnergyManagement.xml b/data_model/clusters/Mode_DeviceEnergyManagement.xml index dc28204cecb511..4181b9b60ead42 100644 --- a/data_model/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/clusters/Mode_DeviceEnergyManagement.xml @@ -62,30 +62,10 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/OccupancySensing.xml b/data_model/clusters/OccupancySensing.xml index 1dd5cbe6156865..d52f118b70cbde 100644 --- a/data_model/clusters/OccupancySensing.xml +++ b/data_model/clusters/OccupancySensing.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + @@ -159,12 +160,10 @@ Davis, CA 95616, USA - - diff --git a/data_model/clusters/PowerSourceConfigurationCluster.xml b/data_model/clusters/PowerSourceConfigurationCluster.xml index b2eb27fd4bd7cc..5548bf6ad8e6b5 100644 --- a/data_model/clusters/PowerSourceConfigurationCluster.xml +++ b/data_model/clusters/PowerSourceConfigurationCluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/PowerTopology.xml b/data_model/clusters/PowerTopology.xml new file mode 100644 index 00000000000000..c8d90baeeded19 --- /dev/null +++ b/data_model/clusters/PowerTopology.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/ResourceMonitoring.xml b/data_model/clusters/ResourceMonitoring.xml index 9772efbd429982..17fc7554ac41f0 100644 --- a/data_model/clusters/ResourceMonitoring.xml +++ b/data_model/clusters/ResourceMonitoring.xml @@ -116,12 +116,10 @@ Davis, CA 95616, USA - - @@ -171,4 +169,4 @@ Davis, CA 95616, USA - + \ No newline at end of file diff --git a/data_model/clusters/Scenes.xml b/data_model/clusters/Scenes.xml index 2168c164a02460..0c4347c4e8be8a 100644 --- a/data_model/clusters/Scenes.xml +++ b/data_model/clusters/Scenes.xml @@ -1,59 +1,59 @@ - @@ -73,50 +73,39 @@ Davis, CA 95616, USA - - - - - - - - - - - @@ -146,24 +135,22 @@ Davis, CA 95616, USA - - + - + - + - diff --git a/data_model/clusters/Thermostat.xml b/data_model/clusters/Thermostat.xml index b7e811bb8738ae..400d55a048a116 100644 --- a/data_model/clusters/Thermostat.xml +++ b/data_model/clusters/Thermostat.xml @@ -451,27 +451,16 @@ Davis, CA 95616, USA - - - - - - - - - - + - - @@ -701,7 +690,7 @@ Davis, CA 95616, USA - + @@ -742,7 +731,7 @@ Davis, CA 95616, USA - + @@ -772,7 +761,7 @@ Davis, CA 95616, USA - + @@ -898,7 +887,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/clusters/WaterContentMeasurement.xml b/data_model/clusters/WaterContentMeasurement.xml index bca3f6de8e4101..8b1ff6a9a049bc 100644 --- a/data_model/clusters/WaterContentMeasurement.xml +++ b/data_model/clusters/WaterContentMeasurement.xml @@ -87,4 +87,4 @@ Davis, CA 95616, USA - + \ No newline at end of file diff --git a/data_model/clusters/Mode_Laundry.xml b/data_model/clusters/WiFiNetworkManagement.xml similarity index 78% rename from data_model/clusters/Mode_Laundry.xml rename to data_model/clusters/WiFiNetworkManagement.xml index 63108a01aa876b..6308eca7e4b184 100644 --- a/data_model/clusters/Mode_Laundry.xml +++ b/data_model/clusters/WiFiNetworkManagement.xml @@ -55,38 +55,31 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - - - - - - - - - - - - - - - - + - - - - + + + - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/bridge-clusters-Actions.xml b/data_model/clusters/bridge-clusters-Actions.xml index ccacb56e8b2576..51f7ee79bb4bad 100644 --- a/data_model/clusters/bridge-clusters-Actions.xml +++ b/data_model/clusters/bridge-clusters-Actions.xml @@ -157,28 +157,22 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/Aggregator.xml b/data_model/device_types/Aggregator.xml index f9bff7aa27cd55..4e0eb1cee512c3 100644 --- a/data_model/device_types/Aggregator.xml +++ b/data_model/device_types/Aggregator.xml @@ -60,7 +60,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/device_types/ColorTemperatureLight.xml b/data_model/device_types/ColorTemperatureLight.xml index 210ce03b2da41c..5d6ac140803e23 100644 --- a/data_model/device_types/ColorTemperatureLight.xml +++ b/data_model/device_types/ColorTemperatureLight.xml @@ -60,7 +60,7 @@ Davis, CA 95616, USA - + @@ -114,12 +114,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/ContentApp.xml b/data_model/device_types/ContentApp.xml index a6eb1a4ca0d424..0db03141e7f9a1 100644 --- a/data_model/device_types/ContentApp.xml +++ b/data_model/device_types/ContentApp.xml @@ -61,7 +61,6 @@ Davis, CA 95616, USA - diff --git a/data_model/device_types/DimmableLight.xml b/data_model/device_types/DimmableLight.xml index ce5dce7c8bf192..42c7d20fb4caad 100644 --- a/data_model/device_types/DimmableLight.xml +++ b/data_model/device_types/DimmableLight.xml @@ -55,12 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - @@ -114,12 +113,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/DimmablePlug-InUnit.xml b/data_model/device_types/DimmablePlug-InUnit.xml index 0756ed62baf9c0..a41db3ad0ae255 100644 --- a/data_model/device_types/DimmablePlug-InUnit.xml +++ b/data_model/device_types/DimmablePlug-InUnit.xml @@ -60,7 +60,7 @@ Davis, CA 95616, USA - + @@ -114,12 +114,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/DoorLockController.xml b/data_model/device_types/DoorLockController.xml index a41cdad0e1bf5a..0e4529c8b5e381 100644 --- a/data_model/device_types/DoorLockController.xml +++ b/data_model/device_types/DoorLockController.xml @@ -63,16 +63,6 @@ Davis, CA 95616, USA - - - - - - - - - - diff --git a/data_model/device_types/EVSE.xml b/data_model/device_types/EVSE.xml index 42636733090c9c..f15b1db770b454 100644 --- a/data_model/device_types/EVSE.xml +++ b/data_model/device_types/EVSE.xml @@ -68,12 +68,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/ElectricalSensor.xml b/data_model/device_types/ElectricalSensor.xml new file mode 100644 index 00000000000000..62c6dd9b4128b2 --- /dev/null +++ b/data_model/device_types/ElectricalSensor.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/device_types/ExtendedColorLight.xml b/data_model/device_types/ExtendedColorLight.xml index a0337009f660eb..73490485fa27fa 100644 --- a/data_model/device_types/ExtendedColorLight.xml +++ b/data_model/device_types/ExtendedColorLight.xml @@ -60,7 +60,7 @@ Davis, CA 95616, USA - + @@ -114,12 +114,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/NetworkInfraManager.xml b/data_model/device_types/NetworkInfraManager.xml index 750a97f22cad86..cc7e22295f40be 100644 --- a/data_model/device_types/NetworkInfraManager.xml +++ b/data_model/device_types/NetworkInfraManager.xml @@ -65,5 +65,8 @@ Davis, CA 95616, USA + + + \ No newline at end of file diff --git a/data_model/device_types/OnOffLight.xml b/data_model/device_types/OnOffLight.xml index ea520612b9dc42..9762c718dcc05b 100644 --- a/data_model/device_types/OnOffLight.xml +++ b/data_model/device_types/OnOffLight.xml @@ -55,12 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - @@ -114,12 +113,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/OnOffPlug-inUnit.xml b/data_model/device_types/OnOffPlug-inUnit.xml index d63e3b22e81aae..41d0a1398ad6f3 100644 --- a/data_model/device_types/OnOffPlug-inUnit.xml +++ b/data_model/device_types/OnOffPlug-inUnit.xml @@ -55,12 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - @@ -114,12 +113,6 @@ Davis, CA 95616, USA - - - - - - diff --git a/data_model/device_types/PowerSource.xml b/data_model/device_types/PowerSource.xml index 3767d5c19ad025..9ed71e905535bd 100644 --- a/data_model/device_types/PowerSource.xml +++ b/data_model/device_types/PowerSource.xml @@ -55,21 +55,14 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/TemperatureControlledCabinet.xml b/data_model/device_types/TemperatureControlledCabinet.xml index 090931ace14f61..b39861690cad61 100644 --- a/data_model/device_types/TemperatureControlledCabinet.xml +++ b/data_model/device_types/TemperatureControlledCabinet.xml @@ -66,6 +66,14 @@ Davis, CA 95616, USA + + + + + + + + diff --git a/data_model/device_types/Thermostat.xml b/data_model/device_types/Thermostat.xml index 8676fe965ef280..fc154468e97c5f 100644 --- a/data_model/device_types/Thermostat.xml +++ b/data_model/device_types/Thermostat.xml @@ -97,9 +97,6 @@ Davis, CA 95616, USA - - - diff --git a/data_model/spec_sha b/data_model/spec_sha index 9c275037d5b895..ec683a1872fc3e 100644 --- a/data_model/spec_sha +++ b/data_model/spec_sha @@ -1 +1 @@ -7e16e82e5264105bdc61d6bc8fe18095959b8292 +72ce960f71810d6ca96125aea54e4fb0a9631e34 diff --git a/docs/QUICK_START.md b/docs/QUICK_START.md index 5a4027e3dc7278..97f0f76b3b0436 100644 --- a/docs/QUICK_START.md +++ b/docs/QUICK_START.md @@ -19,7 +19,7 @@ combination listed below. |
Border Router
|
Node
| Description | | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [**ot-br**](https://openthread.io/guides/border-router/build)
Thread Border Router
  • RasPi
  • BeagleBone | **lighting-app**
  • [Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect/README.md)
  • [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nxp/k32w/k32w0/README.md)
  • [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/qpg)
  • [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/efr32/README.md) | The Lighting example is supported by many of the available Thread platforms. See the chip-tool controller instructions for how to actuate the light on/off cluster. | +| [**ot-br**](https://openthread.io/guides/border-router/build)
    Thread Border Router
  • RasPi
  • BeagleBone | **lighting-app**
  • [Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect/README.md)
  • [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nxp/k32w/k32w0/README.md)
  • [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/qpg)
  • [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/silabs/README.md) | The Lighting example is supported by many of the available Thread platforms. See the chip-tool controller instructions for how to actuate the light on/off cluster. | | [**ot-br**](https://openthread.io/guides/border-router/build)
    Thread Border Router
  • RasPi
  • BeagleBone | **lock-app**
  • [Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/nrfconnect/README.md)
  • [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/nxp/k32w/k32w0/README.md)
  • [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/qpg)
  • [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/efr32/README.md)
  • [TI CC13x2x7](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/cc13x2x7_26x2x7/README.md) | The Lock example is supported by many of the available Thread and Wi-Fi platforms. | ## Controllers diff --git a/docs/guides/silabs_efr32_software_update.md b/docs/guides/silabs_efr32_software_update.md index ec57cc4acaa372..9f94753aa7d29f 100644 --- a/docs/guides/silabs_efr32_software_update.md +++ b/docs/guides/silabs_efr32_software_update.md @@ -8,7 +8,7 @@ all of the EFR32 example applications. ## Running the OTA Download scenario - For Matter with OpenThread: Bring up the OpenThread Border Router as - discussed in examples/lighting-app/efr32/README.md and get its operational + discussed in examples/lighting-app/silabs/README.md and get its operational dataset. - On a Linux or Darwin platform build the chip-tool and the ota-provider-app diff --git a/examples/air-purifier-app/air-purifier-common/include/relative-humidity-sensor-manager.h b/examples/air-purifier-app/air-purifier-common/include/relative-humidity-sensor-manager.h index 23c82787b0203e..f950121b5a22b2 100644 --- a/examples/air-purifier-app/air-purifier-common/include/relative-humidity-sensor-manager.h +++ b/examples/air-purifier-app/air-purifier-common/include/relative-humidity-sensor-manager.h @@ -19,6 +19,7 @@ #pragma once #include +#include namespace chip { namespace app { @@ -31,19 +32,20 @@ class RelativeHumiditySensorManager void Init() { - EmberAfStatus status = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set RelativeHumidityMeasurement MinMeasuredValue attribute")); status = RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Set(mEndpointId, 10000); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set RelativeHumidityMeasurement MaxMeasuredValue attribute")); }; void OnHumidityChangeHandler(uint16_t newValue) { - EmberAfStatus status = RelativeHumidityMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = + RelativeHumidityMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set RelativeHumidityMeasurement MeasuredValue attribute")); ChipLogDetail(NotSpecified, "The new RelativeHumidityMeasurement value: %d", newValue); } diff --git a/examples/air-purifier-app/air-purifier-common/include/temperature-sensor-manager.h b/examples/air-purifier-app/air-purifier-common/include/temperature-sensor-manager.h index 339d02588f52bc..f7061393d76cb6 100644 --- a/examples/air-purifier-app/air-purifier-common/include/temperature-sensor-manager.h +++ b/examples/air-purifier-app/air-purifier-common/include/temperature-sensor-manager.h @@ -19,6 +19,7 @@ #pragma once #include +#include namespace chip { namespace app { @@ -31,19 +32,19 @@ class TemperatureSensorManager void Init() { - EmberAfStatus status = TemperatureMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, -500); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = TemperatureMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, -500); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MinMeasuredValue attribute")); status = TemperatureMeasurement::Attributes::MaxMeasuredValue::Set(mEndpointId, 6000); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MaxMeasuredValue attribute")); } void OnTemperatureChangeHandler(int16_t newValue) { - EmberAfStatus status = TemperatureMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = TemperatureMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MeasuredValue attribute")); ChipLogDetail(NotSpecified, "The new TemperatureMeasurement value: %d", newValue); } diff --git a/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp b/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp index 3b3065e5e843de..22e938ddfa4023 100644 --- a/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp +++ b/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp @@ -196,12 +196,13 @@ void AirPurifierManager::PercentSettingWriteCallback(uint8_t aNewPercentSetting) if (aNewPercentSetting != percentCurrent) { ChipLogDetail(NotSpecified, "AirPurifierManager::PercentSettingWriteCallback: %d", aNewPercentSetting); - percentCurrent = aNewPercentSetting; - EmberAfStatus status = FanControl::Attributes::PercentCurrent::Set(mEndpointId, percentCurrent); - if (status != EMBER_ZCL_STATUS_SUCCESS) + percentCurrent = aNewPercentSetting; + Status status = FanControl::Attributes::PercentCurrent::Set(mEndpointId, percentCurrent); + if (status != Status::Success) { ChipLogError(NotSpecified, - "AirPurifierManager::PercentSettingWriteCallback: failed to set PercentCurrent attribute: %d", status); + "AirPurifierManager::PercentSettingWriteCallback: failed to set PercentCurrent attribute: %d", + to_underlying(status)); } } } @@ -211,12 +212,12 @@ void AirPurifierManager::SpeedSettingWriteCallback(uint8_t aNewSpeedSetting) if (aNewSpeedSetting != speedCurrent) { ChipLogDetail(NotSpecified, "AirPurifierManager::SpeedSettingWriteCallback: %d", aNewSpeedSetting); - speedCurrent = aNewSpeedSetting; - EmberAfStatus status = FanControl::Attributes::SpeedCurrent::Set(mEndpointId, speedCurrent); - if (status != EMBER_ZCL_STATUS_SUCCESS) + speedCurrent = aNewSpeedSetting; + Status status = FanControl::Attributes::SpeedCurrent::Set(mEndpointId, speedCurrent); + if (status != Status::Success) { ChipLogError(NotSpecified, "AirPurifierManager::SpeedSettingWriteCallback: failed to set SpeedCurrent attribute: %d", - status); + to_underlying(status)); } // Determine if the speed change should also change the fan mode @@ -299,10 +300,11 @@ void AirPurifierManager::SetSpeedSetting(DataModel::Nullable aNewSpeedS if (aNewSpeedSetting.Value() != speedCurrent) { - EmberAfStatus status = FanControl::Attributes::SpeedSetting::Set(mEndpointId, aNewSpeedSetting); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = FanControl::Attributes::SpeedSetting::Set(mEndpointId, aNewSpeedSetting); + if (status != Status::Success) { - ChipLogError(NotSpecified, "AirPurifierManager::SetSpeedSetting: failed to set SpeedSetting attribute: %d", status); + ChipLogError(NotSpecified, "AirPurifierManager::SetSpeedSetting: failed to set SpeedSetting attribute: %d", + to_underlying(status)); } } } @@ -310,11 +312,12 @@ void AirPurifierManager::SetSpeedSetting(DataModel::Nullable aNewSpeedS DataModel::Nullable AirPurifierManager::GetSpeedSetting() { DataModel::Nullable speedSetting; - EmberAfStatus status = FanControl::Attributes::SpeedSetting::Get(mEndpointId, speedSetting); + Status status = FanControl::Attributes::SpeedSetting::Get(mEndpointId, speedSetting); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogError(NotSpecified, "AirPurifierManager::GetSpeedSetting: failed to get SpeedSetting attribute: %d", status); + ChipLogError(NotSpecified, "AirPurifierManager::GetSpeedSetting: failed to get SpeedSetting attribute: %d", + to_underlying(status)); } return speedSetting; @@ -323,11 +326,12 @@ DataModel::Nullable AirPurifierManager::GetSpeedSetting() DataModel::Nullable AirPurifierManager::GetPercentSetting() { DataModel::Nullable percentSetting; - EmberAfStatus status = FanControl::Attributes::PercentSetting::Get(mEndpointId, percentSetting); + Status status = FanControl::Attributes::PercentSetting::Get(mEndpointId, percentSetting); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogError(NotSpecified, "AirPurifierManager::GetPercentSetting: failed to get PercentSetting attribute: %d", status); + ChipLogError(NotSpecified, "AirPurifierManager::GetPercentSetting: failed to get PercentSetting attribute: %d", + to_underlying(status)); } return percentSetting; diff --git a/examples/air-purifier-app/air-purifier-common/src/thermostat-manager.cpp b/examples/air-purifier-app/air-purifier-common/src/thermostat-manager.cpp index c2536e4d99e38b..8d511d24e550dc 100644 --- a/examples/air-purifier-app/air-purifier-common/src/thermostat-manager.cpp +++ b/examples/air-purifier-app/air-purifier-common/src/thermostat-manager.cpp @@ -17,6 +17,9 @@ */ #include "thermostat-manager.h" +#include + +using chip::Protocols::InteractionModel::Status; using namespace chip; using namespace chip::app; @@ -26,19 +29,19 @@ void ThermostatManager::Init() { BitMask FeatureMap; FeatureMap.Set(Thermostat::Feature::kHeating); - EmberAfStatus status = Thermostat::Attributes::FeatureMap::Set(mEndpointId, FeatureMap.Raw()); + Status status = Thermostat::Attributes::FeatureMap::Set(mEndpointId, FeatureMap.Raw()); status = Thermostat::Attributes::ControlSequenceOfOperation::Set(mEndpointId, Thermostat::ControlSequenceOfOperationEnum::kHeatingOnly); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to set Thermostat ControlSequenceOfOperation attribute")); status = Thermostat::Attributes::AbsMinHeatSetpointLimit::Set(mEndpointId, 500); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to set Thermostat MinHeatSetpointLimit attribute")); status = Thermostat::Attributes::AbsMaxHeatSetpointLimit::Set(mEndpointId, 3000); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to set Thermostat MaxHeatSetpointLimit attribute")); } @@ -46,8 +49,8 @@ void ThermostatManager::HeatingSetpointWriteCallback(int16_t newValue) { ChipLogDetail(NotSpecified, "ThermostatManager::HeatingSetpointWriteCallback: %d", newValue); Thermostat::SystemModeEnum systemMode; - EmberAfStatus status = Thermostat::Attributes::SystemMode::Get(mEndpointId, &systemMode); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to get Thermostat SystemMode attribute")); + Status status = Thermostat::Attributes::SystemMode::Get(mEndpointId, &systemMode); + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to get Thermostat SystemMode attribute")); // A new setpoint has been set, so we shall infer that the we want to be in Heating mode if (systemMode == Thermostat::SystemModeEnum::kOff) @@ -58,7 +61,7 @@ void ThermostatManager::HeatingSetpointWriteCallback(int16_t newValue) // Check the current temperature and turn on the heater if needed DataModel::Nullable localTemperature; status = Thermostat::Attributes::LocalTemperature::Get(mEndpointId, localTemperature); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to get TemperatureMeasurement MeasuredValue attribute")); if (localTemperature.Value() < newValue) @@ -81,14 +84,13 @@ void ThermostatManager::SystemModeWriteCallback(uint8_t newValue) else if ((Thermostat::SystemModeEnum) newValue == Thermostat::SystemModeEnum::kHeat) { DataModel::Nullable localTemperature; - EmberAfStatus status = Thermostat::Attributes::LocalTemperature::Get(mEndpointId, localTemperature); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Status status = Thermostat::Attributes::LocalTemperature::Get(mEndpointId, localTemperature); + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to get TemperatureMeasurement MeasuredValue attribute")); int16_t heatingSetpoint; status = Thermostat::Attributes::OccupiedHeatingSetpoint::Get(mEndpointId, &heatingSetpoint); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(NotSpecified, "Failed to get Thermostat HeatingSetpoint attribute")); + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to get Thermostat HeatingSetpoint attribute")); if (localTemperature.Value() < heatingSetpoint) { @@ -99,8 +101,8 @@ void ThermostatManager::SystemModeWriteCallback(uint8_t newValue) void ThermostatManager::OnLocalTemperatureChangeCallback(int16_t temperature) { - EmberAfStatus status = Thermostat::Attributes::LocalTemperature::Set(mEndpointId, temperature); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Status status = Thermostat::Attributes::LocalTemperature::Set(mEndpointId, temperature); + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MeasuredValue attribute")); } @@ -122,14 +124,13 @@ void ThermostatManager::SetHeating(bool isHeating) runningState.Clear(Thermostat::RelayStateBitmap::kHeat); } - EmberAfStatus status = Thermostat::Attributes::ThermostatRunningState::Set(mEndpointId, runningState); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(NotSpecified, "Failed to set Thermostat RunningState attribute")); + Status status = Thermostat::Attributes::ThermostatRunningState::Set(mEndpointId, runningState); + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to set Thermostat RunningState attribute")); } void ThermostatManager::SetHeatMode(bool heat) { - EmberAfStatus status = Thermostat::Attributes::SystemMode::Set( + Status status = Thermostat::Attributes::SystemMode::Set( mEndpointId, heat ? Thermostat::SystemModeEnum::kHeat : Thermostat::SystemModeEnum::kOff); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set Thermostat SystemMode attribute")); + VerifyOrReturn(Status::Success == status, ChipLogError(NotSpecified, "Failed to set Thermostat SystemMode attribute")); } diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/include/relative-humidity-sensor-manager.h b/examples/air-quality-sensor-app/air-quality-sensor-common/include/relative-humidity-sensor-manager.h index 4759f6096c84fc..0de2fa76e5ba61 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/include/relative-humidity-sensor-manager.h +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/include/relative-humidity-sensor-manager.h @@ -1,4 +1,5 @@ #include +#include #pragma once @@ -11,19 +12,20 @@ class RelativeHumiditySensorManager public: RelativeHumiditySensorManager(EndpointId aEndpointId) : mEndpointId(aEndpointId) { - EmberAfStatus status = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set RelativeHumidityMeasurement MinMeasuredValue attribute")); status = RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Set(mEndpointId, 100); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set RelativeHumidityMeasurement MaxMeasuredValue attribute")); }; void OnHumidityChangeHandler(uint16_t newValue) { - EmberAfStatus status = RelativeHumidityMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = + RelativeHumidityMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set RelativeHumidityMeasurement MeasuredValue attribute")); ChipLogDetail(NotSpecified, "The new RelativeHumidityMeasurement value: %d", newValue); } diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/include/temperature-sensor-manager.h b/examples/air-quality-sensor-app/air-quality-sensor-common/include/temperature-sensor-manager.h index 3a0fc0cd0f4646..37f26e1412a886 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/include/temperature-sensor-manager.h +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/include/temperature-sensor-manager.h @@ -1,6 +1,8 @@ -#include #pragma once +#include + +#include namespace chip { namespace app { @@ -11,19 +13,19 @@ class TemperatureSensorManager public: TemperatureSensorManager(EndpointId aEndpointId) : mEndpointId(aEndpointId) { - EmberAfStatus status = TemperatureMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, -5); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = TemperatureMeasurement::Attributes::MinMeasuredValue::Set(mEndpointId, -5); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MinMeasuredValue attribute")); status = TemperatureMeasurement::Attributes::MaxMeasuredValue::Set(mEndpointId, 60); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MaxMeasuredValue attribute")); }; void OnTemperatureChangeHandler(int16_t newValue) { - EmberAfStatus status = TemperatureMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, + Protocols::InteractionModel::Status status = TemperatureMeasurement::Attributes::MeasuredValue::Set(mEndpointId, newValue); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, ChipLogError(NotSpecified, "Failed to set TemperatureMeasurement MeasuredValue attribute")); ChipLogDetail(NotSpecified, "The new TemperatureMeasurement value: %d", newValue); } diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index f353ebeef68979..0f09892b936b6e 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2732,7 +2732,7 @@ provisional cluster OvenMode = 73 { /** This cluster supports remotely monitoring and controling the different typs of functionality available to a drying device, such as a laundry dryer. */ -cluster LaundryDryerControls = 74 { +provisional cluster LaundryDryerControls = 74 { revision 1; enum DrynessLevelEnum : enum8 { @@ -7865,8 +7865,11 @@ endpoint 1 { } server cluster OvenCavityOperationalState { + emits event OperationalError; + emits event OperationCompletion; callback attribute phaseList; callback attribute currentPhase; + callback attribute countdownTime; callback attribute operationalStateList; callback attribute operationalState; callback attribute operationalError; @@ -7876,6 +7879,12 @@ endpoint 1 { callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; + + handle command Pause; + handle command Stop; + handle command Start; + handle command Resume; + handle command OperationalCommandResponse; } server cluster OvenMode { @@ -8110,7 +8119,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; handle command Pause; handle command Stop; @@ -8335,11 +8344,9 @@ endpoint 1 { callback attribute supplyState; callback attribute faultState; callback attribute chargingEnabledUntil; - callback attribute dischargingEnabledUntil; callback attribute circuitCapacity; callback attribute minimumChargeCurrent; callback attribute maximumChargeCurrent; - callback attribute maximumDischargeCurrent; callback attribute userMaximumChargeCurrent; callback attribute randomizationDelayWindow; callback attribute nextChargeStartTime; @@ -8347,13 +8354,9 @@ endpoint 1 { callback attribute nextChargeRequiredEnergy; callback attribute nextChargeTargetSoC; callback attribute approximateEVEfficiency; - callback attribute stateOfCharge; - callback attribute batteryCapacity; - callback attribute vehicleID; callback attribute sessionID; callback attribute sessionDuration; callback attribute sessionEnergyCharged; - callback attribute sessionEnergyDischarged; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 2dab4707bb1453..03af457be918e2 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -17,6 +17,12 @@ } ], "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -24,12 +30,6 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data with some extensions" - }, - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" } ], "endpointTypes": [ @@ -3097,10 +3097,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3113,10 +3113,10 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0002", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -8227,6 +8227,48 @@ "side": "server", "enabled": 1, "apiMaturity": "provisional", + "commands": [ + { + "name": "Pause", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "Stop", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "Start", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "Resume", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "OperationalCommandResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], "attributes": [ { "name": "PhaseList", @@ -8260,6 +8302,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "CountdownTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "OperationalStateList", "code": 3, @@ -8404,6 +8462,22 @@ "maxInterval": 65534, "reportableChange": 0 } + ], + "events": [ + { + "name": "OperationalError", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "OperationCompletion", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } ] }, { @@ -8570,6 +8644,7 @@ "define": "LAUNDRY_DRYER_CONTROLS_CLUSTER", "side": "server", "enabled": 1, + "apiMaturity": "provisional", "attributes": [ { "name": "SupportedDrynessLevels", @@ -11175,7 +11250,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -13815,22 +13890,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "DischargingEnabledUntil", - "code": 4, - "mfgCode": null, - "side": "server", - "type": "epoch_s", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "CircuitCapacity", "code": 5, @@ -13879,22 +13938,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "MaximumDischargeCurrent", - "code": 8, - "mfgCode": null, - "side": "server", - "type": "amperage_ma", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "UserMaximumChargeCurrent", "code": 9, @@ -14007,54 +14050,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "StateOfCharge", - "code": 48, - "mfgCode": null, - "side": "server", - "type": "percent", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "BatteryCapacity", - "code": 49, - "mfgCode": null, - "side": "server", - "type": "energy_mwh", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "VehicleID", - "code": 50, - "mfgCode": null, - "side": "server", - "type": "char_string", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "SessionID", "code": 64, @@ -14103,22 +14098,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "SessionEnergyDischarged", - "code": 67, - "mfgCode": null, - "side": "server", - "type": "energy_mwh", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "GeneratedCommandList", "code": 65528, diff --git a/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h index 0bcb76f324a1da..60b6b09e9b6511 100644 --- a/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h +++ b/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { @@ -33,11 +33,15 @@ namespace OperationalState { class GenericOperationalStateDelegateImpl : public Delegate { public: + uint32_t mRunningTime = 0; + uint32_t mPausedTime = 0; + app::DataModel::Nullable mCountDownTime; + /** * Get the countdown time. This attribute is not used in this application. * @return The current countdown time. */ - app::DataModel::Nullable GetCountdownTime() override { return {}; }; + app::DataModel::Nullable GetCountdownTime() override; /** * Fills in the provided GenericOperationalState with the state at index `index` if there is one, @@ -104,11 +108,33 @@ class OperationalStateDelegate : public GenericOperationalStateDelegateImpl GenericOperationalState(to_underlying(OperationalStateEnum::kError)), }; + const uint32_t kExampleCountDown = 30; + public: OperationalStateDelegate() { GenericOperationalStateDelegateImpl::mOperationalStateList = Span(opStateList); } + + /** + * Handle Command Callback in application: Start + * @param[out] get operational error after callback. + */ + void HandleStartStateCallback(GenericOperationalError & err) override + { + mCountDownTime.SetNonNull(static_cast(kExampleCountDown)); + GenericOperationalStateDelegateImpl::HandleStartStateCallback(err); + } + + /** + * Handle Command Callback in application: Stop + * @param[out] get operational error after callback. + */ + void HandleStopStateCallback(GenericOperationalError & err) override + { + GenericOperationalStateDelegateImpl::HandleStopStateCallback(err); + mCountDownTime.SetNull(); + } }; Instance * GetOperationalStateInstance(); diff --git a/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h b/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h index 6d7338214f77ae..89f9969ffb86a7 100644 --- a/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h +++ b/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { @@ -33,13 +33,17 @@ namespace OvenCavityOperationalState { class OvenCavityOperationalStateDelegate : public OperationalState::Delegate { private: - inline static const Clusters::OperationalState::GenericOperationalState mOperationalStateList[] = { + inline static const Clusters::OperationalState::GenericOperationalState opStateList[] = { OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)), OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)), OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)), OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kError)) }; + Span mOperationalStateList = + Span(opStateList); + Span mOperationalPhaseList; + public: /** * Get the countdown time. This attribute is not supported in our example app. @@ -73,43 +77,29 @@ class OvenCavityOperationalStateDelegate : public OperationalState::Delegate * Handle Command Callback in application: Pause * @param[out] get operational error after callback. */ - void HandlePauseStateCallback(Clusters::OperationalState::GenericOperationalError & err) override - { - // This command in not supported. - err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - }; + void HandlePauseStateCallback(Clusters::OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Resume * @param[out] get operational error after callback. */ - void HandleResumeStateCallback(Clusters::OperationalState::GenericOperationalError & err) override - { - // This command in not supported. - err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - }; + void HandleResumeStateCallback(Clusters::OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Start * @param[out] get operational error after callback. */ - void HandleStartStateCallback(Clusters::OperationalState::GenericOperationalError & err) override - { - // This command in not supported. - err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - }; + void HandleStartStateCallback(Clusters::OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Stop * @param[out] get operational error after callback. */ - void HandleStopStateCallback(Clusters::OperationalState::GenericOperationalError & err) override - { - // This command in not supported. - err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - }; + void HandleStopStateCallback(Clusters::OperationalState::GenericOperationalError & err) override; }; +Instance * GetOperationalStateInstance(); + void Shutdown(); } // namespace OvenCavityOperationalState diff --git a/examples/all-clusters-app/all-clusters-common/include/rvc-operational-state-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/rvc-operational-state-delegate-impl.h index 4417f9f5a3ab4a..60a2f5d530f9b9 100644 --- a/examples/all-clusters-app/all-clusters-common/include/rvc-operational-state-delegate-impl.h +++ b/examples/all-clusters-app/all-clusters-common/include/rvc-operational-state-delegate-impl.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { diff --git a/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp b/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp index cd16efd4a3f054..95f50acce7c4ef 100644 --- a/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp @@ -73,13 +73,13 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch using namespace chip; using namespace chip::app; - if (binding.type == EMBER_MULTICAST_BINDING) + if (binding.type == MATTER_MULTICAST_BINDING) { ChipLogError(NotSpecified, "Group binding is not supported now"); return; } - if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 && + if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 && (!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id)) { auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { diff --git a/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp index 58d393752c8bfd..f700df068b529f 100644 --- a/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp @@ -17,7 +17,6 @@ */ #include #include -#include using namespace chip; diff --git a/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp index 4bcea0e8ed9895..2a4c422d581e55 100644 --- a/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp @@ -47,5 +47,7 @@ void emberAfElectricalPowerMeasurementClusterInitCallback(chip::EndpointId endpo OptionalAttributes::kOptionalAttributeNeutralCurrent)); gEPMInstance->Init(); + + gEPMDelegate->SetPowerMode(PowerModeEnum::kAc); } } diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp index f9983d47883852..72fe588995784e 100644 --- a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp @@ -35,9 +35,7 @@ void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId) { gInstance = std::make_unique( endpointId, *gDelegate, - BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, - EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, - EnergyEvse::Feature::kV2x), + BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kRfid), BitMask(OptionalAttributes::kSupportsUserMaximumChargingCurrent, OptionalAttributes::kSupportsRandomizationWindow, OptionalAttributes::kSupportsApproximateEvEfficiency), diff --git a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp index 3370d75bd65f35..2070e1b86754fe 100644 --- a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp @@ -16,6 +16,7 @@ * limitations under the License. */ #include +#include using namespace chip; using namespace chip::app; @@ -23,6 +24,16 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::OperationalState; using namespace chip::app::Clusters::RvcOperationalState; +static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data); + +DataModel::Nullable GenericOperationalStateDelegateImpl::GetCountdownTime() +{ + if (mCountDownTime.IsNull()) + return DataModel::NullNullable; + + return DataModel::MakeNullable((uint32_t) (mCountDownTime.Value() - mRunningTime)); +} + CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) { if (index >= mOperationalStateList.size()) @@ -44,6 +55,15 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_ void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperationalError & err) { + OperationalState::OperationalStateEnum state = + static_cast(GetInstance()->GetCurrentOperationalState()); + + if (state == OperationalState::OperationalStateEnum::kStopped || state == OperationalState::OperationalStateEnum::kError) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState)); + return; + } + // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); if (error == CHIP_NO_ERROR) @@ -58,6 +78,15 @@ void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperat void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOperationalError & err) { + OperationalState::OperationalStateEnum state = + static_cast(GetInstance()->GetCurrentOperationalState()); + + if (state == OperationalState::OperationalStateEnum::kStopped || state == OperationalState::OperationalStateEnum::kError) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState)); + return; + } + // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) @@ -72,10 +101,20 @@ void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOpera void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperationalError & err) { + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + if (current_err.errorStateID != to_underlying(OperationalState::ErrorStateEnum::kNoError)) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume)); + return; + } + // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, this); err.Set(to_underlying(ErrorStateEnum::kNoError)); } else @@ -90,6 +129,18 @@ void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperati auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kStopped)); if (error == CHIP_NO_ERROR) { + (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, this); + + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + Optional> totalTime((DataModel::Nullable(mRunningTime + mPausedTime))); + Optional> pausedTime((DataModel::Nullable(mPausedTime))); + + GetInstance()->OnOperationCompletionDetected(static_cast(current_err.errorStateID), totalTime, pausedTime); + + mRunningTime = 0; + mPausedTime = 0; err.Set(to_underlying(ErrorStateEnum::kNoError)); } else @@ -98,6 +149,38 @@ void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperati } } +static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data) +{ + GenericOperationalStateDelegateImpl * delegate = reinterpret_cast(data); + + OperationalState::Instance * instance = OperationalState::GetOperationalStateInstance(); + OperationalState::OperationalStateEnum state = + static_cast(instance->GetCurrentOperationalState()); + + auto countdown_time = delegate->GetCountdownTime(); + + if (countdown_time.IsNull() || (!countdown_time.IsNull() && countdown_time.Value() > 0)) + { + if (state == OperationalState::OperationalStateEnum::kRunning) + { + delegate->mRunningTime++; + } + else if (state == OperationalState::OperationalStateEnum::kPaused) + { + delegate->mPausedTime++; + } + } + + if (state == OperationalState::OperationalStateEnum::kRunning || state == OperationalState::OperationalStateEnum::kPaused) + { + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, delegate); + } + else + { + (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, delegate); + } +} + // Init Operational State cluster static OperationalState::Instance * gOperationalStateInstance = nullptr; diff --git a/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp b/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp index ecae5c88006ef4..726f326afbb6f8 100644 --- a/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp @@ -22,8 +22,13 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::OvenCavityOperationalState; -static OperationalState::Instance * gOvenCavityOperationalStateInstance = nullptr; -static OvenCavityOperationalStateDelegate * gOvenCavityOperationalStateDelegate = nullptr; +static OvenCavityOperationalState::Instance * gOvenCavityOperationalStateInstance = nullptr; +static OvenCavityOperationalStateDelegate * gOvenCavityOperationalStateDelegate = nullptr; + +OvenCavityOperationalState::Instance * OvenCavityOperationalState::GetOperationalStateInstance() +{ + return gOvenCavityOperationalStateInstance; +} void OvenCavityOperationalState::Shutdown() { @@ -58,7 +63,7 @@ CHIP_ERROR OvenCavityOperationalStateDelegate::GetOperationalStateAtIndex(size_t index, OperationalState::GenericOperationalState & operationalState) { - if (index >= ArraySize(mOperationalStateList)) + if (index >= mOperationalStateList.size()) { return CHIP_ERROR_NOT_FOUND; } @@ -69,5 +74,89 @@ OvenCavityOperationalStateDelegate::GetOperationalStateAtIndex(size_t index, CHIP_ERROR OvenCavityOperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase) { - return CHIP_ERROR_NOT_FOUND; + if (index >= mOperationalPhaseList.size()) + { + return CHIP_ERROR_NOT_FOUND; + } + return CopyCharSpanToMutableCharSpan(mOperationalPhaseList[index], operationalPhase); +} + +void OvenCavityOperationalStateDelegate::HandlePauseStateCallback(OperationalState::GenericOperationalError & err) +{ + OperationalState::OperationalStateEnum state = + static_cast(GetInstance()->GetCurrentOperationalState()); + + if (state == OperationalState::OperationalStateEnum::kStopped || state == OperationalState::OperationalStateEnum::kError) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState)); + return; + } + + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); + if (error == CHIP_NO_ERROR) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + } + else + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); + } +} + +void OvenCavityOperationalStateDelegate::HandleResumeStateCallback(OperationalState::GenericOperationalError & err) +{ + + OperationalState::OperationalStateEnum state = + static_cast(GetInstance()->GetCurrentOperationalState()); + + if (state == OperationalState::OperationalStateEnum::kStopped || state == OperationalState::OperationalStateEnum::kError) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState)); + return; + } + + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); + if (error == CHIP_NO_ERROR) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + } + else + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); + } +} + +void OvenCavityOperationalStateDelegate::HandleStartStateCallback(OperationalState::GenericOperationalError & err) +{ + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + if (current_err.errorStateID != to_underlying(OperationalState::ErrorStateEnum::kNoError)) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume)); + return; + } + + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); + if (error == CHIP_NO_ERROR) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + } + else + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); + } +} + +void OvenCavityOperationalStateDelegate::HandleStopStateCallback(OperationalState::GenericOperationalError & err) +{ + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); + if (error == CHIP_NO_ERROR) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + } + else + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); + } } diff --git a/examples/all-clusters-app/ameba/main/BindingHandler.cpp b/examples/all-clusters-app/ameba/main/BindingHandler.cpp index 64ccb619a2edf5..b00322b44e4f0b 100644 --- a/examples/all-clusters-app/ameba/main/BindingHandler.cpp +++ b/examples/all-clusters-app/ameba/main/BindingHandler.cpp @@ -58,7 +58,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation if (data->isReadAttribute) { // It should always enter here if isReadAttribute is true - if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -82,7 +82,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation } else { - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -103,7 +103,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -190,7 +190,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -205,7 +205,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/all-clusters-app/ameba/main/include/ManualDishWasherAlarmCommand.h b/examples/all-clusters-app/ameba/main/include/ManualDishWasherAlarmCommand.h index c1a37be41d385a..0d87a0eefcf828 100644 --- a/examples/all-clusters-app/ameba/main/include/ManualDishWasherAlarmCommand.h +++ b/examples/all-clusters-app/ameba/main/include/ManualDishWasherAlarmCommand.h @@ -19,6 +19,7 @@ #include "controller/InvokeInteraction.h" #include "controller/ReadInteraction.h" #include +#include #if CONFIG_ENABLE_CHIP_SHELL #include "lib/shell/Engine.h" @@ -65,7 +66,7 @@ CHIP_ERROR ManualDishWasherAlarmSetRaiseCommandHandler(int argc, char ** argv) } CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status; + Protocols::InteractionModel::Status status; DishwasherAlarmServer & serverInstance = DishwasherAlarmServer::Instance(); BitMask supported; // Set dishwasher alarm supported value @@ -88,21 +89,21 @@ CHIP_ERROR ManualDishWasherAlarmSetRaiseCommandHandler(int argc, char ** argv) state.SetField(AlarmMap::kTempTooLow, 1); // 0x08, 8 status = serverInstance.SetSupportedValue(1, supported); // 0x2F, 47 - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetMaskValue(1, mask); // 0x2F, 47 - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetStateValue(1, state); // 0x0E, 14 - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; @@ -124,7 +125,7 @@ CHIP_ERROR ManualDishWasherAlarmSetLowerCommandHandler(int argc, char ** argv) } CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status; + Protocols::InteractionModel::Status status; DishwasherAlarmServer & serverInstance = DishwasherAlarmServer::Instance(); BitMask supported; // Set dishwasher alarm supported value @@ -142,21 +143,21 @@ CHIP_ERROR ManualDishWasherAlarmSetLowerCommandHandler(int argc, char ** argv) mask.SetField(AlarmMap::kWaterLevelError, 1); // 0x20, 32 status = serverInstance.SetSupportedValue(1, supported); // 0x2F, 47 - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetMaskValue(1, mask); // 0x2F, 47 - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetStateValue(1, 0); // Set dishwasher alarm state value 0x00, 0 - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; diff --git a/examples/all-clusters-app/ameba/main/include/ManualRefrigeratorAlarmCommand.h b/examples/all-clusters-app/ameba/main/include/ManualRefrigeratorAlarmCommand.h index d2ec4224a5332f..b4f8974d123a55 100644 --- a/examples/all-clusters-app/ameba/main/include/ManualRefrigeratorAlarmCommand.h +++ b/examples/all-clusters-app/ameba/main/include/ManualRefrigeratorAlarmCommand.h @@ -16,9 +16,12 @@ * limitations under the License. */ +#pragma once + #include "controller/InvokeInteraction.h" #include "controller/ReadInteraction.h" #include +#include #if CONFIG_ENABLE_CHIP_SHELL #include "lib/shell/Engine.h" @@ -60,25 +63,25 @@ CHIP_ERROR ManualRefrigeratorAlarmCommandHandler(int argc, char ** argv) CHIP_ERROR ManualRefrigeratorAlarmDoorOpenCommandHandler(int argc, char ** argv) { CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status; + Protocols::InteractionModel::Status status; RefrigeratorAlarmServer & serverInstance = RefrigeratorAlarmServer::Instance(); status = serverInstance.SetMaskValue(1, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetStateValue(1, 1); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetSupportedValue(1, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; @@ -96,25 +99,25 @@ CHIP_ERROR ManualRefrigeratorAlarmDoorOpenCommandHandler(int argc, char ** argv) CHIP_ERROR ManualRefrigeratorAlarmDoorCloseCommandHandler(int argc, char ** argv) { CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status; + Protocols::InteractionModel::Status status; RefrigeratorAlarmServer & serverInstance = RefrigeratorAlarmServer::Instance(); status = serverInstance.SetMaskValue(1, 1); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetStateValue(1, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetSupportedValue(1, 1); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; @@ -132,18 +135,18 @@ CHIP_ERROR ManualRefrigeratorAlarmDoorCloseCommandHandler(int argc, char ** argv CHIP_ERROR ManualRefrigeratorAlarmSuppressCommandHandler(int argc, char ** argv) { CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status; + Protocols::InteractionModel::Status status; RefrigeratorAlarmServer & serverInstance = RefrigeratorAlarmServer::Instance(); status = serverInstance.SetSupportedValue(1, 1); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; } status = serverInstance.SetStateValue(1, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { err = CHIP_ERROR_INTERNAL; goto exit; diff --git a/examples/all-clusters-app/asr/src/AppTask.cpp b/examples/all-clusters-app/asr/src/AppTask.cpp old mode 100755 new mode 100644 index 3f16789c40e69f..92b6aaef3dba49 --- a/examples/all-clusters-app/asr/src/AppTask.cpp +++ b/examples/all-clusters-app/asr/src/AppTask.cpp @@ -38,10 +38,13 @@ #include #include #include +#include #include #include #include +using chip::Protocols::InteractionModel::Status; + using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceManager; @@ -265,11 +268,11 @@ void AppTask::OnOffUpdateClusterState(void) uint8_t onoff = sLightLED.Get(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(1, onoff); + Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, onoff); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ASR_LOG("ERR: updating on/off %x", status); + ASR_LOG("ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn index 155bdacc2a8e4b..6cf5941e79d2c4 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn @@ -60,7 +60,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index 45d8d66d31c4b5..eb118372b7bd33 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -63,7 +63,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index e9f9dc1a171484..b75b5abfc74294 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -409,11 +409,11 @@ void AppTask::OnOffUpdateClusterState(intptr_t context) uint8_t onoff = sLightLED.Get(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff); + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating on/off %x", status); + P6_LOG("ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index 2da7e0c8900f3d..b2fe3a90b59f3f 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -30,7 +30,9 @@ #include #include #include +#include #include +#include #include using namespace chip; @@ -179,6 +181,12 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context) self->OnAirQualityChange(static_cast(jsonAirQualityEnum.asUInt())); } } + else if (name == "OperationalStateChange") + { + std::string device = self->mJsonValue["Device"].asString(); + std::string operation = self->mJsonValue["Operation"].asString(); + self->OnOperationalStateChange(device, operation, self->mJsonValue["Param"]); + } else { ChipLogError(NotSpecified, "Unhandled command: Should never happens"); @@ -296,8 +304,9 @@ void AllClustersAppCommandHandler::OnSwitchLatchedHandler(uint8_t newPosition) { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The latching switch is moved to a new position:%d", newPosition); Clusters::SwitchServer::Instance().OnSwitchLatch(endpoint, newPosition); @@ -307,8 +316,9 @@ void AllClustersAppCommandHandler::OnSwitchInitialPressedHandler(uint8_t newPosi { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The new position when the momentary switch starts to be pressed:%d", newPosition); Clusters::SwitchServer::Instance().OnInitialPress(endpoint, newPosition); @@ -318,8 +328,9 @@ void AllClustersAppCommandHandler::OnSwitchLongPressedHandler(uint8_t newPositio { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The new position when the momentary switch has been pressed for a long time:%d", newPosition); Clusters::SwitchServer::Instance().OnLongPress(endpoint, newPosition); @@ -332,8 +343,9 @@ void AllClustersAppCommandHandler::OnSwitchShortReleasedHandler(uint8_t previous { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The the previous value of the CurrentPosition when the momentary switch has been released:%d", previousPosition); @@ -344,8 +356,9 @@ void AllClustersAppCommandHandler::OnSwitchLongReleasedHandler(uint8_t previousP { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The the previous value of the CurrentPosition when the momentary switch has been released after having been " "pressed for a long time:%d", @@ -358,8 +371,9 @@ void AllClustersAppCommandHandler::OnSwitchMultiPressOngoingHandler(uint8_t newP { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The new position when the momentary switch has been pressed in a multi-press sequence:%d", newPosition); ChipLogDetail(NotSpecified, "%d times the momentary switch has been pressed", count); @@ -371,8 +385,9 @@ void AllClustersAppCommandHandler::OnSwitchMultiPressCompleteHandler(uint8_t pre { EndpointId endpoint = 1; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The previous position when the momentary switch has been pressed in a multi-press sequence:%d", previousPosition); ChipLogDetail(NotSpecified, "%d times the momentary switch has been pressed", count); @@ -429,6 +444,54 @@ void AllClustersAppCommandHandler::OnModeChangeHandler(std::string device, std:: } } +void AllClustersAppCommandHandler::OnOperationalStateChange(std::string device, std::string operation, Json::Value param) +{ + OperationalState::Instance * operationalStateInstance = nullptr; + if (device == "Generic") + { + operationalStateInstance = OperationalState::GetOperationalStateInstance(); + } + else if (device == "Oven") + { + operationalStateInstance = OvenCavityOperationalState::GetOperationalStateInstance(); + } + else + { + ChipLogDetail(NotSpecified, "Invalid device type : %s", device.c_str()); + return; + } + + if (operation == "Start" || operation == "Resume") + { + operationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); + } + else if (operation == "Pause") + { + operationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); + } + else if (operation == "Stop") + { + operationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); + } + else if (operation == "OnFault") + { + + uint8_t event_id = to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation); + if (!param.isNull()) + { + event_id = to_underlying(static_cast(param.asUInt())); + } + + OperationalState::GenericOperationalError err(event_id); + operationalStateInstance->OnOperationalErrorDetected(err); + } + else + { + ChipLogDetail(NotSpecified, "Invalid operation : %s", operation.c_str()); + return; + } +} + void AllClustersAppCommandHandler::OnAirQualityChange(uint32_t aNewValue) { AirQuality::Instance * airQualityInstance = AirQuality::GetInstance(); diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h index 7998cd15581a74..4022b06e9f8565 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h @@ -98,6 +98,11 @@ class AllClustersAppCommandHandler * Should be called when it is necessary to change the air quality attribute. */ void OnAirQualityChange(uint32_t aEnum); + + /** + * Should be called when it is necessary to change the operational state as a manual operation. + */ + void OnOperationalStateChange(std::string device, std::string operation, Json::Value param); }; class AllClustersCommandDelegate : public NamedPipeCommandDelegate diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index bf42c172e2d735..cc61db4bf4379c 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -19,6 +19,14 @@ import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/src/lib/lib.gni") import("${chip_root}/src/platform/device.gni") +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") + import("${chip_root}/examples/common/pigweed/rpc_config.gni") +} + source_set("chip-all-clusters-common") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", @@ -78,7 +86,19 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/energy-management-app/energy-management-common/include", ] - cflags = [ "-Wconversion" ] + if (chip_enable_pw_rpc) { + defines = rpc_defines + sources += rpc_sources + deps += rpc_deps + + deps += pw_build_LINK_DEPS + + include_dirs += [ "${chip_root}/examples/common" ] + } else { + # The system_rpc_server.cc file is in pigweed and doesn't compile with + # -Wconversion, remove check for RPC build only. + cflags = [ "-Wconversion" ] + } if (chip_build_libshell) { defines = [ "ENABLE_CHIP_SHELL" ] diff --git a/examples/all-clusters-app/linux/with_pw_rpc.gni b/examples/all-clusters-app/linux/with_pw_rpc.gni new file mode 100644 index 00000000000000..0f1ab1ea89c121 --- /dev/null +++ b/examples/all-clusters-app/linux/with_pw_rpc.gni @@ -0,0 +1,42 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" +pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" +pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" +pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" +pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_thread_YIELD_BACKEND = "$dir_pw_thread_stl:yield" +pw_thread_SLEEP_BACKEND = "$dir_pw_thread_stl:sleep" + +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] + +chip_enable_pw_rpc = true +chip_use_pw_logging = true diff --git a/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp b/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp index 2d3a6e4e32f270..eaf2bda516f23e 100644 --- a/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp +++ b/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp @@ -55,9 +55,9 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) // Set FeatureMap to 0, default is: // (kUser|kAccessSchedules|kRfidCredential|kPinCredential) 0x113 - EmberAfStatus status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Updating feature map %x", status); + LOG_ERR("Updating feature map %x", to_underlying(status)); } } diff --git a/examples/all-clusters-app/nxp/mw320/binding-handler.cpp b/examples/all-clusters-app/nxp/mw320/binding-handler.cpp index 6ad25c9d46bc34..ace7da026b253a 100644 --- a/examples/all-clusters-app/nxp/mw320/binding-handler.cpp +++ b/examples/all-clusters-app/nxp/mw320/binding-handler.cpp @@ -74,13 +74,13 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch using namespace chip; using namespace chip::app; - if (binding.type == EMBER_MULTICAST_BINDING) + if (binding.type == MATTER_MULTICAST_BINDING) { ChipLogError(NotSpecified, "Group binding is not supported now"); return; } - if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 && + if (binding.type == MATTER_UNICAST_BINDING && binding.local == 1 && (!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id)) { auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) { diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index b778d95fc4430b..5f2df7b501e88d 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -286,7 +286,7 @@ void GPIO_IRQHandler(void) #endif /* __cplusplus */ /* -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode, uint8_t * buffer, uint16_t maxReadLength, int32_t index) { @@ -295,7 +295,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI if(clusterId == Clusters::Switch::Id) { *buffer = g_ButtonPress; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } */ @@ -1616,20 +1616,21 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & return; } -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { PRINTF("====> %s() \r\n", __FUNCTION__); - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { // Added for the pairing of TE9 to report the commission_info // default function (in callback-stub.cpp) // PRINTF("-> %s()\n\r", __FUNCTION__); - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } diff --git a/examples/all-clusters-app/telink/src/ZclDoorLockCallbacks.cpp b/examples/all-clusters-app/telink/src/ZclDoorLockCallbacks.cpp index 2d3a6e4e32f270..eaf2bda516f23e 100644 --- a/examples/all-clusters-app/telink/src/ZclDoorLockCallbacks.cpp +++ b/examples/all-clusters-app/telink/src/ZclDoorLockCallbacks.cpp @@ -55,9 +55,9 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) // Set FeatureMap to 0, default is: // (kUser|kAccessSchedules|kRfidCredential|kPinCredential) 0x113 - EmberAfStatus status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Updating feature map %x", status); + LOG_ERR("Updating feature map %x", to_underlying(status)); } } diff --git a/examples/all-clusters-minimal-app/asr/src/AppTask.cpp b/examples/all-clusters-minimal-app/asr/src/AppTask.cpp index ac9dfe7ba5d8d0..d6f77d2f28a836 100644 --- a/examples/all-clusters-minimal-app/asr/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/asr/src/AppTask.cpp @@ -221,11 +221,11 @@ void AppTask::OnOffUpdateClusterState(void) uint8_t onoff = sLightLED.Get(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff); + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ASR_LOG("ERR: updating on/off %x", status); + ASR_LOG("ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp index 3fcbc365fbc426..7cbaf6f447d405 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -406,11 +406,11 @@ void AppTask::OnOffUpdateClusterState(intptr_t context) uint8_t onoff = sLightLED.Get(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff); + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(2, onoff); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating on/off %x", status); + P6_LOG("ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp b/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp index 72fbcc663d8582..ab0f2ef3b707a1 100644 --- a/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp +++ b/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp @@ -103,8 +103,8 @@ CHIP_ERROR RemoveDeviceEndpoint(SubDevice * dev) return CHIP_ERROR_INTERNAL; } -EmberAfStatus HandleReadBridgedDeviceBasicAttribute(SubDevice * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadBridgedDeviceBasicAttribute(SubDevice * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength) { using namespace BridgedDeviceBasicInformation::Attributes; ChipLogProgress(DeviceLayer, "HandleReadBridgedDeviceBasicAttribute: attrId=%" PRIu32 ", maxReadLength=%u", attributeId, @@ -125,13 +125,14 @@ EmberAfStatus HandleReadBridgedDeviceBasicAttribute(SubDevice * dev, chip::Attri } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleReadOnOffAttribute(SubDevice * dev, chip::AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadOnOffAttribute(SubDevice * dev, chip::AttributeId attributeId, uint8_t * buffer, + uint16_t maxReadLength) { ChipLogProgress(DeviceLayer, "HandleReadOnOffAttribute: attrId=%" PRIu32 ", maxReadLength=%u", attributeId, maxReadLength); @@ -145,24 +146,25 @@ EmberAfStatus HandleReadOnOffAttribute(SubDevice * dev, chip::AttributeId attrib } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleWriteOnOffAttribute(SubDevice * dev, chip::AttributeId attributeId, uint8_t * buffer) +Protocols::InteractionModel::Status HandleWriteOnOffAttribute(SubDevice * dev, chip::AttributeId attributeId, uint8_t * buffer) { ChipLogProgress(DeviceLayer, "HandleWriteOnOffAttribute: attrId=%" PRIu32, attributeId); - ReturnErrorCodeIf((attributeId != OnOff::Attributes::OnOff::Id) || (!dev->IsReachable()), EMBER_ZCL_STATUS_FAILURE); + ReturnErrorCodeIf((attributeId != OnOff::Attributes::OnOff::Id) || (!dev->IsReachable()), + Protocols::InteractionModel::Status::Failure); dev->SetOnOff(*buffer == 1); - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); @@ -181,11 +183,12 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI } } - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); @@ -199,7 +202,7 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster } } - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } namespace { diff --git a/examples/bridge-app/asr/subdevice/SubDeviceManager.h b/examples/bridge-app/asr/subdevice/SubDeviceManager.h index 3a91527f33e99c..29ce5067fe7faf 100644 --- a/examples/bridge-app/asr/subdevice/SubDeviceManager.h +++ b/examples/bridge-app/asr/subdevice/SubDeviceManager.h @@ -68,8 +68,8 @@ extern "C" { int AddDeviceEndpoint(SubDevice * dev, EmberAfEndpointType * ep, const Span & deviceTypeList, const Span & dataVersionStorage, chip::EndpointId parentEndpointId); CHIP_ERROR RemoveDeviceEndpoint(SubDevice * dev); -EmberAfStatus HandleReadBridgedDeviceBasicAttribute(SubDevice * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength); +Protocols::InteractionModel::Status HandleReadBridgedDeviceBasicAttribute(SubDevice * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength); void HandleDeviceStatusChanged(SubDevice * dev, SubDevice::Changed_t itemChangedMask); void Init_Bridge_Endpoint(); #ifdef __cplusplus diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 92298a488c3186..27cdb3c5e2dab5 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -213,8 +213,8 @@ CHIP_ERROR RemoveDeviceEndpoint(Device * dev) return CHIP_ERROR_INTERNAL; } -EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength) { using namespace BridgedDeviceBasicInformation::Attributes; ChipLogProgress(DeviceLayer, "HandleReadBridgedDeviceBasicAttribute: attrId=%" PRIu32 ", maxReadLength=%u", attributeId, @@ -236,13 +236,14 @@ EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::Attribut } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleReadOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, + uint16_t maxReadLength) { ChipLogProgress(DeviceLayer, "HandleReadOnOffAttribute: attrId=%" PRIu32 ", maxReadLength=%u", attributeId, maxReadLength); @@ -257,24 +258,25 @@ EmberAfStatus HandleReadOnOffAttribute(Device * dev, chip::AttributeId attribute } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleWriteOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer) +Protocols::InteractionModel::Status HandleWriteOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer) { ChipLogProgress(DeviceLayer, "HandleWriteOnOffAttribute: attrId=%" PRIu32, attributeId); - ReturnErrorCodeIf((attributeId != OnOff::Attributes::OnOff::Id) || (!dev->IsReachable()), EMBER_ZCL_STATUS_FAILURE); + ReturnErrorCodeIf((attributeId != OnOff::Attributes::OnOff::Id) || (!dev->IsReachable()), + Protocols::InteractionModel::Status::Failure); dev->SetOnOff(*buffer == 1); - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); @@ -292,11 +294,12 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI } } - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); @@ -310,7 +313,7 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster } } - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } namespace { diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 2c825fe8e5e010..80c8b17b7fbed5 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -436,8 +436,8 @@ void HandleDeviceTempSensorStatusChanged(DeviceTempSensor * dev, DeviceTempSenso } } -EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength) { using namespace BridgedDeviceBasicInformation::Attributes; @@ -464,13 +464,14 @@ EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::Attribut } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleReadOnOffAttribute(DeviceOnOff * dev, chip::AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadOnOffAttribute(DeviceOnOff * dev, chip::AttributeId attributeId, uint8_t * buffer, + uint16_t maxReadLength) { ChipLogProgress(DeviceLayer, "HandleReadOnOffAttribute: attrId=%d, maxReadLength=%d", attributeId, maxReadLength); @@ -485,13 +486,13 @@ EmberAfStatus HandleReadOnOffAttribute(DeviceOnOff * dev, chip::AttributeId attr } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleWriteOnOffAttribute(DeviceOnOff * dev, chip::AttributeId attributeId, uint8_t * buffer) +Protocols::InteractionModel::Status HandleWriteOnOffAttribute(DeviceOnOff * dev, chip::AttributeId attributeId, uint8_t * buffer) { ChipLogProgress(DeviceLayer, "HandleWriteOnOffAttribute: attrId=%d", attributeId); @@ -508,14 +509,14 @@ EmberAfStatus HandleWriteOnOffAttribute(DeviceOnOff * dev, chip::AttributeId att } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength) { using namespace TemperatureMeasurement::Attributes; @@ -546,19 +547,19 @@ EmberAfStatus HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::A } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; if ((endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) && (gDevices[endpointIndex] != nullptr)) { @@ -643,12 +644,13 @@ class BridgedPowerSourceAttrAccess : public AttributeAccessInterface BridgedPowerSourceAttrAccess gPowerAttrAccess; -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; // ChipLogProgress(DeviceLayer, "emberAfExternalAttributeWriteCallback: ep=%d", endpoint); diff --git a/examples/bridge-app/telink/src/AppTask.cpp b/examples/bridge-app/telink/src/AppTask.cpp index 3b4066bd87c2c7..d21897bd2d36b6 100644 --- a/examples/bridge-app/telink/src/AppTask.cpp +++ b/examples/bridge-app/telink/src/AppTask.cpp @@ -36,8 +36,8 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span & dataVersionStorage, chip::EndpointId parentEndpointId); CHIP_ERROR RemoveDeviceEndpoint(Device * dev); void HandleDeviceTempSensorStatusChanged(DeviceTempSensor * dev, DeviceTempSensor::Changed_t itemChangedMask); -EmberAfStatus HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength); +Protocols::InteractionModel::Status HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength); static const int kNodeLabelSize = 32; // Current ZCL implementation of Struct uses a max-size array of 254 bytes @@ -236,8 +236,8 @@ CHIP_ERROR RemoveDeviceEndpoint(Device * dev) return CHIP_ERROR_INTERNAL; } -EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength) { using namespace chip::app::Clusters::BridgedDeviceBasicInformation::Attributes; ChipLogProgress(DeviceLayer, "HandleReadBridgedDeviceBasicAttribute: attrId=%" PRIu32 ", maxReadLength=%u", attributeId, @@ -264,13 +264,14 @@ EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::Attribut } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleReadOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer, + uint16_t maxReadLength) { ChipLogProgress(DeviceLayer, "HandleReadOnOffAttribute: attrId=%" PRIu32 ", maxReadLength=%u", attributeId, maxReadLength); @@ -285,24 +286,25 @@ EmberAfStatus HandleReadOnOffAttribute(Device * dev, chip::AttributeId attribute } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus HandleWriteOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer) +Protocols::InteractionModel::Status HandleWriteOnOffAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer) { ChipLogProgress(DeviceLayer, "HandleWriteOnOffAttribute: attrId=%" PRIu32, attributeId); - ReturnErrorCodeIf((attributeId != Clusters::OnOff::Attributes::OnOff::Id) || (!dev->IsReachable()), EMBER_ZCL_STATUS_FAILURE); + ReturnErrorCodeIf((attributeId != Clusters::OnOff::Attributes::OnOff::Id) || (!dev->IsReachable()), + Protocols::InteractionModel::Status::Failure); dev->SetOnOff(*buffer == 1); - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { using namespace Clusters; @@ -327,11 +329,12 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI } } - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); @@ -345,7 +348,7 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster } } - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } namespace { @@ -488,8 +491,8 @@ void HandleDeviceTempSensorStatusChanged(DeviceTempSensor * dev, DeviceTempSenso } } -EmberAfStatus HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::AttributeId attributeId, + uint8_t * buffer, uint16_t maxReadLength) { using namespace Clusters::TemperatureMeasurement::Attributes; @@ -520,10 +523,10 @@ EmberAfStatus HandleReadTempMeasurementAttribute(DeviceTempSensor * dev, chip::A } else { - return EMBER_ZCL_STATUS_FAILURE; + return Protocols::InteractionModel::Status::Failure; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } void AppTask::LightingActionEventHandler(AppEvent * aEvent) @@ -590,16 +593,16 @@ void AppTask::UpdateClusterState(void) bool isTurnedOn = sAppTask.mPwmRgbBlueLed.IsTurnedOn(); // write the new on/off value - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn); + Protocols::InteractionModel::Status status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Update OnOff fail: %x", status); + LOG_ERR("Update OnOff fail: %x", to_underlying(status)); } uint8_t setLevel = sAppTask.mPwmRgbBlueLed.GetLevel(); status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kExampleEndpointId, setLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Update CurrentLevel fail: %x", status); + LOG_ERR("Update CurrentLevel fail: %x", to_underlying(status)); } } diff --git a/examples/bridge-app/telink/src/ZclCallbacks.cpp b/examples/bridge-app/telink/src/ZclCallbacks.cpp index b6f5ed558c584e..e83993165acb51 100644 --- a/examples/bridge-app/telink/src/ZclCallbacks.cpp +++ b/examples/bridge-app/telink/src/ZclCallbacks.cpp @@ -43,12 +43,12 @@ using namespace chip::app::Clusters::OnOff; */ void emberAfOnOffClusterInitCallback(EndpointId endpoint) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; bool storedValue; // Read storedValue on/off value status = Attributes::OnOff::Get(1, &storedValue); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Protocols::InteractionModel::Status::Success) { // Set actual state to stored before reboot GetAppTask().GetPWMDevice().Set(storedValue); diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 47d3c7ad3d34b7..688bdfef490761 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -730,7 +730,7 @@ def main() -> int: shell.run_cmd(" ".join(nrf_build_cmds)) elif options.build_target == "silabs-thread": - shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/efr32") + shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/silabs") if options.do_clean: shell.run_cmd(f"rm -rf out/{options.sample_device_type_name}") efr32_cmd_args = [] diff --git a/examples/chef/common/chef-air-quality.cpp b/examples/chef/common/chef-air-quality.cpp index 0770d0c185aa0c..eafff42d538fb6 100644 --- a/examples/chef/common/chef-air-quality.cpp +++ b/examples/chef/common/chef-air-quality.cpp @@ -40,15 +40,16 @@ void emberAfAirQualityClusterInitCallback(chip::EndpointId endpointId) gAirQualityClusterInstance[endpointId] = clusterInstance; } -EmberAfStatus chefAirQualityWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status chefAirQualityWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { - EmberAfStatus ret = EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; if (gAirQualityClusterInstance.find(endpoint) == gAirQualityClusterInstance.end()) { ChipLogError(DeviceLayer, "Invalid Endpoind ID: %d", endpoint); - return EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT; + return Protocols::InteractionModel::Status::UnsupportedEndpoint; } Instance * clusterInstance = gAirQualityClusterInstance[endpoint]; @@ -63,12 +64,12 @@ EmberAfStatus chefAirQualityWriteCallback(EndpointId endpoint, ClusterId cluster { break; } - ret = EMBER_ZCL_STATUS_UNSUPPORTED_WRITE; + ret = Protocols::InteractionModel::Status::UnsupportedWrite; ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast(status)); } break; default: - ret = EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; + ret = Protocols::InteractionModel::Status::UnsupportedAttribute; ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); break; } @@ -76,11 +77,11 @@ EmberAfStatus chefAirQualityWriteCallback(EndpointId endpoint, ClusterId cluster return ret; } -EmberAfStatus chefAirQualityReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status chefAirQualityReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength) { - EmberAfStatus ret = EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; return ret; } diff --git a/examples/chef/common/chef-air-quality.h b/examples/chef/common/chef-air-quality.h index 39019b03fbb781..2eaf3ef28fdf66 100644 --- a/examples/chef/common/chef-air-quality.h +++ b/examples/chef/common/chef-air-quality.h @@ -22,9 +22,10 @@ #include #ifdef MATTER_DM_PLUGIN_AIR_QUALITY_SERVER -EmberAfStatus chefAirQualityWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); -EmberAfStatus chefAirQualityReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength); +Protocols::InteractionModel::Status chefAirQualityWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +Protocols::InteractionModel::Status chefAirQualityReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength); #endif diff --git a/examples/chef/common/chef-concentration-measurement.cpp b/examples/chef/common/chef-concentration-measurement.cpp index 395d6604582edf..2d8b65ba2cad19 100644 --- a/examples/chef/common/chef-concentration-measurement.cpp +++ b/examples/chef/common/chef-concentration-measurement.cpp @@ -55,19 +55,19 @@ static std::map *> template -EmberAfStatus chefConcentrationMeasurementWriteCallback( +Protocols::InteractionModel::Status chefConcentrationMeasurementWriteCallback( std::map *> & map, AttributeId measuredValueId, chip::EndpointId endpoint, chip::ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { - EmberAfStatus ret = EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; if (map.find(endpoint) == map.end()) { ChipLogError(DeviceLayer, "Invalid Endpoind ID: %d", endpoint); - return EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT; + return Protocols::InteractionModel::Status::UnsupportedEndpoint; } Instance(attributeId)); } return ret; } -EmberAfStatus chefConcentrationMeasurementWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status chefConcentrationMeasurementWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { - EmberAfStatus ret = EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; switch (clusterId) { @@ -174,11 +175,11 @@ EmberAfStatus chefConcentrationMeasurementWriteCallback(chip::EndpointId endpoin return ret; } -EmberAfStatus chefConcentrationMeasurementReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status chefConcentrationMeasurementReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { - EmberAfStatus ret = EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success; return ret; } diff --git a/examples/chef/common/chef-concentration-measurement.h b/examples/chef/common/chef-concentration-measurement.h index ddd004ebd7047e..9b8fc571872c6b 100644 --- a/examples/chef/common/chef-concentration-measurement.h +++ b/examples/chef/common/chef-concentration-measurement.h @@ -31,9 +31,10 @@ defined(MATTER_DM_PLUGIN_PM10_CONCENTRATION_MEASUREMENT_SERVER) || \ defined(MATTER_DM_PLUGIN_TOTAL_VOLATILE_ORGANIC_COMPOUNDS_CONCENTRATION_MEASUREMENT_SERVER) || \ defined(MATTER_DM_PLUGIN_RADON_CONCENTRATION_MEASUREMENT_SERVER) -EmberAfStatus chefConcentrationMeasurementWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); -EmberAfStatus chefConcentrationMeasurementReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength); +Protocols::InteractionModel::Status chefConcentrationMeasurementWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +Protocols::InteractionModel::Status chefConcentrationMeasurementReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); #endif diff --git a/examples/chef/common/chef-fan-control-manager.cpp b/examples/chef/common/chef-fan-control-manager.cpp index 35d3579adf3439..998491d4a61aeb 100644 --- a/examples/chef/common/chef-fan-control-manager.cpp +++ b/examples/chef/common/chef-fan-control-manager.cpp @@ -56,9 +56,9 @@ CHIP_ERROR ChefFanControlManager::ReadPercentCurrent(AttributeValueEncoder & aEn { // Return PercentSetting attribute value for now DataModel::Nullable percentSetting; - EmberAfStatus status = PercentSetting::Get(mEndpoint, percentSetting); + Protocols::InteractionModel::Status status = PercentSetting::Get(mEndpoint, percentSetting); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, CHIP_ERROR_READ_FAILED); return aEncoder.Encode(percentSetting.ValueOr(0)); } @@ -67,9 +67,9 @@ CHIP_ERROR ChefFanControlManager::ReadSpeedCurrent(AttributeValueEncoder & aEnco { // Return SpeedCurrent attribute value for now DataModel::Nullable speedSetting; - EmberAfStatus status = SpeedSetting::Get(mEndpoint, speedSetting); + Protocols::InteractionModel::Status status = SpeedSetting::Get(mEndpoint, speedSetting); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, CHIP_ERROR_READ_FAILED); return aEncoder.Encode(speedSetting.ValueOr(0)); } @@ -81,19 +81,19 @@ Status ChefFanControlManager::HandleStep(StepDirectionEnum aDirection, bool aWra VerifyOrReturnError(aDirection != StepDirectionEnum::kUnknownEnumValue, Status::InvalidCommand); - EmberAfStatus status; + Protocols::InteractionModel::Status status; uint8_t speedMax; status = SpeedMax::Get(mEndpoint, &speedMax); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::InvalidCommand); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, Status::InvalidCommand); uint8_t speedCurrent; status = SpeedCurrent::Get(mEndpoint, &speedCurrent); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::InvalidCommand); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, Status::InvalidCommand); DataModel::Nullable speedSetting; status = SpeedSetting::Get(mEndpoint, speedSetting); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::InvalidCommand); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, Status::InvalidCommand); uint8_t newSpeedSetting = speedSetting.ValueOr(0); uint8_t speedValue = speedSetting.ValueOr(speedCurrent); diff --git a/examples/chef/common/chef-rvc-operational-state-delegate.h b/examples/chef/common/chef-rvc-operational-state-delegate.h index c8d63c2bb6efc2..f487e38000771d 100644 --- a/examples/chef/common/chef-rvc-operational-state-delegate.h +++ b/examples/chef/common/chef-rvc-operational-state-delegate.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 483919c1c9a952..cff7ffdee4679f 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -23,9 +23,9 @@ using chip::app::DataModel::Nullable; using namespace chip; -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { switch (clusterId) { @@ -58,7 +58,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI default: break; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } /* @@ -71,8 +71,9 @@ Thread 3 "rootnode_airqua" hit Breakpoint 1, emberAfExternalAttributeWriteCallba 48 '0', mask = 16 '\020'} (gdb) */ -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) { switch (clusterId) { @@ -105,7 +106,7 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster default: break; } - return EMBER_ZCL_STATUS_SUCCESS; + return Protocols::InteractionModel::Status::Success; } // Include door lock callbacks only when the server is enabled diff --git a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py index 355a2b18433e31..f4e8e6711d7105 100644 --- a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py +++ b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/encoder.py @@ -148,6 +148,17 @@ } }, + 'Bdx': { + 'commands': { + 'Download': { + 'arguments': { + 'LogType': 'log-type', + }, + 'has_endpoint': False, + } + } + }, + 'DelayCommands': { 'alias': 'delay', 'commands': { diff --git a/examples/common/imgui_ui/windows/light.cpp b/examples/common/imgui_ui/windows/light.cpp index 24f88212ae23a1..86899e044b2ed1 100644 --- a/examples/common/imgui_ui/windows/light.cpp +++ b/examples/common/imgui_ui/windows/light.cpp @@ -70,13 +70,13 @@ void Light::UpdateState() { if (mTargetLightIsOn.HasValue()) { - EmberAfStatus status = OnOffServer::Instance().setOnOffValue( + chip::Protocols::InteractionModel::Status status = OnOffServer::Instance().setOnOffValue( mEndpointId, mTargetLightIsOn.Value() ? OnOff::Commands::On::Id : OnOff::Commands::Off::Id, false /* initiatedByLevelChange */); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != chip::Protocols::InteractionModel::Status::Success) { - ChipLogError(AppServer, "Failed to set on/off value: %d", status); + ChipLogError(AppServer, "Failed to set on/off value: %d", chip::to_underlying(status)); } mTargetLightIsOn.ClearValue(); diff --git a/examples/common/pigweed/nxp/PigweedLoggerMutex.cpp b/examples/common/pigweed/nxp/PigweedLoggerMutex.cpp new file mode 100644 index 00000000000000..ce5f5a9be0d21d --- /dev/null +++ b/examples/common/pigweed/nxp/PigweedLoggerMutex.cpp @@ -0,0 +1,27 @@ +/* + * + * 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. + */ + +#include "PigweedLoggerMutex.h" + +namespace chip { +namespace rpc { + +PigweedLoggerMutex logger_mutex; + +} // namespace rpc +} // namespace chip diff --git a/examples/common/pigweed/nxp/PigweedLoggerMutex.h b/examples/common/pigweed/nxp/PigweedLoggerMutex.h new file mode 100644 index 00000000000000..ecad8995bad61c --- /dev/null +++ b/examples/common/pigweed/nxp/PigweedLoggerMutex.h @@ -0,0 +1,36 @@ +/* + * + * 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. + */ + +#pragma once + +#include "PigweedLogger.h" +#include "RpcService.h" + +namespace chip { +namespace rpc { +class PigweedLoggerMutex : public chip::rpc::Mutex +{ + +public: + void Lock() override { PigweedLogger::Lock(); } + void Unlock() override { PigweedLogger::Unlock(); } +}; + +extern PigweedLoggerMutex logger_mutex; + +} // namespace rpc +} // namespace chip diff --git a/examples/common/pigweed/rpc_config.gni b/examples/common/pigweed/rpc_config.gni new file mode 100644 index 00000000000000..ddd6b0863ebf70 --- /dev/null +++ b/examples/common/pigweed/rpc_config.gni @@ -0,0 +1,53 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +rpc_defines = [ + "PW_RPC_ENABLED", + "PW_RPC_ATTRIBUTE_SERVICE=1", + "PW_RPC_BUTTON_SERVICE=1", + "PW_RPC_DESCRIPTOR_SERVICE=1", + "PW_RPC_DEVICE_SERVICE=1", + "PW_RPC_LIGHTING_SERVICE=1", + "PW_RPC_TRACING_SERVICE=1", +] + +rpc_sources = [ + "${chip_root}/examples/platform/linux/Rpc.cpp", + "${chip_root}/examples/platform/linux/system_rpc_server.cc", +] + +rpc_deps = [ + "$dir_pw_hdlc:pw_rpc", + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_log", + "$dir_pw_rpc:server", + "$dir_pw_rpc/system_server:facade", + "$dir_pw_rpc/system_server:socket", + "$dir_pw_stream:socket_stream", + "$dir_pw_stream:sys_io_stream", + "$dir_pw_sync:mutex", + "$dir_pw_trace", + "$dir_pw_trace_tokenized", + "$dir_pw_trace_tokenized:trace_rpc_service", + "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:rpc_services", +] diff --git a/examples/common/pigweed/rpc_services/internal/StatusUtils.h b/examples/common/pigweed/rpc_services/internal/StatusUtils.h index f92ee66afc44bb..3ea14d3f88923e 100644 --- a/examples/common/pigweed/rpc_services/internal/StatusUtils.h +++ b/examples/common/pigweed/rpc_services/internal/StatusUtils.h @@ -36,15 +36,15 @@ namespace chip { namespace rpc { -constexpr pw::Status ToPwStatus(EmberAfStatus ember_status) +constexpr pw::Status ToPwStatus(Protocols::InteractionModel::Status ember_status) { switch (ember_status) { - case EMBER_ZCL_STATUS_SUCCESS: + case Protocols::InteractionModel::Status::Success: return pw::OkStatus(); - case EMBER_ZCL_STATUS_NOT_FOUND: + case Protocols::InteractionModel::Status::NotFound: return pw::Status::NotFound(); - case EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS: + case Protocols::InteractionModel::Status::UnsupportedAccess: return pw::Status::PermissionDenied(); default: return pw::Status::Unknown(); diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp index 5c942db19b3af5..a46ea5db28df64 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -892,10 +892,10 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg) uint8_t newValue = ContactSensorMgr().IsContactClosed(); // write the new on/off value - EmberAfStatus status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating boolean status value %x", status); + ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status)); } logBooleanStateEvent(newValue); } diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/.gn b/examples/contact-sensor-app/nxp/k32w/k32w1/.gn index dec954b4b9ff69..1e848295f6aa5b 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/.gn @@ -26,4 +26,7 @@ default_args = { target_os = "freertos" import("//args.gni") + + # Import default platform configs + import("${chip_root}/src/platform/nxp/k32w/k32w1/args.gni") } diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn index 1404ad8dd36a1c..ed49c7bdd4f7a3 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn @@ -14,15 +14,19 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") import("//build_overrides/openthread.gni") -import("${k32w1_sdk_build_root}/k32w1_executable.gni") -import("${k32w1_sdk_build_root}/k32w1_sdk.gni") +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_executable.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/platform/device.gni") +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") declare_args() { chip_software_version = 0 @@ -85,7 +89,7 @@ k32w1_executable("contact_sensor_app") { deps = [ ":sdk", "${chip_root}/examples/common/QRCode", - "${chip_root}/examples/contact-sensor-app/contact-sensor-common", + "${chip_root}/examples/contact-sensor-app/nxp/zap", "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", "${chip_root}/src/platform:syscalls_stub", @@ -116,7 +120,6 @@ k32w1_executable("contact_sensor_app") { ldflags = [ "-Wl,--defsym=__heap_size__=0", "-Wl,--defsym=__stack_size__=0x480", - "-Wl,--defsym=gNvmSectors=8", "-Wl,--defsym=lp_ram_lower_limit=0x04000000", "-Wl,--defsym=lp_ram_upper_limit=0x2001C000", "-Wl,-print-memory-usage", @@ -124,6 +127,10 @@ k32w1_executable("contact_sensor_app") { "-T" + rebase_path(ldscript, root_build_dir), ] + if (chip_with_factory_data == 1) { + ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] + } + output_dir = root_out_dir } diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md b/examples/contact-sensor-app/nxp/k32w/k32w1/README.md index da6e3eb00f2f66..28983f45c89578 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/README.md @@ -19,6 +19,7 @@ into an existing Matter network and can be controlled by this network. - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - [Device UI](#device-ui) - [Building](#building) +- [Manufacturing data](#manufacturing-data) - [Flashing](#flashing) - [Flashing the NBU image](#flashing-the-nbu-image) - [Flashing the host image](#flashing-the-host-image) @@ -108,7 +109,9 @@ initiate a reboot. The reset action can be cancelled by press SW2 button at any point before the 6 second limit. **Button SW3** can be used to change the state of the simulated contact sensor. -The button behaves as a toggle, swapping the state every time it is pressed. +The button behaves as a toggle, swapping the state every time it is short +pressed. When long pressed, it does a clean soft reset that takes into account +Matter shutdown procedure. ## Building @@ -134,8 +137,17 @@ In case that Openthread CLI is needed, chip_with_ot_cli build argument must be set to 1. After a successful build, the `elf` and `srec` files are found in `out/debug/` - +`see the files prefixed with chip-k32w1-contact-example`. After a successful +build, the `elf` and `srec` files are found in `out/debug/` - `see the files prefixed with chip-k32w1-contact-example`. +## Manufacturing data + +Use `chip_with_factory_data=1` in the gn build command to enable factory data. + +For a full guide on manufacturing flow, please see +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). + ## Flashing Two images must be written to the board: one for the host (CM33) and one for the diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni b/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni index c0497aa27421d2..18c41cb457bc86 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni @@ -15,7 +15,6 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/examples/platform/nxp/k32w/k32w1/args.gni") # SDK target. This is overridden to add our SDK app_config.h & defines. k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") @@ -23,3 +22,7 @@ k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_ota_requestor = true chip_stack_lock_tracking = "fatal" chip_enable_ble = true + +chip_enable_icd_server = true +chip_persist_subscriptions = true +chip_subscription_timeout_resumption = true diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h b/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h index af3a7067c99e1a..8846799ed6edc9 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h @@ -28,6 +28,58 @@ #pragma once +// Use hard-coded test certificates already embedded in generic chip code => set it to 0 +// Use real/development certificates => set it to 1 + file the provisioning section from +// the internal flash +#ifndef CONFIG_CHIP_LOAD_REAL_FACTORY_DATA +#define CONFIG_CHIP_LOAD_REAL_FACTORY_DATA 0 +#endif + +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + +// VID/PID for product => will be used by Basic Information Cluster +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037 +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA221 + +// Set the following define to use the Certification Declaration from below and not use it stored in factory data section +#ifndef CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION +#define CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION 0 +#endif + +#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION +//-> format_version = 1 +//-> vendor_id = 0x1037 +//-> product_id_array = [ 0xA221 ] +//-> device_type_id = 0x0015 +//-> certificate_id = "ZIG20142ZB330003-24" +//-> security_level = 0 +//-> security_information = 0 +//-> version_number = 0x2694 +//-> certification_type = 1 +//-> dac_origin_vendor_id is not present +//-> dac_origin_product_id is not present +#define CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION \ + { \ + 0x30, 0x81, 0xe7, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x81, 0xd9, 0x30, 0x81, 0xd6, \ + 0x02, 0x01, 0x03, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, \ + 0x44, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x37, 0x04, 0x35, 0x15, 0x24, 0x00, \ + 0x01, 0x25, 0x01, 0x37, 0x10, 0x36, 0x02, 0x05, 0x21, 0xa2, 0x18, 0x24, 0x03, 0x15, 0x2c, 0x04, 0x13, 0x5a, 0x49, \ + 0x47, 0x32, 0x30, 0x31, 0x34, 0x32, 0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x34, 0x24, 0x05, \ + 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x76, 0x98, 0x24, 0x08, 0x01, 0x18, 0x31, 0x7c, 0x30, 0x7a, 0x02, 0x01, 0x03, \ + 0x80, 0x14, 0x62, 0xfa, 0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a, 0xdd, 0xf5, 0x04, \ + 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, 0x0a, 0x06, \ + 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x46, 0x30, 0x44, 0x02, 0x20, 0x1b, 0xf3, 0x13, 0x9b, \ + 0x39, 0xb8, 0x3e, 0x87, 0xde, 0x2e, 0xdf, 0x51, 0xfb, 0xa3, 0xba, 0xcb, 0xc7, 0x4e, 0xef, 0x16, 0x6b, 0xa1, 0x04, \ + 0xa0, 0x05, 0x7f, 0xc3, 0xd4, 0x15, 0x84, 0xd0, 0x44, 0x02, 0x20, 0x32, 0x98, 0xe2, 0x3c, 0x31, 0x16, 0x63, 0x60, \ + 0x2e, 0x58, 0x93, 0x87, 0x50, 0x9e, 0x29, 0x10, 0x9d, 0xe5, 0x9b, 0xcd, 0xab, 0x64, 0x43, 0x08, 0xd6, 0xf6, 0x6f, \ + 0x46, 0x7d, 0x22, 0x24, 0x42 \ + } + +// All remaining data will be pulled from the provisioning region of flash. +#endif + +#else + /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID * @@ -56,18 +108,7 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" -/** - * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID - * - * 0xFFF1: Test vendor. - */ -#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 - -/** - * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID - * - */ -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8006 +#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp index c7acba0f3ee1cb..10039bb8c9270e 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp @@ -94,6 +94,9 @@ using namespace chip; using namespace chip::app; AppTask AppTask::sAppTask; +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA +static AppTask::FactoryDataProvider sFactoryDataProvider; +#endif static Identify gIdentify = { chip::EndpointId{ 1 }, AppTask::OnIdentifyStart, AppTask::OnIdentifyStop, Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator }; @@ -150,8 +153,14 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server PlatformMgr().ScheduleWork(InitServer, 0); - // Initialize device attestation config +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + ReturnErrorOnFailure(sFactoryDataProvider.Init()); + SetDeviceInstanceInfoProvider(&sFactoryDataProvider); + SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); + SetCommissionableDataProvider(&sFactoryDataProvider); +#else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA // QR code will be used with CHIP Tool AppTask::PrintOnboardingInfo(); @@ -358,7 +367,7 @@ void AppTask::AppTaskMain(void * pvParameter) void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) { - if ((pin_no != RESET_BUTTON) && (pin_no != CONTACT_SENSOR_BUTTON) && (pin_no != OTA_BUTTON) && (pin_no != BLE_BUTTON)) + if ((pin_no != RESET_BUTTON) && (pin_no != CONTACT_SENSOR_BUTTON) && (pin_no != SOFT_RESET_BUTTON) && (pin_no != BLE_BUTTON)) { return; } @@ -376,10 +385,10 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) { button_event.Handler = ContactActionEventHandler; } - else if (pin_no == OTA_BUTTON) + else if (pin_no == SOFT_RESET_BUTTON) { - // Starting OTA by button functionality is not used. - // button_event.Handler = OTAHandler; + // Soft reset ensures that platform manager shutdown procedure is called. + button_event.Handler = SoftResetHandler; } else if (pin_no == BLE_BUTTON) { @@ -432,7 +441,7 @@ button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_messa case CONTACT_SENSOR_BUTTON: K32W_LOG("pb2 long press"); - ButtonEventHandler(OTA_BUTTON, OTA_BUTTON_PUSH); + ButtonEventHandler(SOFT_RESET_BUTTON, SOFT_RESET_BUTTON_PUSH); break; } break; @@ -561,29 +570,14 @@ void AppTask::ContactActionEventHandler(void * aGenericEvent) } } -void AppTask::OTAHandler(void * aGenericEvent) +void AppTask::SoftResetHandler(void * aGenericEvent) { AppEvent * aEvent = (AppEvent *) aGenericEvent; - if (aEvent->ButtonEvent.PinNo != OTA_BUTTON) + if (aEvent->ButtonEvent.PinNo != SOFT_RESET_BUTTON) return; -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - if (sAppTask.mFunction != Function::kNoneSelected) - { - K32W_LOG("Another function is scheduled. Could not initiate OTA!"); - return; - } - - PlatformMgr().ScheduleWork(StartOTAQuery, 0); -#endif -} - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -void AppTask::StartOTAQuery(intptr_t arg) -{ - GetRequestorInstance()->TriggerImmediateQuery(); + PlatformMgrImpl().CleanReset(); } -#endif void AppTask::BleHandler(void * aGenericEvent) { @@ -794,11 +788,11 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg) uint8_t newValue = ContactSensorMgr().IsContactClosed(); // write the new on/off value - EmberAfStatus status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); + Protocols::InteractionModel::Status status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating boolean status value %x", status); + ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status)); } logBooleanStateEvent(newValue); } diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h index 47b644769cfb63..bc19b0a9862ebd 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h @@ -30,6 +30,10 @@ #include #include +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA +#include +#endif + #include "FreeRTOS.h" #include "fsl_component_button.h" #include "timers.h" @@ -45,6 +49,9 @@ class AppTask { public: +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; +#endif CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); @@ -74,7 +81,7 @@ class AppTask static void FunctionTimerEventHandler(void * aGenericEvent); static button_status_t KBD_Callback(void * buttonHandle, button_callback_message_t * message, void * callbackParam); static void HandleKeyboard(void); - static void OTAHandler(void * aGenericEvent); + static void SoftResetHandler(void * aGenericEvent); static void BleHandler(void * aGenericEvent); static void BleStartAdvertising(intptr_t arg); static void ContactActionEventHandler(void * aGenericEvent); @@ -89,7 +96,6 @@ class AppTask #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR static void InitOTA(intptr_t arg); - static void StartOTAQuery(intptr_t arg); #endif static void UpdateClusterStateInternal(intptr_t arg); diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h index b62ce79567e8db..fbcf14fe7d88d7 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h @@ -23,12 +23,12 @@ #define RESET_BUTTON 1 #define CONTACT_SENSOR_BUTTON 2 -#define OTA_BUTTON 3 +#define SOFT_RESET_BUTTON 3 #define BLE_BUTTON 4 #define RESET_BUTTON_PUSH 1 #define CONTACT_SENSOR_BUTTON_PUSH 2 -#define OTA_BUTTON_PUSH 3 +#define SOFT_RESET_BUTTON_PUSH 3 #define BLE_BUTTON_PUSH 4 #define APP_BUTTON_PUSH 1 diff --git a/examples/contact-sensor-app/nxp/zap/BUILD.gn b/examples/contact-sensor-app/nxp/zap/BUILD.gn new file mode 100644 index 00000000000000..be4913cf3552ee --- /dev/null +++ b/examples/contact-sensor-app/nxp/zap/BUILD.gn @@ -0,0 +1,25 @@ +# 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. + +import("//build_overrides/chip.gni") +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +import("${chip_root}/src/app/chip_data_model.gni") + +chip_data_model("zap") { + zap_file = "contact-sensor-app.zap" + + zap_pregenerated_dir = + "${chip_root}/zzz_generated/contact-sensor-app/nxp/zap-generated" + is_server = true +} diff --git a/examples/contact-sensor-app/nxp/zap/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap/contact-sensor-app.matter new file mode 100644 index 00000000000000..03736833bb02d3 --- /dev/null +++ b/examples/contact-sensor-app/nxp/zap/contact-sensor-app.matter @@ -0,0 +1,1646 @@ +// This IDL was generated automatically by ZAP. +// It is for view/code review purposes only. + +/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ +cluster Identify = 3 { + revision 4; + + enum EffectIdentifierEnum : enum8 { + kBlink = 0; + kBreathe = 1; + kOkay = 2; + kChannelChange = 11; + kFinishEffect = 254; + kStopEffect = 255; + } + + enum EffectVariantEnum : enum8 { + kDefault = 0; + } + + enum IdentifyTypeEnum : enum8 { + kNone = 0; + kLightOutput = 1; + kVisibleIndicator = 2; + kAudibleBeep = 3; + kDisplay = 4; + kActuator = 5; + } + + attribute int16u identifyTime = 0; + readonly attribute IdentifyTypeEnum identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct IdentifyRequest { + int16u identifyTime = 0; + } + + request struct TriggerEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + EffectVariantEnum effectVariant = 1; + } + + /** Command description for Identify */ + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + /** Command description for TriggerEffect */ + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; +} + +/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ +cluster Descriptor = 29 { + revision 2; + + bitmap Feature : bitmap32 { + kTagList = 0x1; + } + + struct DeviceTypeStruct { + devtype_id deviceType = 0; + int16u revision = 1; + } + + struct SemanticTagStruct { + nullable vendor_id mfgCode = 0; + enum8 namespaceID = 1; + enum8 tag = 2; + optional nullable char_string label = 3; + } + + readonly attribute DeviceTypeStruct deviceTypeList[] = 0; + readonly attribute cluster_id serverList[] = 1; + readonly attribute cluster_id clientList[] = 2; + readonly attribute endpoint_no partsList[] = 3; + readonly attribute optional SemanticTagStruct tagList[] = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** The Access Control Cluster exposes a data model view of a + Node's Access Control List (ACL), which codifies the rules used to manage + and enforce Access Control for the Node's endpoints and their associated + cluster instances. */ +cluster AccessControl = 31 { + revision 1; // NOTE: Default/not specifically set + + enum AccessControlEntryAuthModeEnum : enum8 { + kPASE = 1; + kCASE = 2; + kGroup = 3; + } + + enum AccessControlEntryPrivilegeEnum : enum8 { + kView = 1; + kProxyView = 2; + kOperate = 3; + kManage = 4; + kAdminister = 5; + } + + enum ChangeTypeEnum : enum8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + + struct AccessControlTargetStruct { + nullable cluster_id cluster = 0; + nullable endpoint_no endpoint = 1; + nullable devtype_id deviceType = 2; + } + + fabric_scoped struct AccessControlEntryStruct { + fabric_sensitive AccessControlEntryPrivilegeEnum privilege = 1; + fabric_sensitive AccessControlEntryAuthModeEnum authMode = 2; + nullable fabric_sensitive int64u subjects[] = 3; + nullable fabric_sensitive AccessControlTargetStruct targets[] = 4; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct AccessControlExtensionStruct { + fabric_sensitive octet_string<128> data = 1; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlEntryChanged = 0 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlEntryStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlExtensionChanged = 1 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlExtensionStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0; + attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** This cluster provides attributes and events for determining basic information about Nodes, which supports both + Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number, + which apply to the whole Node. Also allows setting user device information such as location. */ +cluster BasicInformation = 40 { + revision 3; + + enum ColorEnum : enum8 { + kBlack = 0; + kNavy = 1; + kGreen = 2; + kTeal = 3; + kMaroon = 4; + kPurple = 5; + kOlive = 6; + kGray = 7; + kBlue = 8; + kLime = 9; + kAqua = 10; + kRed = 11; + kFuchsia = 12; + kYellow = 13; + kWhite = 14; + kNickel = 15; + kChrome = 16; + kBrass = 17; + kCopper = 18; + kSilver = 19; + kGold = 20; + } + + enum ProductFinishEnum : enum8 { + kOther = 0; + kMatte = 1; + kSatin = 2; + kPolished = 3; + kRugged = 4; + kFabric = 5; + } + + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + + struct ProductAppearanceStruct { + ProductFinishEnum finish = 0; + nullable ColorEnum primaryColor = 1; + } + + critical event StartUp = 0 { + int32u softwareVersion = 0; + } + + critical event ShutDown = 1 { + } + + info event Leave = 2 { + fabric_idx fabricIndex = 0; + } + + info event ReachableChanged = 3 { + boolean reachableNewValue = 0; + } + + readonly attribute int16u dataModelRevision = 0; + readonly attribute char_string<32> vendorName = 1; + readonly attribute vendor_id vendorID = 2; + readonly attribute char_string<32> productName = 3; + readonly attribute int16u productID = 4; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; + readonly attribute int16u hardwareVersion = 7; + readonly attribute char_string<64> hardwareVersionString = 8; + readonly attribute int32u softwareVersion = 9; + readonly attribute char_string<64> softwareVersionString = 10; + readonly attribute optional char_string<16> manufacturingDate = 11; + readonly attribute optional char_string<32> partNumber = 12; + readonly attribute optional long_char_string<256> productURL = 13; + readonly attribute optional char_string<64> productLabel = 14; + readonly attribute optional char_string<32> serialNumber = 15; + attribute access(write: manage) optional boolean localConfigDisabled = 16; + readonly attribute optional boolean reachable = 17; + readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute optional ProductAppearanceStruct productAppearance = 20; + readonly attribute int32u specificationVersion = 21; + readonly attribute int16u maxPathsPerInvoke = 22; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + command MfgSpecificPing(): DefaultSuccess = 0; +} + +/** Provides an interface for providing OTA software updates */ +cluster OtaSoftwareUpdateProvider = 41 { + revision 1; // NOTE: Default/not specifically set + + enum ApplyUpdateActionEnum : enum8 { + kProceed = 0; + kAwaitNextAction = 1; + kDiscontinue = 2; + } + + enum DownloadProtocolEnum : enum8 { + kBDXSynchronous = 0; + kBDXAsynchronous = 1; + kHTTPS = 2; + kVendorSpecific = 3; + } + + enum StatusEnum : enum8 { + kUpdateAvailable = 0; + kBusy = 1; + kNotAvailable = 2; + kDownloadProtocolNotSupported = 3; + } + + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct QueryImageRequest { + vendor_id vendorID = 0; + int16u productID = 1; + int32u softwareVersion = 2; + DownloadProtocolEnum protocolsSupported[] = 3; + optional int16u hardwareVersion = 4; + optional char_string<2> location = 5; + optional boolean requestorCanConsent = 6; + optional octet_string<512> metadataForProvider = 7; + } + + response struct QueryImageResponse = 1 { + StatusEnum status = 0; + optional int32u delayedActionTime = 1; + optional char_string<256> imageURI = 2; + optional int32u softwareVersion = 3; + optional char_string<64> softwareVersionString = 4; + optional octet_string<32> updateToken = 5; + optional boolean userConsentNeeded = 6; + optional octet_string<512> metadataForRequestor = 7; + } + + request struct ApplyUpdateRequestRequest { + octet_string<32> updateToken = 0; + int32u newVersion = 1; + } + + response struct ApplyUpdateResponse = 3 { + ApplyUpdateActionEnum action = 0; + int32u delayedActionTime = 1; + } + + request struct NotifyUpdateAppliedRequest { + octet_string<32> updateToken = 0; + int32u softwareVersion = 1; + } + + /** Determine availability of a new Software Image */ + command QueryImage(QueryImageRequest): QueryImageResponse = 0; + /** Determine next action to take for a downloaded Software Image */ + command ApplyUpdateRequest(ApplyUpdateRequestRequest): ApplyUpdateResponse = 2; + /** Notify OTA Provider that an update was applied */ + command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4; +} + +/** Provides an interface for downloading and applying OTA software updates */ +cluster OtaSoftwareUpdateRequestor = 42 { + revision 1; // NOTE: Default/not specifically set + + enum AnnouncementReasonEnum : enum8 { + kSimpleAnnouncement = 0; + kUpdateAvailable = 1; + kUrgentUpdateAvailable = 2; + } + + enum ChangeReasonEnum : enum8 { + kUnknown = 0; + kSuccess = 1; + kFailure = 2; + kTimeOut = 3; + kDelayByProvider = 4; + } + + enum UpdateStateEnum : enum8 { + kUnknown = 0; + kIdle = 1; + kQuerying = 2; + kDelayedOnQuery = 3; + kDownloading = 4; + kApplying = 5; + kDelayedOnApply = 6; + kRollingBack = 7; + kDelayedOnUserConsent = 8; + } + + fabric_scoped struct ProviderLocation { + node_id providerNodeID = 1; + endpoint_no endpoint = 2; + fabric_idx fabricIndex = 254; + } + + info event StateTransition = 0 { + UpdateStateEnum previousState = 0; + UpdateStateEnum newState = 1; + ChangeReasonEnum reason = 2; + nullable int32u targetSoftwareVersion = 3; + } + + critical event VersionApplied = 1 { + int32u softwareVersion = 0; + int16u productID = 1; + } + + info event DownloadError = 2 { + int32u softwareVersion = 0; + int64u bytesDownloaded = 1; + nullable int8u progressPercent = 2; + nullable int64s platformCode = 3; + } + + attribute access(write: administer) ProviderLocation defaultOTAProviders[] = 0; + readonly attribute boolean updatePossible = 1; + readonly attribute UpdateStateEnum updateState = 2; + readonly attribute nullable int8u updateStateProgress = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AnnounceOTAProviderRequest { + node_id providerNodeID = 0; + vendor_id vendorID = 1; + AnnouncementReasonEnum announcementReason = 2; + optional octet_string<512> metadataForNode = 3; + endpoint_no endpoint = 4; + } + + /** Announce the presence of an OTA Provider */ + command AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0; +} + +/** This cluster is used to manage global aspects of the Commissioning flow. */ +cluster GeneralCommissioning = 48 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningErrorEnum : enum8 { + kOK = 0; + kValueOutsideRange = 1; + kInvalidAuthentication = 2; + kNoFailSafe = 3; + kBusyWithOtherAdmin = 4; + } + + enum RegulatoryLocationTypeEnum : enum8 { + kIndoor = 0; + kOutdoor = 1; + kIndoorOutdoor = 2; + } + + struct BasicCommissioningInfo { + int16u failSafeExpiryLengthSeconds = 0; + int16u maxCumulativeFailsafeSeconds = 1; + } + + attribute access(write: administer) int64u breadcrumb = 0; + readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; + readonly attribute RegulatoryLocationTypeEnum regulatoryConfig = 2; + readonly attribute RegulatoryLocationTypeEnum locationCapability = 3; + readonly attribute boolean supportsConcurrentConnection = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ArmFailSafeRequest { + int16u expiryLengthSeconds = 0; + int64u breadcrumb = 1; + } + + response struct ArmFailSafeResponse = 1 { + CommissioningErrorEnum errorCode = 0; + char_string<128> debugText = 1; + } + + request struct SetRegulatoryConfigRequest { + RegulatoryLocationTypeEnum newRegulatoryConfig = 0; + char_string<2> countryCode = 1; + int64u breadcrumb = 2; + } + + response struct SetRegulatoryConfigResponse = 3 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + response struct CommissioningCompleteResponse = 5 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + /** Arm the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock */ + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + /** Set the regulatory configuration to be used during commissioning */ + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + /** Signals the Server that the Client has successfully completed all steps of Commissioning/Recofiguration needed during fail-safe period. */ + fabric command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; +} + +/** Functionality to configure, enable, disable network credentials and access on a Matter device. */ +cluster NetworkCommissioning = 49 { + revision 1; // NOTE: Default/not specifically set + + enum NetworkCommissioningStatusEnum : enum8 { + kSuccess = 0; + kOutOfRange = 1; + kBoundsExceeded = 2; + kNetworkIDNotFound = 3; + kDuplicateNetworkID = 4; + kNetworkNotFound = 5; + kRegulatoryError = 6; + kAuthFailure = 7; + kUnsupportedSecurity = 8; + kOtherConnectionFailure = 9; + kIPV6Failed = 10; + kIPBindFailed = 11; + kUnknownError = 12; + } + + enum WiFiBandEnum : enum8 { + k2G4 = 0; + k3G65 = 1; + k5G = 2; + k6G = 3; + k60G = 4; + k1G = 5; + } + + bitmap Feature : bitmap32 { + kWiFiNetworkInterface = 0x1; + kThreadNetworkInterface = 0x2; + kEthernetNetworkInterface = 0x4; + kPerDeviceCredentials = 0x8; + } + + bitmap ThreadCapabilitiesBitmap : bitmap16 { + kIsBorderRouterCapable = 0x1; + kIsRouterCapable = 0x2; + kIsSleepyEndDeviceCapable = 0x4; + kIsFullThreadDevice = 0x8; + kIsSynchronizedSleepyEndDeviceCapable = 0x10; + } + + bitmap WiFiSecurityBitmap : bitmap8 { + kUnencrypted = 0x1; + kWEP = 0x2; + kWPAPersonal = 0x4; + kWPA2Personal = 0x8; + kWPA3Personal = 0x10; + kWPA3MatterPDC = 0x20; + } + + struct NetworkInfoStruct { + octet_string<32> networkID = 0; + boolean connected = 1; + optional nullable octet_string<20> networkIdentifier = 2; + optional nullable octet_string<20> clientIdentifier = 3; + } + + struct ThreadInterfaceScanResultStruct { + int16u panId = 0; + int64u extendedPanId = 1; + char_string<16> networkName = 2; + int16u channel = 3; + int8u version = 4; + octet_string<8> extendedAddress = 5; + int8s rssi = 6; + int8u lqi = 7; + } + + struct WiFiInterfaceScanResultStruct { + WiFiSecurityBitmap security = 0; + octet_string<32> ssid = 1; + octet_string<6> bssid = 2; + int16u channel = 3; + WiFiBandEnum wiFiBand = 4; + int8s rssi = 5; + } + + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfoStruct networks[] = 1; + readonly attribute optional int8u scanMaxTimeSeconds = 2; + readonly attribute optional int8u connectMaxTimeSeconds = 3; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatusEnum lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute optional WiFiBandEnum supportedWiFiBands[] = 8; + readonly attribute optional ThreadCapabilitiesBitmap supportedThreadFeatures = 9; + readonly attribute optional int16u threadVersion = 10; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ScanNetworksRequest { + optional nullable octet_string<32> ssid = 0; + optional int64u breadcrumb = 1; + } + + response struct ScanNetworksResponse = 1 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + optional WiFiInterfaceScanResultStruct wiFiScanResults[] = 2; + optional ThreadInterfaceScanResultStruct threadScanResults[] = 3; + } + + request struct AddOrUpdateWiFiNetworkRequest { + octet_string<32> ssid = 0; + octet_string<64> credentials = 1; + optional int64u breadcrumb = 2; + optional octet_string<140> networkIdentity = 3; + optional octet_string<20> clientIdentifier = 4; + optional octet_string<32> possessionNonce = 5; + } + + request struct AddOrUpdateThreadNetworkRequest { + octet_string<254> operationalDataset = 0; + optional int64u breadcrumb = 1; + } + + request struct RemoveNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct NetworkConfigResponse = 5 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string<512> debugText = 1; + optional int8u networkIndex = 2; + optional octet_string<140> clientIdentity = 3; + optional octet_string<64> possessionSignature = 4; + } + + request struct ConnectNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct ConnectNetworkResponse = 7 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + nullable int32s errorValue = 2; + } + + request struct ReorderNetworkRequest { + octet_string<32> networkID = 0; + int8u networkIndex = 1; + optional int64u breadcrumb = 2; + } + + request struct QueryIdentityRequest { + octet_string<20> keyIdentifier = 0; + optional octet_string<32> possessionNonce = 1; + } + + response struct QueryIdentityResponse = 10 { + octet_string<140> identity = 0; + optional octet_string<64> possessionSignature = 1; + } + + /** Detemine the set of networks the device sees as available. */ + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + /** Add or update the credentials for a given Wi-Fi network. */ + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + /** Add or update the credentials for a given Thread network. */ + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + /** Remove the definition of a given network (including its credentials). */ + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + /** Connect to the specified network, using previously-defined credentials. */ + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + /** Modify the order in which networks will be presented in the Networks attribute. */ + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + /** Retrieve details about and optionally proof of possession of a network client identity. */ + command access(invoke: administer) QueryIdentity(QueryIdentityRequest): QueryIdentityResponse = 9; +} + +/** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster GeneralDiagnostics = 51 { + revision 2; + + enum BootReasonEnum : enum8 { + kUnspecified = 0; + kPowerOnReboot = 1; + kBrownOutReset = 2; + kSoftwareWatchdogReset = 3; + kHardwareWatchdogReset = 4; + kSoftwareUpdateCompleted = 5; + kSoftwareReset = 6; + } + + enum HardwareFaultEnum : enum8 { + kUnspecified = 0; + kRadio = 1; + kSensor = 2; + kResettableOverTemp = 3; + kNonResettableOverTemp = 4; + kPowerSource = 5; + kVisualDisplayFault = 6; + kAudioOutputFault = 7; + kUserInterfaceFault = 8; + kNonVolatileMemoryError = 9; + kTamperDetected = 10; + } + + enum InterfaceTypeEnum : enum8 { + kUnspecified = 0; + kWiFi = 1; + kEthernet = 2; + kCellular = 3; + kThread = 4; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kHardwareFailure = 1; + kNetworkJammed = 2; + kConnectionFailed = 3; + } + + enum RadioFaultEnum : enum8 { + kUnspecified = 0; + kWiFiFault = 1; + kCellularFault = 2; + kThreadFault = 3; + kNFCFault = 4; + kBLEFault = 5; + kEthernetFault = 6; + } + + bitmap Feature : bitmap32 { + kDataModelTest = 0x1; + } + + struct NetworkInterface { + char_string<32> name = 0; + boolean isOperational = 1; + nullable boolean offPremiseServicesReachableIPv4 = 2; + nullable boolean offPremiseServicesReachableIPv6 = 3; + octet_string<8> hardwareAddress = 4; + octet_string IPv4Addresses[] = 5; + octet_string IPv6Addresses[] = 6; + InterfaceTypeEnum type = 7; + } + + critical event HardwareFaultChange = 0 { + HardwareFaultEnum current[] = 0; + HardwareFaultEnum previous[] = 1; + } + + critical event RadioFaultChange = 1 { + RadioFaultEnum current[] = 0; + RadioFaultEnum previous[] = 1; + } + + critical event NetworkFaultChange = 2 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + critical event BootReason = 3 { + BootReasonEnum bootReason = 0; + } + + readonly attribute NetworkInterface networkInterfaces[] = 0; + readonly attribute int16u rebootCount = 1; + readonly attribute optional int64u upTime = 2; + readonly attribute optional int32u totalOperationalHours = 3; + readonly attribute optional BootReasonEnum bootReason = 4; + readonly attribute optional HardwareFaultEnum activeHardwareFaults[] = 5; + readonly attribute optional RadioFaultEnum activeRadioFaults[] = 6; + readonly attribute optional NetworkFaultEnum activeNetworkFaults[] = 7; + readonly attribute boolean testEventTriggersEnabled = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct TestEventTriggerRequest { + octet_string<16> enableKey = 0; + int64u eventTrigger = 1; + } + + response struct TimeSnapshotResponse = 2 { + systime_ms systemTimeMs = 0; + nullable posix_ms posixTimeMs = 1; + } + + request struct PayloadTestRequestRequest { + octet_string<16> enableKey = 0; + int8u value = 1; + int16u count = 2; + } + + response struct PayloadTestResponse = 4 { + octet_string payload = 0; + } + + /** Provide a means for certification tests to trigger some test-plan-specific events */ + command access(invoke: manage) TestEventTrigger(TestEventTriggerRequest): DefaultSuccess = 0; + /** Take a snapshot of system time and epoch time. */ + command TimeSnapshot(): TimeSnapshotResponse = 1; + /** Request a variable length payload response. */ + command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; +} + +/** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster SoftwareDiagnostics = 52 { + revision 1; // NOTE: Default/not specifically set + + bitmap Feature : bitmap32 { + kWatermarks = 0x1; + } + + struct ThreadMetricsStruct { + int64u id = 0; + optional char_string<8> name = 1; + optional int32u stackFreeCurrent = 2; + optional int32u stackFreeMinimum = 3; + optional int32u stackSize = 4; + } + + info event SoftwareFault = 0 { + int64u id = 0; + optional char_string name = 1; + optional octet_string faultRecording = 2; + } + + readonly attribute optional ThreadMetricsStruct threadMetrics[] = 0; + readonly attribute optional int64u currentHeapFree = 1; + readonly attribute optional int64u currentHeapUsed = 2; + readonly attribute optional int64u currentHeapHighWatermark = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the values: The StackFreeMinimum field of the ThreadMetrics attribute, CurrentHeapHighWaterMark attribute. */ + command access(invoke: manage) ResetWatermarks(): DefaultSuccess = 0; +} + +/** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ +cluster ThreadNetworkDiagnostics = 53 { + revision 1; // NOTE: Default/not specifically set + + enum ConnectionStatusEnum : enum8 { + kConnected = 0; + kNotConnected = 1; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kLinkDown = 1; + kHardwareFailure = 2; + kNetworkJammed = 3; + } + + enum RoutingRoleEnum : enum8 { + kUnspecified = 0; + kUnassigned = 1; + kSleepyEndDevice = 2; + kEndDevice = 3; + kREED = 4; + kRouter = 5; + kLeader = 6; + } + + bitmap Feature : bitmap32 { + kPacketCounts = 0x1; + kErrorCounts = 0x2; + kMLECounts = 0x4; + kMACCounts = 0x8; + } + + struct NeighborTableStruct { + int64u extAddress = 0; + int32u age = 1; + int16u rloc16 = 2; + int32u linkFrameCounter = 3; + int32u mleFrameCounter = 4; + int8u lqi = 5; + nullable int8s averageRssi = 6; + nullable int8s lastRssi = 7; + int8u frameErrorRate = 8; + int8u messageErrorRate = 9; + boolean rxOnWhenIdle = 10; + boolean fullThreadDevice = 11; + boolean fullNetworkData = 12; + boolean isChild = 13; + } + + struct OperationalDatasetComponents { + boolean activeTimestampPresent = 0; + boolean pendingTimestampPresent = 1; + boolean masterKeyPresent = 2; + boolean networkNamePresent = 3; + boolean extendedPanIdPresent = 4; + boolean meshLocalPrefixPresent = 5; + boolean delayPresent = 6; + boolean panIdPresent = 7; + boolean channelPresent = 8; + boolean pskcPresent = 9; + boolean securityPolicyPresent = 10; + boolean channelMaskPresent = 11; + } + + struct RouteTableStruct { + int64u extAddress = 0; + int16u rloc16 = 1; + int8u routerId = 2; + int8u nextHop = 3; + int8u pathCost = 4; + int8u LQIIn = 5; + int8u LQIOut = 6; + int8u age = 7; + boolean allocated = 8; + boolean linkEstablished = 9; + } + + struct SecurityPolicy { + int16u rotationTime = 0; + int16u flags = 1; + } + + info event ConnectionStatus = 0 { + ConnectionStatusEnum connectionStatus = 0; + } + + info event NetworkFaultChange = 1 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + readonly attribute nullable int16u channel = 0; + readonly attribute nullable RoutingRoleEnum routingRole = 1; + readonly attribute nullable char_string<16> networkName = 2; + readonly attribute nullable int16u panId = 3; + readonly attribute nullable int64u extendedPanId = 4; + readonly attribute nullable octet_string<17> meshLocalPrefix = 5; + readonly attribute optional int64u overrunCount = 6; + readonly attribute NeighborTableStruct neighborTable[] = 7; + readonly attribute RouteTableStruct routeTable[] = 8; + readonly attribute nullable int32u partitionId = 9; + readonly attribute nullable int16u weighting = 10; + readonly attribute nullable int16u dataVersion = 11; + readonly attribute nullable int16u stableDataVersion = 12; + readonly attribute nullable int8u leaderRouterId = 13; + readonly attribute optional int16u detachedRoleCount = 14; + readonly attribute optional int16u childRoleCount = 15; + readonly attribute optional int16u routerRoleCount = 16; + readonly attribute optional int16u leaderRoleCount = 17; + readonly attribute optional int16u attachAttemptCount = 18; + readonly attribute optional int16u partitionIdChangeCount = 19; + readonly attribute optional int16u betterPartitionAttachAttemptCount = 20; + readonly attribute optional int16u parentChangeCount = 21; + readonly attribute optional int32u txTotalCount = 22; + readonly attribute optional int32u txUnicastCount = 23; + readonly attribute optional int32u txBroadcastCount = 24; + readonly attribute optional int32u txAckRequestedCount = 25; + readonly attribute optional int32u txAckedCount = 26; + readonly attribute optional int32u txNoAckRequestedCount = 27; + readonly attribute optional int32u txDataCount = 28; + readonly attribute optional int32u txDataPollCount = 29; + readonly attribute optional int32u txBeaconCount = 30; + readonly attribute optional int32u txBeaconRequestCount = 31; + readonly attribute optional int32u txOtherCount = 32; + readonly attribute optional int32u txRetryCount = 33; + readonly attribute optional int32u txDirectMaxRetryExpiryCount = 34; + readonly attribute optional int32u txIndirectMaxRetryExpiryCount = 35; + readonly attribute optional int32u txErrCcaCount = 36; + readonly attribute optional int32u txErrAbortCount = 37; + readonly attribute optional int32u txErrBusyChannelCount = 38; + readonly attribute optional int32u rxTotalCount = 39; + readonly attribute optional int32u rxUnicastCount = 40; + readonly attribute optional int32u rxBroadcastCount = 41; + readonly attribute optional int32u rxDataCount = 42; + readonly attribute optional int32u rxDataPollCount = 43; + readonly attribute optional int32u rxBeaconCount = 44; + readonly attribute optional int32u rxBeaconRequestCount = 45; + readonly attribute optional int32u rxOtherCount = 46; + readonly attribute optional int32u rxAddressFilteredCount = 47; + readonly attribute optional int32u rxDestAddrFilteredCount = 48; + readonly attribute optional int32u rxDuplicatedCount = 49; + readonly attribute optional int32u rxErrNoFrameCount = 50; + readonly attribute optional int32u rxErrUnknownNeighborCount = 51; + readonly attribute optional int32u rxErrInvalidSrcAddrCount = 52; + readonly attribute optional int32u rxErrSecCount = 53; + readonly attribute optional int32u rxErrFcsCount = 54; + readonly attribute optional int32u rxErrOtherCount = 55; + readonly attribute optional nullable int64u activeTimestamp = 56; + readonly attribute optional nullable int64u pendingTimestamp = 57; + readonly attribute optional nullable int32u delay = 58; + readonly attribute nullable SecurityPolicy securityPolicy = 59; + readonly attribute nullable octet_string<4> channelPage0Mask = 60; + readonly attribute nullable OperationalDatasetComponents operationalDatasetComponents = 61; + readonly attribute NetworkFaultEnum activeNetworkFaultsList[] = 62; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the OverrunCount attributes to 0 */ + command access(invoke: manage) ResetCounts(): DefaultSuccess = 0; +} + +/** Commands to trigger a Node to allow a new Administrator to commission it. */ +cluster AdministratorCommissioning = 60 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningWindowStatusEnum : enum8 { + kWindowNotOpen = 0; + kEnhancedWindowOpen = 1; + kBasicWindowOpen = 2; + } + + enum StatusCode : enum8 { + kBusy = 2; + kPAKEParameterError = 3; + kWindowNotOpen = 4; + } + + bitmap Feature : bitmap32 { + kBasic = 0x1; + } + + readonly attribute CommissioningWindowStatusEnum windowStatus = 0; + readonly attribute nullable fabric_idx adminFabricIndex = 1; + readonly attribute nullable vendor_id adminVendorId = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OpenCommissioningWindowRequest { + int16u commissioningTimeout = 0; + octet_string PAKEPasscodeVerifier = 1; + int16u discriminator = 2; + int32u iterations = 3; + octet_string<32> salt = 4; + } + + request struct OpenBasicCommissioningWindowRequest { + int16u commissioningTimeout = 0; + } + + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using enhanced commissioning method. */ + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using basic commissioning method, if the node supports it. */ + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + /** This command is used by a current Administrator to instruct a Node to revoke any active Open Commissioning Window or Open Basic Commissioning Window command. */ + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; +} + +/** This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the associated Fabrics. */ +cluster OperationalCredentials = 62 { + revision 1; // NOTE: Default/not specifically set + + enum CertificateChainTypeEnum : enum8 { + kDACCertificate = 1; + kPAICertificate = 2; + } + + enum NodeOperationalCertStatusEnum : enum8 { + kOK = 0; + kInvalidPublicKey = 1; + kInvalidNodeOpId = 2; + kInvalidNOC = 3; + kMissingCsr = 4; + kTableFull = 5; + kInvalidAdminSubject = 6; + kFabricConflict = 9; + kLabelConflict = 10; + kInvalidFabricIndex = 11; + } + + fabric_scoped struct FabricDescriptorStruct { + octet_string<65> rootPublicKey = 1; + vendor_id vendorID = 2; + fabric_id fabricID = 3; + node_id nodeID = 4; + char_string<32> label = 5; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct NOCStruct { + fabric_sensitive octet_string noc = 1; + nullable fabric_sensitive octet_string icac = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; + readonly attribute FabricDescriptorStruct fabrics[] = 1; + readonly attribute int8u supportedFabrics = 2; + readonly attribute int8u commissionedFabrics = 3; + readonly attribute octet_string trustedRootCertificates[] = 4; + readonly attribute int8u currentFabricIndex = 5; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AttestationRequestRequest { + octet_string<32> attestationNonce = 0; + } + + response struct AttestationResponse = 1 { + octet_string<900> attestationElements = 0; + octet_string<64> attestationSignature = 1; + } + + request struct CertificateChainRequestRequest { + CertificateChainTypeEnum certificateType = 0; + } + + response struct CertificateChainResponse = 3 { + octet_string<600> certificate = 0; + } + + request struct CSRRequestRequest { + octet_string<32> CSRNonce = 0; + optional boolean isForUpdateNOC = 1; + } + + response struct CSRResponse = 5 { + octet_string NOCSRElements = 0; + octet_string attestationSignature = 1; + } + + request struct AddNOCRequest { + octet_string<400> NOCValue = 0; + optional octet_string<400> ICACValue = 1; + octet_string<16> IPKValue = 2; + int64u caseAdminSubject = 3; + vendor_id adminVendorId = 4; + } + + request struct UpdateNOCRequest { + octet_string NOCValue = 0; + optional octet_string ICACValue = 1; + } + + response struct NOCResponse = 8 { + NodeOperationalCertStatusEnum statusCode = 0; + optional fabric_idx fabricIndex = 1; + optional char_string<128> debugText = 2; + } + + request struct UpdateFabricLabelRequest { + char_string<32> label = 0; + } + + request struct RemoveFabricRequest { + fabric_idx fabricIndex = 0; + } + + request struct AddTrustedRootCertificateRequest { + octet_string rootCACertificate = 0; + } + + /** Sender is requesting attestation information from the receiver. */ + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + /** Sender is requesting a device attestation certificate from the receiver. */ + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + /** Sender is requesting a certificate signing request (CSR) from the receiver. */ + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + /** Sender is requesting to add the new node operational certificates. */ + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + /** Sender is requesting to update the node operational certificates. */ + fabric command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + /** This command SHALL be used by an Administrative Node to set the user-visible Label field for a given Fabric, as reflected by entries in the Fabrics attribute. */ + fabric command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + /** This command is used by Administrative Nodes to remove a given fabric index and delete all associated fabric-scoped data. */ + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + /** This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation. */ + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; +} + +/** The Group Key Management Cluster is the mechanism by which group keys are managed. */ +cluster GroupKeyManagement = 63 { + revision 1; // NOTE: Default/not specifically set + + enum GroupKeySecurityPolicyEnum : enum8 { + kTrustFirst = 0; + kCacheAndSync = 1; + } + + bitmap Feature : bitmap32 { + kCacheAndSync = 0x1; + } + + fabric_scoped struct GroupInfoMapStruct { + group_id groupId = 1; + endpoint_no endpoints[] = 2; + optional char_string<16> groupName = 3; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct GroupKeyMapStruct { + group_id groupId = 1; + int16u groupKeySetID = 2; + fabric_idx fabricIndex = 254; + } + + struct GroupKeySetStruct { + int16u groupKeySetID = 0; + GroupKeySecurityPolicyEnum groupKeySecurityPolicy = 1; + nullable octet_string<16> epochKey0 = 2; + nullable epoch_us epochStartTime0 = 3; + nullable octet_string<16> epochKey1 = 4; + nullable epoch_us epochStartTime1 = 5; + nullable octet_string<16> epochKey2 = 6; + nullable epoch_us epochStartTime2 = 7; + } + + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; + readonly attribute GroupInfoMapStruct groupTable[] = 1; + readonly attribute int16u maxGroupsPerFabric = 2; + readonly attribute int16u maxGroupKeysPerFabric = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct KeySetWriteRequest { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetReadRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadResponse = 2 { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetRemoveRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadAllIndicesResponse = 5 { + int16u groupKeySetIDs[] = 0; + } + + /** Write a new set of keys for the given key set id. */ + fabric command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + /** Read the keys for a given key set id. */ + fabric command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + /** Revoke a Root Key from a Group */ + fabric command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + /** Return the list of Group Key Sets associated with the accessing fabric */ + fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; +} + +/** This cluster provides an interface to a boolean state called StateValue. */ +cluster BooleanState = 69 { + revision 1; + + info event StateChange = 0 { + boolean stateValue = 0; + } + + readonly attribute boolean stateValue = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** Allows servers to ensure that listed clients are notified when a server is available for communication. */ +cluster IcdManagement = 70 { + revision 2; + + enum OperatingModeEnum : enum8 { + kSIT = 0; + kLIT = 1; + } + + bitmap Feature : bitmap32 { + kCheckInProtocolSupport = 0x1; + kUserActiveModeTrigger = 0x2; + kLongIdleTimeSupport = 0x4; + } + + bitmap UserActiveModeTriggerBitmap : bitmap32 { + kPowerCycle = 0x1; + kSettingsMenu = 0x2; + kCustomInstruction = 0x4; + kDeviceManual = 0x8; + kActuateSensor = 0x10; + kActuateSensorSeconds = 0x20; + kActuateSensorTimes = 0x40; + kActuateSensorLightsBlink = 0x80; + kResetButton = 0x100; + kResetButtonLightsBlink = 0x200; + kResetButtonSeconds = 0x400; + kResetButtonTimes = 0x800; + kSetupButton = 0x1000; + kSetupButtonSeconds = 0x2000; + kSetupButtonLightsBlink = 0x4000; + kSetupButtonTimes = 0x8000; + kAppDefinedButton = 0x10000; + } + + fabric_scoped struct MonitoringRegistrationStruct { + fabric_sensitive node_id checkInNodeID = 1; + fabric_sensitive int64u monitoredSubject = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeDuration = 0; + readonly attribute int32u activeModeDuration = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute access(read: administer) optional MonitoringRegistrationStruct registeredClients[] = 3; + readonly attribute access(read: administer) optional int32u ICDCounter = 4; + readonly attribute optional int16u clientsSupportedPerFabric = 5; + readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6; + readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7; + readonly attribute optional OperatingModeEnum operatingMode = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RegisterClientRequest { + node_id checkInNodeID = 0; + int64u monitoredSubject = 1; + octet_string<16> key = 2; + optional octet_string<16> verificationKey = 3; + } + + response struct RegisterClientResponse = 1 { + int32u ICDCounter = 0; + } + + request struct UnregisterClientRequest { + node_id checkInNodeID = 0; + optional octet_string<16> verificationKey = 1; + } + + response struct StayActiveResponse = 4 { + int32u promisedActiveDuration = 0; + } + + /** Register a client to the end device */ + fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0; + /** Unregister a client from an end device */ + fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2; + /** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */ + command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3; +} + +endpoint 0 { + device type ma_rootdevice = 22, version 2; + + binding cluster OtaSoftwareUpdateProvider; + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster AccessControl { + emits event AccessControlEntryChanged; + emits event AccessControlExtensionChanged; + callback attribute acl; + callback attribute subjectsPerAccessControlEntry; + callback attribute targetsPerAccessControlEntry; + callback attribute accessControlEntriesPerFabric; + callback attribute attributeList; + ram attribute featureMap default = 0; + callback attribute clusterRevision; + } + + server cluster BasicInformation { + emits event StartUp; + emits event ShutDown; + emits event Leave; + callback attribute dataModelRevision; + callback attribute vendorName; + callback attribute vendorID; + callback attribute productName; + callback attribute productID; + persist attribute nodeLabel; + callback attribute location; + callback attribute hardwareVersion; + callback attribute hardwareVersionString; + callback attribute softwareVersion; + callback attribute softwareVersionString; + callback attribute capabilityMinima; + callback attribute specificationVersion; + callback attribute maxPathsPerInvoke; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + } + + server cluster OtaSoftwareUpdateRequestor { + emits event StateTransition; + emits event VersionApplied; + emits event DownloadError; + callback attribute defaultOTAProviders; + ram attribute updatePossible default = 1; + ram attribute updateState default = 0; + ram attribute updateStateProgress default = 0; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AnnounceOTAProvider; + } + + server cluster GeneralCommissioning { + ram attribute breadcrumb default = 0x0000000000000000; + callback attribute basicCommissioningInfo; + callback attribute regulatoryConfig; + callback attribute locationCapability; + callback attribute supportsConcurrentConnection; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command ArmFailSafe; + handle command ArmFailSafeResponse; + handle command SetRegulatoryConfig; + handle command SetRegulatoryConfigResponse; + handle command CommissioningComplete; + handle command CommissioningCompleteResponse; + } + + server cluster NetworkCommissioning { + ram attribute maxNetworks; + callback attribute networks; + ram attribute scanMaxTimeSeconds; + ram attribute connectMaxTimeSeconds; + ram attribute interfaceEnabled; + ram attribute lastNetworkingStatus; + ram attribute lastNetworkID; + ram attribute lastConnectErrorValue; + ram attribute featureMap default = 2; + ram attribute clusterRevision default = 1; + + handle command ScanNetworks; + handle command ScanNetworksResponse; + handle command AddOrUpdateThreadNetwork; + handle command RemoveNetwork; + handle command NetworkConfigResponse; + handle command ConnectNetwork; + handle command ConnectNetworkResponse; + handle command ReorderNetwork; + } + + server cluster GeneralDiagnostics { + emits event BootReason; + callback attribute networkInterfaces; + callback attribute rebootCount; + callback attribute activeNetworkFaults; + callback attribute testEventTriggersEnabled default = false; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command TestEventTrigger; + } + + server cluster SoftwareDiagnostics { + callback attribute threadMetrics; + callback attribute currentHeapFree; + callback attribute currentHeapUsed; + callback attribute currentHeapHighWatermark; + callback attribute featureMap; + ram attribute clusterRevision default = 1; + + handle command ResetWatermarks; + } + + server cluster ThreadNetworkDiagnostics { + callback attribute channel; + callback attribute routingRole; + callback attribute networkName; + callback attribute panId; + callback attribute extendedPanId; + callback attribute meshLocalPrefix; + callback attribute overrunCount; + callback attribute neighborTable; + callback attribute routeTable; + callback attribute partitionId; + callback attribute weighting; + callback attribute dataVersion; + callback attribute stableDataVersion; + callback attribute leaderRouterId; + callback attribute detachedRoleCount; + callback attribute childRoleCount; + callback attribute routerRoleCount; + callback attribute leaderRoleCount; + callback attribute attachAttemptCount; + callback attribute partitionIdChangeCount; + callback attribute betterPartitionAttachAttemptCount; + callback attribute parentChangeCount; + callback attribute txTotalCount; + callback attribute txUnicastCount; + callback attribute txBroadcastCount; + callback attribute txAckRequestedCount; + callback attribute txAckedCount; + callback attribute txNoAckRequestedCount; + callback attribute txDataCount; + callback attribute txDataPollCount; + callback attribute txBeaconCount; + callback attribute txBeaconRequestCount; + callback attribute txOtherCount; + callback attribute txRetryCount; + callback attribute txDirectMaxRetryExpiryCount; + callback attribute txIndirectMaxRetryExpiryCount; + callback attribute txErrCcaCount; + callback attribute txErrAbortCount; + callback attribute txErrBusyChannelCount; + callback attribute rxTotalCount; + callback attribute rxUnicastCount; + callback attribute rxBroadcastCount; + callback attribute rxDataCount; + callback attribute rxDataPollCount; + callback attribute rxBeaconCount; + callback attribute rxBeaconRequestCount; + callback attribute rxOtherCount; + callback attribute rxAddressFilteredCount; + callback attribute rxDestAddrFilteredCount; + callback attribute rxDuplicatedCount; + callback attribute rxErrNoFrameCount; + callback attribute rxErrUnknownNeighborCount; + callback attribute rxErrInvalidSrcAddrCount; + callback attribute rxErrSecCount; + callback attribute rxErrFcsCount; + callback attribute rxErrOtherCount; + callback attribute securityPolicy; + callback attribute channelPage0Mask; + callback attribute operationalDatasetComponents; + callback attribute activeNetworkFaultsList; + ram attribute featureMap default = 0x000F; + ram attribute clusterRevision default = 1; + + handle command ResetCounts; + } + + server cluster AdministratorCommissioning { + callback attribute windowStatus; + callback attribute adminFabricIndex; + callback attribute adminVendorId; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command OpenCommissioningWindow; + handle command RevokeCommissioning; + } + + server cluster OperationalCredentials { + callback attribute NOCs; + callback attribute fabrics; + callback attribute supportedFabrics; + callback attribute commissionedFabrics; + callback attribute trustedRootCertificates; + callback attribute currentFabricIndex; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AttestationRequest; + handle command AttestationResponse; + handle command CertificateChainRequest; + handle command CertificateChainResponse; + handle command CSRRequest; + handle command CSRResponse; + handle command AddNOC; + handle command UpdateNOC; + handle command NOCResponse; + handle command UpdateFabricLabel; + handle command RemoveFabric; + handle command AddTrustedRootCertificate; + } + + server cluster GroupKeyManagement { + callback attribute groupKeyMap; + callback attribute groupTable; + callback attribute maxGroupsPerFabric; + callback attribute maxGroupKeysPerFabric; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command KeySetWrite; + handle command KeySetRead; + handle command KeySetReadResponse; + handle command KeySetRemove; + handle command KeySetReadAllIndices; + handle command KeySetReadAllIndicesResponse; + } + + server cluster IcdManagement { + callback attribute idleModeDuration; + callback attribute activeModeDuration; + callback attribute activeModeThreshold; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x0000; + ram attribute clusterRevision default = 1; + } +} +endpoint 1 { + device type ma_contactsensor = 21, version 1; + + + server cluster Identify { + ram attribute identifyTime default = 0x0000; + ram attribute identifyType default = 0x0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 4; + + handle command Identify; + handle command TriggerEffect; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster BooleanState { + emits event StateChange; + ram attribute stateValue default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } +} + + diff --git a/examples/contact-sensor-app/nxp/zap/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap/contact-sensor-app.zap new file mode 100644 index 00000000000000..bf037957bd2629 --- /dev/null +++ b/examples/contact-sensor-app/nxp/zap/contact-sensor-app.zap @@ -0,0 +1,3576 @@ +{ + "fileFormat": 2, + "featureLevel": 99, + "creator": "zap", + "keyValuePairs": [ + { + "key": "commandDiscovery", + "value": "1" + }, + { + "key": "defaultResponsePolicy", + "value": "always" + }, + { + "key": "manufacturerCodes", + "value": "0x1002" + } + ], + "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", + "category": "matter", + "version": 1, + "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + } + ], + "endpointTypes": [ + { + "id": 1, + "name": "MA-rootdevice", + "deviceTypeRef": { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice" + }, + "deviceTypes": [ + { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice" + } + ], + "deviceVersions": [ + 2 + ], + "deviceIdentifiers": [ + 22 + ], + "deviceTypeName": "MA-rootdevice", + "deviceTypeCode": 22, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Access Control", + "code": 31, + "mfgCode": null, + "define": "ACCESS_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "ACL", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "AccessControlEntryChanged", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "AccessControlExtensionChanged", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Basic Information", + "code": 40, + "mfgCode": null, + "define": "BASIC_INFORMATION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DataModelRevision", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NodeLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "CapabilityMinimaStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SpecificationVersion", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxPathsPerInvoke", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StartUp", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "ShutDown", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Leave", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "OTA Software Update Provider", + "code": 41, + "mfgCode": null, + "define": "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "QueryImage", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "QueryImageResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ApplyUpdateRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ApplyUpdateResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NotifyUpdateApplied", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "OTA Software Update Requestor", + "code": 42, + "mfgCode": null, + "define": "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AnnounceOTAProvider", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "DefaultOTAProviders", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UpdatePossible", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "UpdateStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateStateProgress", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StateTransition", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "VersionApplied", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "DownloadError", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ArmFailSafe", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ArmFailSafeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfig", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfigResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CommissioningComplete", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommissioningCompleteResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Breadcrumb", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BasicCommissioningInfo", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "BasicCommissioningInfo", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RegulatoryConfig", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LocationCapability", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportsConcurrentConnection", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddOrUpdateThreadNetwork", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NetworkConfigResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ConnectNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ConnectNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ReorderNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "MaxNetworks", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Networks", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ScanMaxTimeSeconds", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ConnectMaxTimeSeconds", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "InterfaceEnabled", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkingStatus", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "NetworkCommissioningStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkID", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastConnectErrorValue", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "TestEventTrigger", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NetworkInterfaces", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RebootCount", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaults", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TestEventTriggersEnabled", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "BootReason", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Software Diagnostics", + "code": 52, + "mfgCode": null, + "define": "SOFTWARE_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetWatermarks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "ThreadMetrics", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapFree", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapUsed", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapHighWatermark", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thread Network Diagnostics", + "code": 53, + "mfgCode": null, + "define": "THREAD_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Channel", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RoutingRole", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "RoutingRoleEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NetworkName", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PanId", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ExtendedPanId", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "MeshLocalPrefix", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NeighborTable", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouteTable", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionId", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Weighting", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DataVersion", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "StableDataVersion", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRouterId", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DetachedRoleCount", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChildRoleCount", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouterRoleCount", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRoleCount", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "AttachAttemptCount", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionIdChangeCount", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BetterPartitionAttachAttemptCount", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ParentChangeCount", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxTotalCount", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxUnicastCount", + "code": 23, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBroadcastCount", + "code": 24, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckRequestedCount", + "code": 25, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckedCount", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxNoAckRequestedCount", + "code": 27, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataCount", + "code": 28, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataPollCount", + "code": 29, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconCount", + "code": 30, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconRequestCount", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxOtherCount", + "code": 32, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxRetryCount", + "code": 33, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDirectMaxRetryExpiryCount", + "code": 34, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxIndirectMaxRetryExpiryCount", + "code": 35, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrCcaCount", + "code": 36, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrAbortCount", + "code": 37, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrBusyChannelCount", + "code": 38, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxTotalCount", + "code": 39, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxUnicastCount", + "code": 40, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBroadcastCount", + "code": 41, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataCount", + "code": 42, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataPollCount", + "code": 43, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconCount", + "code": 44, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconRequestCount", + "code": 45, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxOtherCount", + "code": 46, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxAddressFilteredCount", + "code": 47, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDestAddrFilteredCount", + "code": 48, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDuplicatedCount", + "code": 49, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrNoFrameCount", + "code": 50, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrUnknownNeighborCount", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrInvalidSrcAddrCount", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrSecCount", + "code": 53, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrFcsCount", + "code": 54, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrOtherCount", + "code": 55, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SecurityPolicy", + "code": 59, + "mfgCode": null, + "side": "server", + "type": "SecurityPolicy", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChannelPage0Mask", + "code": 60, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OperationalDatasetComponents", + "code": 61, + "mfgCode": null, + "side": "server", + "type": "OperationalDatasetComponents", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaultsList", + "code": 62, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x000F", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Administrator Commissioning", + "code": 60, + "mfgCode": null, + "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "OpenCommissioningWindow", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RevokeCommissioning", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "WindowStatus", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "CommissioningWindowStatusEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminFabricIndex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "fabric_idx", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminVendorId", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AttestationRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AttestationResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CertificateChainRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CertificateChainResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CSRRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CSRResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddNOC", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "UpdateNOC", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NOCResponse", + "code": 8, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "UpdateFabricLabel", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveFabric", + "code": 10, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddTrustedRootCertificate", + "code": 11, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NOCs", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Fabrics", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SupportedFabrics", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CommissionedFabrics", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TrustedRootCertificates", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentFabricIndex", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "GroupKeyMap", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GroupTable", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "ICD Management", + "code": 70, + "mfgCode": null, + "define": "ICD_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "IdleModeDuration", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeDuration", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + }, + { + "id": 2, + "name": "MA-dimmablelight", + "deviceTypeRef": { + "code": 21, + "profileId": 259, + "label": "MA-contactsensor", + "name": "MA-contactsensor" + }, + "deviceTypes": [ + { + "code": 21, + "profileId": 259, + "label": "MA-contactsensor", + "name": "MA-contactsensor" + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 21 + ], + "deviceTypeName": "MA-contactsensor", + "deviceTypeCode": 21, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdentifyTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "IdentifyType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "IdentifyTypeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Boolean State", + "code": 69, + "mfgCode": null, + "define": "BOOLEAN_STATE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "StateValue", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StateChange", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + } + ] + } + ], + "endpoints": [ + { + "endpointTypeName": "MA-rootdevice", + "endpointTypeIndex": 0, + "profileId": 259, + "endpointId": 0, + "networkId": 0 + }, + { + "endpointTypeName": "MA-dimmablelight", + "endpointTypeIndex": 1, + "profileId": 259, + "endpointId": 1, + "networkId": 0 + } + ], + "log": [] +} \ No newline at end of file diff --git a/examples/contact-sensor-app/telink/src/AppTask.cpp b/examples/contact-sensor-app/telink/src/AppTask.cpp index ba6a8d8118a897..dbcf9e1ce48405 100644 --- a/examples/contact-sensor-app/telink/src/AppTask.cpp +++ b/examples/contact-sensor-app/telink/src/AppTask.cpp @@ -95,10 +95,10 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg) ChipLogProgress(NotSpecified, "StateValue::Set : %d", newValue); // write the new boolean state value - EmberAfStatus status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating boolean status value %x", status); + ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status)); } } diff --git a/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.h b/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.h index ce48270d28b6ac..27bbdd676d4971 100644 --- a/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.h +++ b/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.h @@ -32,14 +32,23 @@ class DownloadLogCommand : public CHIPCommandBridge "The timeout for getting the log. If the timeout expires, completion will be called with whatever has been " "retrieved by that point (which might be none or a partial log). If the timeout is set to 0, the request will " "not expire and completion will not be called until the log is fully retrieved or an error occurs."); + AddArgument("async", 0, 1, &mIsAsyncCommand, + "By default the command waits for the download to finish before returning. If async is true the command will " + "not wait and the download will proceed in the background"); + AddArgument("filepath", &mFilePath, "An optional filepath to save the download log content to."); } /////////// CHIPCommandBridge Interface ///////// CHIP_ERROR RunCommand() override; - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(10); } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout > 0 ? mTimeout + 10 : 300); + } private: chip::NodeId mNodeId; uint8_t mLogType; uint16_t mTimeout; + chip::Optional mFilePath; + chip::Optional mIsAsyncCommand; }; diff --git a/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.mm b/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.mm index 494ec964f14b63..b105b6cb3098c8 100644 --- a/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.mm +++ b/examples/darwin-framework-tool/commands/bdx/DownloadLogCommand.mm @@ -21,6 +21,7 @@ #import "MTRError_Utils.h" #include "DownloadLogCommand.h" +#include "RemoteDataModelLogger.h" CHIP_ERROR DownloadLogCommand::RunCommand() { @@ -32,27 +33,62 @@ auto logType = static_cast(mLogType); auto queue = dispatch_queue_create("com.chip.bdx.downloader", DISPATCH_QUEUE_SERIAL); + bool shouldWaitForDownload = !mIsAsyncCommand.ValueOr(false); + mIsAsyncCommand.ClearValue(); + + bool dumpToFile = mFilePath.HasValue(); + auto * dumpFilePath = dumpToFile ? [NSString stringWithUTF8String:mFilePath.Value()] : nil; + mFilePath.ClearValue(); + auto * self = this; auto completion = ^(NSURL * url, NSError * error) { // A non-nil url indicates the presence of content, which can occur even in error scenarios like timeouts. + NSString * logContent = nil; if (nil != url) { NSError * readError = nil; auto * data = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:&readError]; - VerifyOrReturn(nil == readError, self->SetCommandExitStatus(MTRErrorToCHIPErrorCode(readError))); + if (nil != readError) { + if (shouldWaitForDownload) { + self->SetCommandExitStatus(MTRErrorToCHIPErrorCode(readError)); + } + return; + } + + logContent = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + NSLog(@"Content: %@", logContent); - auto * content = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - NSLog(@"Content: %@", content); + if (dumpToFile) { + NSError * writeError = nil; + auto * fileManager = [NSFileManager defaultManager]; + [fileManager copyItemAtPath:[url path] toPath:dumpFilePath error:&writeError]; + if (nil != writeError) { + if (shouldWaitForDownload) { + self->SetCommandExitStatus(MTRErrorToCHIPErrorCode(readError)); + } + return; + } + } } - VerifyOrReturn(nil == error, self->SetCommandExitStatus(MTRErrorToCHIPErrorCode(error))); + ChipLogProgress(chipTool, "Diagnostic logs transfer: %s", error ? "Error" : "Success"); + auto err = RemoteDataModelLogger::LogBdxDownload(logContent, error); - // The url is nil when there are no logs on the target device. - if (nil == url) { - NSLog(@"No logs has been found onto node 0x" ChipLogFormatX64, ChipLogValueX64(mNodeId)); + if (CHIP_NO_ERROR != err) { + if (shouldWaitForDownload) { + self->SetCommandExitStatus(err); + } + return; + } + + if (shouldWaitForDownload) { + self->SetCommandExitStatus(MTRErrorToCHIPErrorCode(error)); } - self->SetCommandExitStatus(CHIP_NO_ERROR); }; [device downloadLogOfType:logType timeout:mTimeout queue:queue completion:completion]; + + if (!shouldWaitForDownload) { + SetCommandExitStatus(CHIP_NO_ERROR); + } return CHIP_NO_ERROR; } diff --git a/examples/darwin-framework-tool/commands/common/MTRError.mm b/examples/darwin-framework-tool/commands/common/MTRError.mm index d385983ca2fc94..f7680e822d323d 100644 --- a/examples/darwin-framework-tool/commands/common/MTRError.mm +++ b/examples/darwin-framework-tool/commands/common/MTRError.mm @@ -20,7 +20,6 @@ #import #import -#import #import #import diff --git a/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.h b/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.h index 39605e6fb56390..b2cd92df859deb 100644 --- a/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.h +++ b/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.h @@ -32,5 +32,6 @@ CHIP_ERROR LogCommandAsJSON(NSNumber * endpointId, NSNumber * clusterId, NSNumbe CHIP_ERROR LogAttributeErrorAsJSON(NSNumber * endpointId, NSNumber * clusterId, NSNumber * attributeId, NSError * error); CHIP_ERROR LogCommandErrorAsJSON(NSNumber * endpointId, NSNumber * clusterId, NSNumber * commandId, NSError * error); CHIP_ERROR LogGetCommissionerNodeId(NSNumber * nodeId); +CHIP_ERROR LogBdxDownload(NSString * content, NSError * error); void SetDelegate(RemoteDataModelLoggerDelegate * delegate); }; // namespace RemoteDataModelLogger diff --git a/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.mm b/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.mm index 760fe0bc998ed5..ff12cdc022e515 100644 --- a/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.mm +++ b/examples/darwin-framework-tool/commands/common/RemoteDataModelLogger.mm @@ -35,6 +35,7 @@ constexpr char kClusterErrorIdKey[] = "clusterError"; constexpr char kValueKey[] = "value"; constexpr char kNodeIdKey[] = "nodeId"; +constexpr char kLogContentIdKey[] = "logContent"; constexpr char kBase64Header[] = "base64:"; @@ -204,5 +205,33 @@ CHIP_ERROR LogGetCommissionerNodeId(NSNumber * value) return gDelegate->LogJSON(valueStr.c_str()); } +CHIP_ERROR LogBdxDownload(NSString * content, NSError * error) +{ + VerifyOrReturnError(gDelegate != nullptr, CHIP_NO_ERROR); + + Json::Value rootValue; + rootValue[kValueKey] = Json::Value(); + + Json::Value jsonValue; + VerifyOrDie(CHIP_NO_ERROR == AsJsonValue(content, jsonValue)); + rootValue[kValueKey][kLogContentIdKey] = jsonValue; + + if (error) { + auto err = MTRErrorToCHIPErrorCode(error); + auto status = chip::app::StatusIB(err); + +#if CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT + auto statusName = chip::Protocols::InteractionModel::StatusName(status.mStatus); + rootValue[kValueKey][kErrorIdKey] = statusName; +#else + auto statusName = status.mStatus; + rootValue[kValueKey][kErrorIdKey] = chip::to_underlying(statusName); +#endif // CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT + } + + auto valueStr = JsonToString(rootValue); + return gDelegate->LogJSON(valueStr.c_str()); +} + void SetDelegate(RemoteDataModelLoggerDelegate * delegate) { gDelegate = delegate; } }; // namespace RemoteDataModelLogger diff --git a/examples/dishwasher-app/dishwasher-common/include/operational-state-delegate-impl.h b/examples/dishwasher-app/dishwasher-common/include/operational-state-delegate-impl.h index 9fd023db8194d9..5f017119930e5e 100644 --- a/examples/dishwasher-app/dishwasher-common/include/operational-state-delegate-impl.h +++ b/examples/dishwasher-app/dishwasher-common/include/operational-state-delegate-impl.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.matter b/examples/energy-management-app/energy-management-common/energy-management-app.matter index 1ab71d2cc0769d..c56280b2b72f08 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.matter +++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter @@ -1896,7 +1896,19 @@ endpoint 1 { callback attribute ranges; callback attribute voltage; callback attribute activeCurrent; + callback attribute reactiveCurrent; + callback attribute apparentCurrent; callback attribute activePower; + callback attribute reactivePower; + callback attribute apparentPower; + callback attribute RMSVoltage; + callback attribute RMSCurrent; + callback attribute RMSPower; + callback attribute frequency; + callback attribute harmonicCurrents; + callback attribute harmonicPhases; + callback attribute powerFactor; + callback attribute neutralCurrent; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; @@ -1963,11 +1975,9 @@ endpoint 1 { callback attribute supplyState; callback attribute faultState; callback attribute chargingEnabledUntil; - callback attribute dischargingEnabledUntil; callback attribute circuitCapacity; callback attribute minimumChargeCurrent; callback attribute maximumChargeCurrent; - callback attribute maximumDischargeCurrent; callback attribute userMaximumChargeCurrent; callback attribute randomizationDelayWindow; callback attribute nextChargeStartTime; @@ -1975,13 +1985,9 @@ endpoint 1 { callback attribute nextChargeRequiredEnergy; callback attribute nextChargeTargetSoC; callback attribute approximateEVEfficiency; - callback attribute stateOfCharge; - callback attribute batteryCapacity; - callback attribute vehicleID; callback attribute sessionID; callback attribute sessionDuration; callback attribute sessionEnergyCharged; - callback attribute sessionEnergyDischarged; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index ba1fa29d585485..d795b4fd482448 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -2860,7 +2860,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2898,6 +2898,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "ReactiveCurrent", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ApparentCurrent", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ActivePower", "code": 8, @@ -2914,6 +2946,166 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "ReactivePower", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ApparentPower", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RMSVoltage", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "voltage_mv", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RMSCurrent", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RMSPower", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Frequency", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "int64s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "HarmonicCurrents", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "HarmonicPhases", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PowerFactor", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int64s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NeutralCurrent", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -3701,22 +3893,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "DischargingEnabledUntil", - "code": 4, - "mfgCode": null, - "side": "server", - "type": "epoch_s", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "CircuitCapacity", "code": 5, @@ -3765,22 +3941,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "MaximumDischargeCurrent", - "code": 8, - "mfgCode": null, - "side": "server", - "type": "amperage_ma", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "UserMaximumChargeCurrent", "code": 9, @@ -3893,54 +4053,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "StateOfCharge", - "code": 48, - "mfgCode": null, - "side": "server", - "type": "percent", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "BatteryCapacity", - "code": 49, - "mfgCode": null, - "side": "server", - "type": "energy_mwh", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "VehicleID", - "code": 50, - "mfgCode": null, - "side": "server", - "type": "char_string", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "SessionID", "code": 64, @@ -3989,22 +4101,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "SessionEnergyDischarged", - "code": 67, - "mfgCode": null, - "side": "server", - "type": "energy_mwh", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "GeneratedCommandList", "code": 65528, diff --git a/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp b/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp index fe712d92ae1667..fdda913a868a22 100644 --- a/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp +++ b/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp @@ -246,12 +246,17 @@ CHIP_ERROR ElectricalPowerMeasurementDelegate::EndRangesRead() return CHIP_NO_ERROR; } +static const Structs::HarmonicMeasurementStruct::Type kHarmonicCurrentMeasurements[] = { + { .order = 1, .measurement = MakeNullable(static_cast(100000)) } +}; + /* @brief This function is called by the cluster server at the start of read cycle * This could take a semaphore to stop a background update of the data */ -CHIP_ERROR ElectricalPowerMeasurementDelegate::StartHarmonicCurrentsRead() +CHIP_ERROR +ElectricalPowerMeasurementDelegate::StartHarmonicCurrentsRead() { - /* Since we don't an implementation here we don't need to do anything here */ + /* Since we have a static array we don't need to do anything here */ return CHIP_NO_ERROR; } CHIP_ERROR @@ -269,34 +274,34 @@ ElectricalPowerMeasurementDelegate::GetHarmonicCurrentsByIndex(uint8_t harmonicC * MatterReportingAttributeChangeCallback(mEndpointId, ElectricalPowerMeasurement::Id, HarmonicCurrents::Id); */ - /* if (rangeIndex >= ArraySize(mHarmonicCurrentMeasurements)) - * { - * return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; - * } - * - * range = mHarmonicCurrentMeasurements[rangeIndex]; - * - * return CHIP_NO_ERROR; - */ + /* Added to support testing using a static array for now */ + if (harmonicCurrentsIndex >= ArraySize(kHarmonicCurrentMeasurements)) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } - /* Return an empty list for now */ - return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + harmonicCurrent = kHarmonicCurrentMeasurements[harmonicCurrentsIndex]; + return CHIP_NO_ERROR; } /* @brief This function is called by the cluster server at the end of read cycle * This could release a semaphore to allow a background update of the data */ CHIP_ERROR ElectricalPowerMeasurementDelegate::EndHarmonicCurrentsRead() { - /* Since we don't an implementation here we don't need to do anything here */ + /* Since we have a static array we don't need to do anything here */ return CHIP_NO_ERROR; } +static const Structs::HarmonicMeasurementStruct::Type kHarmonicPhaseMeasurements[] = { + { .order = 1, .measurement = MakeNullable(static_cast(100000)) } +}; + /* @brief This function is called by the cluster server at the start of read cycle * This could take a semaphore to stop a background update of the data */ CHIP_ERROR ElectricalPowerMeasurementDelegate::StartHarmonicPhasesRead() { - /* Since we don't an implementation here we don't need to do anything here */ + /* Since we have a static array we don't need to do anything here */ return CHIP_NO_ERROR; } @@ -314,25 +319,21 @@ CHIP_ERROR ElectricalPowerMeasurementDelegate::GetHarmonicPhasesByIndex(uint8_t * MatterReportingAttributeChangeCallback(mEndpointId, ElectricalPowerMeasurement::Id, HarmonicPhases::Id); */ - /* if (rangeIndex >= ArraySize(mHarmonicPhaseMeasurements)) - * { - * return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; - * } - * - * range = mHarmonicPhaseMeasurements[rangeIndex]; - * - * return CHIP_NO_ERROR; - */ + /* Added to support testing using a static array for now */ + if (harmonicPhaseIndex >= ArraySize(kHarmonicPhaseMeasurements)) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } - /* Return an empty list for now */ - return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + harmonicPhase = kHarmonicPhaseMeasurements[harmonicPhaseIndex]; + return CHIP_NO_ERROR; } /* @brief This function is called by the cluster server at the end of read cycle * This could release a semaphore to allow a background update of the data */ CHIP_ERROR ElectricalPowerMeasurementDelegate::EndHarmonicPhasesRead() { - /* Since we don't an implementation here we don't need to do anything here */ + /* Since we have a static array we don't need to do anything here */ return CHIP_NO_ERROR; } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp index 92593efe6f8370..9beff80e8dc22a 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp @@ -152,9 +152,7 @@ CHIP_ERROR EnergyEvseInit() /* Manufacturer may optionally not support all features, commands & attributes */ gEvseInstance = std::make_unique( EndpointId(ENERGY_EVSE_ENDPOINT), *gEvseDelegate, - BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, - EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, - EnergyEvse::Feature::kV2x), + BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kRfid), BitMask(EnergyEvse::OptionalAttributes::kSupportsUserMaximumChargingCurrent, EnergyEvse::OptionalAttributes::kSupportsRandomizationWindow, EnergyEvse::OptionalAttributes::kSupportsApproximateEvEfficiency), @@ -224,13 +222,27 @@ CHIP_ERROR EnergyMeterInit() } /* Manufacturer may optionally not support all features, commands & attributes */ + /* Turning on all optional features and attributes for test certification purposes */ gEPMInstance = std::make_unique( EndpointId(ENERGY_EVSE_ENDPOINT), *gEPMDelegate, - BitMask(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + BitMask( + ElectricalPowerMeasurement::Feature::kDirectCurrent, ElectricalPowerMeasurement::Feature::kAlternatingCurrent, + ElectricalPowerMeasurement::Feature::kPolyphasePower, ElectricalPowerMeasurement::Feature::kHarmonics, + ElectricalPowerMeasurement::Feature::kPowerQuality), BitMask( ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRanges, ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeVoltage, - ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent)); + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactiveCurrent, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentCurrent, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactivePower, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentPower, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSVoltage, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSCurrent, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSPower, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeFrequency, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributePowerFactor, + ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeNeutralCurrent)); if (!gEPMInstance) { diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImReadCommand.kt b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImReadCommand.kt index 3e45d62323cfec..e0a95d584130eb 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImReadCommand.kt +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImReadCommand.kt @@ -10,6 +10,7 @@ import chip.devicecontroller.model.ChipPathId import chip.devicecontroller.model.DataVersionFilter import chip.devicecontroller.model.EventState import chip.devicecontroller.model.NodeState +import chip.devicecontroller.model.Status import com.matter.controller.commands.common.CredentialsIssuer import java.util.logging.Level import java.util.logging.Logger @@ -34,13 +35,6 @@ class PairOnNetworkLongImReadCommand( eventPath: ChipEventPath?, e: Exception ) { - if (attributePath != null && attributePath.clusterId.getId() == UNIT_TEST_CLUSTER) { - logger.log( - Level.INFO, - "TODO: skip the error check for unit test cluster that covers most error result" - ) - return - } logger.log(Level.INFO, "Read receive onError") setFailure("read failure") } @@ -72,11 +66,20 @@ class PairOnNetworkLongImReadCommand( return cluster.equals(expected) } + fun checkUnitTestClusterGeneralStatus(status: Status): Boolean = + (status.getStatus() == CLUSTER_ID_TEST_GENERAL_ERROR_STATUS) && + !status.getClusterStatus().isPresent() + + fun checkUnitTestClusterClusterStatus(status: Status): Boolean = + (status.getStatus() == CLUSTER_ID_TEST_CLUSTER_ERROR_STATUS) && + status.getClusterStatus().isPresent() && + status.getClusterStatus().get() == CLUSTER_ID_TEST_CLUSTER_ERROR_CLUSTER_STATUS + private fun validateResponse(nodeState: NodeState) { val endpointZero = requireNotNull(nodeState.getEndpointState(0)) { "Endpoint zero not found." } - val endpointOne = requireNotNull(nodeState.getEndpointState(0)) { "Endpoint one not found." } + val endpointOne = requireNotNull(nodeState.getEndpointState(1)) { "Endpoint one not found." } val basicCluster = requireNotNull(endpointZero.getClusterState(CLUSTER_ID_BASIC)) { @@ -93,6 +96,11 @@ class PairOnNetworkLongImReadCommand( "No local config disabled attribute found." } + val unitTestCluster = + requireNotNull(endpointOne.getClusterState(UNIT_TEST_CLUSTER)) { + "Unit test cluster not found." + } + val startUpEvents = requireNotNull(basicCluster.getEventState(EVENT_ID_START_UP)) { "No start up event found." } @@ -122,6 +130,22 @@ class PairOnNetworkLongImReadCommand( require(checkAllAttributesJsonForFixedLabel(clusterAttributes)) { "Invalid fixed label cluster attributes Json ${clusterAttributes}" } + + require( + checkUnitTestClusterGeneralStatus( + unitTestCluster.getAttributeStatuses()[CLUSTER_ID_TEST_GENERAL_ERROR_BOOLEAN]!! + ) + ) { + "Invalid unit test cluster generalStatus check ${unitTestCluster}" + } + + require( + checkUnitTestClusterClusterStatus( + unitTestCluster.getAttributeStatuses()[CLUSTER_ID_TEST_CLUSTER_ERROR_BOOLEAN]!! + ) + ) { + "Invalid unit test cluster clusterStatus check ${unitTestCluster}" + } } override fun onReport(nodeState: NodeState) { @@ -212,10 +236,15 @@ class PairOnNetworkLongImReadCommand( private const val MATTER_PORT = 5540 private const val CLUSTER_ID_BASIC = 0x0028L private const val FIXED_LABEL_CLUSTER = 0x0040L - private const val UNIT_TEST_CLUSTER = 0xfff1fc05 + private const val UNIT_TEST_CLUSTER = 0xfff1fc05L private const val ATTR_ID_LOCAL_CONFIG_DISABLED = 16L private const val EVENT_ID_START_UP = 0L private const val GLOBAL_ATTRIBUTE_LIST = 65531L private const val CLUSTER_ID_BASIC_VERSION = 0L + private const val CLUSTER_ID_TEST_GENERAL_ERROR_BOOLEAN = 0x0031L + private const val CLUSTER_ID_TEST_CLUSTER_ERROR_BOOLEAN = 0x0032L + private const val CLUSTER_ID_TEST_GENERAL_ERROR_STATUS = 0x8d + private const val CLUSTER_ID_TEST_CLUSTER_ERROR_STATUS = 1 + private const val CLUSTER_ID_TEST_CLUSTER_ERROR_CLUSTER_STATUS = 17 } } diff --git a/examples/light-switch-app/ameba/main/BindingHandler.cpp b/examples/light-switch-app/ameba/main/BindingHandler.cpp index 29acdaae952896..0ffcddc67839eb 100644 --- a/examples/light-switch-app/ameba/main/BindingHandler.cpp +++ b/examples/light-switch-app/ameba/main/BindingHandler.cpp @@ -113,7 +113,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -122,7 +122,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -246,7 +246,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -261,7 +261,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/asr/src/BindingHandler.cpp b/examples/light-switch-app/asr/src/BindingHandler.cpp index bb2d1d754fc70f..10ee9e2332af30 100644 --- a/examples/light-switch-app/asr/src/BindingHandler.cpp +++ b/examples/light-switch-app/asr/src/BindingHandler.cpp @@ -199,7 +199,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & aB VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingData * data = static_cast(context); - if (aBinding.type == EMBER_MULTICAST_BINDING && data->IsGroup) + if (aBinding.type == MATTER_MULTICAST_BINDING && data->IsGroup) { switch (data->ClusterId) { @@ -214,7 +214,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & aB break; } } - else if (aBinding.type == EMBER_UNICAST_BINDING && !data->IsGroup) + else if (aBinding.type == MATTER_UNICAST_BINDING && !data->IsGroup) { switch (data->ClusterId) { @@ -255,7 +255,7 @@ bool BindingHandler::IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } @@ -273,7 +273,7 @@ void BindingHandler::PrintBindingTable() { switch (entry.type) { - case EMBER_UNICAST_BINDING: + case MATTER_UNICAST_BINDING: ASR_LOG("[%d] UNICAST:", i++); ASR_LOG("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -283,7 +283,7 @@ void BindingHandler::PrintBindingTable() (int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote, (int) entry.nodeId); break; - case EMBER_MULTICAST_BINDING: + case MATTER_MULTICAST_BINDING: ASR_LOG("[%d] GROUP:", i++); ASR_LOG("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -291,10 +291,10 @@ void BindingHandler::PrintBindingTable() \t+ GroupId %d", (int) entry.fabricIndex, (int) entry.local, (int) entry.remote, (int) entry.groupId); break; - case EMBER_UNUSED_BINDING: + case MATTER_UNUSED_BINDING: ASR_LOG("[%d] UNUSED", i++); break; - // case EMBER_MANY_TO_ONE_BINDING: + // case MATTER_MANY_TO_ONE_BINDING: // ASR_LOG("[%d] MANY TO ONE", i++); // break; default: diff --git a/examples/light-switch-app/esp32/main/BindingHandler.cpp b/examples/light-switch-app/esp32/main/BindingHandler.cpp index 5cc520fd2accd0..9602cd1a534414 100644 --- a/examples/light-switch-app/esp32/main/BindingHandler.cpp +++ b/examples/light-switch-app/esp32/main/BindingHandler.cpp @@ -109,7 +109,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -118,7 +118,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -244,7 +244,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -259,7 +259,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/genio/src/BindingHandler.cpp b/examples/light-switch-app/genio/src/BindingHandler.cpp index c8392f20ac9c4c..e988464b331afe 100644 --- a/examples/light-switch-app/genio/src/BindingHandler.cpp +++ b/examples/light-switch-app/genio/src/BindingHandler.cpp @@ -119,7 +119,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation // Eason+ ChipLogDetail(AppServer, "LightSwitchChangedHandler~~~~~~~"); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -128,7 +128,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -243,7 +243,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -258,7 +258,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp b/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp index 477ce99fa44c0b..91cc0c74176a53 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/AppShellCommands.cpp @@ -361,7 +361,7 @@ CHIP_ERROR GroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->local = 1; // Hardcoded to endpoint 1 for now entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); @@ -379,7 +379,7 @@ CHIP_ERROR UnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 4, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->local = 1; // Hardcoded to endpoint 1 for now entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); diff --git a/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp b/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp index bcf66efb2dd81a..4df68993fddae4 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/BindingHandler.cpp @@ -213,7 +213,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi VerifyOrReturn(context != nullptr, printf("Invalid context for Light switch handler\n");); BindingData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->IsGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->IsGroup) { switch (data->ClusterId) { @@ -228,7 +228,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->IsGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->IsGroup) { switch (data->ClusterId) { @@ -281,7 +281,7 @@ bool BindingHandler::IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } @@ -299,7 +299,7 @@ void BindingHandler::PrintBindingTable() { switch (entry.type) { - case EMBER_UNICAST_BINDING: + case MATTER_UNICAST_BINDING: printf("[%d] UNICAST:", i++); printf("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -309,7 +309,7 @@ void BindingHandler::PrintBindingTable() (int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote, (int) entry.nodeId); break; - case EMBER_MULTICAST_BINDING: + case MATTER_MULTICAST_BINDING: printf("[%d] GROUP:", i++); printf("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -317,7 +317,7 @@ void BindingHandler::PrintBindingTable() \t+ GroupId %d \n", (int) entry.fabricIndex, (int) entry.local, (int) entry.remote, (int) entry.groupId); break; - case EMBER_UNUSED_BINDING: + case MATTER_UNUSED_BINDING: printf("[%d] UNUSED", i++); break; default: diff --git a/examples/light-switch-app/infineon/cyw30739/src/ZclCallbacks.cpp b/examples/light-switch-app/infineon/cyw30739/src/ZclCallbacks.cpp index 852295fffcd23b..a8e252719ae791 100644 --- a/examples/light-switch-app/infineon/cyw30739/src/ZclCallbacks.cpp +++ b/examples/light-switch-app/infineon/cyw30739/src/ZclCallbacks.cpp @@ -33,7 +33,8 @@ void MatterPostAttributeChangeCallback(const app::ConcreteAttributePath & attrib if (attributePath.mAttributeId == Identify::Attributes::IdentifyTime::Id) { uint16_t identifyTime; - if (EMBER_ZCL_STATUS_SUCCESS == Identify::Attributes::IdentifyTime::Get(attributePath.mEndpointId, &identifyTime)) + if (Protocols::InteractionModel::Status::Success == + Identify::Attributes::IdentifyTime::Get(attributePath.mEndpointId, &identifyTime)) { ChipLogProgress(Zcl, "IdentifyTime %u", identifyTime); return; diff --git a/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp b/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp index 886637fd21018a..0d93428f8dca5e 100644 --- a/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp +++ b/examples/light-switch-app/nrfconnect/main/BindingHandler.cpp @@ -198,7 +198,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi VerifyOrReturn(context != nullptr, LOG_ERR("Invalid context for Light switch handler");); BindingData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->IsGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->IsGroup) { switch (data->ClusterId) { @@ -213,7 +213,7 @@ void BindingHandler::LightSwitchChangedHandler(const EmberBindingTableEntry & bi break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->IsGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->IsGroup) { switch (data->ClusterId) { @@ -259,7 +259,7 @@ bool BindingHandler::IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } @@ -277,7 +277,7 @@ void BindingHandler::PrintBindingTable() { switch (entry.type) { - case EMBER_UNICAST_BINDING: + case MATTER_UNICAST_BINDING: LOG_INF("[%d] UNICAST:", i++); LOG_INF("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -287,7 +287,7 @@ void BindingHandler::PrintBindingTable() (int) entry.fabricIndex, (int) entry.local, (int) entry.clusterId.Value(), (int) entry.remote, (int) entry.nodeId); break; - case EMBER_MULTICAST_BINDING: + case MATTER_MULTICAST_BINDING: LOG_INF("[%d] GROUP:", i++); LOG_INF("\t\t+ Fabric: %d\n \ \t+ LocalEndpoint %d \n \ @@ -295,7 +295,7 @@ void BindingHandler::PrintBindingTable() \t+ GroupId %d", (int) entry.fabricIndex, (int) entry.local, (int) entry.remote, (int) entry.groupId); break; - case EMBER_UNUSED_BINDING: + case MATTER_UNUSED_BINDING: LOG_INF("[%d] UNUSED", i++); break; default: diff --git a/examples/light-switch-app/qpg/args.gni b/examples/light-switch-app/qpg/args.gni index d5dcdfe217c635..64db0987b3d7d6 100644 --- a/examples/light-switch-app/qpg/args.gni +++ b/examples/light-switch-app/qpg/args.gni @@ -23,6 +23,7 @@ chip_enable_ota_requestor = true chip_openthread_ftd = false enable_sleepy_device = true chip_enable_icd_server = true +chip_enable_icd_lit = true # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/light-switch-app/qpg/src/AppTask.cpp b/examples/light-switch-app/qpg/src/AppTask.cpp index f02823b178220d..318e61b1e875c8 100644 --- a/examples/light-switch-app/qpg/src/AppTask.cpp +++ b/examples/light-switch-app/qpg/src/AppTask.cpp @@ -495,11 +495,12 @@ void AppTask::UpdateClusterState(void) /* write the new attribute value based on attribute setter API. example API usage of on-off attribute: - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(QPG_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn()); + Protocols::InteractionModel::Status status = Clusters::OnOff::Attributes::OnOff::Set(QPG_LIGHT_ENDPOINT_ID, + LightingMgr().IsTurnedOn()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating on/off %x", status); + ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status)); } */ } diff --git a/examples/light-switch-app/qpg/src/binding-handler.cpp b/examples/light-switch-app/qpg/src/binding-handler.cpp index 6369aa0ab06c25..4dae4e12b44155 100644 --- a/examples/light-switch-app/qpg/src/binding-handler.cpp +++ b/examples/light-switch-app/qpg/src/binding-handler.cpp @@ -73,7 +73,7 @@ static void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Op BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_UNICAST_BINDING) + if (binding.type == MATTER_UNICAST_BINDING) { switch (data->clusterId) { diff --git a/examples/light-switch-app/silabs/README.md b/examples/light-switch-app/silabs/README.md index 615b27c7bc3cd9..401e9b88b41fac 100644 --- a/examples/light-switch-app/silabs/README.md +++ b/examples/light-switch-app/silabs/README.md @@ -254,22 +254,30 @@ combination with JLinkRTTClient as follows: [SVR] Copy/paste the below URL in a browser to see the QR Code: [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0 - **LED 0** shows the overall state of the device and its connectivity. The - following states are possible: + **LED 0** - - Short Flash On (50 ms on/950 ms off): The device is in the + - ICD Configuration (Default) - LED is only active under two circumstances: + + 1. Factory reset sequence - LED will blink when initiated upon press and hold of + Button 0 after 3 seconds + 2. An Identify command was received + + - Non-ICD Configuration - shows the overall state of the device and its connectivity. The + following states are possible: + + Short Flash On (50 ms on/950 ms off): The device is in the unprovisioned (unpaired) state and is waiting for a commissioning application to connect. - - Rapid Even Flashing (100 ms on/100 ms off): The device is in the + Rapid Even Flashing (100 ms on/100 ms off): The device is in the unprovisioned state and a commissioning application is connected through Bluetooth LE. - - Short Flash Off (950ms on/50ms off): The device is fully + Short Flash Off (950ms on/50ms off): The device is fully provisioned, but does not yet have full Thread network or service connectivity. - - Solid On: The device is fully provisioned and has full Thread + Solid On: The device is fully provisioned and has full Thread network and service connectivity. **Push Button 0** diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni index 2ea7cd471c2b8a..17cc5885460379 100644 --- a/examples/light-switch-app/silabs/openthread.gni +++ b/examples/light-switch-app/silabs/openthread.gni @@ -35,6 +35,6 @@ sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals sl_ot_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags -sl_idle_mode_interval_s = 3600 # 60min Idle Mode Interval -sl_active_mode_interval_ms = 60000 # 60s Active Mode Interval +sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration +sl_active_mode_duration_ms = 60000 # 60s Active Mode Duration sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold diff --git a/examples/light-switch-app/silabs/src/BindingHandler.cpp b/examples/light-switch-app/silabs/src/BindingHandler.cpp index 3f75f79a60d82c..56f7c306f989d8 100644 --- a/examples/light-switch-app/silabs/src/BindingHandler.cpp +++ b/examples/light-switch-app/silabs/src/BindingHandler.cpp @@ -90,7 +90,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); BindingCommandData * data = static_cast(context); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -99,7 +99,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { diff --git a/examples/light-switch-app/silabs/src/ShellCommands.cpp b/examples/light-switch-app/silabs/src/ShellCommands.cpp index daac5078501858..ee5872276efe19 100644 --- a/examples/light-switch-app/silabs/src/ShellCommands.cpp +++ b/examples/light-switch-app/silabs/src/ShellCommands.cpp @@ -139,7 +139,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -154,7 +154,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now diff --git a/examples/light-switch-app/telink/src/binding-handler.cpp b/examples/light-switch-app/telink/src/binding-handler.cpp index f982266828c583..39a8cddc2c60f8 100755 --- a/examples/light-switch-app/telink/src/binding-handler.cpp +++ b/examples/light-switch-app/telink/src/binding-handler.cpp @@ -113,7 +113,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation BindingCommandData * data = static_cast(context); data->isGroup = IsGroupBound(); - if (binding.type == EMBER_MULTICAST_BINDING && data->isGroup) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) { switch (data->clusterId) { @@ -122,7 +122,7 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, Operation break; } } - else if (binding.type == EMBER_UNICAST_BINDING && !data->isGroup) + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { @@ -239,7 +239,7 @@ CHIP_ERROR BindingGroupBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_MULTICAST_BINDING; + entry->type = MATTER_MULTICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->groupId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -254,7 +254,7 @@ CHIP_ERROR BindingUnicastBindCommandHandler(int argc, char ** argv) VerifyOrReturnError(argc == 3, CHIP_ERROR_INVALID_ARGUMENT); EmberBindingTableEntry * entry = Platform::New(); - entry->type = EMBER_UNICAST_BINDING; + entry->type = MATTER_UNICAST_BINDING; entry->fabricIndex = atoi(argv[0]); entry->nodeId = atoi(argv[1]); entry->local = 1; // Hardcoded to endpoint 1 for now @@ -409,7 +409,7 @@ bool IsGroupBound() for (auto & entry : bindingTable) { - if (EMBER_MULTICAST_BINDING == entry.type) + if (MATTER_MULTICAST_BINDING == entry.type) { return true; } diff --git a/examples/lighting-app/asr/src/AppTask.cpp b/examples/lighting-app/asr/src/AppTask.cpp index e9467d294ef136..b72ff5c8588f31 100755 --- a/examples/lighting-app/asr/src/AppTask.cpp +++ b/examples/lighting-app/asr/src/AppTask.cpp @@ -82,13 +82,13 @@ CHIP_ERROR AppTask::StartAppTask() bool IsLightOn() { - EmberAfStatus status; + Protocols::InteractionModel::Status status; bool on = true; status = app::Clusters::OnOff::Attributes::OnOff::Get(1, &on); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ASR_LOG("Error Read OnOff Attribute 0x%02x\n", status); + ASR_LOG("Error Read OnOff Attribute 0x%02x\n", to_underlying(status)); } return on != false; @@ -96,14 +96,14 @@ bool IsLightOn() uint8_t GetLightLevel() { - EmberAfStatus status; + Protocols::InteractionModel::Status status; app::DataModel::Nullable currentLevel; status = app::Clusters::LevelControl::Attributes::CurrentLevel::Get(1, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ASR_LOG("Error Read CurrentLevel Attribute 0x%02x\n", status); + ASR_LOG("Error Read CurrentLevel Attribute 0x%02x\n", to_underlying(status)); return -1; } diff --git a/examples/lighting-app/bouffalolab/common/AppTask.cpp b/examples/lighting-app/bouffalolab/common/AppTask.cpp index a0eb17fd747eec..fafc9943e24890 100644 --- a/examples/lighting-app/bouffalolab/common/AppTask.cpp +++ b/examples/lighting-app/bouffalolab/common/AppTask.cpp @@ -252,22 +252,25 @@ void AppTask::LightingUpdate(app_event_t status) { do { - if (EMBER_ZCL_STATUS_SUCCESS != Clusters::OnOff::Attributes::OnOff::Get(endpoint, &onoff)) + if (Protocols::InteractionModel::Status::Success != Clusters::OnOff::Attributes::OnOff::Get(endpoint, &onoff)) { break; } - if (EMBER_ZCL_STATUS_SUCCESS != Clusters::LevelControl::Attributes::CurrentLevel::Get(endpoint, v)) + if (Protocols::InteractionModel::Status::Success != + Clusters::LevelControl::Attributes::CurrentLevel::Get(endpoint, v)) { break; } - if (EMBER_ZCL_STATUS_SUCCESS != Clusters::ColorControl::Attributes::CurrentHue::Get(endpoint, &hue)) + if (Protocols::InteractionModel::Status::Success != + Clusters::ColorControl::Attributes::CurrentHue::Get(endpoint, &hue)) { break; } - if (EMBER_ZCL_STATUS_SUCCESS != Clusters::ColorControl::Attributes::CurrentSaturation::Get(endpoint, &sat)) + if (Protocols::InteractionModel::Status::Success != + Clusters::ColorControl::Attributes::CurrentSaturation::Get(endpoint, &sat)) { break; } diff --git a/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn index a745c65a1407cf..1292b5f5e9626c 100644 --- a/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn @@ -55,7 +55,7 @@ ti_sysconfig("sysconfig") { ] } - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/lighting-app/cc13x4_26x4/BUILD.gn b/examples/lighting-app/cc13x4_26x4/BUILD.gn index f4e9ce30d080aa..02d9b0b8763ee7 100644 --- a/examples/lighting-app/cc13x4_26x4/BUILD.gn +++ b/examples/lighting-app/cc13x4_26x4/BUILD.gn @@ -63,7 +63,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/lighting-app/esp32/main/AppTask.cpp b/examples/lighting-app/esp32/main/AppTask.cpp index 33b1505aafc581..562ee4b763faff 100644 --- a/examples/lighting-app/esp32/main/AppTask.cpp +++ b/examples/lighting-app/esp32/main/AppTask.cpp @@ -189,18 +189,18 @@ void AppTask::UpdateClusterState() { ESP_LOGI(TAG, "Writing to OnOff cluster"); // write the new on/off value - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(kLightEndpointId, AppLED.IsTurnedOn()); + Protocols::InteractionModel::Status status = Clusters::OnOff::Attributes::OnOff::Set(kLightEndpointId, AppLED.IsTurnedOn()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ESP_LOGE(TAG, "Updating on/off cluster failed: %x", status); + ESP_LOGE(TAG, "Updating on/off cluster failed: %x", to_underlying(status)); } ESP_LOGI(TAG, "Writing to Current Level cluster"); status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kLightEndpointId, AppLED.GetLevel()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ESP_LOGE(TAG, "Updating level cluster failed: %x", status); + ESP_LOGE(TAG, "Updating level cluster failed: %x", to_underlying(status)); } } diff --git a/examples/lighting-app/genio/src/ZclCallbacks.cpp b/examples/lighting-app/genio/src/ZclCallbacks.cpp index 9d0a4d97c09e9b..30faa57990ba7f 100644 --- a/examples/lighting-app/genio/src/ZclCallbacks.cpp +++ b/examples/lighting-app/genio/src/ZclCallbacks.cpp @@ -55,7 +55,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & } else if (clusterId == ColorControl::Id) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; /* ignore several attributes that are currently not processed */ if ((attributeId == ColorControl::Attributes::RemainingTime::Id) || (attributeId == ColorControl::Attributes::EnhancedColorMode::Id) || diff --git a/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp b/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp index b7fa437127bacb..3af2ffad095f9b 100644 --- a/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp +++ b/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp @@ -49,12 +49,12 @@ bool LightingManager::IsActionInProgress() bool LightingManager::IsLightOn(void) { - bool on = true; - const EmberAfStatus status = OnOff::Attributes::OnOff::Get(1, &on); + bool on = true; + const Protocols::InteractionModel::Status status = OnOff::Attributes::OnOff::Get(1, &on); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - printf("Error ReadServerAttribute 0x%02x\n", status); + printf("Error ReadServerAttribute 0x%02x\n", to_underlying(status)); } return on != false; @@ -99,20 +99,20 @@ bool LightingManager::InitiateAction(Actor_t aActor, Action_t aAction, uint8_t v void LightingManager::WriteClusterState(uint8_t value) { - const EmberAfStatus status = OnOff::Attributes::OnOff::Set(1, value); + const Protocols::InteractionModel::Status status = OnOff::Attributes::OnOff::Set(1, value); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - printf("Error WriteServerAttribute 0x%02x\n", status); + printf("Error WriteServerAttribute 0x%02x\n", to_underlying(status)); } } void LightingManager::WriteClusterLevel(uint8_t value) { - const EmberAfStatus status = LevelControl::Attributes::CurrentLevel::Set(1, value); + const Protocols::InteractionModel::Status status = LevelControl::Attributes::CurrentLevel::Set(1, value); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - printf("Error WriteServerAttribute 0x%02x\n", status); + printf("Error WriteServerAttribute 0x%02x\n", to_underlying(status)); } } diff --git a/examples/lighting-app/infineon/cyw30739/src/ZclCallbacks.cpp b/examples/lighting-app/infineon/cyw30739/src/ZclCallbacks.cpp index 4f0222ca740ca3..0b00eaec57687a 100644 --- a/examples/lighting-app/infineon/cyw30739/src/ZclCallbacks.cpp +++ b/examples/lighting-app/infineon/cyw30739/src/ZclCallbacks.cpp @@ -53,7 +53,8 @@ void MatterPostAttributeChangeCallback(const app::ConcreteAttributePath & attrib if (attributePath.mAttributeId == Identify::Attributes::IdentifyTime::Id) { uint16_t identifyTime; - if (EMBER_ZCL_STATUS_SUCCESS == Identify::Attributes::IdentifyTime::Get(attributePath.mEndpointId, &identifyTime)) + if (Protocols::InteractionModel::Status::Success == + Identify::Attributes::IdentifyTime::Get(attributePath.mEndpointId, &identifyTime)) { ChipLogProgress(Zcl, "IdentifyTime %u", identifyTime); return; diff --git a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp index 2315086b246594..49e6278ab032c9 100644 --- a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp @@ -555,10 +555,10 @@ void AppTask::UpdateClusterState(intptr_t context) uint8_t newValue = LightMgr().IsLightOn(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating on/off %x", status); + P6_LOG("ERR: updating on/off %x", to_underlying(status)); } } #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR diff --git a/examples/lighting-app/linux/LightingAppCommandDelegate.cpp b/examples/lighting-app/linux/LightingAppCommandDelegate.cpp index cafc1df1161359..e6ac7b3970c148 100644 --- a/examples/lighting-app/linux/LightingAppCommandDelegate.cpp +++ b/examples/lighting-app/linux/LightingAppCommandDelegate.cpp @@ -259,8 +259,9 @@ void LightingAppCommandHandler::OnSwitchLatchedHandler(uint8_t newPosition) { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The latching switch is moved to a new position:%d", newPosition); Clusters::SwitchServer::Instance().OnSwitchLatch(endpoint, newPosition); @@ -270,8 +271,9 @@ void LightingAppCommandHandler::OnSwitchInitialPressedHandler(uint8_t newPositio { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The new position when the momentary switch starts to be pressed:%d", newPosition); Clusters::SwitchServer::Instance().OnInitialPress(endpoint, newPosition); @@ -281,8 +283,9 @@ void LightingAppCommandHandler::OnSwitchLongPressedHandler(uint8_t newPosition) { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The new position when the momentary switch has been pressed for a long time:%d", newPosition); Clusters::SwitchServer::Instance().OnLongPress(endpoint, newPosition); @@ -292,8 +295,9 @@ void LightingAppCommandHandler::OnSwitchShortReleasedHandler(uint8_t previousPos { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The the previous value of the CurrentPosition when the momentary switch has been released:%d", previousPosition); @@ -304,8 +308,9 @@ void LightingAppCommandHandler::OnSwitchLongReleasedHandler(uint8_t previousPosi { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The the previous value of the CurrentPosition when the momentary switch has been released after having been " "pressed for a long time:%d", @@ -318,8 +323,9 @@ void LightingAppCommandHandler::OnSwitchMultiPressOngoingHandler(uint8_t newPosi { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, newPosition); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to set CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The new position when the momentary switch has been pressed in a multi-press sequence:%d", newPosition); ChipLogDetail(NotSpecified, "%d times the momentary switch has been pressed", count); @@ -331,8 +337,9 @@ void LightingAppCommandHandler::OnSwitchMultiPressCompleteHandler(uint8_t previo { EndpointId endpoint = 0; - EmberAfStatus status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); + Protocols::InteractionModel::Status status = Switch::Attributes::CurrentPosition::Set(endpoint, 0); + VerifyOrReturn(Protocols::InteractionModel::Status::Success == status, + ChipLogError(NotSpecified, "Failed to reset CurrentPosition attribute")); ChipLogDetail(NotSpecified, "The previous position when the momentary switch has been pressed in a multi-press sequence:%d", previousPosition); ChipLogDetail(NotSpecified, "%d times the momentary switch has been pressed", count); diff --git a/examples/lighting-app/mbed/main/AppTask.cpp b/examples/lighting-app/mbed/main/AppTask.cpp index fdbe8ea0cce291..26403bdb5e5b28 100644 --- a/examples/lighting-app/mbed/main/AppTask.cpp +++ b/examples/lighting-app/mbed/main/AppTask.cpp @@ -462,18 +462,18 @@ void AppTask::UpdateClusterState() uint8_t onoff = LightingMgr().IsTurnedOn(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(1, onoff); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, onoff); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "Updating on/off cluster failed: %x", status); + ChipLogError(NotSpecified, "Updating on/off cluster failed: %x", to_underlying(status)); } uint8_t level = LightingMgr().GetLevel(); status = app::Clusters::LevelControl::Attributes::CurrentLevel::Set(1, level); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "Updating level cluster failed: %x", status); + ChipLogError(NotSpecified, "Updating level cluster failed: %x", to_underlying(status)); } } diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 494095e04de9dc..5eaa1b1b401524 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -689,19 +689,20 @@ void AppTask::UpdateClusterState() { SystemLayer().ScheduleLambda([this] { // write the new on/off value - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(kLightEndpointId, mPWMDevice.IsTurnedOn()); + Protocols::InteractionModel::Status status = + Clusters::OnOff::Attributes::OnOff::Set(kLightEndpointId, mPWMDevice.IsTurnedOn()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Updating on/off cluster failed: %x", status); + LOG_ERR("Updating on/off cluster failed: %x", to_underlying(status)); } // write the current level status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kLightEndpointId, mPWMDevice.GetLevel()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Updating level cluster failed: %x", status); + LOG_ERR("Updating level cluster failed: %x", to_underlying(status)); } }); } diff --git a/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp b/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp index eeb83262bfb804..b872a1c8416d49 100644 --- a/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp +++ b/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp @@ -73,12 +73,12 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & */ void emberAfOnOffClusterInitCallback(EndpointId endpoint) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; bool storedValue; // Read storedValue on/off value status = Attributes::OnOff::Get(endpoint, &storedValue); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Protocols::InteractionModel::Status::Success) { // Set actual state to the cluster state that was last persisted AppTask::Instance().GetPWMDevice().InitiateAction(storedValue ? PWMDevice::ON_ACTION : PWMDevice::OFF_ACTION, diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index b1fc51c7c29360..39c9584c883480 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -955,10 +955,10 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg) uint8_t newValue = !LightingMgr().IsTurnedOff(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating on/off %x", status); + ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/lighting-app/nxp/k32w/k32w1/.gn b/examples/lighting-app/nxp/k32w/k32w1/.gn index 3d48789e30ab3d..a88f6f5aa7cb3f 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/.gn +++ b/examples/lighting-app/nxp/k32w/k32w1/.gn @@ -25,4 +25,7 @@ default_args = { target_os = "freertos" import("//args.gni") + + # Import default platform configs + import("${chip_root}/src/platform/nxp/k32w/k32w1/args.gni") } diff --git a/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn index a7643a9f847931..2f327213533e94 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn @@ -13,15 +13,26 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") import("//build_overrides/openthread.gni") +import("${nxp_sdk_build_root}/nxp_sdk.gni") -import("${k32w1_sdk_build_root}/k32w1_executable.gni") -import("${k32w1_sdk_build_root}/k32w1_sdk.gni") +import("${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_executable.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/platform/device.gni") +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") + +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") + import("${chip_root}/examples/platform/nxp/pw_rpc_server.gni") +} declare_args() { chip_software_version = 0 @@ -65,12 +76,30 @@ k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${chip_software_version}", ] } + + if (chip_enable_pw_rpc) { + defines += [ + "PW_RPC_ENABLED", + "STREAMER_UART_FLUSH_DELAY_MS=0", + "STREAMER_UART_SERIAL_MANAGER_RING_BUFFER_SIZE=512", + "BOARD_APP_UART_CLK_FREQ=96000000", + ] + } } k32w1_executable("light_app") { output_name = "chip-k32w1-light-example" - sources = [ + sources = [] + deps = [] + + if (chip_enable_pw_rpc) { + forward_variables_from(pw_rpc_server, "*") + } else { + cflags = [ "-Wconversion" ] + } + + sources += [ "${k32w1_platform_dir}/util/LEDWidget.cpp", "${k32w1_platform_dir}/util/include/LEDWidget.h", "main/AppTask.cpp", @@ -84,7 +113,7 @@ k32w1_executable("light_app") { public = [ "${chip_root}/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h" ] - deps = [ + deps += [ ":sdk", "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lighting-app/nxp/zap/", @@ -107,9 +136,7 @@ k32w1_executable("light_app") { ] } - cflags = [ "-Wconversion" ] - - if (use_smu2_as_system_memory) { + if (use_smu2_static) { ldscript = "${k32w1_platform_dir}/app/ldscripts/k32w1_app.ld" base_ldscript_dir = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc" } else { @@ -121,13 +148,17 @@ k32w1_executable("light_app") { ldflags = [ "-Wl,--defsym=__heap_size__=0", "-Wl,--defsym=__stack_size__=0x480", - "-Wl,--defsym=gNvmSectors=8", + "-Wl,--defsym=gUseFactoryData_d=1", "-Wl,-print-memory-usage", "-Wl,--no-warn-rwx-segments", "-T" + rebase_path(ldscript, root_build_dir), ] - if (use_smu2_as_system_memory) { + if (chip_with_factory_data == 1) { + ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] + } + + if (use_smu2_static) { ldflags += [ "-L" + rebase_path(base_ldscript_dir, root_build_dir) ] } diff --git a/examples/lighting-app/nxp/k32w/k32w1/README.md b/examples/lighting-app/nxp/k32w/k32w1/README.md index 92dca287111449..253c21e04eafbb 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/README.md +++ b/examples/lighting-app/nxp/k32w/k32w1/README.md @@ -22,6 +22,7 @@ into an existing Matter network and can be controlled by this network. - [Device UI](#device-ui) - [Building](#building) - [SMU2](#smu2-memory) +- [Manufacturing data](#manufacturing-data) - [Flashing](#flashing) - [Flashing the NBU image](#flashing-the-nbu-image) - [Flashing the host image](#flashing-the-host-image) @@ -33,6 +34,8 @@ into an existing Matter network and can be controlled by this network. - [Running OTA](#running-ota) - [Known issues](#known-issues) +- [Running RPC console](#running-rpc-console) + ## Introduction @@ -112,7 +115,8 @@ point before the 6 second limit. **Button SW3** can be used to change the state of the simulated light bulb. This can be used to mimic a user manually operating a switch. The button behaves as a -toggle, swapping the state every time it is pressed. +toggle, swapping the state every time it is short pressed. When long pressed, it +does a clean soft reset that takes into account Matter shutdown procedure. ## Building @@ -147,8 +151,8 @@ see the files prefixed with `chip-k32w1-light-example`. Some Matter instances and global variables can be placed in the `NBU` `SMU2` memory. When compiling with OpenThread FTD support (`chip_openthread_ftd=true`) -and with `use_smu2_as_system_memory=true`, the following components are placed -in `SMU2` memory: +and with `use_smu2_static=true`, the following components are placed in `SMU2` +memory: - `gImageProcessor` from `OTAImageProcessorImpl.cpp`. - `gApplicationProcessor` from `OTAHooks.cpp`. @@ -161,8 +165,18 @@ changed, the names must be updated in `k32w1_app.ld`. See [k32w1_app.ld](../../../../platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld) for names and `SMU2` memory range size. -To use the `SMU2` Memory an optimized `NBU` binary is also needed. See -[Flashing the NBU image](#flashing-the-nbu-image). +The OpenThread buffers can be allocated from a 13KB `SMU2` range after a +successful commissioning process until a factory reset is initiated. This way, +the OpenThread buffers will be dynamically allocated instead of statically, +freeing some `SRAM`. To enable this feature compile with OpenThread FTD support +(`chip_openthread_ftd=true`) and with `use_smu2_dynamic=true`. + +## Manufacturing data + +Use `chip_with_factory_data=1` in the gn build command to enable factory data. + +For a full guide on manufacturing flow, please see +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). ## Flashing @@ -423,3 +437,22 @@ user@computer1:~/connectedhomeip$ sudo ifconfig eth0 -multicast - If Wi-Fi is used on a RPI4, then a 5Ghz network should be selected. Otherwise, issues related to BLE-WiFi combo may appear. + +## Running RPC console + +To build example with RPC enabled, use the following gn command: +`gn gen out/debug --args='import("//with_pw_rpc.gni") treat_warnings_as_errors=false'` + +The application runs an RPC server and processes events coming from an RPC +client. An example of an RPC client is the `chip-console`, which can be accessed +by running: +`chip-console --device /dev/tty. -b 115200 -o pw_log.out` + +The console should already have been installed in the virtual environment. From +the `chip-console`, a user can send specific commands to the device, e.g.: + +- To toggle the LED (`#define LIGHT_BUTTON 2` in `app_config.h`) + `rpcs.chip.rpc.Button.Event(idx=2)` +- To start BLE advertising (`#define BLE_BUTTON 4` in `app_config.h`) + `rpcs.chip.rpc.Button.Event(idx=4)` +- To reboot the device `rpcs.chip.rpc.Device.Reboot()` diff --git a/examples/lighting-app/nxp/k32w/k32w1/args.gni b/examples/lighting-app/nxp/k32w/k32w1/args.gni index 4efb6421f5ca02..a06e5828acdc45 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/args.gni +++ b/examples/lighting-app/nxp/k32w/k32w1/args.gni @@ -13,7 +13,6 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("${chip_root}/examples/platform/nxp/k32w/k32w1/args.gni") # SDK target. This is overridden to add our SDK app_config.h & defines. k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h index 07d8b6a92f5e69..536b822d776377 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h @@ -34,6 +34,58 @@ // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. #define CHIP_CONFIG_SECURITY_TEST_MODE 0 +// Use hard-coded test certificates already embedded in generic chip code => set it to 0 +// Use real/development certificates => set it to 1 + file the provisioning section from +// the internal flash +#ifndef CONFIG_CHIP_LOAD_REAL_FACTORY_DATA +#define CONFIG_CHIP_LOAD_REAL_FACTORY_DATA 0 +#endif + +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + +// VID/PID for product => will be used by Basic Information Cluster +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037 +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA221 + +// Set the following define to use the Certification Declaration from below and not use it stored in factory data section +#ifndef CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION +#define CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION 0 +#endif + +#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION +//-> format_version = 1 +//-> vendor_id = 0x1037 +//-> product_id_array = [ 0xA221 ] +//-> device_type_id = 0x0100 +//-> certificate_id = "ZIG20142ZB330003-24" +//-> security_level = 0 +//-> security_information = 0 +//-> version_number = 0x2694 +//-> certification_type = 1 +//-> dac_origin_vendor_id is not present +//-> dac_origin_product_id is not present +#define CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION \ + { \ + 0x30, 0x81, 0xe9, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x81, 0xdb, 0x30, 0x81, 0xd8, \ + 0x02, 0x01, 0x03, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, \ + 0x45, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x38, 0x04, 0x36, 0x15, 0x24, 0x00, \ + 0x01, 0x25, 0x01, 0x37, 0x10, 0x36, 0x02, 0x05, 0x21, 0xa2, 0x18, 0x25, 0x03, 0x00, 0x01, 0x2c, 0x04, 0x13, 0x5a, \ + 0x49, 0x47, 0x32, 0x30, 0x31, 0x34, 0x32, 0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x34, 0x24, \ + 0x05, 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x76, 0x98, 0x24, 0x08, 0x01, 0x18, 0x31, 0x7d, 0x30, 0x7b, 0x02, 0x01, \ + 0x03, 0x80, 0x14, 0x62, 0xfa, 0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a, 0xdd, 0xf5, \ + 0x04, 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, 0x0a, \ + 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0x93, 0x77, \ + 0x28, 0xd2, 0xd5, 0x36, 0xea, 0x09, 0xe4, 0xc5, 0xbc, 0x87, 0xa5, 0xa2, 0x44, 0x57, 0xf0, 0xed, 0x24, 0x66, 0xe7, \ + 0x50, 0x61, 0x1b, 0xe1, 0x17, 0x7c, 0x55, 0x0a, 0x83, 0xfa, 0xc3, 0x02, 0x20, 0x21, 0x6c, 0x60, 0x67, 0x4e, 0x3f, \ + 0xbe, 0x30, 0x38, 0xd4, 0x5e, 0x86, 0x1d, 0xe1, 0xe7, 0x6f, 0x7b, 0x1d, 0xd4, 0xfe, 0xbf, 0x79, 0x5a, 0x4e, 0x07, \ + 0x83, 0x46, 0xca, 0x94, 0x92, 0x5f, 0x14 \ + } + +// All remaining data will be pulled from the provisioning region of flash. +#endif + +#else + /** * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID * @@ -63,6 +115,8 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" +#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + /** * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION * diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp index 7150003f599588..2eb2f8e095b8b1 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp @@ -30,6 +30,9 @@ #include #include #include +#if defined(USE_SMU2_DYNAMIC) +#include +#endif #include #include @@ -88,6 +91,9 @@ using namespace chip; using namespace chip::app; AppTask AppTask::sAppTask; +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA +static AppTask::FactoryDataProvider sFactoryDataProvider; +#endif // This key is for testing/certification only and should not be used in production devices. // For production devices this key must be provided from factory data. @@ -135,8 +141,14 @@ CHIP_ERROR AppTask::Init() // Init ZCL Data Model and start server PlatformMgr().ScheduleWork(InitServer, 0); - // Initialize device attestation config +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + ReturnErrorOnFailure(sFactoryDataProvider.Init()); + SetDeviceInstanceInfoProvider(&sFactoryDataProvider); + SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); + SetCommissionableDataProvider(&sFactoryDataProvider); +#else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA // QR code will be used with CHIP Tool AppTask::PrintOnboardingInfo(); @@ -213,6 +225,10 @@ void AppTask::InitServer(intptr_t arg) initParams.operationalKeystore = &sK32W1PersistentStorageOpKeystore; #endif +#if defined(USE_SMU2_DYNAMIC) + VerifyOrDie(SMU2::Init(initParams.persistentStorageDelegate) == CHIP_NO_ERROR); +#endif + // Init ZCL Data Model and start server static DefaultTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; @@ -339,7 +355,7 @@ void AppTask::AppTaskMain(void * pvParameter) void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) { - if ((pin_no != RESET_BUTTON) && (pin_no != LIGHT_BUTTON) && (pin_no != OTA_BUTTON) && (pin_no != BLE_BUTTON)) + if ((pin_no != RESET_BUTTON) && (pin_no != LIGHT_BUTTON) && (pin_no != SOFT_RESET_BUTTON) && (pin_no != BLE_BUTTON)) { return; } @@ -353,9 +369,10 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) { button_event.Handler = LightActionEventHandler; } - else if (pin_no == OTA_BUTTON) + else if (pin_no == SOFT_RESET_BUTTON) { - // button_event.Handler = OTAHandler; + // Soft reset ensures that platform manager shutdown procedure is called. + button_event.Handler = SoftResetHandler; } else if (pin_no == BLE_BUTTON) { @@ -379,7 +396,7 @@ button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_messa switch (pinNb) { case BLE_BUTTON: - K32W_LOG("pb1 short press"); + // K32W_LOG("pb1 short press"); if (sAppTask.mResetTimerActive) { ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH); @@ -391,7 +408,7 @@ button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_messa break; case LIGHT_BUTTON: - K32W_LOG("pb2 short press"); + // K32W_LOG("pb2 short press"); ButtonEventHandler(LIGHT_BUTTON, LIGHT_BUTTON_PUSH); break; } @@ -401,13 +418,13 @@ button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_messa switch (pinNb) { case BLE_BUTTON: - K32W_LOG("pb1 long press"); + // K32W_LOG("pb1 long press"); ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH); break; case LIGHT_BUTTON: - K32W_LOG("pb2 long press"); - ButtonEventHandler(OTA_BUTTON, OTA_BUTTON_PUSH); + // K32W_LOG("pb2 long press"); + ButtonEventHandler(SOFT_RESET_BUTTON, SOFT_RESET_BUTTON_PUSH); break; } break; @@ -529,29 +546,14 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) } } -void AppTask::OTAHandler(AppEvent * aEvent) +void AppTask::SoftResetHandler(AppEvent * aEvent) { - if (aEvent->ButtonEvent.PinNo != OTA_BUTTON) + if (aEvent->ButtonEvent.PinNo != SOFT_RESET_BUTTON) return; -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - if (sAppTask.mFunction != kFunction_NoneSelected) - { - K32W_LOG("Another function is scheduled. Could not initiate OTA!"); - return; - } - - PlatformMgr().ScheduleWork(StartOTAQuery, 0); -#endif + PlatformMgrImpl().CleanReset(); } -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -void AppTask::StartOTAQuery(intptr_t arg) -{ - GetRequestorInstance()->TriggerImmediateQuery(); -} -#endif - void AppTask::BleHandler(AppEvent * aEvent) { if (aEvent->ButtonEvent.PinNo != BLE_BUTTON) @@ -807,11 +809,24 @@ void AppTask::PostTurnOnActionRequest(int32_t aActor, LightingManager::Action_t void AppTask::PostEvent(const AppEvent * aEvent) { + portBASE_TYPE taskToWake = pdFALSE; if (sAppEventQueue != NULL) { - if (!xQueueSend(sAppEventQueue, aEvent, 1)) + if (__get_IPSR()) + { + if (!xQueueSendToFrontFromISR(sAppEventQueue, aEvent, &taskToWake)) + { + K32W_LOG("Failed to post event to app task event queue"); + } + + portYIELD_FROM_ISR(taskToWake); + } + else { - K32W_LOG("Failed to post event to app task event queue"); + if (!xQueueSend(sAppEventQueue, aEvent, 1)) + { + K32W_LOG("Failed to post event to app task event queue"); + } } } } @@ -838,10 +853,10 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg) uint8_t newValue = !LightingMgr().IsTurnedOff(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating on/off %x", status); + ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h b/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h index db81edf168c41e..b5201da2477862 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h +++ b/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h @@ -27,6 +27,10 @@ #include #include +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA +#include +#endif + #include "FreeRTOS.h" #include "fsl_component_button.h" #include "timers.h" @@ -42,6 +46,9 @@ class AppTask { public: +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; +#endif CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); @@ -56,6 +63,7 @@ class AppTask static void OnIdentifyStop(Identify * identify); static void OnTriggerEffect(Identify * identify); static void OnTriggerEffectComplete(chip::System::Layer * systemLayer, void * appState); + static void ButtonEventHandler(uint8_t pin_no, uint8_t button_action); private: friend AppTask & GetAppTask(void); @@ -71,14 +79,13 @@ class AppTask static void FunctionTimerEventHandler(AppEvent * aEvent); static button_status_t KBD_Callback(void * buttonHandle, button_callback_message_t * message, void * callbackParam); - static void OTAHandler(AppEvent * aEvent); + static void SoftResetHandler(AppEvent * aEvent); static void BleHandler(AppEvent * aEvent); static void BleStartAdvertising(intptr_t arg); static void LightActionEventHandler(AppEvent * aEvent); static void ResetActionEventHandler(AppEvent * aEvent); static void InstallEventHandler(AppEvent * aEvent); - static void ButtonEventHandler(uint8_t pin_no, uint8_t button_action); static void TimerEventHandler(TimerHandle_t xTimer); static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h b/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h index ff938f494b089d..1478b53b11aba1 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h +++ b/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h @@ -22,12 +22,12 @@ #define RESET_BUTTON 1 #define LIGHT_BUTTON 2 -#define OTA_BUTTON 3 +#define SOFT_RESET_BUTTON 3 #define BLE_BUTTON 4 #define RESET_BUTTON_PUSH 1 #define LIGHT_BUTTON_PUSH 2 -#define OTA_BUTTON_PUSH 3 +#define SOFT_RESET_BUTTON_PUSH 3 #define BLE_BUTTON_PUSH 4 #define APP_BUTTON_PUSH 1 diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp index 7ebd3f3ed3b1b7..53a6efbbb3ffd5 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp +++ b/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp @@ -35,6 +35,7 @@ #include "FreeRtosHooks.h" #include "app_config.h" +#include "pin_mux.h" using namespace ::chip; using namespace ::chip::Inet; @@ -43,6 +44,10 @@ using namespace ::chip::Logging; #include +#if PW_RPC_ENABLED +#include "Rpc.h" +#endif + typedef void (*InitFunc)(void); extern InitFunc __init_array_start; extern InitFunc __init_array_end; @@ -69,6 +74,17 @@ extern "C" void main_task(void const * argument) /* Used for HW initializations */ otSysInit(0, NULL); +#if PW_RPC_ENABLED + /* set clock */ + CLOCK_SetIpSrc(kCLOCK_Lpuart1, kCLOCK_IpSrcFro192M); + /* enable clock */ + CLOCK_EnableClock(kCLOCK_Lpuart1); + + BOARD_InitPinLPUART1_TX(); + BOARD_InitPinLPUART1_RX(); + chip::rpc::Init(); +#endif + K32W_LOG("Welcome to NXP Lighting Demo App"); /* Mbedtls Threading support is needed because both diff --git a/examples/lighting-app/nxp/k32w/k32w1/with_pw_rpc.gni b/examples/lighting-app/nxp/k32w/k32w1/with_pw_rpc.gni new file mode 100644 index 00000000000000..d6bea63f8402c0 --- /dev/null +++ b/examples/lighting-app/nxp/k32w/k32w1/with_pw_rpc.gni @@ -0,0 +1,33 @@ +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") +import("${chip_root}/config/nxp/lib/pw_rpc/pw_rpc.gni") +import("${chip_root}/examples/platform/nxp/k32w/k32w1/args.gni") + +k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") + +chip_enable_ota_requestor = true +chip_stack_lock_tracking = "fatal" +chip_enable_ble = true +chip_enable_pw_rpc = true +chip_with_ot_cli = 0 +is_debug = false +chip_openthread_ftd = true +chip_crypto = "platform" + +cpp_standard = "gnu++17" diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index 9f4e9c51e5e5c3..5241ba629863ab 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -1522,7 +1522,7 @@ cluster GroupKeyManagement = 63 { } endpoint 0 { - device type ma_rootdevice = 22, version 1; + device type ma_rootdevice = 22, version 2; binding cluster OtaSoftwareUpdateProvider; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.zap b/examples/lighting-app/nxp/zap/lighting-on-off.zap index e7f1d48c378d29..8873c5e9732c85 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.zap +++ b/examples/lighting-app/nxp/zap/lighting-on-off.zap @@ -51,7 +51,7 @@ } ], "deviceVersions": [ - 1 + 2 ], "deviceIdentifiers": [ 22 @@ -3994,5 +3994,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index 4dafde6ac41960..2bc0ffafec5d2a 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -642,18 +642,19 @@ void AppTask::UpdateClusterState(void) ChipLogProgress(NotSpecified, "UpdateClusterState"); // Write the new on/off value - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(QPG_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn()); + Protocols::InteractionModel::Status status = + Clusters::OnOff::Attributes::OnOff::Set(QPG_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating on/off %x", status); + ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status)); } // Write new level value status = Clusters::LevelControl::Attributes::CurrentLevel::Set(QPG_LIGHT_ENDPOINT_ID, LightingMgr().GetLevel()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating level %x", status); + ChipLogError(NotSpecified, "ERR: updating level %x", to_underlying(status)); } }); } diff --git a/examples/lighting-app/qpg/src/ZclCallbacks.cpp b/examples/lighting-app/qpg/src/ZclCallbacks.cpp index 0b75837a64a8cc..e2255bd4e76684 100644 --- a/examples/lighting-app/qpg/src/ZclCallbacks.cpp +++ b/examples/lighting-app/qpg/src/ZclCallbacks.cpp @@ -78,15 +78,15 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & { xy.x = *reinterpret_cast(value); // get Y from cluster value storage - EmberAfStatus status = ColorControl::Attributes::CurrentY::Get(endpoint, &xy.y); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Protocols::InteractionModel::Status status = ColorControl::Attributes::CurrentY::Get(endpoint, &xy.y); + assert(status == Protocols::InteractionModel::Status::Success); } if (attributeId == ColorControl::Attributes::CurrentY::Id) { xy.y = *reinterpret_cast(value); // get X from cluster value storage - EmberAfStatus status = ColorControl::Attributes::CurrentX::Get(endpoint, &xy.x); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Protocols::InteractionModel::Status status = ColorControl::Attributes::CurrentX::Get(endpoint, &xy.x); + assert(status == Protocols::InteractionModel::Status::Success); } ChipLogProgress(Zcl, "New XY color: %u|%u", xy.x, xy.y); @@ -108,22 +108,22 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & // We only support 8-bit hue. Assuming hue is linear, normalize 16-bit to 8-bit. hsv.h = (uint8_t) ((*reinterpret_cast(value)) >> 8); // get saturation from cluster value storage - EmberAfStatus status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Protocols::InteractionModel::Status status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s); + assert(status == Protocols::InteractionModel::Status::Success); } else if (attributeId == ColorControl::Attributes::CurrentHue::Id) { hsv.h = *value; // get saturation from cluster value storage - EmberAfStatus status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Protocols::InteractionModel::Status status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s); + assert(status == Protocols::InteractionModel::Status::Success); } else if (attributeId == ColorControl::Attributes::CurrentSaturation::Id) { hsv.s = *value; // get hue from cluster value storage - EmberAfStatus status = ColorControl::Attributes::CurrentHue::Get(endpoint, &hsv.h); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Protocols::InteractionModel::Status status = ColorControl::Attributes::CurrentHue::Get(endpoint, &hsv.h); + assert(status == Protocols::InteractionModel::Status::Success); } ChipLogProgress(Zcl, "New HSV color: %u|%u", hsv.h, hsv.s); LightingMgr().InitiateAction(LightingManager::COLOR_ACTION_HSV, 0, sizeof(hsv), (uint8_t *) &hsv); @@ -164,11 +164,11 @@ void emberAfOnOffClusterInitCallback(EndpointId endpoint) XyColor_t xy; bool onOffValue = false; app::DataModel::Nullable currentLevel; - EmberAfStatus status; + Protocols::InteractionModel::Status status; status = OnOff::Attributes::OnOff::Get(1, &onOffValue); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Protocols::InteractionModel::Status::Success) { LightingMgr().InitiateAction(onOffValue ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION, 0, 1, (uint8_t *) onOffValue); @@ -176,7 +176,7 @@ void emberAfOnOffClusterInitCallback(EndpointId endpoint) /* restore values saved by DeferredAttributePersistenceProvider */ status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS || currentLevel.IsNull()) + if (status != Protocols::InteractionModel::Status::Success || currentLevel.IsNull()) { return; } @@ -184,12 +184,12 @@ void emberAfOnOffClusterInitCallback(EndpointId endpoint) levelValue = currentLevel.Value(); status = ColorControl::Attributes::CurrentY::Get(endpoint, &xy.y); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { return; } status = ColorControl::Attributes::CurrentX::Get(endpoint, &xy.x); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { return; } diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index 542dc2fbfd55c8..bce7b06cb5cb07 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -246,10 +246,10 @@ void AppTask::UpdateClusterState(intptr_t context) uint8_t newValue = LightMgr().IsLightOn(); // write the new on/off value - EmberAfStatus status = OnOffServer::Instance().setOnOffValue(1, newValue, false); + Protocols::InteractionModel::Status status = OnOffServer::Instance().setOnOffValue(1, newValue, false); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - SILABS_LOG("ERR: updating on/off %x", status); + SILABS_LOG("ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp b/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp index 4b9d5427adc8f4..d102f8a9dfd421 100644 --- a/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp +++ b/examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp @@ -444,17 +444,18 @@ void AppTask::UpdateClusterState(void) { ChipLogProgress(NotSpecified, "UpdateClusterState"); // Write the new on/off value - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(STM32_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = + Clusters::OnOff::Attributes::OnOff::Set(STM32_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn()); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating on/off %x", status); + ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status)); } // Write new level value status = Clusters::LevelControl::Attributes::CurrentLevel::Set(STM32_LIGHT_ENDPOINT_ID, LightingMgr().GetLevel()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating level %x", status); + ChipLogError(NotSpecified, "ERR: updating level %x", to_underlying(status)); } } diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index fde4a836c90886..54dd2703c16ce9 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -204,7 +204,7 @@ void AppTask::ActionCompleted(PWMDevice::Action_t aAction, int32_t aActor) void AppTask::UpdateClusterState(void) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; bool isTurnedOn; uint8_t setLevel; @@ -240,15 +240,15 @@ void AppTask::UpdateClusterState(void) // write the new on/off value status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Update OnOff fail: %x", status); + LOG_ERR("Update OnOff fail: %x", to_underlying(status)); } status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kExampleEndpointId, setLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("Update CurrentLevel fail: %x", status); + LOG_ERR("Update CurrentLevel fail: %x", to_underlying(status)); } } diff --git a/examples/lighting-app/telink/src/ZclCallbacks.cpp b/examples/lighting-app/telink/src/ZclCallbacks.cpp index 53649639507142..7aebb1ba69bae1 100644 --- a/examples/lighting-app/telink/src/ZclCallbacks.cpp +++ b/examples/lighting-app/telink/src/ZclCallbacks.cpp @@ -130,12 +130,12 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & */ void emberAfOnOffClusterInitCallback(EndpointId endpoint) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; bool storedValue; // Read storedValue on/off value status = Attributes::OnOff::Get(1, &storedValue); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Protocols::InteractionModel::Status::Success) { // Set actual state to stored before reboot GetAppTask().GetLightingDevice().Set(storedValue); diff --git a/examples/lighting-app/tizen/BUILD.gn b/examples/lighting-app/tizen/BUILD.gn index c0a38e7c113a91..66b508b74e3284 100644 --- a/examples/lighting-app/tizen/BUILD.gn +++ b/examples/lighting-app/tizen/BUILD.gn @@ -12,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("//build_overrides/tizen.gni") +import("${build_root}/config/linux/pkg_config.gni") import("${chip_root}/build/chip/linux/gdbus_library.gni") import("${chip_root}/build/chip/tools.gni") import("${chip_root}/src/app/common_flags.gni") @@ -27,6 +29,10 @@ declare_args() { chip_examples_enable_ui = false } +pkg_config("capi-system-peripheral-io") { + packages = [ "capi-system-peripheral-io" ] +} + gdbus_library("chip-lighting-app-manager") { sources = [ "xml/DBusLightApp.xml" ] interface_prefix = "org.tizen.matter.example.lighting" @@ -50,6 +56,8 @@ executable("chip-lighting-app") { "${chip_root}/src/lib", ] + configs += [ ":capi-system-peripheral-io" ] + if (chip_examples_enable_ui) { sources += [ "src/DBusInterface.cpp" ] deps += [ ":chip-lighting-app-manager" ] diff --git a/examples/lighting-app/tizen/src/DBusInterface.cpp b/examples/lighting-app/tizen/src/DBusInterface.cpp index 7c6e29d6a1cc38..e39ca5c1e1232c 100644 --- a/examples/lighting-app/tizen/src/DBusInterface.cpp +++ b/examples/lighting-app/tizen/src/DBusInterface.cpp @@ -206,7 +206,8 @@ void DBusInterface::InitOnOff() { bool isOn = false; auto status = Clusters::OnOff::Attributes::OnOff::Get(mEndpointId, &isOn); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(NotSpecified, "Error getting OnOff: 0x%x", status)); + VerifyOrReturn(status == Protocols::InteractionModel::Status::Success, + ChipLogError(NotSpecified, "Error getting OnOff: 0x%x", to_underlying(status))); light_app_on_off_set_on_off(mIfaceOnOff, isOn); } @@ -215,14 +216,15 @@ void DBusInterface::InitColor() { uint8_t value = 0; auto status = Clusters::ColorControl::Attributes::ColorMode::Get(mEndpointId, &value); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(NotSpecified, "Error getting ColorMode: 0x%x", status)); + VerifyOrReturn(status == Protocols::InteractionModel::Status::Success, + ChipLogError(NotSpecified, "Error getting ColorMode: 0x%x", to_underlying(status))); light_app_color_control_set_color_mode(mIfaceColorControl, value); } { uint16_t value = 0; auto status = Clusters::ColorControl::Attributes::ColorTemperatureMireds::Get(mEndpointId, &value); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, - ChipLogError(NotSpecified, "Error getting ColorTemperatureMireds: 0x%x", status)); + VerifyOrReturn(status == Protocols::InteractionModel::Status::Success, + ChipLogError(NotSpecified, "Error getting ColorTemperatureMireds: 0x%x", to_underlying(status))); light_app_color_control_set_color_temperature_mireds(mIfaceColorControl, value); } } diff --git a/examples/lighting-app/tizen/src/LedManager.cpp b/examples/lighting-app/tizen/src/LedManager.cpp index 0848675c7c0fef..474ba612287f16 100644 --- a/examples/lighting-app/tizen/src/LedManager.cpp +++ b/examples/lighting-app/tizen/src/LedManager.cpp @@ -62,7 +62,8 @@ void LedManager::InitOnOff() { bool isOn = false; auto status = Clusters::OnOff::Attributes::OnOff::Get(mEndpointId, &isOn); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(NotSpecified, "Error getting OnOff: 0x%x", status)); + VerifyOrReturn(status == Protocols::InteractionModel::Status::Success, + ChipLogError(NotSpecified, "Error getting OnOff: 0x%x", to_underlying(status))); SetOnOff(isOn); } diff --git a/examples/lit-icd-app/linux/args.gni b/examples/lit-icd-app/linux/args.gni index c1421b0c721f9b..09ea58ef2a51d5 100644 --- a/examples/lit-icd-app/linux/args.gni +++ b/examples/lit-icd-app/linux/args.gni @@ -30,3 +30,4 @@ matter_enable_tracing_support = true chip_enable_icd_server = true chip_subscription_timeout_resumption = false chip_icd_report_on_active_mode = true +chip_enable_icd_lit = true diff --git a/examples/lit-icd-app/silabs/README.md b/examples/lit-icd-app/silabs/README.md index f359eacbd23cf4..07ec9c320bcb36 100644 --- a/examples/lit-icd-app/silabs/README.md +++ b/examples/lit-icd-app/silabs/README.md @@ -241,22 +241,30 @@ combination with JLinkRTTClient as follows: [SVR] Copy/paste the below URL in a browser to see the QR Code: [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0 - **LED 0** shows the overall state of the device and its connectivity. The - following states are possible: + **LED 0** - - Short Flash On (50 ms on/950 ms off): The device is in the + - ICD Configuration (Default) - LED is only active under two circumstances: + + 1. Factory reset sequence - LED will blink when initiated upon press and hold of + Button 0 after 3 seconds + 2. An Identify command was received + + - Non-ICD Configuration - shows the overall state of the device and its connectivity. The + following states are possible: + + Short Flash On (50 ms on/950 ms off): The device is in the unprovisioned (unpaired) state and is waiting for a commissioning application to connect. - - Rapid Even Flashing (100 ms on/100 ms off): The device is in the + Rapid Even Flashing (100 ms on/100 ms off): The device is in the unprovisioned state and a commissioning application is connected through Bluetooth LE. - - Short Flash Off (950ms on/50ms off): The device is fully + Short Flash Off (950ms on/50ms off): The device is fully provisioned, but does not yet have full Thread network or service connectivity. - - Solid On: The device is fully provisioned and has full Thread + Solid On: The device is fully provisioned and has full Thread network and service connectivity. **Push Button 0** diff --git a/examples/lit-icd-app/silabs/build_for_wifi_args.gni b/examples/lit-icd-app/silabs/build_for_wifi_args.gni index 630cb65b53f45d..3531a31ffde406 100644 --- a/examples/lit-icd-app/silabs/build_for_wifi_args.gni +++ b/examples/lit-icd-app/silabs/build_for_wifi_args.gni @@ -28,8 +28,9 @@ chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_synching = true icd_enforce_sit_slow_poll_limit = true +chip_enable_icd_lit = true # ICD Matter Configuration flags -sl_idle_mode_interval_s = 3600 # 60min Idle Mode Interval -sl_active_mode_interval_ms = 0 # 0 Active Mode Interval +sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration +sl_active_mode_duration_ms = 0 # 0 Active Mode Duration sl_active_mode_threshold_ms = 30000 # 30s Active Mode Threshold diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index 69bd7b88e6bdc6..9d06737d622a2d 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -32,12 +32,13 @@ chip_subscription_timeout_resumption = false sl_use_subscription_synching = true icd_enforce_sit_slow_poll_limit = true chip_icd_report_on_active_mode = true +chip_enable_icd_lit = true # Openthread Configuration flags sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval sl_ot_active_interval_ms = 1000 # 1000ms Active Polling Interval # ICD Matter Configuration flags -sl_idle_mode_interval_s = 3600 # 60min Idle Mode Interval -sl_active_mode_interval_ms = 0 # 0 Active Mode Interval +sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration +sl_active_mode_duration_ms = 0 # 0 Active Mode Duration sl_active_mode_threshold_ms = 5000 # 5s Active Mode Threshold diff --git a/examples/lock-app/asr/src/AppTask.cpp b/examples/lock-app/asr/src/AppTask.cpp old mode 100755 new mode 100644 index 36d53399a991f1..a90d0013761324 --- a/examples/lock-app/asr/src/AppTask.cpp +++ b/examples/lock-app/asr/src/AppTask.cpp @@ -480,11 +480,12 @@ void AppTask::UpdateCluster(intptr_t context) OperationSourceEnum source = OperationSourceEnum::kUnspecified; // write the new lock value - EmberAfStatus status = - DoorLockServer::Instance().SetLockState(1, newState, source) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = DoorLockServer::Instance().SetLockState(1, newState, source) + ? Protocols::InteractionModel::Status::Success + : Protocols::InteractionModel::Status::Failure; + if (status != Protocols::InteractionModel::Status::Success) { - ASR_LOG("ERR: updating lock state %x", status); + ASR_LOG("ERR: updating lock state %x", to_underlying(status)); } } diff --git a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn index db4f599aad8f79..8cf4f38dc771f2 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn @@ -55,7 +55,7 @@ ti_sysconfig("sysconfig") { ] } - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/lock-app/cc13x4_26x4/BUILD.gn b/examples/lock-app/cc13x4_26x4/BUILD.gn index 67560cd7469f41..aed45f85bce94b 100644 --- a/examples/lock-app/cc13x4_26x4/BUILD.gn +++ b/examples/lock-app/cc13x4_26x4/BUILD.gn @@ -59,7 +59,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/lock-app/esp32/main/AppTask.cpp b/examples/lock-app/esp32/main/AppTask.cpp index e6a8519b782c18..fbca981316f69b 100644 --- a/examples/lock-app/esp32/main/AppTask.cpp +++ b/examples/lock-app/esp32/main/AppTask.cpp @@ -23,7 +23,7 @@ #include #include #include -#include + #include #include #include @@ -468,9 +468,9 @@ void AppTask::UpdateClusterState(intptr_t context) uint8_t newValue = !BoltLockMgr().IsUnlocked(); // write the new on/off value - EmberAfStatus status = chip::app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = chip::app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ESP_LOGI(TAG, "ERR: updating on/off %x", status); + ESP_LOGI(TAG, "ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/lock-app/genio/src/AppTask.cpp b/examples/lock-app/genio/src/AppTask.cpp index 2b331d3cfafd33..7a438dd4974d3d 100644 --- a/examples/lock-app/genio/src/AppTask.cpp +++ b/examples/lock-app/genio/src/AppTask.cpp @@ -596,11 +596,12 @@ void AppTask::UpdateClusterState(intptr_t context) OperationSourceEnum source = OperationSourceEnum::kUnspecified; // write the new lock value - EmberAfStatus status = - DoorLockServer::Instance().SetLockState(1, newState, source) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; + Protocols::InteractionModel::Status status = DoorLockServer::Instance().SetLockState(1, newState, source) + ? Protocols::InteractionModel::Status::Success + : Protocols::InteractionModel::Status::Failure; - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - MT793X_LOG("ERR: updating lock state %x", status); + MT793X_LOG("ERR: updating lock state %x", to_underlying(status)); } } diff --git a/examples/lock-app/genio/src/ZclCallbacks.cpp b/examples/lock-app/genio/src/ZclCallbacks.cpp index 12688358f0feee..88ebaf641d86c7 100644 --- a/examples/lock-app/genio/src/ZclCallbacks.cpp +++ b/examples/lock-app/genio/src/ZclCallbacks.cpp @@ -61,45 +61,45 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & */ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; status = DoorLock::Attributes::LockType::Set(endpoint, DlLockType::kDeadBolt); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set LockType %x", status); + ChipLogError(Zcl, "Failed to set LockType %x", to_underlying(status)); } status = DoorLock::Attributes::NumberOfTotalUsersSupported::Set(endpoint, CONFIG_LOCK_NUM_USERS); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set number of users %x", status); + ChipLogError(Zcl, "Failed to set number of users %x", to_underlying(status)); } status = DoorLock::Attributes::NumberOfPINUsersSupported::Set(endpoint, CONFIG_LOCK_NUM_USERS); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set number of PIN users %x", status); + ChipLogError(Zcl, "Failed to set number of PIN users %x", to_underlying(status)); } status = DoorLock::Attributes::NumberOfRFIDUsersSupported::Set(endpoint, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set number of RFID users %x", status); + ChipLogError(Zcl, "Failed to set number of RFID users %x", to_underlying(status)); } status = DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Set(endpoint, CONFIG_LOCK_NUM_CREDENTIALS_PER_USER); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set number of credentials per user %x", status); + ChipLogError(Zcl, "Failed to set number of credentials per user %x", to_underlying(status)); } // Note: Due to current logic of credential, do not enable PIN and RFID // at the same time. // Set FeatureMap to (kUser|kPinCredential) status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0x101); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set number of credentials per user %x", status); + ChipLogError(Zcl, "Failed to set number of credentials per user %x", to_underlying(status)); } } diff --git a/examples/lock-app/infineon/cyw30739/src/main.cpp b/examples/lock-app/infineon/cyw30739/src/main.cpp index a0a92487a807bc..c82cc894bae5af 100644 --- a/examples/lock-app/infineon/cyw30739/src/main.cpp +++ b/examples/lock-app/infineon/cyw30739/src/main.cpp @@ -324,12 +324,13 @@ void UpdateClusterState(intptr_t context) OperationSourceEnum source = OperationSourceEnum::kUnspecified; // write the new lock value - EmberAfStatus status = - DoorLockServer::Instance().SetLockState(1, newState, source) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; + Protocols::InteractionModel::Status status = DoorLockServer::Instance().SetLockState(1, newState, source) + ? Protocols::InteractionModel::Status::Success + : Protocols::InteractionModel::Status::Failure; - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "ERR: updating lock state %x", status); + ChipLogError(Zcl, "ERR: updating lock state %x", to_underlying(status)); } } diff --git a/examples/lock-app/infineon/psoc6/src/AppTask.cpp b/examples/lock-app/infineon/psoc6/src/AppTask.cpp index e3be287e024442..9f29e32e6c618a 100644 --- a/examples/lock-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lock-app/infineon/psoc6/src/AppTask.cpp @@ -660,11 +660,12 @@ void AppTask::UpdateCluster(intptr_t context) OperationSourceEnum source = OperationSourceEnum::kUnspecified; // write the new lock value - EmberAfStatus status = - DoorLockServer::Instance().SetLockState(1, newState, source) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = DoorLockServer::Instance().SetLockState(1, newState, source) + ? Protocols::InteractionModel::Status::Success + : Protocols::InteractionModel::Status::Failure; + if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating lock state %x", status); + P6_LOG("ERR: updating lock state %x", to_underlying(status)); } } diff --git a/examples/lock-app/mbed/main/AppTask.cpp b/examples/lock-app/mbed/main/AppTask.cpp index 4e1d0c70e943cc..2dd5a4463dcf74 100644 --- a/examples/lock-app/mbed/main/AppTask.cpp +++ b/examples/lock-app/mbed/main/AppTask.cpp @@ -461,9 +461,9 @@ void AppTask::UpdateClusterState() uint8_t newValue = !BoltLockMgr().IsUnlocked(); // write the new on/off value - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ZCL update failed: %lx", status); + ChipLogError(NotSpecified, "ZCL update failed: %lx", to_underlying(status)); } } diff --git a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp index 99ea77ee21adb9..63040970d9b9df 100644 --- a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp +++ b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp @@ -112,10 +112,10 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) { DoorLockServer::Instance().InitServer(endpoint); - const auto logOnFailure = [](EmberAfStatus status, const char * attributeName) { - if (status != EMBER_ZCL_STATUS_SUCCESS) + const auto logOnFailure = [](Protocols::InteractionModel::Status status, const char * attributeName) { + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, status); + ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, to_underlying(status)); } }; diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index 130569791e2e8e..7c6cffaf968c02 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -777,11 +777,11 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg) } // write the new door lock state - EmberAfStatus status = Attributes::LockState::Set(1, newValue); + chip::Protocols::InteractionModel::Status status = Attributes::LockState::Set(1, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != chip::Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating door lock state %x", status); + ChipLogError(NotSpecified, "ERR: updating door lock state %x", chip::to_underlying(status)); } } diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 54a4b2a5d2a3f3..7f9d922cc8558d 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -622,10 +622,10 @@ void AppTask::UpdateClusterState(void) if (currentLockState.IsNull()) { - EmberAfStatus status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: updating DoorLock %x", status); + ChipLogError(NotSpecified, "ERR: updating DoorLock %x", to_underlying(status)); } } else diff --git a/examples/lock-app/qpg/src/ZclCallbacks.cpp b/examples/lock-app/qpg/src/ZclCallbacks.cpp index 51751c43ed4058..05518bff13cabd 100644 --- a/examples/lock-app/qpg/src/ZclCallbacks.cpp +++ b/examples/lock-app/qpg/src/ZclCallbacks.cpp @@ -114,10 +114,10 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) { DoorLockServer::Instance().InitServer(endpoint); - const auto logOnFailure = [](EmberAfStatus status, const char * attributeName) { - if (status != EMBER_ZCL_STATUS_SUCCESS) + const auto logOnFailure = [](Protocols::InteractionModel::Status status, const char * attributeName) { + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, status); + ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, to_underlying(status)); } }; diff --git a/examples/lock-app/silabs/README.md b/examples/lock-app/silabs/README.md index 1bce8c431bee54..447fe3b9949995 100644 --- a/examples/lock-app/silabs/README.md +++ b/examples/lock-app/silabs/README.md @@ -262,22 +262,30 @@ combination with JLinkRTTClient as follows: [SVR] Copy/paste the below URL in a browser to see the QR Code: [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0 - **LED 0** shows the overall state of the device and its connectivity. The - following states are possible: + **LED 0** - - _Short Flash On (50 ms on/950 ms off)_ ; The device is in the + - ICD Configuration (Default) - LED is only active under two circumstances: + + 1. Factory reset sequence - LED will blink when initiated upon press and hold of + Button 0 after 3 seconds + 2. An Identify command was received + + - Non-ICD Configuration - shows the overall state of the device and its connectivity. The + following states are possible: + + Short Flash On (50 ms on/950 ms off): The device is in the unprovisioned (unpaired) state and is waiting for a commissioning application to connect. - - _Rapid Even Flashing_ ; (100 ms on/100 ms off)_ — The device is in the + Rapid Even Flashing (100 ms on/100 ms off): The device is in the unprovisioned state and a commissioning application is connected through Bluetooth LE. - - _Short Flash Off_ ; (950ms on/50ms off)_ — The device is fully + Short Flash Off (950ms on/50ms off): The device is fully provisioned, but does not yet have full Thread network or service connectivity. - - _Solid On_ ; The device is fully provisioned and has full Thread + Solid On: The device is fully provisioned and has full Thread network and service connectivity. **LED 1** Simulates the Lock The following states are possible: diff --git a/examples/lock-app/silabs/build_for_wifi_args.gni b/examples/lock-app/silabs/build_for_wifi_args.gni index a9a7ee66170687..25c5a2435d332f 100644 --- a/examples/lock-app/silabs/build_for_wifi_args.gni +++ b/examples/lock-app/silabs/build_for_wifi_args.gni @@ -27,6 +27,6 @@ chip_subscription_timeout_resumption = false sl_use_subscription_synching = true # ICD Matter Configuration flags -sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval -sl_active_mode_interval_ms = 10000 # 10s Active Mode Interval +sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration +sl_active_mode_duration_ms = 10000 # 10s Active Mode Duration sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold diff --git a/examples/lock-app/silabs/openthread.gni b/examples/lock-app/silabs/openthread.gni index cde56f8029f6da..3bfa566596aeaf 100644 --- a/examples/lock-app/silabs/openthread.gni +++ b/examples/lock-app/silabs/openthread.gni @@ -35,6 +35,6 @@ sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals sl_ot_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags -sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval -sl_active_mode_interval_ms = 10000 # 10s Active Mode Interval +sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration +sl_active_mode_duration_ms = 10000 # 10s Active Mode Duration sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold diff --git a/examples/lock-app/silabs/src/AppTask.cpp b/examples/lock-app/silabs/src/AppTask.cpp index 4e8527f4f4fa1a..2510fa7f351c03 100644 --- a/examples/lock-app/silabs/src/AppTask.cpp +++ b/examples/lock-app/silabs/src/AppTask.cpp @@ -353,11 +353,12 @@ void AppTask::UpdateClusterState(intptr_t context) DlLockState newState = unlocked ? DlLockState::kUnlocked : DlLockState::kLocked; // write the new lock value - EmberAfStatus status = - DoorLockServer::Instance().SetLockState(1, newState) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; + Protocols::InteractionModel::Status status = DoorLockServer::Instance().SetLockState(1, newState) + ? Protocols::InteractionModel::Status::Success + : Protocols::InteractionModel::Status::Failure; - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - SILABS_LOG("ERR: updating lock state %x", status); + SILABS_LOG("ERR: updating lock state %x", to_underlying(status)); } } diff --git a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h index 4e88aa1117c21e..7799ae6fc7574a 100644 --- a/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h +++ b/examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h @@ -22,7 +22,7 @@ #include #include #include -#include + #include #include #include diff --git a/examples/ota-requestor-app/esp32/main/main.cpp b/examples/ota-requestor-app/esp32/main/main.cpp index f8282ccdf22e30..c3ee1d5803b207 100644 --- a/examples/ota-requestor-app/esp32/main/main.cpp +++ b/examples/ota-requestor-app/esp32/main/main.cpp @@ -16,7 +16,6 @@ */ #include "DeviceCallbacks.h" -#include "app/util/af-enums.h" #include "app/util/af.h" #include "esp_heap_caps_init.h" #include "esp_log.h" diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn b/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn index ea0acea00155be..0a8930dff1adb2 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn @@ -46,7 +46,7 @@ ti_sysconfig("sysconfig") { "ti_drivers_config.h", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/platform/asr/shell/matter_shell.cpp b/examples/platform/asr/shell/matter_shell.cpp index dcd412af5f033e..bfa138f92ff0e5 100644 --- a/examples/platform/asr/shell/matter_shell.cpp +++ b/examples/platform/asr/shell/matter_shell.cpp @@ -83,12 +83,12 @@ void asr_matter_onoff(int value) { ChipLogProgress(Zcl, "updating on/off = %d", value); - EmberAfStatus status = chip::app::Clusters::OnOff::Attributes::OnOff::Set( + Protocols::InteractionModel::Status status = chip::app::Clusters::OnOff::Attributes::OnOff::Set( /* endpoint ID */ 1, (uint8_t *) &value); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogProgress(Zcl, "ERR: updating on/off %x", status); + ChipLogProgress(Zcl, "ERR: updating on/off %x", to_underlying(status)); } } diff --git a/examples/platform/nxp/PigweedLogger.cpp b/examples/platform/nxp/PigweedLogger.cpp new file mode 100644 index 00000000000000..8e7bf277e320fb --- /dev/null +++ b/examples/platform/nxp/PigweedLogger.cpp @@ -0,0 +1,111 @@ +/* + * + * 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. + */ + +/* + * @file PigweedLogger.cpp + * + * This file contains basic string writing function, based on Pigweed HDLC + * over UART transport. It allows to send log messages even if the application + * needs to use HDLC/UART for another purpose like the RPC server. + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "PigweedLogger.h" + +namespace PigweedLogger { +namespace { + +constexpr uint8_t kLogHdlcAddress = 1; // Send log messages to HDLC address 1 (other than RPC communication) +constexpr size_t kWriteBufferSize = 256; // Buffer for constructing HDLC frames + +// Exclusive access to the backend is needed to make sure that log messages coming +// from different threads are not interwoven. +SemaphoreHandle_t sLoggerLock; + +static pw::stream::SysIoWriter sWriter; +static size_t sWriteBufferPos; +static char sWriteBuffer[kWriteBufferSize]; + +static void send(void) +{ + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); + sWriteBufferPos = 0; +} + +} // namespace + +void Init(void) +{ + sLoggerLock = xSemaphoreCreateMutex(); + assert(sLoggerLock != NULL); + + pw_sys_io_Init(); +} + +int PutString(const char * buffer, size_t size) +{ + assert(sWriteBufferPos < kWriteBufferSize); + assert(size < kWriteBufferSize); + + Lock(); + + for (size_t i = 0; i < size; ++i) + { + // Send each line excluding "\r\n" in a separate frame + + if (buffer[i] == '\r') + continue; + + if (buffer[i] == '\n') + { + send(); + continue; + } + + sWriteBuffer[sWriteBufferPos++] = buffer[i]; + + if (sWriteBufferPos == kWriteBufferSize) + send(); + } + + Unlock(); + + return size; +} + +void Lock() +{ + xSemaphoreTake(sLoggerLock, portMAX_DELAY); +} + +void Unlock() +{ + xSemaphoreGive(sLoggerLock); +} + +} // namespace PigweedLogger diff --git a/examples/platform/nxp/PigweedLogger.h b/examples/platform/nxp/PigweedLogger.h new file mode 100644 index 00000000000000..8ea1da5dbae92b --- /dev/null +++ b/examples/platform/nxp/PigweedLogger.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace PigweedLogger { + +void Init(void); +int PutString(const char * buffer, size_t size); + +void Lock(); +void Unlock(); + +} // namespace PigweedLogger diff --git a/examples/platform/nxp/Rpc.cpp b/examples/platform/nxp/Rpc.cpp new file mode 100644 index 00000000000000..d9bf744382627c --- /dev/null +++ b/examples/platform/nxp/Rpc.cpp @@ -0,0 +1,144 @@ +/* + * + * 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. + */ + +#include "AppTask.h" +#include "FreeRTOS.h" +#include "PigweedLogger.h" +#include "PigweedLoggerMutex.h" +#include "pigweed/RpcService.h" +#include "task.h" + +#if defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE +#include "pigweed/rpc_services/Attributes.h" +#endif // defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +#include "pigweed/rpc_services/Button.h" +#endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE + +#if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE +#include "pigweed/rpc_services/Device.h" +#endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE + +#if defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE +#include "pigweed/rpc_services/Lighting.h" +#endif // defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE + +#if defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE +#include "pigweed/rpc_services/Locking.h" +#endif // defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE + +#define RPC_TASK_STACK_SIZE 2048 +#define RPC_TASK_PRIORITY 1 +TaskHandle_t RpcTaskHandle; + +namespace chip { +namespace rpc { + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +class NxpButton final : public Button +{ +public: + pw::Status Event(const chip_rpc_ButtonEvent & request, pw_protobuf_Empty & response) override + { + GetAppTask().ButtonEventHandler(request.idx, request.idx); + return pw::OkStatus(); + } +}; +#endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE + +#if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE +class NxpDevice final : public Device +{ +public: + pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override + { + mRebootTimer = xTimerCreate("Reboot", kRebootTimerPeriodTicks, false, nullptr, RebootHandler); + xTimerStart(mRebootTimer, pdMS_TO_TICKS(0)); + return pw::OkStatus(); + } + +private: + static constexpr TickType_t kRebootTimerPeriodTicks = 300; + TimerHandle_t mRebootTimer; + + static void RebootHandler(TimerHandle_t) { NVIC_SystemReset(); } +}; +#endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE + +namespace { + +#if defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE +Attributes attributes_service; +#endif // defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +NxpButton button_service; +#endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE + +#if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE +NxpDevice device_service; +#endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE + +#if defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE +Lighting lighting_service; +#endif // defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE + +#if defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE +Locking locking; +#endif // defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE + +void RegisterServices(pw::rpc::Server & server) +{ +#if defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE + server.RegisterService(attributes_service); +#endif // defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE + server.RegisterService(button_service); +#endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE + +#if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE + server.RegisterService(device_service); +#endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE + +#if defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE + server.RegisterService(lighting_service); +#endif // defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE + +#if defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE + server.RegisterService(locking); +#endif // defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE +} + +} // namespace + +void RunRpcService(void *) +{ + Start(RegisterServices, &logger_mutex); +} + +void Init() +{ + PigweedLogger::Init(); + + xTaskCreate(RunRpcService, "RPC_TASK", RPC_TASK_STACK_SIZE, nullptr, RPC_TASK_PRIORITY, &RpcTaskHandle); +} + +} // namespace rpc +} // namespace chip diff --git a/examples/platform/nxp/Rpc.h b/examples/platform/nxp/Rpc.h new file mode 100644 index 00000000000000..741fe7982883cc --- /dev/null +++ b/examples/platform/nxp/Rpc.h @@ -0,0 +1,30 @@ +/* + * + * 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. + */ + +#pragma once + +namespace chip { +namespace rpc { + +class LightingService; + +void Init(); +void RunRpcService(void *); + +} // namespace rpc +} // namespace chip diff --git a/examples/platform/nxp/k32w/k32w0/scripts/sign-outdir.py b/examples/platform/nxp/k32w/k32w0/scripts/sign-outdir.py index dfaf912ae5283d..ea4a888c9e3555 100644 --- a/examples/platform/nxp/k32w/k32w0/scripts/sign-outdir.py +++ b/examples/platform/nxp/k32w/k32w0/scripts/sign-outdir.py @@ -4,7 +4,7 @@ def main(args): - if os.environ["NXP_K32W0_SDK_ROOT"] != "": + if "NXP_K32W0_SDK_ROOT" in os.environ and os.environ["NXP_K32W0_SDK_ROOT"] != "": sign_images_path = os.environ["NXP_K32W0_SDK_ROOT"] + "/tools/imagetool/sign_images.sh" else: sign_images_path = os.getcwd() + "/../../../../../../../third_party/nxp/k32w0_sdk/repo/core/tools/imagetool/sign_images.sh" diff --git a/examples/platform/nxp/k32w/k32w1/BUILD.gn b/examples/platform/nxp/k32w/k32w1/BUILD.gn index 0a980406bce075..5cd2a8b31392c2 100644 --- a/examples/platform/nxp/k32w/k32w1/BUILD.gn +++ b/examples/platform/nxp/k32w/k32w1/BUILD.gn @@ -13,9 +13,11 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") -import("${k32w1_sdk_build_root}/k32w1_sdk.gni") +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") config("chip_examples_project_config") { include_dirs = [ diff --git a/examples/platform/nxp/k32w/k32w1/app/args.gni b/examples/platform/nxp/k32w/k32w1/app/args.gni index c09510c14df229..2705c251fb807d 100644 --- a/examples/platform/nxp/k32w/k32w1/app/args.gni +++ b/examples/platform/nxp/k32w/k32w1/app/args.gni @@ -16,11 +16,6 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/platform/nxp/k32w/k32w1/args.gni") -arm_float_abi = "hard" -arm_cpu = "cortex-m33" -arm_fpu = "fpv5-sp-d16" -arm_arch = "armv8-m.main+dsp+fp" - openthread_project_core_config_file = "OpenThreadConfig.h" chip_ble_project_config_include = "" diff --git a/examples/platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld b/examples/platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld index de9c882af9fed4..ac8f7bd65d0950 100644 --- a/examples/platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld +++ b/examples/platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld @@ -14,7 +14,7 @@ ** limitations under the License. */ -m_smu2_data_start = 0x489C0000; +m_smu2_data_start = 0x489C0080; m_smu2_data_end = 0x489C537B; m_smu2_data_size = m_smu2_data_end - m_smu2_data_start + 1; diff --git a/examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn b/examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn index dafa6de4d3d31d..dc688edc2c78ed 100644 --- a/examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn +++ b/examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn @@ -13,7 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") config("support_config") { include_dirs = [ "../../../../.." ] diff --git a/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c b/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c index 83549b1dc1f04a..a7c78a77440e03 100644 --- a/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c +++ b/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c @@ -51,10 +51,6 @@ #define APP_DBG_LOG(...) #endif -#if (configUSE_TICKLESS_IDLE != 0) -extern uint64_t PWR_TryEnterLowPower(uint64_t timeoutUs); -#endif - static inline void mutex_init(mbedtls_threading_mutex_t * p_mutex) { assert(p_mutex != NULL); @@ -123,7 +119,7 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime) if (abortIdle == false) { /* Enter low power with a maximal timeout */ - actualIdleTimeUs = PWR_TryEnterLowPower(expectedIdleTimeUs); + actualIdleTimeUs = PWR_EnterLowPower(expectedIdleTimeUs); /* Re enable systicks and compensate systick timebase */ PWR_SysticksPostProcess(expectedIdleTimeUs, actualIdleTimeUs); diff --git a/examples/platform/nxp/k32w/k32w1/app/support/Memconfig.cpp b/examples/platform/nxp/k32w/k32w1/app/support/Memconfig.cpp index e5acf5ea3ceecb..e05281fdee4f4d 100644 --- a/examples/platform/nxp/k32w/k32w1/app/support/Memconfig.cpp +++ b/examples/platform/nxp/k32w/k32w1/app/support/Memconfig.cpp @@ -40,6 +40,8 @@ #include #endif // CHIP_CONFIG_MEMORY_DEBUG_DMALLOC +#include "fsl_component_mem_manager.h" + /* Assumes 8bit bytes! */ #define heapBITS_PER_BYTE ((size_t) 8) @@ -64,42 +66,6 @@ static size_t xBlockAllocatedBit = ((size_t) 1) << ((sizeof(size_t) * heapBITS_P extern "C" { -/* xPortMallocUsableSize relies on heap4 implementation. -It returns the size of an allocated block and it is -called by __wrap_realloc. -Thus it is validated in __wrap_realloc function that the allocated size -of the old_ptr is smaller than the allocated size of new_ptr */ -size_t xPortMallocUsableSize(void * pv) -{ - uint8_t * puc = (uint8_t *) pv; - BlockLink_t * pxLink; - void * voidp; - size_t sz = 0; - - if (pv != NULL) - { - vTaskSuspendAll(); - { - /* The memory being checked will have an BlockLink_t structure immediately - before it. */ - puc -= xHeapStructSize; - - /* This casting is to keep the compiler from issuing warnings. */ - voidp = (void *) puc; - pxLink = (BlockLink_t *) voidp; - - /* Check if the block is actually allocated. */ - configASSERT((pxLink->xBlockSize & xBlockAllocatedBit) != 0); - configASSERT(pxLink->pxNextFreeBlock == NULL); - - sz = (pxLink->xBlockSize & ~xBlockAllocatedBit) - xHeapStructSize; - } - (void) xTaskResumeAll(); - } - - return sz; -} - void * __wrap_malloc(size_t size) { return pvPortMalloc(size); @@ -135,34 +101,22 @@ void * __wrap_calloc(size_t num, size_t size) void * __wrap_realloc(void * ptr, size_t new_size) { - void * new_ptr = NULL; if (new_size) { - size_t old_ptr_size = xPortMallocUsableSize(ptr); - if (new_size <= old_ptr_size) - { - /* Return old pointer if the newly allocated size is smaller - or equal to the allocated size for old_ptr */ - return ptr; - } - - /* if old_ptr is NULL, then old_ptr_size is zero and new_ptr will be returned */ - new_ptr = pvPortMalloc(new_size); + /* MML will only realloc a new pointer if the size is greater than old pointer size.*/ + vTaskSuspendAll(); + new_ptr = MEM_BufferRealloc(ptr, new_size); + xTaskResumeAll(); if (!new_ptr) { ChipLogError(DeviceLayer, "__wrap_realloc: Could not allocate memory!"); return NULL; } - - memset(reinterpret_cast(new_ptr) + old_ptr_size, 0, (new_size - old_ptr_size)); - memcpy(new_ptr, ptr, old_ptr_size); } - vPortFree(ptr); - return new_ptr; } diff --git a/examples/platform/nxp/pw_rpc_server.gni b/examples/platform/nxp/pw_rpc_server.gni new file mode 100644 index 00000000000000..0ec2d3b121b2d5 --- /dev/null +++ b/examples/platform/nxp/pw_rpc_server.gni @@ -0,0 +1,62 @@ +# 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. + +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +import("$dir_pw_build/target_types.gni") +import("${chip_root}/src/platform/device.gni") + +nxp_platform_dir = "${chip_root}/examples/platform/nxp" + +# Define a scope for pw RPC server dependencies. +# This .gni file should be imported by applications that want to use pw RPC. +# These variables shall be copied in the final executable target by adding +# forward_variables_from(pw_rpc_server, "*") in the beginning of the target scope. +pw_rpc_server = { + sources = [ + "${chip_root}/examples/common/pigweed/RpcService.cpp", + "${chip_root}/examples/common/pigweed/nxp/PigweedLoggerMutex.cpp", + "${nxp_platform_dir}/PigweedLogger.cpp", + "${nxp_platform_dir}/Rpc.cpp", + ] + + include_dirs = [ + "${chip_root}/examples/common", + "${chip_root}/examples/common/pigweed", + "${chip_root}/examples/common/pigweed/nxp", + "${nxp_platform_dir}", + ] + + defines = [ + "PW_RPC_ENABLED", + "PW_RPC_ATTRIBUTE_SERVICE=1", + "PW_RPC_BUTTON_SERVICE=1", + "PW_RPC_DEVICE_SERVICE=1", + "PW_RPC_LIGHTING_SERVICE=1", + ] + + deps = [ + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_stream:sys_io_stream", + "$dir_pw_trace", + "${chip_root}/config/nxp/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc", + "${nxp_platform_dir}/pw_sys_io:pw_sys_io_nxp", + ] + deps += pw_build_LINK_DEPS +} diff --git a/examples/platform/nxp/pw_sys_io/BUILD.gn b/examples/platform/nxp/pw_sys_io/BUILD.gn new file mode 100644 index 00000000000000..ed3d35246093f1 --- /dev/null +++ b/examples/platform/nxp/pw_sys_io/BUILD.gn @@ -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. + +import("//build_overrides/chip.gni") +import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/pigweed.gni") + +import("$dir_pw_build/target_types.gni") +import("${chip_root}/src/platform/device.gni") + +config("default_config") { + include_dirs = [ + "public", + "${chip_root}/src/", + ] +} + +pw_source_set("pw_sys_io_nxp") { + sources = [ + "${chip_root}/src/lib/shell/streamer_nxp.cpp", + "sys_io_nxp.cc", + ] + + deps = [ + "$dir_pw_sys_io:default_putget_bytes", + "$dir_pw_sys_io:facade", + "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_sdk", + ] + + public_configs = [ ":default_config" ] +} diff --git a/examples/platform/nxp/pw_sys_io/public/pw_sys_io_nxp/init.h b/examples/platform/nxp/pw_sys_io/public/pw_sys_io_nxp/init.h new file mode 100644 index 00000000000000..47d18772638d5f --- /dev/null +++ b/examples/platform/nxp/pw_sys_io/public/pw_sys_io_nxp/init.h @@ -0,0 +1,27 @@ +/* + * + * 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. + */ + +#pragma once + +#include "pw_preprocessor/util.h" + +PW_EXTERN_C_START + +// The actual implement of PreMainInit() in sys_io_BACKEND. +void pw_sys_io_Init(); + +PW_EXTERN_C_END diff --git a/examples/platform/nxp/pw_sys_io/sys_io_nxp.cc b/examples/platform/nxp/pw_sys_io/sys_io_nxp.cc new file mode 100644 index 00000000000000..8e729f0986bbb3 --- /dev/null +++ b/examples/platform/nxp/pw_sys_io/sys_io_nxp.cc @@ -0,0 +1,78 @@ +/* + * + * 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. + */ + +#include + +#include +#include +#include +#include + +#include + +int16_t console_getchar(char * chr) +{ + auto * streamer = chip::Shell::streamer_get(); + return static_cast(streamer->read_cb(nullptr, chr, 1)); +} + +int16_t console_putchar(const char * chr) +{ + auto * streamer = chip::Shell::streamer_get(); + return static_cast(streamer->write_cb(nullptr, chr, 1)); +} + +extern "C" void pw_sys_io_Init() +{ + auto * streamer = chip::Shell::streamer_get(); + streamer->init_cb(nullptr); +} + +namespace pw::sys_io { + +Status ReadByte(std::byte * dest) +{ + if (!dest) + return Status::InvalidArgument(); + + int16_t ret = console_getchar(reinterpret_cast(dest)); + return ret < 0 ? Status::FailedPrecondition() : OkStatus(); +} + +Status WriteByte(std::byte b) +{ + int16_t ret = console_putchar(reinterpret_cast(&b)); + return ret < 0 ? Status::FailedPrecondition() : OkStatus(); +} + +// Writes a string using pw::sys_io, and add newline characters at the end. +StatusWithSize WriteLine(const std::string_view & s) +{ + size_t chars_written = 0; + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); + if (!result.ok()) + { + return result; + } + chars_written += result.size(); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); + chars_written += result.size(); + + return StatusWithSize(result.status(), chars_written); +} + +} // namespace pw::sys_io diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 99be69fbbc9b14..bbfeee1fa679e1 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -32,7 +32,7 @@ declare_args() { sl_wfx_config_scan = true # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_transition = false + rs91x_wpa3_transition = true # use commissionable data for SiWx917 siwx917_commissionable_data = false diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index effbe038389f06..02f1317f55b643 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -32,7 +32,7 @@ declare_args() { sl_wfx_config_scan = true # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_transition = false + rs91x_wpa3_transition = true #default WiFi SSID chip_default_wifi_ssid = "" diff --git a/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn b/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn index 4c670552dc2baf..02e87a04f067f0 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn @@ -54,7 +54,7 @@ ti_sysconfig("sysconfig") { ] } - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp index 31f0846c412008..8ac373b643bfce 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -459,15 +459,15 @@ void AppTask::DispatchEvent(AppEvent * aEvent) void AppTask::InitOnOffClusterState() { - EmberAfStatus status; + Protocols::InteractionModel::Status status; ChipLogProgress(NotSpecified, "Init On/Off clusterstate"); // Write false as pump always boots in stopped mode status = OnOff::Attributes::OnOff::Set(ONOFF_CLUSTER_ENDPOINT, false); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Init On/Off state %x", status); + ChipLogError(NotSpecified, "ERR: Init On/Off state %x", to_underlying(status)); } } @@ -482,7 +482,7 @@ void AppTask::UpdateClusterState(void) void AppTask::UpdateCluster(intptr_t context) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; BitMask pumpStatus; ChipLogProgress(NotSpecified, "Update Cluster State"); @@ -501,126 +501,126 @@ void AppTask::UpdateCluster(intptr_t context) status = PumpConfigurationAndControl::Attributes::ControlMode::Set(PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Flow error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Flow error %x", to_underlying(status)); } status = PumpConfigurationAndControl::Attributes::ControlMode::Set( PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantPressure); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Pressure error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Pressure error %x", to_underlying(status)); } status = PumpConfigurationAndControl::Attributes::ControlMode::Set( PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Speed error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Speed error %x", to_underlying(status)); } status = PumpConfigurationAndControl::Attributes::ControlMode::Set( PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantTemperature); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Temperature error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Temperature error %x", to_underlying(status)); } // Write the new values bool onOffState = !PumpMgr().IsStopped(); status = OnOff::Attributes::OnOff::Set(ONOFF_CLUSTER_ENDPOINT, onOffState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", status); + ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", to_underlying(status)); } int16_t maxPressure = PumpMgr().GetMaxPressure(); status = PumpConfigurationAndControl::Attributes::MaxPressure::Set(PCC_CLUSTER_ENDPOINT, maxPressure); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxPressure %x", to_underlying(status)); } uint16_t maxSpeed = PumpMgr().GetMaxSpeed(); status = PumpConfigurationAndControl::Attributes::MaxSpeed::Set(PCC_CLUSTER_ENDPOINT, maxSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxSpeed %x", to_underlying(status)); } uint16_t maxFlow = PumpMgr().GetMaxFlow(); status = PumpConfigurationAndControl::Attributes::MaxFlow::Set(PCC_CLUSTER_ENDPOINT, maxFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxFlow %x", to_underlying(status)); } int16_t minConstPress = PumpMgr().GetMinConstPressure(); status = PumpConfigurationAndControl::Attributes::MinConstPressure::Set(PCC_CLUSTER_ENDPOINT, minConstPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstPressure %x", to_underlying(status)); } int16_t maxConstPress = PumpMgr().GetMaxConstPressure(); status = PumpConfigurationAndControl::Attributes::MaxConstPressure::Set(PCC_CLUSTER_ENDPOINT, maxConstPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstPressure %x", to_underlying(status)); } int16_t minCompPress = PumpMgr().GetMinCompPressure(); status = PumpConfigurationAndControl::Attributes::MinCompPressure::Set(PCC_CLUSTER_ENDPOINT, minCompPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinCompPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinCompPressure %x", to_underlying(status)); } int16_t maxCompPress = PumpMgr().GetMaxCompPressure(); status = PumpConfigurationAndControl::Attributes::MaxCompPressure::Set(PCC_CLUSTER_ENDPOINT, maxCompPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxCompPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxCompPressure %x", to_underlying(status)); } uint16_t minConstSpeed = PumpMgr().GetMinConstSpeed(); status = PumpConfigurationAndControl::Attributes::MinConstSpeed::Set(PCC_CLUSTER_ENDPOINT, minConstSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstSpeed %x", to_underlying(status)); } uint16_t maxConstSpeed = PumpMgr().GetMaxConstSpeed(); status = PumpConfigurationAndControl::Attributes::MaxConstSpeed::Set(PCC_CLUSTER_ENDPOINT, maxConstSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstSpeed %x", to_underlying(status)); } uint16_t minConstFlow = PumpMgr().GetMinConstFlow(); status = PumpConfigurationAndControl::Attributes::MinConstFlow::Set(PCC_CLUSTER_ENDPOINT, minConstFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstFlow %x", to_underlying(status)); } uint16_t maxConstFlow = PumpMgr().GetMaxConstFlow(); status = PumpConfigurationAndControl::Attributes::MaxConstFlow::Set(PCC_CLUSTER_ENDPOINT, maxConstFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstFlow %x", to_underlying(status)); } int16_t minConstTemp = PumpMgr().GetMinConstTemp(); status = PumpConfigurationAndControl::Attributes::MinConstTemp::Set(PCC_CLUSTER_ENDPOINT, minConstTemp); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstTemp %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstTemp %x", to_underlying(status)); } int16_t maxConstTemp = PumpMgr().GetMaxConstTemp(); status = PumpConfigurationAndControl::Attributes::MaxConstTemp::Set(PCC_CLUSTER_ENDPOINT, maxConstTemp); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstTemp %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstTemp %x", to_underlying(status)); } } diff --git a/examples/pump-app/cc13x4_26x4/BUILD.gn b/examples/pump-app/cc13x4_26x4/BUILD.gn index 7cbf21cc41140e..8c68ba70066315 100644 --- a/examples/pump-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-app/cc13x4_26x4/BUILD.gn @@ -62,7 +62,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index c98e99be1cb487..ea094e96767665 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -456,15 +456,15 @@ void AppTask::DispatchEvent(AppEvent * aEvent) void AppTask::InitOnOffClusterState() { - EmberAfStatus status; + Protocols::InteractionModel::Status status; ChipLogProgress(NotSpecified, "Init On/Off clusterstate"); // Write false as pump always boots in stopped mode status = OnOff::Attributes::OnOff::Set(ONOFF_CLUSTER_ENDPOINT, false); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Init On/Off state %x", status); + ChipLogError(NotSpecified, "ERR: Init On/Off state %x", to_underlying(status)); } } @@ -479,7 +479,7 @@ void AppTask::UpdateClusterState(void) void AppTask::UpdateCluster(intptr_t context) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; BitMask pumpStatus; ChipLogProgress(NotSpecified, "Update Cluster State"); @@ -498,126 +498,126 @@ void AppTask::UpdateCluster(intptr_t context) status = PumpConfigurationAndControl::Attributes::ControlMode::Set(PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Flow error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Flow error %x", to_underlying(status)); } status = PumpConfigurationAndControl::Attributes::ControlMode::Set( PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantPressure); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Pressure error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Pressure error %x", to_underlying(status)); } status = PumpConfigurationAndControl::Attributes::ControlMode::Set( PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Speed error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Speed error %x", to_underlying(status)); } status = PumpConfigurationAndControl::Attributes::ControlMode::Set( PCC_CLUSTER_ENDPOINT, PumpConfigurationAndControl::ControlModeEnum::kConstantTemperature); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Constant Temperature error %x", status); + ChipLogError(NotSpecified, "ERR: Constant Temperature error %x", to_underlying(status)); } // Write the new values bool onOffState = !PumpMgr().IsStopped(); status = OnOff::Attributes::OnOff::Set(ONOFF_CLUSTER_ENDPOINT, onOffState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", status); + ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", to_underlying(status)); } int16_t maxPressure = PumpMgr().GetMaxPressure(); status = PumpConfigurationAndControl::Attributes::MaxPressure::Set(PCC_CLUSTER_ENDPOINT, maxPressure); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxPressure %x", to_underlying(status)); } uint16_t maxSpeed = PumpMgr().GetMaxSpeed(); status = PumpConfigurationAndControl::Attributes::MaxSpeed::Set(PCC_CLUSTER_ENDPOINT, maxSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxSpeed %x", to_underlying(status)); } uint16_t maxFlow = PumpMgr().GetMaxFlow(); status = PumpConfigurationAndControl::Attributes::MaxFlow::Set(PCC_CLUSTER_ENDPOINT, maxFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxFlow %x", to_underlying(status)); } int16_t minConstPress = PumpMgr().GetMinConstPressure(); status = PumpConfigurationAndControl::Attributes::MinConstPressure::Set(PCC_CLUSTER_ENDPOINT, minConstPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstPressure %x", to_underlying(status)); } int16_t maxConstPress = PumpMgr().GetMaxConstPressure(); status = PumpConfigurationAndControl::Attributes::MaxConstPressure::Set(PCC_CLUSTER_ENDPOINT, maxConstPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstPressure %x", to_underlying(status)); } int16_t minCompPress = PumpMgr().GetMinCompPressure(); status = PumpConfigurationAndControl::Attributes::MinCompPressure::Set(PCC_CLUSTER_ENDPOINT, minCompPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinCompPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinCompPressure %x", to_underlying(status)); } int16_t maxCompPress = PumpMgr().GetMaxCompPressure(); status = PumpConfigurationAndControl::Attributes::MaxCompPressure::Set(PCC_CLUSTER_ENDPOINT, maxCompPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxCompPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxCompPressure %x", to_underlying(status)); } uint16_t minConstSpeed = PumpMgr().GetMinConstSpeed(); status = PumpConfigurationAndControl::Attributes::MinConstSpeed::Set(PCC_CLUSTER_ENDPOINT, minConstSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstSpeed %x", to_underlying(status)); } uint16_t maxConstSpeed = PumpMgr().GetMaxConstSpeed(); status = PumpConfigurationAndControl::Attributes::MaxConstSpeed::Set(PCC_CLUSTER_ENDPOINT, maxConstSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstSpeed %x", to_underlying(status)); } uint16_t minConstFlow = PumpMgr().GetMinConstFlow(); status = PumpConfigurationAndControl::Attributes::MinConstFlow::Set(PCC_CLUSTER_ENDPOINT, minConstFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstFlow %x", to_underlying(status)); } uint16_t maxConstFlow = PumpMgr().GetMaxConstFlow(); status = PumpConfigurationAndControl::Attributes::MaxConstFlow::Set(PCC_CLUSTER_ENDPOINT, maxConstFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstFlow %x", to_underlying(status)); } int16_t minConstTemp = PumpMgr().GetMinConstTemp(); status = PumpConfigurationAndControl::Attributes::MinConstTemp::Set(PCC_CLUSTER_ENDPOINT, minConstTemp); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstTemp %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstTemp %x", to_underlying(status)); } int16_t maxConstTemp = PumpMgr().GetMaxConstTemp(); status = PumpConfigurationAndControl::Attributes::MaxConstTemp::Set(PCC_CLUSTER_ENDPOINT, maxConstTemp); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstTemp %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstTemp %x", to_underlying(status)); } } diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 1426977d5028ec..3a6eb9023ded0a 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -562,7 +562,7 @@ void AppTask::DispatchEvent(const AppEvent & event) void AppTask::UpdateClusterState() { - EmberAfStatus status; + Protocols::InteractionModel::Status status; ChipLogProgress(NotSpecified, "UpdateClusterState"); @@ -571,99 +571,99 @@ void AppTask::UpdateClusterState() bool onOffState = !PumpMgr().IsStopped(); status = OnOff::Attributes::OnOff::Set(kOnOffClusterEndpoint, onOffState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", status); + ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", to_underlying(status)); } int16_t maxPressure = PumpMgr().GetMaxPressure(); status = PumpConfigurationAndControl::Attributes::MaxPressure::Set(kPccClusterEndpoint, maxPressure); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxPressure %x", to_underlying(status)); } uint16_t maxSpeed = PumpMgr().GetMaxSpeed(); status = PumpConfigurationAndControl::Attributes::MaxSpeed::Set(kPccClusterEndpoint, maxSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxSpeed %x", to_underlying(status)); } uint16_t maxFlow = PumpMgr().GetMaxFlow(); status = PumpConfigurationAndControl::Attributes::MaxFlow::Set(kPccClusterEndpoint, maxFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxFlow %x", to_underlying(status)); } int16_t minConstPress = PumpMgr().GetMinConstPressure(); status = PumpConfigurationAndControl::Attributes::MinConstPressure::Set(kPccClusterEndpoint, minConstPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstPressure %x", to_underlying(status)); } int16_t maxConstPress = PumpMgr().GetMaxConstPressure(); status = PumpConfigurationAndControl::Attributes::MaxConstPressure::Set(kPccClusterEndpoint, maxConstPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstPressure %x", to_underlying(status)); } int16_t minCompPress = PumpMgr().GetMinCompPressure(); status = PumpConfigurationAndControl::Attributes::MinCompPressure::Set(kPccClusterEndpoint, minCompPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinCompPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinCompPressure %x", to_underlying(status)); } int16_t maxCompPress = PumpMgr().GetMaxCompPressure(); status = PumpConfigurationAndControl::Attributes::MaxCompPressure::Set(kPccClusterEndpoint, maxCompPress); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxCompPressure %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxCompPressure %x", to_underlying(status)); } uint16_t minConstSpeed = PumpMgr().GetMinConstSpeed(); status = PumpConfigurationAndControl::Attributes::MinConstSpeed::Set(kPccClusterEndpoint, minConstSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstSpeed %x", to_underlying(status)); } uint16_t maxConstSpeed = PumpMgr().GetMaxConstSpeed(); status = PumpConfigurationAndControl::Attributes::MaxConstSpeed::Set(kPccClusterEndpoint, maxConstSpeed); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstSpeed %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstSpeed %x", to_underlying(status)); } uint16_t minConstFlow = PumpMgr().GetMinConstFlow(); status = PumpConfigurationAndControl::Attributes::MinConstFlow::Set(kPccClusterEndpoint, minConstFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstFlow %x", to_underlying(status)); } uint16_t maxConstFlow = PumpMgr().GetMaxConstFlow(); status = PumpConfigurationAndControl::Attributes::MaxConstFlow::Set(kPccClusterEndpoint, maxConstFlow); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstFlow %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstFlow %x", to_underlying(status)); } int16_t minConstTemp = PumpMgr().GetMinConstTemp(); status = PumpConfigurationAndControl::Attributes::MinConstTemp::Set(kPccClusterEndpoint, minConstTemp); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MinConstTemp %x", status); + ChipLogError(NotSpecified, "ERR: Updating MinConstTemp %x", to_underlying(status)); } int16_t maxConstTemp = PumpMgr().GetMaxConstTemp(); status = PumpConfigurationAndControl::Attributes::MaxConstTemp::Set(kPccClusterEndpoint, maxConstTemp); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating MaxConstTemp %x", status); + ChipLogError(NotSpecified, "ERR: Updating MaxConstTemp %x", to_underlying(status)); } } diff --git a/examples/pump-app/silabs/src/AppTask.cpp b/examples/pump-app/silabs/src/AppTask.cpp index 5b46641cd58dbc..365c53fc7a33ac 100644 --- a/examples/pump-app/silabs/src/AppTask.cpp +++ b/examples/pump-app/silabs/src/AppTask.cpp @@ -242,11 +242,11 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) void AppTask::UpdateClusterState(intptr_t context) { // Set On/Off state - EmberAfStatus status; + Protocols::InteractionModel::Status status; bool onOffState = !PumpMgr().IsStopped(); status = chip::app::Clusters::OnOff::Attributes::OnOff::Set(PCC_CLUSTER_ENDPOINT, onOffState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", status); + ChipLogError(NotSpecified, "ERR: Updating On/Off state %x", to_underlying(status)); } } diff --git a/examples/pump-app/telink/src/AppTask.cpp b/examples/pump-app/telink/src/AppTask.cpp index 4b443464879146..368702d51ae11f 100644 --- a/examples/pump-app/telink/src/AppTask.cpp +++ b/examples/pump-app/telink/src/AppTask.cpp @@ -131,10 +131,10 @@ void AppTask::UpdateClusterState() // Write the new values bool onOffState = !PumpMgr().IsStopped(); - EmberAfStatus status = Clusters::OnOff::Attributes::OnOff::Set(kOnOffClusterEndpoint, onOffState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = Clusters::OnOff::Attributes::OnOff::Set(kOnOffClusterEndpoint, onOffState); + if (status != Protocols::InteractionModel::Status::Success) { - LOG_ERR("ERR: Updating On/Off state %x", status); + LOG_ERR("ERR: Updating On/Off state %x", to_underlying(status)); } int16_t maxPressure = PumpMgr().GetMaxPressure(); diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn b/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn index fb118046b876c4..2d66a7f993158b 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn @@ -55,7 +55,7 @@ ti_sysconfig("sysconfig") { ] } - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn index c1b106f0feb1c2..289b10de001294 100644 --- a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn @@ -63,7 +63,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/rvc-app/rvc-common/include/rvc-operational-state-delegate.h b/examples/rvc-app/rvc-common/include/rvc-operational-state-delegate.h index 3081a27ea3e625..6522793ac94dc9 100644 --- a/examples/rvc-app/rvc-common/include/rvc-operational-state-delegate.h +++ b/examples/rvc-app/rvc-common/include/rvc-operational-state-delegate.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { diff --git a/examples/shell/cc13x2x7_26x2x7/BUILD.gn b/examples/shell/cc13x2x7_26x2x7/BUILD.gn index 5264bd079c02b0..80e342313aaca6 100644 --- a/examples/shell/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/shell/cc13x2x7_26x2x7/BUILD.gn @@ -59,7 +59,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/shell/cc13x4_26x4/BUILD.gn b/examples/shell/cc13x4_26x4/BUILD.gn index e6db696baa649c..2480f085783384 100644 --- a/examples/shell/cc13x4_26x4/BUILD.gn +++ b/examples/shell/cc13x4_26x4/BUILD.gn @@ -59,7 +59,7 @@ ti_sysconfig("sysconfig") { #"ti_build_config.opt", ] - public_configs = [ ":sdk_dmm_config" ] + public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ] cflags = [ "-Wno-comment", diff --git a/examples/smoke-co-alarm-app/telink/prj.conf b/examples/smoke-co-alarm-app/telink/prj.conf index 36f00385d93d53..3a6c279a6cb9dd 100755 --- a/examples/smoke-co-alarm-app/telink/prj.conf +++ b/examples/smoke-co-alarm-app/telink/prj.conf @@ -50,3 +50,5 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n # Enable Power Management CONFIG_PM=y + +CONFIG_CHIP_ICD_LIT_SUPPORT=y diff --git a/examples/thermostat/qpg/src/ThermostaticRadiatorValveManager.cpp b/examples/thermostat/qpg/src/ThermostaticRadiatorValveManager.cpp index f8f2c348cc2558..55173272977964 100644 --- a/examples/thermostat/qpg/src/ThermostaticRadiatorValveManager.cpp +++ b/examples/thermostat/qpg/src/ThermostaticRadiatorValveManager.cpp @@ -304,7 +304,7 @@ void ThermostaticRadiatorValveManager::UpdateLocalTemperature(int16_t aLocalTemp { SystemLayer().ScheduleLambda([aLocalTemperature] { ChipLogProgress(NotSpecified, "UpdateLocalTemperature with value (0.01 degC) %u", aLocalTemperature); - if (EMBER_ZCL_STATUS_SUCCESS != + if (Protocols::InteractionModel::Status::Success != Thermostat::Attributes::LocalTemperature::Set(QPG_THERMOSTATIC_ENDPOINT_ID, aLocalTemperature)) { ChipLogProgress(NotSpecified, "UpdateLocalTemperature failure"); diff --git a/examples/thermostat/qpg/src/ZclCallbacks.cpp b/examples/thermostat/qpg/src/ZclCallbacks.cpp index 4551a0d0bedb2f..c66901656442cc 100644 --- a/examples/thermostat/qpg/src/ZclCallbacks.cpp +++ b/examples/thermostat/qpg/src/ZclCallbacks.cpp @@ -56,10 +56,10 @@ void emberAfThermostatClusterInitCallback(EndpointId endpoint) { // Temp. code for testing purpose, need to be updated - const auto logOnFailure = [](EmberAfStatus status, const char * attributeName) { - if (status != EMBER_ZCL_STATUS_SUCCESS) + const auto logOnFailure = [](Protocols::InteractionModel::Status status, const char * attributeName) { + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, status); + ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, to_underlying(status)); } }; diff --git a/examples/tv-app/android/include/account-login/AccountLoginManager.cpp b/examples/tv-app/android/include/account-login/AccountLoginManager.cpp index 2151dd63920f74..b3160b2ec2fd8b 100644 --- a/examples/tv-app/android/include/account-login/AccountLoginManager.cpp +++ b/examples/tv-app/android/include/account-login/AccountLoginManager.cpp @@ -112,7 +112,8 @@ uint16_t AccountLoginManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "AccountLoginManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/include/content-launcher/AppContentLauncherManager.cpp b/examples/tv-app/android/include/content-launcher/AppContentLauncherManager.cpp index 31745a93c42fce..86eabb83f99066 100644 --- a/examples/tv-app/android/include/content-launcher/AppContentLauncherManager.cpp +++ b/examples/tv-app/android/include/content-launcher/AppContentLauncherManager.cpp @@ -174,7 +174,8 @@ uint16_t AppContentLauncherManager::GetClusterRevision(chip::EndpointId endpoint } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "AppContentLauncherManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/include/media-playback/AppMediaPlaybackManager.cpp b/examples/tv-app/android/include/media-playback/AppMediaPlaybackManager.cpp index 39e364d60e4148..087f1742c355a0 100644 --- a/examples/tv-app/android/include/media-playback/AppMediaPlaybackManager.cpp +++ b/examples/tv-app/android/include/media-playback/AppMediaPlaybackManager.cpp @@ -292,7 +292,8 @@ uint16_t AppMediaPlaybackManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "AppMediaPlaybackManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp b/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp index cb22e9fd9b8abf..23cf8058bab068 100644 --- a/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp +++ b/examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp @@ -154,7 +154,8 @@ uint16_t TargetNavigatorManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "TargetNavigatorManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/java/ChannelManager.cpp b/examples/tv-app/android/java/ChannelManager.cpp index 997f041b78982f..3c0efcab9f8cdc 100644 --- a/examples/tv-app/android/java/ChannelManager.cpp +++ b/examples/tv-app/android/java/ChannelManager.cpp @@ -761,7 +761,8 @@ uint16_t ChannelManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "ChannelManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp index 53136c23e5a596..3963140d1b5e65 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp @@ -41,7 +41,7 @@ using LaunchResponseType = chip::app::Clusters::ContentLauncher::Command using PlaybackResponseType = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Type; using NavigateTargetResponseType = chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Type; using GetSetupPINResponseType = chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Type; -using Status = Protocols::InteractionModel::Status; +using Status = chip::Protocols::InteractionModel::Status; const std::string FAILURE_KEY = "PlatformError"; const std::string FAILURE_STATUS_KEY = "Status"; @@ -60,7 +60,7 @@ void ContentAppCommandDelegate::InvokeCommand(CommandHandlerInterface::HandlerCo { handlerContext.SetCommandHandled(); handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, - Protocols::InteractionModel::Status::InvalidCommand); + chip::Protocols::InteractionModel::Status::InvalidCommand); return; } @@ -112,7 +112,7 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust if (!mContentAppEndpointManager.HasValidObjectRef()) { - return Protocols::InteractionModel::Status::Failure; + return chip::Protocols::InteractionModel::Status::Failure; } jstring resp = @@ -133,7 +133,7 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust if (!reader.parse(respStr.c_str(), value)) { env->DeleteLocalRef(resp); - return Protocols::InteractionModel::Status::Failure; + return chip::Protocols::InteractionModel::Status::Failure; } } env->DeleteLocalRef(resp); @@ -146,15 +146,15 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust { return static_cast(value[FAILURE_STATUS_KEY].asUInt()); } - return Protocols::InteractionModel::Status::Failure; + return chip::Protocols::InteractionModel::Status::Failure; } - return Protocols::InteractionModel::Status::UnsupportedEndpoint; + return chip::Protocols::InteractionModel::Status::UnsupportedEndpoint; } else { commandHandled = false; - return Protocols::InteractionModel::Status::UnsupportedEndpoint; + return chip::Protocols::InteractionModel::Status::UnsupportedEndpoint; } } @@ -178,7 +178,7 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand handlerContext.mRequestPath, static_cast(value[FAILURE_STATUS_KEY].asUInt())); return; } - handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Protocols::InteractionModel::Status::Failure); + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, chip::Protocols::InteractionModel::Status::Failure); return; } @@ -187,7 +187,7 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand case app::Clusters::ContentLauncher::Id: { Status status; LaunchResponseType launchResponse = FormatContentLauncherResponse(value, status); - if (status != Protocols::InteractionModel::Status::Success) + if (status != chip::Protocols::InteractionModel::Status::Success) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, status); } @@ -201,7 +201,7 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand case app::Clusters::TargetNavigator::Id: { Status status; NavigateTargetResponseType navigateTargetResponse = FormatNavigateTargetResponse(value, status); - if (status != Protocols::InteractionModel::Status::Success) + if (status != chip::Protocols::InteractionModel::Status::Success) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, status); } @@ -215,7 +215,7 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand case app::Clusters::MediaPlayback::Id: { Status status; PlaybackResponseType playbackResponse = FormatMediaPlaybackResponse(value, status); - if (status != Protocols::InteractionModel::Status::Success) + if (status != chip::Protocols::InteractionModel::Status::Success) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, status); } @@ -234,7 +234,7 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand } Status status; GetSetupPINResponseType getSetupPINresponse = FormatGetSetupPINResponse(value, status); - if (status != Protocols::InteractionModel::Status::Success) + if (status != chip::Protocols::InteractionModel::Status::Success) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, status); } @@ -251,13 +251,13 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand LaunchResponseType ContentAppCommandDelegate::FormatContentLauncherResponse(Json::Value value, Status & status) { - status = Protocols::InteractionModel::Status::Success; + status = chip::Protocols::InteractionModel::Status::Success; LaunchResponseType launchResponse; std::string statusFieldId = std::to_string(to_underlying(app::Clusters::ContentLauncher::Commands::LauncherResponse::Fields::kStatus)); if (value[statusFieldId].empty()) { - status = Protocols::InteractionModel::Status::Failure; + status = chip::Protocols::InteractionModel::Status::Failure; return launchResponse; } else @@ -275,13 +275,13 @@ LaunchResponseType ContentAppCommandDelegate::FormatContentLauncherResponse(Json NavigateTargetResponseType ContentAppCommandDelegate::FormatNavigateTargetResponse(Json::Value value, Status & status) { - status = Protocols::InteractionModel::Status::Success; + status = chip::Protocols::InteractionModel::Status::Success; NavigateTargetResponseType navigateTargetResponse; std::string statusFieldId = std::to_string(to_underlying(app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Fields::kStatus)); if (value[statusFieldId].empty()) { - status = Protocols::InteractionModel::Status::Failure; + status = chip::Protocols::InteractionModel::Status::Failure; return navigateTargetResponse; } else @@ -299,13 +299,13 @@ NavigateTargetResponseType ContentAppCommandDelegate::FormatNavigateTargetRespon PlaybackResponseType ContentAppCommandDelegate::FormatMediaPlaybackResponse(Json::Value value, Status & status) { - status = Protocols::InteractionModel::Status::Success; + status = chip::Protocols::InteractionModel::Status::Success; PlaybackResponseType playbackResponse; std::string statusFieldId = std::to_string(to_underlying(app::Clusters::MediaPlayback::Commands::PlaybackResponse::Fields::kStatus)); if (value[statusFieldId].empty()) { - status = Protocols::InteractionModel::Status::Failure; + status = chip::Protocols::InteractionModel::Status::Failure; return playbackResponse; } else @@ -323,7 +323,7 @@ PlaybackResponseType ContentAppCommandDelegate::FormatMediaPlaybackResponse(Json GetSetupPINResponseType ContentAppCommandDelegate::FormatGetSetupPINResponse(Json::Value value, Status & status) { - status = Protocols::InteractionModel::Status::Success; + status = chip::Protocols::InteractionModel::Status::Success; GetSetupPINResponseType getSetupPINresponse; std::string setupPINFieldId = std::to_string(to_underlying(app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Fields::kSetupPIN)); diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.h b/examples/tv-app/android/java/ContentAppCommandDelegate.h index a896e55b4ce035..750aff6d34853c 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.h +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.h @@ -34,7 +34,7 @@ namespace chip { namespace AppPlatform { using CommandHandlerInterface = chip::app::CommandHandlerInterface; -using Status = Protocols::InteractionModel::Status; +using Status = chip::Protocols::InteractionModel::Status; using LaunchResponseType = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Type; using PlaybackResponseType = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Type; using NavigateTargetResponseType = chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Type; diff --git a/examples/tv-app/android/java/ContentLauncherManager.cpp b/examples/tv-app/android/java/ContentLauncherManager.cpp index 25e5659b4f6703..caa14b04f9e938 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -295,7 +295,8 @@ uint16_t ContentLauncherManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "ContentLauncherManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/java/LevelManager.cpp b/examples/tv-app/android/java/LevelManager.cpp index f8e3dab6aa7773..b79f150c7ae20e 100644 --- a/examples/tv-app/android/java/LevelManager.cpp +++ b/examples/tv-app/android/java/LevelManager.cpp @@ -83,9 +83,9 @@ void LevelManager::PostLevelChanged(chip::EndpointId endpoint, uint8_t value) jboolean LevelManager::SetLevel(jint endpoint, jint value) { - EmberAfStatus status = app::Clusters::LevelControl::Attributes::CurrentLevel::Set(static_cast(endpoint), - static_cast(value)); - return status == EMBER_ZCL_STATUS_SUCCESS; + chip::Protocols::InteractionModel::Status status = app::Clusters::LevelControl::Attributes::CurrentLevel::Set( + static_cast(endpoint), static_cast(value)); + return status == chip::Protocols::InteractionModel::Status::Success; } CHIP_ERROR LevelManager::InitializeWithObjects(jobject managerObject) diff --git a/examples/tv-app/android/java/MediaPlaybackManager.cpp b/examples/tv-app/android/java/MediaPlaybackManager.cpp index 8da71d5a533193..62abeb12ec30eb 100644 --- a/examples/tv-app/android/java/MediaPlaybackManager.cpp +++ b/examples/tv-app/android/java/MediaPlaybackManager.cpp @@ -614,7 +614,8 @@ uint16_t MediaPlaybackManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "MediaPlaybackManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/android/java/OnOffManager.cpp b/examples/tv-app/android/java/OnOffManager.cpp index c05c20700eabd0..9a330754aa4a16 100644 --- a/examples/tv-app/android/java/OnOffManager.cpp +++ b/examples/tv-app/android/java/OnOffManager.cpp @@ -84,8 +84,9 @@ void OnOffManager::PostOnOffChanged(chip::EndpointId endpoint, bool value) jboolean OnOffManager::SetOnOff(jint endpoint, bool value) { chip::DeviceLayer::StackLock stack; - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(static_cast(endpoint), value); - return status == EMBER_ZCL_STATUS_SUCCESS; + chip::Protocols::InteractionModel::Status status = + app::Clusters::OnOff::Attributes::OnOff::Set(static_cast(endpoint), value); + return status == chip::Protocols::InteractionModel::Status::Success; } CHIP_ERROR OnOffManager::InitializeWithObjects(jobject managerObject) diff --git a/examples/tv-app/tv-common/clusters/account-login/AccountLoginManager.cpp b/examples/tv-app/tv-common/clusters/account-login/AccountLoginManager.cpp index 532986f7ba4eea..0f3e5b5036e081 100644 --- a/examples/tv-app/tv-common/clusters/account-login/AccountLoginManager.cpp +++ b/examples/tv-app/tv-common/clusters/account-login/AccountLoginManager.cpp @@ -74,7 +74,8 @@ uint16_t AccountLoginManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "AccountLoginManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp b/examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp index 82a278b827cd6a..75bb07b5438dd1 100644 --- a/examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp +++ b/examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp @@ -347,7 +347,8 @@ uint16_t ChannelManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "ChannelManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/tv-common/clusters/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/tv-common/clusters/content-launcher/ContentLauncherManager.cpp index 572209a44d11c3..b062c64b95efd6 100644 --- a/examples/tv-app/tv-common/clusters/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/tv-common/clusters/content-launcher/ContentLauncherManager.cpp @@ -214,7 +214,8 @@ uint16_t ContentLauncherManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "ContentLauncherManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.cpp b/examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.cpp index f97a2e98630e01..456aba87b61b3a 100644 --- a/examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.cpp +++ b/examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.cpp @@ -335,7 +335,8 @@ uint16_t MediaPlaybackManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "MediaPlaybackManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp b/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp index 0d3a15578b861d..9b907339df02e4 100644 --- a/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp +++ b/examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp @@ -76,7 +76,8 @@ uint16_t TargetNavigatorManager::GetClusterRevision(chip::EndpointId endpoint) } uint16_t clusterRevision = 0; - bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS); + bool success = + (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == chip::Protocols::InteractionModel::Status::Success); if (!success) { ChipLogError(Zcl, "TargetNavigatorManager::GetClusterRevision error reading cluster revision"); diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index e4099412be31c5..6effacc92c0812 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -2024,7 +2024,7 @@ cluster UserLabel = 65 { } /** This cluster provides an interface for passing messages to be presented by a device. */ -cluster Messages = 151 { +provisional cluster Messages = 151 { revision 3; enum FutureMessagePreferenceEnum : enum8 { @@ -3053,7 +3053,7 @@ cluster AccountLogin = 1294 { } /** This cluster is used for managing the content control (including "parental control") settings on a media device such as a TV, or Set-top Box. */ -cluster ContentControl = 1295 { +provisional cluster ContentControl = 1295 { revision 1; // NOTE: Default/not specifically set bitmap Feature : bitmap32 { @@ -3136,7 +3136,7 @@ cluster ContentControl = 1295 { } /** This cluster provides an interface for sending targeted commands to an Observer of a Content App on a Video Player device such as a Streaming Media Player, Smart TV or Smart Screen. The cluster server for Content App Observer is implemented by an endpoint that communicates with a Content App, such as a Casting Video Client. The cluster client for Content App Observer is implemented by a Content App endpoint. A Content App is informed of the NodeId of an Observer when a binding is set on the Content App. The Content App can then send the ContentAppMessage to the Observer (server cluster), and the Observer responds with a ContentAppMessageResponse. */ -cluster ContentAppObserver = 1296 { +provisional cluster ContentAppObserver = 1296 { revision 1; // NOTE: Default/not specifically set enum StatusEnum : enum8 { diff --git a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp index e4bb7647085b40..98f6b197a59e33 100644 --- a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp @@ -278,7 +278,7 @@ void CastingServer::ReadServerClustersForNode(NodeId nodeId) " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && nodeId == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && nodeId == binding.nodeId) { if (!mActiveTargetVideoPlayerInfo.HasEndpoint(binding.remote)) { @@ -550,7 +550,7 @@ void CastingServer::DeviceEventCallback(const DeviceLayer::ChipDeviceEvent * eve " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) + if (binding.type == MATTER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) { ChipLogProgress( NotSpecified, @@ -641,7 +641,7 @@ NodeId CastingServer::GetVideoPlayerNodeForFabricIndex(FabricIndex fabricIndex) " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && fabricIndex == binding.fabricIndex) + if (binding.type == MATTER_UNICAST_BINDING && fabricIndex == binding.fabricIndex) { ChipLogProgress(NotSpecified, "GetVideoPlayerNodeForFabricIndex nodeId=0x" ChipLogFormatX64, ChipLogValueX64(binding.nodeId)); @@ -667,7 +667,7 @@ FabricIndex CastingServer::GetVideoPlayerFabricIndexForNode(NodeId nodeId) " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && nodeId == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && nodeId == binding.nodeId) { ChipLogProgress(NotSpecified, "GetVideoPlayerFabricIndexForNode fabricIndex=%d nodeId=0x" ChipLogFormatX64, binding.fabricIndex, ChipLogValueX64(binding.nodeId)); diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp index bced79be4bc102..20558982ea78ca 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp @@ -156,7 +156,7 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) + if (binding.type == MATTER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) { ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster Matched accessingFabricIndex with " diff --git a/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp b/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp index 478847d15a2eca..60d589c1fc640b 100644 --- a/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp @@ -53,7 +53,7 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM for (const auto & binding : chip::BindingTable::GetInstance()) { - if (binding.type == EMBER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) { // check to see if we discovered a new endpoint in the bindings chip::EndpointId endpointId = binding.remote; @@ -86,7 +86,7 @@ CHIP_ERROR EndpointListLoader::Load() " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.ValueOr(0))); - if (binding.type == EMBER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) { // if we discovered a new Endpoint from the bindings, read its EndpointAttributes chip::EndpointId endpointId = binding.remote; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 7eee24e57ce285..4bece078774075 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1502,7 +1502,7 @@ cluster FixedLabel = 64 { } /** This cluster provides an interface for passing messages to be presented by a device. */ -cluster Messages = 151 { +provisional cluster Messages = 151 { revision 3; enum FutureMessagePreferenceEnum : enum8 { @@ -2515,7 +2515,7 @@ cluster AccountLogin = 1294 { } /** This cluster is used for managing the content control (including "parental control") settings on a media device such as a TV, or Set-top Box. */ -cluster ContentControl = 1295 { +provisional cluster ContentControl = 1295 { revision 1; // NOTE: Default/not specifically set bitmap Feature : bitmap32 { @@ -2598,7 +2598,7 @@ cluster ContentControl = 1295 { } /** This cluster provides an interface for sending targeted commands to an Observer of a Content App on a Video Player device such as a Streaming Media Player, Smart TV or Smart Screen. The cluster server for Content App Observer is implemented by an endpoint that communicates with a Content App, such as a Casting Video Client. The cluster client for Content App Observer is implemented by a Content App endpoint. A Content App is informed of the NodeId of an Observer when a binding is set on the Content App. The Content App can then send the ContentAppMessage to the Observer (server cluster), and the Observer responds with a ContentAppMessageResponse. */ -cluster ContentAppObserver = 1296 { +provisional cluster ContentAppObserver = 1296 { revision 1; // NOTE: Default/not specifically set enum StatusEnum : enum8 { diff --git a/examples/virtual-device-app/android/java/DoorLockManager.cpp b/examples/virtual-device-app/android/java/DoorLockManager.cpp index 5e85ffc817b4c9..b3e245ea75dac2 100644 --- a/examples/virtual-device-app/android/java/DoorLockManager.cpp +++ b/examples/virtual-device-app/android/java/DoorLockManager.cpp @@ -49,10 +49,11 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) ChipLogProgress(Zcl, "Device App::DoorLock::PostClusterInit"); DeviceAppJNIMgr().PostClusterInit(chip::app::Clusters::DoorLock::Id, endpoint); DoorLockServer::Instance().InitServer(endpoint); - EmberAfStatus status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Protocols::InteractionModel::Status status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogProgress(Zcl, "Device App::DoorLock::emberAfDoorLockClusterInitCallback()::Updating feature map %x", status); + ChipLogProgress(Zcl, "Device App::DoorLock::emberAfDoorLockClusterInitCallback()::Updating feature map %x", + to_underlying(status)); } } @@ -104,9 +105,9 @@ DoorLockManager * GetDoorLockManager(EndpointId endpoint) jboolean DoorLockManager::SetLockType(jint endpoint, jint value) { - EmberAfStatus status = app::Clusters::DoorLock::Attributes::LockType::Set( + Protocols::InteractionModel::Status status = app::Clusters::DoorLock::Attributes::LockType::Set( static_cast(endpoint), static_cast(value)); - return status == EMBER_ZCL_STATUS_SUCCESS; + return status == Protocols::InteractionModel::Status::Success; } jboolean DoorLockManager::SetLockState(jint endpoint, jint value) @@ -127,16 +128,16 @@ jboolean DoorLockManager::SetAutoRelockTime(jint endpoint, jint value) jboolean DoorLockManager::SetOperatingMode(jint endpoint, jint value) { - EmberAfStatus status = app::Clusters::DoorLock::Attributes::OperatingMode::Set( + Protocols::InteractionModel::Status status = app::Clusters::DoorLock::Attributes::OperatingMode::Set( static_cast(endpoint), static_cast(value)); - return status == EMBER_ZCL_STATUS_SUCCESS; + return status == Protocols::InteractionModel::Status::Success; } jboolean DoorLockManager::SetSupportedOperatingModes(jint endpoint, jint value) { - EmberAfStatus status = app::Clusters::DoorLock::Attributes::SupportedOperatingModes::Set( + Protocols::InteractionModel::Status status = app::Clusters::DoorLock::Attributes::SupportedOperatingModes::Set( static_cast(endpoint), static_cast(value)); - return status == EMBER_ZCL_STATUS_SUCCESS; + return status == Protocols::InteractionModel::Status::Success; } jboolean DoorLockManager::SendLockAlarmEvent(jint endpoint) diff --git a/examples/virtual-device-app/android/java/OnOffManager.cpp b/examples/virtual-device-app/android/java/OnOffManager.cpp index 2dcede64a8bce5..c058e99a91c111 100644 --- a/examples/virtual-device-app/android/java/OnOffManager.cpp +++ b/examples/virtual-device-app/android/java/OnOffManager.cpp @@ -82,8 +82,9 @@ void OnOffManager::PostOnOffChanged(chip::EndpointId endpoint, bool value) jboolean OnOffManager::SetOnOff(jint endpoint, bool value) { - EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(static_cast(endpoint), value); - return status == EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status status = + app::Clusters::OnOff::Attributes::OnOff::Set(static_cast(endpoint), value); + return status == Protocols::InteractionModel::Status::Success; } CHIP_ERROR OnOffManager::InitializeWithObjects(jobject managerObject) diff --git a/examples/virtual-device-app/android/java/PowerSourceManager.cpp b/examples/virtual-device-app/android/java/PowerSourceManager.cpp index afbdcca23bacb7..e71a5bb1eec692 100644 --- a/examples/virtual-device-app/android/java/PowerSourceManager.cpp +++ b/examples/virtual-device-app/android/java/PowerSourceManager.cpp @@ -83,13 +83,13 @@ jboolean PowerSourceManager::SetBatPercentRemaining(jint endpoint, jint value) { using namespace chip::app::Clusters; using namespace chip::DeviceLayer; - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Protocols::InteractionModel::Status status = Protocols::InteractionModel::Status::Success; status = PowerSource::Attributes::BatPercentRemaining::Set(static_cast(endpoint), static_cast(value * 2)); ChipLogDetail(Zcl, "Device App::PowerSource::SetBatPercentRemaining: endpoint:%d, percent:%d", endpoint, value); - return status == EMBER_ZCL_STATUS_SUCCESS; + return status == Protocols::InteractionModel::Status::Success; } CHIP_ERROR PowerSourceManager::InitializeWithObjects(jobject managerObject) diff --git a/examples/window-app/common/src/WindowApp.cpp b/examples/window-app/common/src/WindowApp.cpp index 11d49b7e34ed20..aa0e2654a5e4d3 100644 --- a/examples/window-app/common/src/WindowApp.cpp +++ b/examples/window-app/common/src/WindowApp.cpp @@ -455,7 +455,7 @@ void WindowApp::Cover::Finish() void WindowApp::Cover::LiftStepToward(OperationalState direction) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; chip::Percent100ths percent100ths; NPercent100ths current; @@ -463,7 +463,7 @@ void WindowApp::Cover::LiftStepToward(OperationalState direction) status = Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, current); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { percent100ths = ComputePercent100thsStep(direction, current.Value(), LIFT_DELTA); } @@ -519,7 +519,7 @@ void WindowApp::Cover::LiftUpdate(bool newTarget) void WindowApp::Cover::TiltStepToward(OperationalState direction) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; chip::Percent100ths percent100ths; NPercent100ths current; @@ -527,7 +527,7 @@ void WindowApp::Cover::TiltStepToward(OperationalState direction) status = Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, current); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { percent100ths = ComputePercent100thsStep(direction, current.Value(), TILT_DELTA); } @@ -595,7 +595,7 @@ void WindowApp::Cover::StepToward(OperationalState direction, bool isTilt) void WindowApp::Cover::UpdateTargetPosition(OperationalState direction, bool isTilt) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; NPercent100ths current; chip::Percent100ths target; @@ -604,7 +604,7 @@ void WindowApp::Cover::UpdateTargetPosition(OperationalState direction, bool isT if (isTilt) { status = Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, current); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { target = ComputePercent100thsStep(direction, current.Value(), TILT_DELTA); @@ -614,7 +614,7 @@ void WindowApp::Cover::UpdateTargetPosition(OperationalState direction, bool isT else { status = Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, current); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { target = ComputePercent100thsStep(direction, current.Value(), LIFT_DELTA); diff --git a/examples/window-app/nrfconnect/main/WindowCovering.cpp b/examples/window-app/nrfconnect/main/WindowCovering.cpp index f2d078838a427b..4d200ffa3c919e 100644 --- a/examples/window-app/nrfconnect/main/WindowCovering.cpp +++ b/examples/window-app/nrfconnect/main/WindowCovering.cpp @@ -59,8 +59,10 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) NPercent100ths target{}; NPercent100ths positionToSet{}; - VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); - VerifyOrReturn(Attributes::TargetPositionLiftPercent100ths::Get(Endpoint(), target) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == + Protocols::InteractionModel::Status::Success); + VerifyOrReturn(Attributes::TargetPositionLiftPercent100ths::Get(Endpoint(), target) == + Protocols::InteractionModel::Status::Success); OperationalState state = ComputeOperationalState(target, current); UpdateOperationalStatus(MoveType::LIFT, state); @@ -85,7 +87,8 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) // assume single move completed Instance().mInLiftMove = false; - VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == + Protocols::InteractionModel::Status::Success); if (!TargetCompleted(MoveType::LIFT, current, target)) { @@ -101,7 +104,7 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) chip::Percent100ths WindowCovering::CalculateNextPosition(MoveType aMoveType) { - EmberAfStatus status{}; + Protocols::InteractionModel::Status status{}; chip::Percent100ths percent100ths{}; NPercent100ths current{}; OperationalState opState{}; @@ -117,7 +120,7 @@ chip::Percent100ths WindowCovering::CalculateNextPosition(MoveType aMoveType) opState = OperationalStateGet(Endpoint(), OperationalStatus::kTilt); } - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { static constexpr auto sPercentDelta{ WC_PERCENT100THS_MAX_CLOSED / 20 }; percent100ths = ComputePercent100thsStep(opState, current.Value(), sPercentDelta); @@ -168,8 +171,10 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t) NPercent100ths target{}; NPercent100ths positionToSet{}; - VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); - VerifyOrReturn(Attributes::TargetPositionTiltPercent100ths::Get(Endpoint(), target) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == + Protocols::InteractionModel::Status::Success); + VerifyOrReturn(Attributes::TargetPositionTiltPercent100ths::Get(Endpoint(), target) == + Protocols::InteractionModel::Status::Success); OperationalState state = ComputeOperationalState(target, current); UpdateOperationalStatus(MoveType::TILT, state); @@ -194,7 +199,8 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t) // assume single move completed Instance().mInTiltMove = false; - VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == + Protocols::InteractionModel::Status::Success); if (!TargetCompleted(MoveType::TILT, current, target)) { @@ -256,7 +262,7 @@ void WindowCovering::UpdateOperationalStatus(MoveType aMoveType, OperationalStat void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percent100ths aPosition) { - EmberAfStatus status{}; + Protocols::InteractionModel::Status status{}; if (Instance().mCurrentUIMoveType == MoveType::LIFT) { status = Attributes::TargetPositionLiftPercent100ths::Set(Endpoint(), aPosition); @@ -266,7 +272,7 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen status = Attributes::TargetPositionTiltPercent100ths::Set(Endpoint(), aPosition); } - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Protocols::InteractionModel::Status::Success) { LOG_ERR("Cannot set the target position. Error: %d", static_cast(status)); } @@ -274,13 +280,13 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen void WindowCovering::PositionLEDUpdate(MoveType aMoveType) { - EmberAfStatus status{}; + Protocols::InteractionModel::Status status{}; NPercent100ths currentPosition{}; if (aMoveType == MoveType::LIFT) { status = Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), currentPosition); - if (EMBER_ZCL_STATUS_SUCCESS == status && !currentPosition.IsNull()) + if (Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) { Instance().SetBrightness(MoveType::LIFT, currentPosition.Value()); } @@ -288,7 +294,7 @@ void WindowCovering::PositionLEDUpdate(MoveType aMoveType) else if (aMoveType == MoveType::TILT) { status = Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), currentPosition); - if (EMBER_ZCL_STATUS_SUCCESS == status && !currentPosition.IsNull()) + if (Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) { Instance().SetBrightness(MoveType::TILT, currentPosition.Value()); } @@ -343,4 +349,6 @@ void WindowCovering::DoPostAttributeChange(intptr_t aArg) VerifyOrReturn(data != nullptr); PostAttributeChange(data->mEndpoint, data->mAttributeId); + + chip::Platform::Delete(data); } diff --git a/examples/window-app/nrfconnect/main/ZclCallbacks.cpp b/examples/window-app/nrfconnect/main/ZclCallbacks.cpp index 63b9b10d32b852..12e95a7f566788 100644 --- a/examples/window-app/nrfconnect/main/ZclCallbacks.cpp +++ b/examples/window-app/nrfconnect/main/ZclCallbacks.cpp @@ -82,17 +82,17 @@ void MatterWindowCoveringClusterServerAttributeChangedCallback(const app::Concre void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint) { - const auto logOnFailure = [](EmberAfStatus status, const char * attributeName) { - if (status != EMBER_ZCL_STATUS_SUCCESS) + const auto logOnFailure = [](Protocols::InteractionModel::Status status, const char * attributeName) { + if (status != Protocols::InteractionModel::Status::Success) { - ChipLogError(Zcl, "Failed to set WindowCovering %s: %x", attributeName, status); + ChipLogError(Zcl, "Failed to set WindowCovering %s: %x", attributeName, to_underlying(status)); } }; app::DataModel::Nullable currentPercent100ths; app::DataModel::Nullable targetPercent100ths; app::DataModel::Nullable currentPercentage; - EmberAfStatus status; + Protocols::InteractionModel::Status status; status = Attributes::CurrentPositionLiftPercentage::Get(endpoint, currentPercentage); if (currentPercentage.IsNull()) diff --git a/examples/window-app/silabs/openthread.gni b/examples/window-app/silabs/openthread.gni index cdd7f8c0f1f42e..d3d50ab878b211 100644 --- a/examples/window-app/silabs/openthread.gni +++ b/examples/window-app/silabs/openthread.gni @@ -36,6 +36,6 @@ sl_ot_idle_interval_ms = 1000 # 1s Idle Intervals sl_ot_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags -sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval -sl_active_mode_interval_ms = 0 # 0s Active Mode Interval +sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration +sl_active_mode_duration_ms = 0 # 0s Active Mode Duration sl_active_mode_threshold_ms = 0 # 1s Active Mode Threshold diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index 309fb393565990..58716b82af4a52 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -275,7 +275,7 @@ void WindowManager::Cover::Init(chip::EndpointId endpoint) void WindowManager::Cover::LiftStepToward(OperationalState direction) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; chip::Percent100ths percent100ths; NPercent100ths current; @@ -283,7 +283,7 @@ void WindowManager::Cover::LiftStepToward(OperationalState direction) status = Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, current); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { percent100ths = ComputePercent100thsStep(direction, current.Value(), LIFT_DELTA); } @@ -339,7 +339,7 @@ void WindowManager::Cover::LiftUpdate(bool newTarget) void WindowManager::Cover::TiltStepToward(OperationalState direction) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; chip::Percent100ths percent100ths; NPercent100ths current; @@ -347,7 +347,7 @@ void WindowManager::Cover::TiltStepToward(OperationalState direction) status = Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, current); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { percent100ths = ComputePercent100thsStep(direction, current.Value(), TILT_DELTA); } @@ -403,7 +403,7 @@ void WindowManager::Cover::TiltUpdate(bool newTarget) void WindowManager::Cover::UpdateTargetPosition(OperationalState direction, bool isTilt) { - EmberAfStatus status; + Protocols::InteractionModel::Status status; NPercent100ths current; chip::Percent100ths target; @@ -412,7 +412,7 @@ void WindowManager::Cover::UpdateTargetPosition(OperationalState direction, bool if (isTilt) { status = Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, current); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { target = ComputePercent100thsStep(direction, current.Value(), TILT_DELTA); (void) Attributes::TargetPositionTiltPercent100ths::Set(mEndpoint, target); @@ -421,7 +421,7 @@ void WindowManager::Cover::UpdateTargetPosition(OperationalState direction, bool else { status = Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, current); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) { target = ComputePercent100thsStep(direction, current.Value(), LIFT_DELTA); (void) Attributes::TargetPositionLiftPercent100ths::Set(mEndpoint, target); diff --git a/examples/window-app/telink/src/WindowCovering.cpp b/examples/window-app/telink/src/WindowCovering.cpp index a8cae9d37e597b..5c1b8d10559c33 100644 --- a/examples/window-app/telink/src/WindowCovering.cpp +++ b/examples/window-app/telink/src/WindowCovering.cpp @@ -59,8 +59,10 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) NPercent100ths target{}; NPercent100ths positionToSet{}; - VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); - VerifyOrReturn(Attributes::TargetPositionLiftPercent100ths::Get(Endpoint(), target) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == + chip::Protocols::InteractionModel::Status::Success); + VerifyOrReturn(Attributes::TargetPositionLiftPercent100ths::Get(Endpoint(), target) == + chip::Protocols::InteractionModel::Status::Success); UpdateOperationalStatus(WindowCoveringType::Lift, ComputeOperationalState(target, current)); @@ -70,7 +72,8 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) // assume single move completed Instance().mInLiftMove = false; - VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == + chip::Protocols::InteractionModel::Status::Success); if (!TargetCompleted(WindowCoveringType::Lift, current, target)) { @@ -86,7 +89,7 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) chip::Percent100ths WindowCovering::CalculateSingleStep(WindowCoveringType aMoveType) { - EmberAfStatus status{}; + chip::Protocols::InteractionModel::Status status{}; chip::Percent100ths percent100ths{}; NPercent100ths current{}; OperationalState opState = OperationalState::Stall; @@ -102,7 +105,7 @@ chip::Percent100ths WindowCovering::CalculateSingleStep(WindowCoveringType aMove opState = OperationalStateGet(Endpoint(), OperationalStatus::kTilt); } - if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) + if ((status == chip::Protocols::InteractionModel::Status::Success) && !current.IsNull()) { percent100ths = ComputePercent100thsStep(opState, current.Value(), sPercentDelta); } @@ -152,8 +155,10 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t) NPercent100ths target{}; NPercent100ths positionToSet{}; - VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); - VerifyOrReturn(Attributes::TargetPositionTiltPercent100ths::Get(Endpoint(), target) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == + chip::Protocols::InteractionModel::Status::Success); + VerifyOrReturn(Attributes::TargetPositionTiltPercent100ths::Get(Endpoint(), target) == + chip::Protocols::InteractionModel::Status::Success); UpdateOperationalStatus(WindowCoveringType::Lift, ComputeOperationalState(target, current)); @@ -163,7 +168,8 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t) // assume single move completed Instance().mInTiltMove = false; - VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == EMBER_ZCL_STATUS_SUCCESS); + VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == + chip::Protocols::InteractionModel::Status::Success); if (!TargetCompleted(WindowCoveringType::Tilt, current, target)) { @@ -225,7 +231,7 @@ void WindowCovering::UpdateOperationalStatus(WindowCoveringType aMoveType, Opera void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percent100ths aPosition) { - EmberAfStatus status{}; + chip::Protocols::InteractionModel::Status status{}; if (Instance().mCurrentUIMoveType == WindowCoveringType::Lift) { status = Attributes::TargetPositionLiftPercent100ths::Set(Endpoint(), aPosition); @@ -235,7 +241,7 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen status = Attributes::TargetPositionTiltPercent100ths::Set(Endpoint(), aPosition); } - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != chip::Protocols::InteractionModel::Status::Success) { LOG_ERR("Cannot set the target position. Error: %d", static_cast(status)); } @@ -243,13 +249,13 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen void WindowCovering::PositionLEDUpdate(WindowCoveringType aMoveType) { - EmberAfStatus status{}; + chip::Protocols::InteractionModel::Status status{}; NPercent100ths currentPosition{}; if (aMoveType == WindowCoveringType::Lift) { status = Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), currentPosition); - if (EMBER_ZCL_STATUS_SUCCESS == status && !currentPosition.IsNull()) + if (chip::Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) { Instance().SetBrightness(WindowCoveringType::Lift, currentPosition.Value()); } @@ -257,7 +263,7 @@ void WindowCovering::PositionLEDUpdate(WindowCoveringType aMoveType) else if (aMoveType == WindowCoveringType::Tilt) { status = Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), currentPosition); - if (EMBER_ZCL_STATUS_SUCCESS == status && !currentPosition.IsNull()) + if (chip::Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) { Instance().SetBrightness(WindowCoveringType::Tilt, currentPosition.Value()); } diff --git a/iwyu.imp b/iwyu.imp new file mode 100644 index 00000000000000..b7572ff9f5a394 --- /dev/null +++ b/iwyu.imp @@ -0,0 +1,22 @@ +# General IWYU command example: +# +# iwyu_tool.py \ +# -p out/linux-x64-all-clusters-clang/compile_commands.json \ +# src/lib/core/ \ +# -- \ +# -Xiwyu --mapping_file=$(pwd)/iwyu.imp \ +# -Xiwyu --no_comments \ +# -Xiwyu --comment_style=none \ +# -Xiwyu --cxx17ns \ +# -Xiwyu no_fwd_decls \ +# | tee out/iwyu.out +# +# cd out/linux-x64-all-clusters-clang +# +# fix_includes.py <../iwyu.out +# +[ + { include: [ '"system/SystemBuildConfig.h"', private, '', public ] }, + { include: [ '"core/CHIPBuildConfig.h"', private, '', public ] }, + { include: [ '@"platform/.*/CHIPPlatformConfig.h"', private, '', public ] }, +] diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 771c92b99cabef..af1bd454b86ddb 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -152,6 +152,7 @@ def BuildHostTarget(): target.AppendModifier('nodeps', enable_ble=False, enable_wifi=False, enable_thread=False, crypto_library=HostCryptoLibrary.MBEDTLS, use_clang=True).ExceptIfRe('-(clang|noble|boringssl|mbedtls)') + target.AppendModifier('nlfaultinject', use_nl_fault_injection=True) target.AppendModifier('platform-mdns', use_platform_mdns=True) target.AppendModifier('minmdns-verbose', minmdns_high_verbosity=True) target.AppendModifier('libnl', minmdns_address_policy="libnl") diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 7b7a02d421f097..a6ad8f343e0b16 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -295,7 +295,7 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True, enable_ble=True, enable_wifi=True, enable_thread=True, use_tsan=False, use_asan=False, use_ubsan=False, separate_event_loop=True, fuzzing_type: HostFuzzingType = HostFuzzingType.NONE, use_clang=False, - interactive_mode=True, extra_tests=False, use_platform_mdns=False, enable_rpcs=False, + interactive_mode=True, extra_tests=False, use_nl_fault_injection=False, use_platform_mdns=False, enable_rpcs=False, use_coverage=False, use_dmalloc=False, minmdns_address_policy=None, minmdns_high_verbosity=False, imgui_ui=False, crypto_library: HostCryptoLibrary = None, enable_test_event_triggers=None): @@ -368,6 +368,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, # so setting clang is not correct raise Exception('Fake host board is always gcc (not clang)') + if use_nl_fault_injection: + self.extra_gn_options.append('chip_with_nlfaultinjection=true') + if minmdns_address_policy: if use_platform_mdns: raise Exception('Address policy applies to minmdns only') diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 6a0b73362b8f5c..3c6a2d3b643d6b 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -10,7 +10,7 @@ efr32-{brd4161a,brd4187c,brd4186c,brd4163a,brd4164a,brd4166a,brd4170a,brd4186a,b esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,energy-management,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only][-tracing] genio-lighting-app linux-fake-tests[-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang] -linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management}[-nodeps][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event] +linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management}[-nodeps][-nlfaultinject][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event] linux-x64-efr32-test-runner[-clang] imx-{chip-tool,lighting-app,thermostat,all-clusters-app,all-clusters-minimal-app,ota-provider-app}[-release] infineon-psoc6-{lock,light,all-clusters,all-clusters-minimal}[-ota][-updateimage] diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index c69f9d495fa975..9f7314c14010ad 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -48,7 +48,7 @@ if [ "$#" == "0" ]; then $USAGE - Root Location of the app e.g: examples/lighting-app/efr32/ + Root Location of the app e.g: examples/lighting-app/silabs/ Desired location for the output files diff --git a/scripts/helpers/iwyu-check.py b/scripts/helpers/iwyu-check.py index f4419ccd99ff10..822b85c184766d 100755 --- a/scripts/helpers/iwyu-check.py +++ b/scripts/helpers/iwyu-check.py @@ -172,8 +172,8 @@ def main(compile_commands_glob, scanning_destination, mapping_file_dir, logging.info("============== IWYU output start ================") logger = logging.info - while status.poll() is None: - line = status.stdout.readline().rstrip() + for line in status.stdout: + line = line.rstrip() if re.match(r"^warning:.*$", line): logger = logging.warning diff --git a/scripts/helpers/platforms/iwyu.imp b/scripts/helpers/platforms/iwyu.imp index c3d2210b2886dd..06637de3ad3ddb 100644 --- a/scripts/helpers/platforms/iwyu.imp +++ b/scripts/helpers/platforms/iwyu.imp @@ -32,7 +32,12 @@ ## lib/* { include: [ '"lib/core/CHIPError.h"', private, '', public ] }, { include: [ '"lib/dnssd/ServiceNaming.h"', private, '', public ] }, + + ## lib/support/logging/* + { include: [ '"lib/support/logging/BinaryLogging.h"', private, '', public ] }, { include: [ '"lib/support/logging/CHIPLogging.h"', private, '', public ] }, + { include: [ '"lib/support/logging/Constants.h"', private, '', public ] }, + { include: [ '"lib/support/logging/TextOnlyLogging.h"', private, '', public ] }, ## platform/* { include: [ '"platform/NetworkCommissioning.h"', private, '', public ] }, diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py index d3e3403fef4954..a8991deb9b7870 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py @@ -17,6 +17,7 @@ import xmlrpc.client _DEFAULT_KEY = 'default' +_DEFAULT_WAIT_FOR_MESSAGE_TIMEOUT_SECONDS = 10 _IP = '127.0.0.1' _PORT = 9000 @@ -113,9 +114,11 @@ def factoryReset(request): def waitForMessage(request): register_key = _get_option(request, 'registerKey', _DEFAULT_KEY) message = _get_option(request, 'message') + timeout_in_seconds = _get_option( + request, 'timeoutInSeconds', _DEFAULT_WAIT_FOR_MESSAGE_TIMEOUT_SECONDS) with xmlrpc.client.ServerProxy(_make_url(), allow_none=True) as proxy: - proxy.waitForMessage(register_key, [message]) + proxy.waitForMessage(register_key, [message], timeout_in_seconds) def createOtaImage(request): otaImageFilePath = _get_option(request, 'otaImageFilePath') diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/delay_commands.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/delay_commands.py index fdb949da9b1449..7586be6de2239a 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/delay_commands.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/delay_commands.py @@ -40,6 +40,7 @@ + diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 82006643481fd2..fd4ad6f52867b5 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -160,6 +160,13 @@ def _GetInDevelopmentTests() -> Set[str]: } +def _GetChipToolUnsupportedTests() -> Set[str]: + """Tests that fail in chip-tool for some reason""" + return { + "TestDiagnosticLogsDownloadCommand", # chip-tool does not implement a bdx download command. + } + + def _GetDarwinFrameworkToolUnsupportedTests() -> Set[str]: """Tests that fail in darwin-framework-tool for some reason""" return { @@ -202,7 +209,6 @@ def _GetDarwinFrameworkToolUnsupportedTests() -> Set[str]: "Test_TC_GRPKEY_2_1", # darwin-framework-tool does not support writing readonly attributes by name "Test_TC_LCFG_2_1", # darwin-framework-tool does not support writing readonly attributes by name "Test_TC_OPCREDS_3_7", # darwin-framework-tool does not support the GetCommissionerRootCertificate command. - "Test_TC_OPSTATE_2_4", # darwin-framework-tool does not currently support reading or subscribing to Events "Test_TC_SMOKECO_2_2", # darwin-framework-tool does not currently support reading or subscribing to Events "Test_TC_SMOKECO_2_3", # darwin-framework-tool does not currently support reading or subscribing to Events "Test_TC_SMOKECO_2_4", # darwin-framework-tool does not currently support reading or subscribing to Events @@ -258,6 +264,7 @@ def _GetChipReplUnsupportedTests() -> Set[str]: "Test_TC_RVCCLEANM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "Test_TC_BINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "TestDiagnosticLogs.yaml", # chip-repl does not implement a BDXTransferServerDelegate + "TestDiagnosticLogsDownloadCommand.yaml", # chip-repl does not implement the bdx download command } @@ -340,7 +347,7 @@ def tests_with_command(chip_tool: str, is_manual: bool): ) -def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool, treat_dft_unsupported_as_in_development: bool, use_short_run_name: bool): +def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool, treat_dft_unsupported_as_in_development: bool, treat_chip_tool_unsupported_as_in_development: bool, use_short_run_name: bool): """ use_short_run_name should be true if we want the run_name to be "Test_ABC" instead of "some/path/Test_ABC.yaml" """ @@ -350,7 +357,8 @@ def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool, treat_dft extra_slow_tests = _GetExtraSlowTests() in_development_tests = _GetInDevelopmentTests() chip_repl_unsupported_tests = _GetChipReplUnsupportedTests() - treat_dft_unsupported_as_in_development_tests = _GetDarwinFrameworkToolUnsupportedTests() + dft_unsupported_as_in_development_tests = _GetDarwinFrameworkToolUnsupportedTests() + chip_tool_unsupported_as_in_development_tests = _GetChipToolUnsupportedTests() purposeful_failure_tests = _GetPurposefulFailureTests() for path in _AllYamlTests(): @@ -384,7 +392,10 @@ def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool, treat_dft else: run_name = str(path) - if treat_dft_unsupported_as_in_development and run_name in treat_dft_unsupported_as_in_development_tests: + if treat_dft_unsupported_as_in_development and run_name in dft_unsupported_as_in_development_tests: + tags.add(TestTag.IN_DEVELOPMENT) + + if treat_chip_tool_unsupported_as_in_development and run_name in chip_tool_unsupported_as_in_development_tests: tags.add(TestTag.IN_DEVELOPMENT) yield TestDefinition( @@ -396,17 +407,17 @@ def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool, treat_dft def AllReplYamlTests(): - for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=True, treat_dft_unsupported_as_in_development=False, use_short_run_name=False): + for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=True, treat_dft_unsupported_as_in_development=False, treat_chip_tool_unsupported_as_in_development=False, use_short_run_name=False): yield test def AllChipToolYamlTests(): - for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=False, treat_dft_unsupported_as_in_development=False, use_short_run_name=True): + for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=False, treat_dft_unsupported_as_in_development=False, treat_chip_tool_unsupported_as_in_development=True, use_short_run_name=True): yield test def AllDarwinFrameworkToolYamlTests(): - for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=False, treat_dft_unsupported_as_in_development=True, use_short_run_name=True): + for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=False, treat_dft_unsupported_as_in_development=True, treat_chip_tool_unsupported_as_in_development=False, use_short_run_name=True): yield test diff --git a/scripts/tests/chiptest/accessories.py b/scripts/tests/chiptest/accessories.py index 60e2136209ec19..99433d7ed88660 100644 --- a/scripts/tests/chiptest/accessories.py +++ b/scripts/tests/chiptest/accessories.py @@ -98,12 +98,12 @@ def factoryReset(self, name): return accessory.factoryReset() return False - def waitForMessage(self, name, message): + def waitForMessage(self, name, message, timeoutInSeconds=10): accessory = self.__accessories[name] if accessory: # The message param comes directly from the sys.argv[2:] of WaitForMessage.py and should contain a list of strings that # comprise the entire message to wait for - return accessory.waitForMessage(' '.join(message)) + return accessory.waitForMessage(' '.join(message), timeoutInSeconds) return False def createOtaImage(self, otaImageFilePath, rawImageFilePath, rawImageContent, vid='0xDEAD', pid='0xBEEF'): diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index fc27c447d222b5..95f7a631928ba4 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -83,8 +83,8 @@ def factoryReset(self): def waitForAnyAdvertisement(self): self.__waitFor("mDNS service published:", self.process, self.outpipe) - def waitForMessage(self, message): - self.__waitFor(message, self.process, self.outpipe) + def waitForMessage(self, message, timeoutInSeconds=10): + self.__waitFor(message, self.process, self.outpipe, timeoutInSeconds) return True def kill(self): @@ -124,7 +124,7 @@ def __startServer(self, runner, command): self.kvsPathSet.add(value) return runner.RunSubprocess(app_cmd, name='APP ', wait=False) - def __waitFor(self, waitForString, server_process, outpipe): + def __waitFor(self, waitForString, server_process, outpipe, timeoutInSeconds=10): logging.debug('Waiting for %s' % waitForString) start_time = time.monotonic() @@ -139,7 +139,7 @@ def __waitFor(self, waitForString, server_process, outpipe): (waitForString, server_process.returncode)) logging.error(died_str) raise Exception(died_str) - if time.monotonic() - start_time > 10: + if time.monotonic() - start_time > timeoutInSeconds: raise Exception('Timeout while waiting for %s' % waitForString) time.sleep(0.1) ready, self.lastLogIndex = outpipe.CapturedLogContains( @@ -336,6 +336,13 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, # so it will be commissionable again. app.factoryReset() + # It may sometimes be useful to run the same app multiple times depending + # on the implementation. So this code creates a duplicate entry but with a different + # key. + app = App(runner, path) + apps_register.add(f'{key}#2', app) + app.factoryReset() + if dry_run: tool_storage_dir = None tool_storage_args = [] diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index fdea7767037aa6..1a9b54a3ad6736 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -125,6 +125,8 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st log_cooking_threads = [] app_process = None + app_pid = 0 + if app: if not os.path.exists(app): if app is None: @@ -133,11 +135,12 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st logging.info(f"Execute: {app_args}") app_process = subprocess.Popen( app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) + app_pid = app_process.pid DumpProgramOutputToQueue( log_cooking_threads, Fore.GREEN + "APP " + Style.RESET_ALL, app_process, log_queue) script_command = [script, "--paa-trust-store-path", os.path.join(DEFAULT_CHIP_ROOT, MATTER_DEVELOPMENT_PAA_ROOT_CERTS), - '--log-format', '%(message)s'] + shlex.split(script_args) + '--log-format', '%(message)s', "--app-pid", str(app_pid)] + shlex.split(script_args) if script_gdb: # diff --git a/scripts/tools/nxp/factory_data_generator/custom.py b/scripts/tools/nxp/factory_data_generator/custom.py index 13b1a34fc98c12..e2f7584e2d7fa2 100644 --- a/scripts/tools/nxp/factory_data_generator/custom.py +++ b/scripts/tools/nxp/factory_data_generator/custom.py @@ -96,11 +96,14 @@ def encode(self): assert (self.private_key is not None) return self.private_key - def generate_private_key(self, password): - keys = load_der_private_key(self.val, password, backend=default_backend()) - self.private_key = keys.private_numbers().private_value.to_bytes( - 32, byteorder='big' - ) + def generate_private_key(self, password, use_sss_blob=False): + if use_sss_blob: + self.private_key = self.val + else: + keys = load_der_private_key(self.val, password, backend=default_backend()) + self.private_key = keys.private_numbers().private_value.to_bytes( + 32, byteorder='big' + ) class DacCert(FileArgument): diff --git a/scripts/tools/nxp/factory_data_generator/generate.py b/scripts/tools/nxp/factory_data_generator/generate.py index a203ac9dee749e..1fb7d91edeedaf 100755 --- a/scripts/tools/nxp/factory_data_generator/generate.py +++ b/scripts/tools/nxp/factory_data_generator/generate.py @@ -78,7 +78,7 @@ def __init__(self, args): self.spake2p = Spake2p() if self.args.spake2p_verifier is None: self.spake2p.generate(self.args) - self.args.dac_key.generate_private_key(self.args.dac_key_password) + self.args.dac_key.generate_private_key(self.args.dac_key_password, self.args.dac_key_use_sss_blob) def _validate_args(self): if self.args.dac_key_password is None: @@ -217,6 +217,8 @@ def main(): optional.add_argument("--dac_key_password", type=str, help="[path] Password to decode DAC Key if available") + optional.add_argument("--dac_key_use_sss_blob", action='store_true', + help="[bool] If present, DAC private key area is populated by an encrypted blob") optional.add_argument("--spake2p_verifier", type=Verifier, help="[base64 str] Already generated spake2p verifier") optional.add_argument("--aes128_key", diff --git a/scripts/tools/nxp/factory_data_generator/k32w1/example_convert_dac_private_key.jlink b/scripts/tools/nxp/factory_data_generator/k32w1/example_convert_dac_private_key.jlink new file mode 100644 index 00000000000000..d31c1370933ace --- /dev/null +++ b/scripts/tools/nxp/factory_data_generator/k32w1/example_convert_dac_private_key.jlink @@ -0,0 +1,16 @@ +reset +halt +// Factory data size is one internal flash sector (8K). +// Factory data address is retrieved from the map file. +erase 0xec000 0xee000 noreset +// Load factory data and conversion application, then +// wait for 10 seconds and load the "real" application. +loadfile factory_data.bin 0xec000 +loadfile chip-k32w1-light-example-before-conversion.srec +reset +go +Sleep 10000 +loadfile chip-k32w1-light-example-after-conversion.srec +reset +go +quit \ No newline at end of file diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 84540e97892e6a..73a0433f73b262 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -42,6 +42,13 @@ declare_args() { chip_im_force_fabric_quota_check = false enable_eventlist_attribute = false + + # Systems that can spare a bit of RAM for InteractionModelEngine/delegate + # pointers should do so (allows InteractionModelEngine decoupling and less usage + # of global pointers) + chip_im_static_global_interaction_model_engine = + current_os != "linux" && current_os != "mac" && current_os != "ios" && + current_os != "android" } buildconfig_header("app_buildconfig") { @@ -57,6 +64,7 @@ buildconfig_header("app_buildconfig") { "CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION=${chip_subscription_timeout_resumption}", "CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE=${enable_eventlist_attribute}", "CHIP_CONFIG_ENABLE_READ_CLIENT=${chip_enable_read_client}", + "CHIP_CONFIG_STATIC_GLOBAL_INTERACTION_MODEL_ENGINE=${chip_im_static_global_interaction_model_engine}", ] visibility = [ ":app_config" ] @@ -129,6 +137,8 @@ static_library("interaction-model") { "CASESessionManager.h", "DeviceProxy.cpp", "DeviceProxy.h", + "InteractionModelDelegatePointers.cpp", + "InteractionModelDelegatePointers.h", "InteractionModelEngine.cpp", "InteractionModelEngine.h", "InteractionModelTimeout.h", @@ -161,6 +171,7 @@ static_library("interaction-model") { "${chip_root}/src/app/icd/server:observer", "${chip_root}/src/lib/address_resolve", "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:static-support", "${chip_root}/src/protocols/interaction_model", "${chip_root}/src/protocols/secure_channel", "${chip_root}/src/system", diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 6831a8440606b2..d0e5db94197e0d 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -214,6 +214,7 @@ Status CommandHandler::ProcessInvokeRequest(System::PacketBufferHandle && payloa SetGroupRequest(true); } + // When updating this code, please remember to make corresponding changes to TestOnlyInvokeCommandRequestWithFaultsInjected. VerifyOrReturnError(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, Status::InvalidAction); VerifyOrReturnError(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, Status::InvalidAction); VerifyOrReturnError(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, Status::InvalidAction); @@ -911,6 +912,135 @@ void CommandHandler::MoveToState(const State aTargetState) ChipLogDetail(DataManagement, "Command handler moving to [%10.10s]", GetStateStr()); } +#if CHIP_WITH_NLFAULTINJECTION + +namespace { + +CHIP_ERROR TestOnlyExtractCommandPathFromNextInvokeRequest(TLV::TLVReader & invokeRequestsReader, + ConcreteCommandPath & concretePath) +{ + ReturnErrorOnFailure(invokeRequestsReader.Next(TLV::AnonymousTag())); + CommandDataIB::Parser commandData; + ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); + CommandPathIB::Parser commandPath; + ReturnErrorOnFailure(commandData.GetPath(&commandPath)); + return commandPath.GetConcreteCommandPath(concretePath); +} + +[[maybe_unused]] const char * GetFaultInjectionTypeStr(CommandHandler::NlFaultInjectionType faultType) +{ + switch (faultType) + { + case CommandHandler::NlFaultInjectionType::SeparateResponseMessages: + return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be the same as the " + "original request."; + case CommandHandler::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder: + return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be reversed from the " + "original request."; + case CommandHandler::NlFaultInjectionType::SkipSecondResponse: + return "Single InvokeResponseMessages. Dropping response to second request"; + } + VerifyOrDieWithMsg(false, DataManagement, "TH Failure: Unexpected fault type"); +} + +} // anonymous namespace + +// This method intentionally duplicates code from other sections. While code consolidation +// is generally preferred, here we prioritize generating a clear crash message to aid in +// troubleshooting test failures. +void CommandHandler::TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::ExchangeContext * ec, + System::PacketBufferHandle && payload, bool isTimedInvoke, + NlFaultInjectionType faultType) +{ + VerifyOrDieWithMsg(ec != nullptr, DataManagement, "TH Failure: Incoming exchange context should not be null"); + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "TH Failure: state should be Idle, issue with TH"); + + ChipLogProgress(DataManagement, "Response to InvokeRequestMessage overridden by fault injection"); + ChipLogProgress(DataManagement, " Injecting the following response:%s", GetFaultInjectionTypeStr(faultType)); + + mResponseSender.SetExchangeContext(ec); + Handle workHandle(this); + mResponseSender.WillSendMessage(); + VerifyOrDieWithMsg(!mResponseSender.IsForGroup(), DataManagement, "DUT Failure: Unexpected Group Command"); + + System::PacketBufferTLVReader reader; + InvokeRequestMessage::Parser invokeRequestMessage; + InvokeRequests::Parser invokeRequests; + reader.Init(std::move(payload)); + VerifyOrDieWithMsg(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Failed 'invokeRequestMessage.Init(reader)'"); +#if CHIP_CONFIG_IM_PRETTY_PRINT + invokeRequestMessage.PrettyPrint(); +#endif + + VerifyOrDieWithMsg(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory SuppressResponse field missing"); + VerifyOrDieWithMsg(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory TimedRequest field missing"); + VerifyOrDieWithMsg(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory InvokeRequests field missing"); + VerifyOrDieWithMsg(mTimedRequest == isTimedInvoke, DataManagement, + "DUT Failure: TimedRequest value in message mismatches action"); + + { + InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; + VerifyOrDieWithMsg(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: InvokeRequestMessage contents were invalid"); + } + + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + size_t commandCount = 0; + VerifyOrDieWithMsg(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, + DataManagement, + "TH Failure: Failed to get the length of InvokeRequests after InvokeRequestMessage validation"); + + // The command count check (specifically for a count of 2) is tied to IDM_1_3. This may need adjustment for + // compatibility with future test plans. + VerifyOrDieWithMsg(commandCount == 2, DataManagement, "DUT failure: We were strictly expecting exactly 2 InvokeRequests"); + mReserveSpaceForMoreChunkMessages = true; + + { + // Response path is the same as request path since we are replying with a failure message. + ConcreteCommandPath concreteResponsePath1; + ConcreteCommandPath concreteResponsePath2; + VerifyOrDieWithMsg( + TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath1) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the first request"); + VerifyOrDieWithMsg( + TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath2) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the second request"); + + if (faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) + { + ConcreteCommandPath temp(concreteResponsePath1); + concreteResponsePath1 = concreteResponsePath2; + concreteResponsePath2 = temp; + } + + VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath1, Status::Failure) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Error adding the first InvokeResponse"); + if (faultType == NlFaultInjectionType::SeparateResponseMessages || + faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) + { + VerifyOrDieWithMsg(FinalizeInvokeResponseMessageAndPrepareNext() == CHIP_NO_ERROR, DataManagement, + "TH Failure: Failed to create second InvokeResponseMessage"); + } + if (faultType != NlFaultInjectionType::SkipSecondResponse) + { + VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath2, Status::Failure) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Error adding the second InvokeResponse"); + } + } + + VerifyOrDieWithMsg(invokeRequestsReader.Next() == CHIP_END_OF_TLV, DataManagement, + "DUT Failure: Unexpected TLV ending of InvokeRequests"); + VerifyOrDieWithMsg(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, DataManagement, + "DUT Failure: InvokeRequestMessage TLV is not properly terminated"); +} +#endif // CHIP_WITH_NLFAULTINJECTION + } // namespace app } // namespace chip diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index b90cb821244336..f7acd709b26808 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -429,6 +429,35 @@ class CommandHandler return mResponseSender.GetSubjectDescriptor(); } +#if CHIP_WITH_NLFAULTINJECTION + + enum class NlFaultInjectionType : uint8_t + { + SeparateResponseMessages, + SeparateResponseMessagesAndInvertedResponseOrder, + SkipSecondResponse + }; + + /** + * @brief Sends InvokeResponseMessages with injected faults for certification testing. + * + * The Test Harness (TH) uses this to simulate various server response behaviors, + * ensuring the Device Under Test (DUT) handles responses per specification. + * + * This function strictly validates the DUT's InvokeRequestMessage against the test plan. + * If deviations occur, the TH terminates with a detailed error message. + * + * @param ec Exchange context for sending InvokeResponseMessages to the client. + * @param payload Payload of the incoming InvokeRequestMessage from the client. + * @param isTimedInvoke Indicates whether the interaction is timed. + * @param faultType The specific type of fault to inject into the response. + */ + // TODO(#30453): After refactoring CommandHandler for better unit testability, create a + // unit test specifically for the fault injection behavior. + void TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::ExchangeContext * ec, System::PacketBufferHandle && payload, + bool isTimedInvoke, NlFaultInjectionType faultType); +#endif // CHIP_WITH_NLFAULTINJECTION + private: friend class TestCommandInteraction; friend class CommandHandler::Handle; diff --git a/src/app/ConcreteCommandPath.h b/src/app/ConcreteCommandPath.h index 5020aa0ba6d2c0..42845b64241053 100644 --- a/src/app/ConcreteCommandPath.h +++ b/src/app/ConcreteCommandPath.h @@ -33,6 +33,8 @@ struct ConcreteCommandPath : public ConcreteClusterPath ConcreteClusterPath(aEndpointId, aClusterId), mCommandId(aCommandId) {} + ConcreteCommandPath() : ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId), mCommandId(kInvalidCommandId) {} + bool operator==(const ConcreteCommandPath & aOther) const { return ConcreteClusterPath::operator==(aOther) && (mCommandId == aOther.mCommandId); diff --git a/src/app/InteractionModelDelegatePointers.cpp b/src/app/InteractionModelDelegatePointers.cpp new file mode 100644 index 00000000000000..af4c85ee1bb1c2 --- /dev/null +++ b/src/app/InteractionModelDelegatePointers.cpp @@ -0,0 +1,36 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "InteractionModelDelegatePointers.h" + +#if CHIP_CONFIG_STATIC_GLOBAL_INTERACTION_MODEL_ENGINE + +// TODO: It would be nice to not need to couple the pointers class +// to the global interaction model engine +#include "InteractionModelEngine.h" + +namespace chip { + +template <> +app::TimedHandlerDelegate * GlobalInstanceProvider::InstancePointer() +{ + return app::InteractionModelEngine::GetInstance(); +} + +} // namespace chip + +#endif diff --git a/src/app/InteractionModelDelegatePointers.h b/src/app/InteractionModelDelegatePointers.h new file mode 100644 index 00000000000000..6677022b5561cb --- /dev/null +++ b/src/app/InteractionModelDelegatePointers.h @@ -0,0 +1,37 @@ +/* + * + * Copyright (c) 2024 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. + */ +#pragma once + +#include +#include + +namespace chip { + +#if CHIP_CONFIG_STATIC_GLOBAL_INTERACTION_MODEL_ENGINE + +template +using InteractionModelDelegatePointer = chip::CheckedGlobalInstanceReference; + +#else + +template +using InteractionModelDelegatePointer = chip::SimpleInstanceReference; + +#endif // CHIP_CONFIG_STATIC_GLOBAL_INTERATION_MODEL_ENGINE + +} // namespace chip diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 98cb6ff156a653..ddc8a984f16b72 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -411,6 +412,21 @@ Status InteractionModelEngine::OnInvokeCommandRequest(Messaging::ExchangeContext ChipLogProgress(InteractionModel, "no resource for Invoke interaction"); return Status::Busy; } + CHIP_FAULT_INJECT( + FaultInjection::kFault_IMInvoke_SeparateResponses, + commandHandler->TestOnlyInvokeCommandRequestWithFaultsInjected( + apExchangeContext, std::move(aPayload), aIsTimedInvoke, CommandHandler::NlFaultInjectionType::SeparateResponseMessages); + return Status::Success;); + CHIP_FAULT_INJECT(FaultInjection::kFault_IMInvoke_SeparateResponsesInvertResponseOrder, + commandHandler->TestOnlyInvokeCommandRequestWithFaultsInjected( + apExchangeContext, std::move(aPayload), aIsTimedInvoke, + CommandHandler::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder); + return Status::Success;); + CHIP_FAULT_INJECT( + FaultInjection::kFault_IMInvoke_SkipSecondResponse, + commandHandler->TestOnlyInvokeCommandRequestWithFaultsInjected(apExchangeContext, std::move(aPayload), aIsTimedInvoke, + CommandHandler::NlFaultInjectionType::SkipSecondResponse); + return Status::Success;); commandHandler->OnInvokeCommandRequest(apExchangeContext, aPayloadHeader, std::move(aPayload), aIsTimedInvoke); return Status::Success; } @@ -840,7 +856,7 @@ CHIP_ERROR InteractionModelEngine::OnTimedRequest(Messaging::ExchangeContext * a const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload, Protocols::InteractionModel::Status & aStatus) { - TimedHandler * handler = mTimedHandlers.CreateObject(); + TimedHandler * handler = mTimedHandlers.CreateObject(this); if (handler == nullptr) { ChipLogProgress(InteractionModel, "no resource for Timed interaction"); diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 8ed201a0d934e6..b222087867380f 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -80,7 +80,8 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, public CommandHandler::Callback, public ReadHandler::ManagementCallback, public FabricTable::Delegate, - public SubscriptionsInfoProvider + public SubscriptionsInfoProvider, + public TimedHandlerDelegate { public: /** @@ -218,26 +219,12 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, } void UnregisterReadHandlerAppCallback() { mpReadHandlerApplicationCallback = nullptr; } - /** - * Called when a timed interaction has failed (i.e. the exchange it was - * happening on has closed while the exchange delegate was the timed - * handler). - */ - void OnTimedInteractionFailed(TimedHandler * apTimedHandler); - - /** - * Called when a timed invoke is received. This function takes over all - * handling of the exchange, status reporting, and so forth. - */ + // TimedHandlerDelegate implementation + void OnTimedInteractionFailed(TimedHandler * apTimedHandler) override; void OnTimedInvoke(TimedHandler * apTimedHandler, Messaging::ExchangeContext * apExchangeContext, - const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); - - /** - * Called when a timed write is received. This function takes over all - * handling of the exchange, status reporting, and so forth. - */ + const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) override; void OnTimedWrite(TimedHandler * apTimedHandler, Messaging::ExchangeContext * apExchangeContext, - const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); + const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) override; #if CHIP_CONFIG_ENABLE_READ_CLIENT /** diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index d602273a8611a9..71070c357147df 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -275,7 +275,7 @@ class ReadHandler : public Messaging::ExchangeDelegate /** * Returns SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT - * For an ICD publisher, this SHALL be set to the idle mode interval. + * For an ICD publisher, this SHALL be set to the idle mode duration. * Otherwise, this SHALL be set to 60 minutes. */ uint16_t GetPublisherSelectedIntervalLimit(); diff --git a/src/app/TimedHandler.cpp b/src/app/TimedHandler.cpp index d448784721ac59..8df0246ba26728 100644 --- a/src/app/TimedHandler.cpp +++ b/src/app/TimedHandler.cpp @@ -17,7 +17,7 @@ */ #include "TimedHandler.h" -#include +#include #include #include #include @@ -74,19 +74,17 @@ CHIP_ERROR TimedHandler::OnMessageReceived(Messaging::ExchangeContext * aExchang if (aPayloadHeader.HasMessageType(MsgType::InvokeCommandRequest)) { - auto * imEngine = InteractionModelEngine::GetInstance(); ChipLogDetail(DataManagement, "Handing timed invoke to IM engine: handler %p exchange " ChipLogFormatExchange, this, ChipLogValueExchange(aExchangeContext)); - imEngine->OnTimedInvoke(this, aExchangeContext, aPayloadHeader, std::move(aPayload)); + mDelegate->OnTimedInvoke(this, aExchangeContext, aPayloadHeader, std::move(aPayload)); return CHIP_NO_ERROR; } if (aPayloadHeader.HasMessageType(MsgType::WriteRequest)) { - auto * imEngine = InteractionModelEngine::GetInstance(); ChipLogDetail(DataManagement, "Handing timed write to IM engine: handler %p exchange " ChipLogFormatExchange, this, ChipLogValueExchange(aExchangeContext)); - imEngine->OnTimedWrite(this, aExchangeContext, aPayloadHeader, std::move(aPayload)); + mDelegate->OnTimedWrite(this, aExchangeContext, aPayloadHeader, std::move(aPayload)); return CHIP_NO_ERROR; } } @@ -101,7 +99,7 @@ CHIP_ERROR TimedHandler::OnMessageReceived(Messaging::ExchangeContext * aExchang void TimedHandler::OnExchangeClosing(Messaging::ExchangeContext *) { - InteractionModelEngine::GetInstance()->OnTimedInteractionFailed(this); + mDelegate->OnTimedInteractionFailed(this); } CHIP_ERROR TimedHandler::HandleTimedRequestAction(Messaging::ExchangeContext * aExchangeContext, diff --git a/src/app/TimedHandler.h b/src/app/TimedHandler.h index 47faa9d5940946..e47bfb7b49e1e6 100644 --- a/src/app/TimedHandler.h +++ b/src/app/TimedHandler.h @@ -15,15 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * Definition of a handler for timed interactions. - * - */ - #pragma once +#include #include #include #include @@ -31,6 +25,11 @@ #include #include +namespace chip { +namespace app { + +class TimedHandler; + /** * A TimedHandler handles a Timed Request action and then waits for a * subsequent Invoke or Write action and hands those on to @@ -43,14 +42,37 @@ * either the exchange is closed or the interaction is handed on to the * InteractionModelEngine. */ +class TimedHandlerDelegate +{ +public: + virtual ~TimedHandlerDelegate() = default; -namespace chip { -namespace app { + /** + * Called when a timed invoke is received. This function takes over all + * handling of the exchange, status reporting, and so forth. + */ + virtual void OnTimedInvoke(TimedHandler * apTimedHandler, Messaging::ExchangeContext * apExchangeContext, + const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) = 0; + + /** + * Called when a timed write is received. This function takes over all + * handling of the exchange, status reporting, and so forth. + */ + virtual void OnTimedWrite(TimedHandler * apTimedHandler, Messaging::ExchangeContext * apExchangeContext, + const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) = 0; + + /** + * Called when a timed interaction has failed (i.e. the exchange it was + * happening on has closed while the exchange delegate was the timed + * handler). + */ + virtual void OnTimedInteractionFailed(TimedHandler * apTimedHandler) = 0; +}; class TimedHandler : public Messaging::ExchangeDelegate { public: - TimedHandler() {} + TimedHandler(TimedHandlerDelegate * delegate) : mDelegate(delegate) {} ~TimedHandler() override {} // ExchangeDelegate implementation. @@ -83,15 +105,31 @@ class TimedHandler : public Messaging::ExchangeDelegate kExpectingFollowingAction, // Expecting write or invoke. }; - // Because we have a vtable pointer and mTimeLimit needs to be 8-byte - // aligned on ARM, putting mState first here means we fit in 16 bytes on - // 32-bit ARM, whereas if we put it second we'd be 24 bytes. - // On platforms where either vtable pointers are 8 bytes or 64-bit ints can - // be 4-byte-aligned the ordering here does not matter. State mState = State::kExpectingTimedAction; + + /// This may be "fake" pointer or a real delegate pointer, depending + /// on CHIP_CONFIG_STATIC_GLOBAL_INTERACTION_MODEL_ENGINE setting. + /// + /// When this is not a real pointer, it checks that the value is always + /// set to the global InteractionModelEngine and the size of this + /// member is 1 byte. + InteractionModelDelegatePointer mDelegate; + // We keep track of the time limit for message reception, in case our // exchange's "response expected" timer gets delayed and does not fire when // the time runs out. + // + // NOTE: mTimeLimit needs to be 8-byte aligned on ARM so we place this last, + // to allow previous values to potentially use remaining packing space. + // Rationale: + // - vtable is 4-byte aligned on 32-bit arm + // - mTimeLimit requires 8-byte aligment + // => As a result we may gain 4 bytes if we place mTimeLimit last. + // Expectation of memory layout: + // - vtable pointer (4 bytes & 4 byte alignment) + // - other members (2 bytes on embedded "global pointer" arm) + // (2 bytes padding for 8-byte alignment) + // - mTimeLimit (8 bytes & 8 byte alignment) System::Clock::Timestamp mTimeLimit; }; diff --git a/src/app/app-platform/ContentApp.cpp b/src/app/app-platform/ContentApp.cpp index 571561454162ac..3bc16e9555ced5 100644 --- a/src/app/app-platform/ContentApp.cpp +++ b/src/app/app-platform/ContentApp.cpp @@ -29,35 +29,37 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED using namespace chip; using namespace chip::AppPlatform; +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace AppPlatform { #define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) #define ZCL_APPLICATION_BASIC_CLUSTER_REVISION (1u) -EmberAfStatus ContentApp::HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Status ContentApp::HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength) { ChipLogProgress(DeviceLayer, "Read Attribute for endpoint " ChipLogFormatMEI " cluster " ChipLogFormatMEI " attribute " ChipLogFormatMEI, ChipLogValueMEI(mEndpointId), ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } -EmberAfStatus ContentApp::HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer) +Status ContentApp::HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer) { ChipLogProgress(DeviceLayer, "Read Attribute for endpoint " ChipLogFormatMEI " cluster " ChipLogFormatMEI " attribute " ChipLogFormatMEI, ChipLogValueMEI(mEndpointId), ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } } // namespace AppPlatform diff --git a/src/app/app-platform/ContentApp.h b/src/app/app-platform/ContentApp.h index 6fed23cf7d64da..d3b7d1fb2b2187 100644 --- a/src/app/app-platform/ContentApp.h +++ b/src/app/app-platform/ContentApp.h @@ -33,6 +33,7 @@ #include #include #include +#include namespace chip { namespace AppPlatform { @@ -65,8 +66,9 @@ class DLL_EXPORT ContentApp virtual MediaPlaybackDelegate * GetMediaPlaybackDelegate() = 0; virtual TargetNavigatorDelegate * GetTargetNavigatorDelegate() = 0; - EmberAfStatus HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength); - EmberAfStatus HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer); + Protocols::InteractionModel::Status HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, + uint16_t maxReadLength); + Protocols::InteractionModel::Status HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer); protected: EndpointId mEndpointId = 0; diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index bb4638c45d95ba..abcaa981843037 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED @@ -41,19 +42,20 @@ using namespace chip::app::Clusters; using namespace chip::Access; using ApplicationStatusEnum = app::Clusters::ApplicationBasic::ApplicationStatusEnum; using GetSetupPINResponseType = app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Type; +using chip::Protocols::InteractionModel::Status; // Device Version for dynamic endpoints: #define DEVICE_VERSION_DEFAULT 1 -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); ChipLogDetail(DeviceLayer, "emberAfExternalAttributeReadCallback endpoint %d ", endpointIndex); - EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; + Status ret = Status::Failure; ContentApp * app = ContentAppPlatform::GetInstance().GetContentApp(endpoint); if (app != nullptr) @@ -68,14 +70,14 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI return ret; } -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); ChipLogDetail(DeviceLayer, "emberAfExternalAttributeWriteCallback endpoint %d ", endpointIndex); - EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; + Status ret = Status::Failure; ContentApp * app = ContentAppPlatform::GetInstance().GetContentApp(endpoint); if (app != nullptr) @@ -93,18 +95,18 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster namespace chip { namespace AppPlatform { -EmberAfStatus __attribute__((weak)) AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, - uint8_t * buffer, uint16_t maxReadLength) +Status __attribute__((weak)) AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { - return (EMBER_ZCL_STATUS_FAILURE); + return (Status::Failure); } -EmberAfStatus __attribute__((weak)) +Status __attribute__((weak)) AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { - return (EMBER_ZCL_STATUS_FAILURE); + return (Status::Failure); } EndpointId ContentAppPlatform::AddContentApp(ContentApp * app, EmberAfEndpointType * ep, diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 3dd0b138d2e9d1..16a47c26a3b991 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -27,6 +27,7 @@ #include #include #include +#include #include using chip::app::Clusters::ApplicationBasic::CatalogVendorApp; @@ -40,14 +41,15 @@ namespace AppPlatform { // The AppPlatform overrides emberAfExternalAttributeReadCallback to handle external attribute reads for ContentApps. // This callback can be used to handle external attribute reads for attributes belonging to static endpoints. -EmberAfStatus AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength); +Protocols::InteractionModel::Status AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); // The AppPlatform overrides emberAfExternalAttributeWriteCallback to handle external attribute writes for ContentApps. // This callback can be used to handle external attribute writes for attributes belonging to static endpoints. -EmberAfStatus AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); +Protocols::InteractionModel::Status AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); inline constexpr EndpointId kTargetBindingClusterEndpointId = 0; inline constexpr EndpointId kLocalVideoPlayerEndpointId = 1; @@ -157,7 +159,7 @@ class DLL_EXPORT ContentAppPlatform // loads given app and calls HandleGetSetupPasscode. Sets passcode to 0 if it cannot be obtained. // return true if a matching app was found (and it granted this client access), even if a passcode was not obtained bool HasTargetContentApp(uint16_t vendorId, uint16_t productId, CharSpan rotatingId, - chip::Protocols::UserDirectedCommissioning::TargetAppInfo & info, uint32_t & passcode); + Protocols::UserDirectedCommissioning::TargetAppInfo & info, uint32_t & passcode); /** * @brief 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 aa939ae810bb10..684558eec0f0bc 100644 --- a/src/app/clusters/account-login-server/account-login-server.cpp +++ b/src/app/clusters/account-login-server/account-login-server.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED #include 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 aa72d8ad499620..18a30bb1190659 100644 --- a/src/app/clusters/application-launcher-server/application-launcher-server.cpp +++ b/src/app/clusters/application-launcher-server/application-launcher-server.cpp @@ -116,8 +116,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } 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 f47fc528456a78..297d1ea9d8d8b3 100644 --- a/src/app/clusters/audio-output-server/audio-output-server.cpp +++ b/src/app/clusters/audio-output-server/audio-output-server.cpp @@ -92,8 +92,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } 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 e4e72eeb2ae930..99bd0621ba793d 100644 --- a/src/app/clusters/barrier-control-server/barrier-control-server.cpp +++ b/src/app/clusters/barrier-control-server/barrier-control-server.cpp @@ -102,29 +102,29 @@ static void cancelEndpointTimerCallback(EndpointId endpoint) uint8_t emAfPluginBarrierControlServerGetBarrierPosition(EndpointId endpoint) { uint8_t position; - EmberAfStatus status = Attributes::BarrierPosition::Get(endpoint, &position); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierPosition::Get(endpoint, &position); + assert(status == Status::Success); return position; } void emAfPluginBarrierControlServerSetBarrierPosition(EndpointId endpoint, uint8_t position) { - EmberAfStatus status = Attributes::BarrierPosition::Set(endpoint, position); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierPosition::Set(endpoint, position); + assert(status == Status::Success); } bool emAfPluginBarrierControlServerIsPartialBarrierSupported(EndpointId endpoint) { uint8_t bitmap; - EmberAfStatus status = Attributes::BarrierCapabilities::Get(endpoint, &bitmap); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierCapabilities::Get(endpoint, &bitmap); + assert(status == Status::Success); return (bitmap & to_underlying(BarrierControlCapabilities::kPartialBarrier)) != 0; } static uint16_t getOpenOrClosePeriod(EndpointId endpoint, bool open) { - uint16_t period = 0; - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + uint16_t period = 0; + Status status = Status::Success; #if defined(ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_OPEN_PERIOD_ATTRIBUTE) if (open) { @@ -137,21 +137,21 @@ static uint16_t getOpenOrClosePeriod(EndpointId endpoint, bool open) status = Attributes::BarrierClosePeriod::Get(endpoint, &period); } #endif - assert(status == EMBER_ZCL_STATUS_SUCCESS); + assert(status == Status::Success); return period; } static void setMovingState(EndpointId endpoint, uint8_t newState) { - EmberAfStatus status = Attributes::BarrierMovingState::Set(endpoint, newState); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierMovingState::Set(endpoint, newState); + assert(status == Status::Success); } uint16_t emAfPluginBarrierControlServerGetSafetyStatus(EndpointId endpoint) { uint16_t safetyStatus; - EmberAfStatus status = Attributes::BarrierSafetyStatus::Get(endpoint, &safetyStatus); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierSafetyStatus::Get(endpoint, &safetyStatus); + assert(status == Status::Success); return safetyStatus; } @@ -163,8 +163,8 @@ static bool isRemoteLockoutOn(EndpointId endpoint) void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool open, bool command) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - uint16_t events = 0; + Status status = Status::Success; + uint16_t events = 0; #if defined(ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_OPEN_EVENTS_ATTRIBUTE) if (open && !command) @@ -190,7 +190,7 @@ void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool ope status = Attributes::BarrierCommandCloseEvents::Get(endpoint, &events); } #endif - assert(status == EMBER_ZCL_STATUS_SUCCESS); + assert(status == Status::Success); // Section 7.1.2.1.5-8 says that this events counter SHALL NOT roll over. // The maximum 16-bit unsigned integer in Zigbee is 0xFFFE, so we have this @@ -225,7 +225,7 @@ void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool ope status = Attributes::BarrierCommandCloseEvents::Set(endpoint, events); } #endif - assert(status == EMBER_ZCL_STATUS_SUCCESS); + assert(status == Status::Success); } // ----------------------------------------------------------------------------- diff --git a/src/app/clusters/basic-information/basic-information.cpp b/src/app/clusters/basic-information/basic-information.cpp index f241bb2cf5a008..641dc59a853dd6 100644 --- a/src/app/clusters/basic-information/basic-information.cpp +++ b/src/app/clusters/basic-information/basic-information.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,7 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::BasicInformation; using namespace chip::app::Clusters::BasicInformation::Attributes; using namespace chip::DeviceLayer; +using chip::Protocols::InteractionModel::Status; namespace { @@ -463,9 +465,9 @@ namespace Clusters { namespace BasicInformation { bool IsLocalConfigDisabled() { - bool disabled = false; - EmberAfStatus status = LocalConfigDisabled::Get(0, &disabled); - return status == EMBER_ZCL_STATUS_SUCCESS && disabled; + bool disabled = false; + Status status = LocalConfigDisabled::Get(0, &disabled); + return status == Status::Success && disabled; } } // namespace BasicInformation } // namespace Clusters diff --git a/src/app/clusters/bindings/BindingManager.cpp b/src/app/clusters/bindings/BindingManager.cpp index 7243fdcfb3b744..b765146ed55153 100644 --- a/src/app/clusters/bindings/BindingManager.cpp +++ b/src/app/clusters/bindings/BindingManager.cpp @@ -88,7 +88,7 @@ CHIP_ERROR BindingManager::Init(const BindingManagerInitParams & params) { for (const EmberBindingTableEntry & entry : BindingTable::GetInstance()) { - if (entry.type == EMBER_UNICAST_BINDING) + if (entry.type == MATTER_UNICAST_BINDING) { // The CASE connection can also fail if the unicast peer is offline. // There is recovery mechanism to retry connection on-demand so ignore error. @@ -187,14 +187,14 @@ CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, Cluste { if (iter->local == endpoint && (!iter->clusterId.HasValue() || iter->clusterId.Value() == cluster)) { - if (iter->type == EMBER_UNICAST_BINDING) + if (iter->type == MATTER_UNICAST_BINDING) { error = mPendingNotificationMap.AddPendingNotification(iter.GetIndex(), bindingContext); SuccessOrExit(error); error = EstablishConnection(ScopedNodeId(iter->nodeId, iter->fabricIndex)); SuccessOrExit(error); } - else if (iter->type == EMBER_MULTICAST_BINDING) + else if (iter->type == MATTER_MULTICAST_BINDING) { mBoundDeviceChangedHandler(*iter, nullptr, bindingContext->GetContext()); } diff --git a/src/app/clusters/bindings/PendingNotificationMap.cpp b/src/app/clusters/bindings/PendingNotificationMap.cpp index 3499bddc090046..a7299b2d1f4663 100644 --- a/src/app/clusters/bindings/PendingNotificationMap.cpp +++ b/src/app/clusters/bindings/PendingNotificationMap.cpp @@ -30,17 +30,17 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) // to the start of the list than the last entry of any other peer. // First, set up a way to easily track which entries correspond to the same peer. - uint8_t bindingWithSamePeer[EMBER_BINDING_TABLE_SIZE]; + uint8_t bindingWithSamePeer[MATTER_BINDING_TABLE_SIZE]; for (auto iter = BindingTable::GetInstance().begin(); iter != BindingTable::GetInstance().end(); ++iter) { - if (iter->type != EMBER_UNICAST_BINDING) + if (iter->type != MATTER_UNICAST_BINDING) { continue; } for (auto checkIter = BindingTable::GetInstance().begin(); checkIter != BindingTable::GetInstance().end(); ++checkIter) { - if (checkIter->type == EMBER_UNICAST_BINDING && checkIter->fabricIndex == iter->fabricIndex && + if (checkIter->type == MATTER_UNICAST_BINDING && checkIter->fabricIndex == iter->fabricIndex && checkIter->nodeId == iter->nodeId) { bindingWithSamePeer[iter.GetIndex()] = checkIter.GetIndex(); @@ -49,7 +49,7 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) } } - uint16_t lastAppear[EMBER_BINDING_TABLE_SIZE]; + uint16_t lastAppear[MATTER_BINDING_TABLE_SIZE]; for (uint16_t & value : lastAppear) { value = UINT16_MAX; @@ -62,7 +62,7 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) } uint8_t lruBindingEntryIndex; uint16_t minLastAppearValue = UINT16_MAX; - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { if (lastAppear[i] < minLastAppearValue) { @@ -82,7 +82,7 @@ CHIP_ERROR PendingNotificationMap::FindLRUConnectPeer(ScopedNodeId & nodeId) CHIP_ERROR PendingNotificationMap::AddPendingNotification(uint8_t bindingEntryId, PendingNotificationContext * context) { RemoveEntry(bindingEntryId); - if (mNumEntries == EMBER_BINDING_TABLE_SIZE) + if (mNumEntries == MATTER_BINDING_TABLE_SIZE) { // We know that the RemoveEntry above did not do anything so we don't need to try restoring it. return CHIP_ERROR_NO_MEMORY; diff --git a/src/app/clusters/bindings/PendingNotificationMap.h b/src/app/clusters/bindings/PendingNotificationMap.h index d0697b0dac32ff..c06a0a426d434c 100644 --- a/src/app/clusters/bindings/PendingNotificationMap.h +++ b/src/app/clusters/bindings/PendingNotificationMap.h @@ -68,7 +68,7 @@ struct PendingNotificationEntry class PendingNotificationMap { public: - static constexpr uint8_t kMaxPendingNotifications = EMBER_BINDING_TABLE_SIZE; + static constexpr uint8_t kMaxPendingNotifications = MATTER_BINDING_TABLE_SIZE; friend class Iterator; diff --git a/src/app/clusters/bindings/bindings.cpp b/src/app/clusters/bindings/bindings.cpp index 22c4fba0be6920..7e0f3ce306da32 100644 --- a/src/app/clusters/bindings/bindings.cpp +++ b/src/app/clusters/bindings/bindings.cpp @@ -114,7 +114,7 @@ CHIP_ERROR CheckValidBindingList(const EndpointId localEndpoint, const Decodable oldListSize++; } } - ReturnErrorCodeIf(BindingTable::GetInstance().Size() - oldListSize + listSize > EMBER_BINDING_TABLE_SIZE, + ReturnErrorCodeIf(BindingTable::GetInstance().Size() - oldListSize + listSize > MATTER_BINDING_TABLE_SIZE, CHIP_IM_GLOBAL_STATUS(ResourceExhausted)); return CHIP_NO_ERROR; } @@ -153,7 +153,7 @@ CHIP_ERROR BindingTableAccess::ReadBindingTable(EndpointId endpoint, AttributeVa return encoder.EncodeList([&](const auto & subEncoder) { for (const EmberBindingTableEntry & entry : BindingTable::GetInstance()) { - if (entry.local == endpoint && entry.type == EMBER_UNICAST_BINDING) + if (entry.local == endpoint && entry.type == MATTER_UNICAST_BINDING) { Binding::Structs::TargetStruct::Type value = { .node = MakeOptional(entry.nodeId), @@ -164,7 +164,7 @@ CHIP_ERROR BindingTableAccess::ReadBindingTable(EndpointId endpoint, AttributeVa }; ReturnErrorOnFailure(subEncoder.Encode(value)); } - else if (entry.local == endpoint && entry.type == EMBER_MULTICAST_BINDING) + else if (entry.local == endpoint && entry.type == MATTER_MULTICAST_BINDING) { Binding::Structs::TargetStruct::Type value = { .node = NullOptional, @@ -214,7 +214,7 @@ CHIP_ERROR BindingTableAccess::WriteBindingTable(const ConcreteDataAttributePath { if (bindingTableIter->local == path.mEndpointId && bindingTableIter->fabricIndex == mAccessingFabricIndex) { - if (bindingTableIter->type == EMBER_UNICAST_BINDING) + if (bindingTableIter->type == MATTER_UNICAST_BINDING) { BindingManager::GetInstance().UnicastBindingRemoved(bindingTableIter.GetIndex()); } @@ -284,7 +284,7 @@ CHIP_ERROR AddBindingEntry(const EmberBindingTableEntry & entry) return err; } - if (entry.type == EMBER_UNICAST_BINDING) + if (entry.type == MATTER_UNICAST_BINDING) { err = BindingManager::GetInstance().UnicastBindingCreated(entry.fabricIndex, entry.nodeId); if (err != CHIP_NO_ERROR) diff --git a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp index 8fa2f36d3a3aab..b302f468aa38e4 100644 --- a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp +++ b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.cpp @@ -102,7 +102,7 @@ CHIP_ERROR BooleanStateConfigAttrAccess::ReadCurrentSensitivityLevel(const Concr if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) { uint8_t supportedSensLevel; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == SupportedSensitivityLevels::Get(aPath.mEndpointId, &supportedSensLevel), + VerifyOrReturnError(Status::Success == SupportedSensitivityLevels::Get(aPath.mEndpointId, &supportedSensLevel), CHIP_IM_GLOBAL_STATUS(Failure)); VerifyOrReturnError(supportedSensLevel >= kMinSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(Failure)); VerifyOrReturnError(supportedSensLevel <= kMaxSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(Failure)); @@ -168,13 +168,13 @@ static bool emitAlarmsStateChangedEvent(EndpointId ep) BooleanStateConfiguration::Events::AlarmsStateChanged::Type event; BitMask active; - VerifyOrReturnValue(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &active), false); + VerifyOrReturnValue(Status::Success == AlarmsActive::Get(ep, &active), false); event.alarmsActive = active; if (HasFeature(ep, BooleanStateConfiguration::Feature::kAlarmSuppress)) { BitMask suppressed; - VerifyOrReturnValue(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &suppressed), false); + VerifyOrReturnValue(Status::Success == AlarmsSuppressed::Get(ep, &suppressed), false); event.alarmsSuppressed.SetValue(suppressed); } @@ -214,7 +214,7 @@ static CHIP_ERROR emitSensorFaultEvent(EndpointId ep, BitMask= kMinSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(ConstraintError)); VerifyOrReturnError(supportedSensLevel <= kMaxSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(ConstraintError)); @@ -254,11 +254,10 @@ CHIP_ERROR SetAlarmsActive(EndpointId ep, BitMask alarmsEnabled; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Get(ep, &alarmsEnabled), - CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(Status::Success == AlarmsEnabled::Get(ep, &alarmsEnabled), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); VerifyOrReturnError(alarmsEnabled.HasAll(alarms), CHIP_IM_GLOBAL_STATUS(Failure)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarms), CHIP_IM_GLOBAL_STATUS(Failure)); + VerifyOrReturnError(Status::Success == AlarmsActive::Set(ep, alarms), CHIP_IM_GLOBAL_STATUS(Failure)); emitAlarmsStateChangedEvent(ep); return CHIP_NO_ERROR; @@ -271,12 +270,11 @@ CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep) CHIP_IM_GLOBAL_STATUS(Failure)); BitMask alarmsEnabled; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Get(ep, &alarmsEnabled), - CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(Status::Success == AlarmsEnabled::Get(ep, &alarmsEnabled), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); if (alarmsEnabled.HasAny()) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsEnabled), CHIP_IM_GLOBAL_STATUS(Failure)); + VerifyOrReturnError(Status::Success == AlarmsActive::Set(ep, alarmsEnabled), CHIP_IM_GLOBAL_STATUS(Failure)); emitAlarmsStateChangedEvent(ep); } @@ -288,23 +286,21 @@ CHIP_ERROR ClearAllAlarms(EndpointId ep) BitMask alarmsActive, alarmsSuppressed; bool emitEvent = false; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), - CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), + VerifyOrReturnError(Status::Success == AlarmsActive::Get(ep, &alarmsActive), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); if (alarmsActive.HasAny()) { alarmsActive.ClearAll(); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsActive), - CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + VerifyOrReturnError(Status::Success == AlarmsActive::Set(ep, alarmsActive), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); emitEvent = true; } if (alarmsSuppressed.HasAny()) { alarmsSuppressed.ClearAll(); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), + VerifyOrReturnError(Status::Success == AlarmsSuppressed::Set(ep, alarmsSuppressed), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); emitEvent = true; } @@ -329,10 +325,10 @@ CHIP_ERROR SuppressAlarms(EndpointId ep, BitMask alarmsActive, alarmsSuppressed, alarmsSupported; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSupported::Get(ep, &alarmsSupported), attribute_error); + VerifyOrReturnError(Status::Success == AlarmsSupported::Get(ep, &alarmsSupported), attribute_error); VerifyOrReturnError(alarmsSupported.HasAll(alarm), CHIP_IM_GLOBAL_STATUS(ConstraintError)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), attribute_error); + VerifyOrReturnError(Status::Success == AlarmsActive::Get(ep, &alarmsActive), attribute_error); VerifyOrReturnError(alarmsActive.HasAll(alarm), CHIP_IM_GLOBAL_STATUS(InvalidInState)); Delegate * delegate = GetDelegate(ep); @@ -341,9 +337,9 @@ CHIP_ERROR SuppressAlarms(EndpointId ep, BitMaskHandleSuppressAlarm(alarm); } - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), attribute_error); + VerifyOrReturnError(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed), attribute_error); alarmsSuppressed.Set(alarm); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), attribute_error); + VerifyOrReturnError(Status::Success == AlarmsSuppressed::Set(ep, alarmsSuppressed), attribute_error); emitAlarmsStateChangedEvent(ep); @@ -409,29 +405,29 @@ bool emberAfBooleanStateConfigurationClusterEnableDisableAlarmCallback( uint8_t rawAlarm = static_cast(~alarms.Raw() & 0x03); // 0x03 is the current max bitmap alarmsToDisable = BitMask(rawAlarm); - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSupported::Get(ep, &alarmsSupported), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == AlarmsSupported::Get(ep, &alarmsSupported), status.Emplace(Status::Failure)); VerifyOrExit(alarmsSupported.HasAll(alarms), status.Emplace(Status::ConstraintError)); - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Set(ep, alarms), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == AlarmsEnabled::Set(ep, alarms), status.Emplace(Status::Failure)); if (!isDelegateNull(delegate)) { delegate->HandleEnableDisableAlarms(alarms); } - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == AlarmsActive::Get(ep, &alarmsActive), status.Emplace(Status::Failure)); if (alarmsActive.HasAny(alarmsToDisable)) { alarmsActive.Clear(alarmsToDisable); - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsActive), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == AlarmsActive::Set(ep, alarmsActive), status.Emplace(Status::Failure)); emit = true; } - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed), status.Emplace(Status::Failure)); if (alarmsSuppressed.HasAny(alarmsToDisable)) { alarmsSuppressed.Clear(alarmsToDisable); - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == AlarmsSuppressed::Set(ep, alarmsSuppressed), status.Emplace(Status::Failure)); emit = true; } diff --git a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h index 21813208c77249..547096053d04ea 100644 --- a/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h +++ b/src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-server.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -46,7 +47,7 @@ CHIP_ERROR EmitSensorFault(EndpointId ep, chip::BitMask #include #include -#include + #include #include #include @@ -33,13 +33,15 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::BridgedDeviceBasicInformation; +using chip::Protocols::InteractionModel::Status; + namespace { void ReachableChanged(EndpointId endpointId) { MATTER_TRACE_INSTANT("ReachableChanged", "BridgeBasicInfo"); bool reachable = false; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::Reachable::Get(endpointId, &reachable)) + if (Status::Success != Attributes::Reachable::Get(endpointId, &reachable)) { ChipLogError(Zcl, "ReachabledChanged: Failed to get Reachable value"); } 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 941f9d5a5f5842..3e883cf5165e3a 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -109,14 +109,14 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kXy)) { uint16_t xValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::CurrentX::Get(endpoint, &xValue)) + if (Status::Success != Attributes::CurrentX::Get(endpoint, &xValue)) { xValue = 0x616B; // Default X value according to spec } AddAttributeValuePair(pairs, Attributes::CurrentX::Id, xValue, attributeCount); uint16_t yValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::CurrentY::Get(endpoint, &yValue)) + if (Status::Success != Attributes::CurrentY::Get(endpoint, &yValue)) { yValue = 0x607D; // Default Y value according to spec } @@ -133,7 +133,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kHueAndSaturation)) { uint8_t saturationValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::CurrentSaturation::Get(endpoint, &saturationValue)) + if (Status::Success != Attributes::CurrentSaturation::Get(endpoint, &saturationValue)) { saturationValue = 0x00; } @@ -143,21 +143,21 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop)) { uint8_t loopActiveValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorLoopActive::Get(endpoint, &loopActiveValue)) + if (Status::Success != Attributes::ColorLoopActive::Get(endpoint, &loopActiveValue)) { loopActiveValue = 0x00; } AddAttributeValuePair(pairs, Attributes::ColorLoopActive::Id, loopActiveValue, attributeCount); uint8_t loopDirectionValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorLoopDirection::Get(endpoint, &loopDirectionValue)) + if (Status::Success != Attributes::ColorLoopDirection::Get(endpoint, &loopDirectionValue)) { loopDirectionValue = 0x00; } AddAttributeValuePair(pairs, Attributes::ColorLoopDirection::Id, loopDirectionValue, attributeCount); uint16_t loopTimeValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorLoopTime::Get(endpoint, &loopTimeValue)) + if (Status::Success != Attributes::ColorLoopTime::Get(endpoint, &loopTimeValue)) { loopTimeValue = 0x0019; // Default loop time value according to spec } @@ -167,7 +167,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorTemperature)) { uint16_t temperatureValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorTemperatureMireds::Get(endpoint, &temperatureValue)) + if (Status::Success != Attributes::ColorTemperatureMireds::Get(endpoint, &temperatureValue)) { temperatureValue = 0x00FA; // Default temperature value according to spec } @@ -175,7 +175,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } uint8_t modeValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::EnhancedColorMode::Get(endpoint, &modeValue)) + if (Status::Success != Attributes::EnhancedColorMode::Get(endpoint, &modeValue)) { modeValue = ColorControl::EnhancedColorMode::kCurrentXAndCurrentY; // Default mode value according to spec } @@ -446,7 +446,7 @@ bool ColorControlServer::HasFeature(chip::EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } @@ -2509,11 +2509,11 @@ Status ColorControlServer::moveToColorTemp(EndpointId aEndpoint, uint16_t colorT uint16_t ColorControlServer::getTemperatureCoupleToLevelMin(EndpointId endpoint) { uint16_t colorTemperatureCoupleToLevelMin; - EmberAfStatus status; + Status status; status = Attributes::CoupleColorTempToLevelMinMireds::Get(endpoint, &colorTemperatureCoupleToLevelMin); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { // Not less than the physical min. Attributes::ColorTempPhysicalMinMireds::Get(endpoint, &colorTemperatureCoupleToLevelMin); @@ -2552,14 +2552,14 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint) // Initialize startUpColorTempMireds to "maintain previous value" value null app::DataModel::Nullable startUpColorTemp; - EmberAfStatus status = Attributes::StartUpColorTemperatureMireds::Get(endpoint, startUpColorTemp); + Status status = Attributes::StartUpColorTemperatureMireds::Get(endpoint, startUpColorTemp); - if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpColorTemp.IsNull()) + if (status == Status::Success && !startUpColorTemp.IsNull()) { uint16_t updatedColorTemp = MAX_TEMPERATURE_VALUE; status = Attributes::ColorTemperatureMireds::Get(endpoint, &updatedColorTemp); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE; Attributes::ColorTempPhysicalMinMireds::Get(endpoint, &tempPhysicalMin); @@ -2576,7 +2576,7 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint) updatedColorTemp = startUpColorTemp.Value(); status = Attributes::ColorTemperatureMireds::Set(endpoint, updatedColorTemp); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { // Set ColorMode attributes to reflect ColorTemperature. uint8_t updateColorMode = ColorControl::EnhancedColorMode::kColorTemperature; @@ -2607,7 +2607,7 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint) // Check whether our color temperature has actually changed. If not, do // nothing, and wait for it to change. uint16_t currentColorTemp; - if (Attributes::ColorTemperatureMireds::Get(endpoint, ¤tColorTemp) != EMBER_ZCL_STATUS_SUCCESS) + if (Attributes::ColorTemperatureMireds::Get(endpoint, ¤tColorTemp) != Status::Success) { // Why can't we read our attribute? return; @@ -2906,9 +2906,9 @@ void ColorControlServer::levelControlColorTempChangeCommand(EndpointId endpoint) if (colorMode == ColorControl::EnhancedColorMode::kColorTemperature) { app::DataModel::Nullable currentLevel; - EmberAfStatus status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); + Status status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS || currentLevel.IsNull()) + if (status != Status::Success || currentLevel.IsNull()) { currentLevel.SetNonNull((uint8_t) 0x7F); } diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index 3620379d4ed8e2..7aeb06da661cd1 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -35,8 +36,6 @@ namespace DeviceEnergyManagement { using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; -using chip::Protocols::InteractionModel::Status; - class Delegate { public: @@ -52,7 +51,8 @@ class Delegate * @param duration The duration that the ESA SHALL maintain the requested power for. * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. */ - virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration, AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status PowerAdjustRequest(const int64_t power, const uint32_t duration, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate SHALL make the ESA end the active power adjustment session & return to normal (or idle) power levels. @@ -60,7 +60,7 @@ class Delegate * * @return It should report SUCCESS if successful and FAILURE otherwise. */ - virtual Status CancelPowerAdjustRequest() = 0; + virtual Protocols::InteractionModel::Status CancelPowerAdjustRequest() = 0; /** * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastId. @@ -76,7 +76,8 @@ class Delegate * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate * IM_Status. */ - virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime, AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status StartTimeAdjustRequest(const uint32_t requestedStartTime, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for PauseRequest command @@ -91,7 +92,7 @@ class Delegate * @param duration Duration that the ESA SHALL be paused for. * @return Success if the ESA is paused, otherwise returns other IM_Status. */ - virtual Status PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for ResumeRequest command @@ -102,7 +103,7 @@ class Delegate * * @return Success if the ESA is resumed, otherwise returns other IM_Status. */ - virtual Status ResumeRequest() = 0; + virtual Protocols::InteractionModel::Status ResumeRequest() = 0; /** * @brief Delegate handler for ModifyForecastRequest @@ -118,9 +119,10 @@ class Delegate * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command * SHALL be rejected returning other IM_Status. */ - virtual Status ModifyForecastRequest(const uint32_t forecastId, - const DataModel::DecodableList & slotAdjustments, - AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status + ModifyForecastRequest(const uint32_t forecastId, + const DataModel::DecodableList & slotAdjustments, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for RequestConstraintBasedForecast @@ -133,8 +135,9 @@ class Delegate * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. */ - virtual Status RequestConstraintBasedForecast(const DataModel::DecodableList & constraints, - AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status + RequestConstraintBasedForecast(const DataModel::DecodableList & constraints, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for CancelRequest @@ -153,7 +156,7 @@ class Delegate * * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. */ - virtual Status CancelRequest() = 0; + virtual Protocols::InteractionModel::Status CancelRequest() = 0; // ------------------------------------------------------------------ // Get attribute methods @@ -210,7 +213,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface void InvokeCommand(HandlerContext & handlerContext) override; CHIP_ERROR EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) override; - Status CheckOptOutAllowsRequest(AdjustmentCauseEnum adjustmentCause); + Protocols::InteractionModel::Status CheckOptOutAllowsRequest(AdjustmentCauseEnum adjustmentCause); void HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData); void HandleCancelPowerAdjustRequest(HandlerContext & ctx, const Commands::CancelPowerAdjustRequest::DecodableType & commandData); diff --git a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp index 73a626e73e4f34..40321f8c53297c 100644 --- a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp +++ b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp @@ -76,67 +76,67 @@ DishwasherAlarmServer & DishwasherAlarmServer::Instance() return instance; } -EmberAfStatus DishwasherAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) +Status DishwasherAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) { - EmberAfStatus status = Attributes::Mask::Get(endpoint, mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Mask::Get(endpoint, mask); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading mask, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading mask, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::GetLatchValue(EndpointId endpoint, BitMask * latch) +Status DishwasherAlarmServer::GetLatchValue(EndpointId endpoint, BitMask * latch) { if (!HasResetFeature(endpoint)) { ChipLogProgress(Zcl, "Dishwasher Alarm feature: Unsupport Latch attribute"); - return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; + return Status::UnsupportedAttribute; } - EmberAfStatus status = Attributes::Latch::Get(endpoint, latch); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Latch::Get(endpoint, latch); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading latch, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading latch, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) +Status DishwasherAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) { - EmberAfStatus status = Attributes::State::Get(endpoint, state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::State::Get(endpoint, state); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: get state, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: get state, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) +Status DishwasherAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) { - EmberAfStatus status = Attributes::Supported::Get(endpoint, supported); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Supported::Get(endpoint, supported); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading supported, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading supported, err:0x%x", to_underlying(status)); } return status; } -EmberAfStatus DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) +Status DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; ; - if ((status = Attributes::Supported::Set(endpoint, supported)) != EMBER_ZCL_STATUS_SUCCESS) + if ((status = Attributes::Supported::Set(endpoint, supported)) != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing supported, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing supported, err:0x%x", to_underlying(status)); return status; } // Whenever there is change in Supported attribute, Latch should change accordingly (if possible). BitMask latch; - if (GetLatchValue(endpoint, &latch) == EMBER_ZCL_STATUS_SUCCESS && !supported.HasAll(latch)) + if (GetLatchValue(endpoint, &latch) == Status::Success && !supported.HasAll(latch)) { latch = latch & supported; status = SetLatchValue(endpoint, latch); @@ -144,7 +144,7 @@ EmberAfStatus DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, cons // Whenever there is change in Supported attribute, Mask, State should change accordingly. BitMask mask; - if ((status = GetMaskValue(endpoint, &mask)) != EMBER_ZCL_STATUS_SUCCESS) + if ((status = GetMaskValue(endpoint, &mask)) != Status::Success) { return status; } @@ -157,26 +157,26 @@ EmberAfStatus DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, cons return status; } -EmberAfStatus DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) +Status DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) { BitMask supported; - if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(mask)) + if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(mask)) { ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Mask is not supported"); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - if ((status = Attributes::Mask::Set(endpoint, mask)) != EMBER_ZCL_STATUS_SUCCESS) + Status status = Status::Success; + if ((status = Attributes::Mask::Set(endpoint, mask)) != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing mask, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing mask, err:0x%x", to_underlying(status)); return status; } // Whenever there is change in Mask, State should change accordingly. BitMask state; status = GetStateValue(endpoint, &state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -189,61 +189,61 @@ EmberAfStatus DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const Bit return status; } -EmberAfStatus DishwasherAlarmServer::SetLatchValue(EndpointId endpoint, const BitMask latch) +Status DishwasherAlarmServer::SetLatchValue(EndpointId endpoint, const BitMask latch) { if (!HasResetFeature(endpoint)) { ChipLogProgress(Zcl, "Dishwasher Alarm feature: Unsupport Latch attribute"); - return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; + return Status::UnsupportedAttribute; } BitMask supported; - if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(latch)) + if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(latch)) { ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Latch is not supported"); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } - EmberAfStatus status = Attributes::Latch::Set(endpoint, latch); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Latch::Set(endpoint, latch); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing latch, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing latch, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const BitMask newState, bool ignoreLatchState) +Status DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const BitMask newState, bool ignoreLatchState) { BitMask supported; BitMask finalNewState; finalNewState.Set(newState); - if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(finalNewState)) + if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(finalNewState)) { ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Alarm is not supported"); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } BitMask mask; - if (GetMaskValue(endpoint, &mask) || !mask.HasAll(finalNewState)) + if (Status::Success != GetMaskValue(endpoint, &mask) || !mask.HasAll(finalNewState)) { ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Alarm is suppressed"); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; BitMask currentState; status = Attributes::State::Get(endpoint, ¤tState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading state, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading state, err:0x%x", to_underlying(status)); return status; } BitMask latch; - if (!ignoreLatchState && (GetLatchValue(endpoint, &latch) == EMBER_ZCL_STATUS_SUCCESS)) + if (!ignoreLatchState && (GetLatchValue(endpoint, &latch) == Status::Success)) { // Restore bits that have their Latch bit set. auto bitsToKeep = latch & currentState; @@ -252,9 +252,9 @@ EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const Bi // Store the new value of the State attribute. status = Attributes::State::Set(endpoint, finalNewState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing state, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing state, err:0x%x", to_underlying(status)); return status; } @@ -268,19 +268,19 @@ EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const Bi return status; } -EmberAfStatus DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms) +Status DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms) { BitMask supported; - if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(alarms)) + if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(alarms)) { ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Alarm is not supported"); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } BitMask state; - if (GetStateValue(endpoint, &state) != EMBER_ZCL_STATUS_SUCCESS) + if (GetStateValue(endpoint, &state) != Status::Success) { - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } state.Clear(alarms); @@ -290,7 +290,7 @@ EmberAfStatus DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, con bool DishwasherAlarmServer::HasResetFeature(EndpointId endpoint) { uint32_t featureMap = 0; - if (Attributes::FeatureMap::Get(endpoint, &featureMap) != EMBER_ZCL_STATUS_SUCCESS) + if (Attributes::FeatureMap::Get(endpoint, &featureMap) != Status::Success) { return false; } @@ -319,7 +319,7 @@ static Status ModifyEnabledHandler(const app::ConcreteCommandPath & commandPath, EndpointId endpoint = commandPath.mEndpointId; BitMask supported; - if (DishwasherAlarmServer::Instance().GetSupportedValue(endpoint, &supported) != EMBER_ZCL_STATUS_SUCCESS) + if (DishwasherAlarmServer::Instance().GetSupportedValue(endpoint, &supported) != Status::Success) { return Status::Failure; } @@ -340,7 +340,7 @@ static Status ModifyEnabledHandler(const app::ConcreteCommandPath & commandPath, return Status::Failure; } // The cluster will do this update if delegate.ModifyEnabledAlarmsCallback() returns true. - if (DishwasherAlarmServer::Instance().SetMaskValue(endpoint, mask) != EMBER_ZCL_STATUS_SUCCESS) + if (DishwasherAlarmServer::Instance().SetMaskValue(endpoint, mask) != Status::Success) { return Status::Failure; } @@ -354,7 +354,7 @@ static Status ResetHandler(const app::ConcreteCommandPath & commandPath, const B if (!DishwasherAlarmServer::Instance().HasResetFeature(endpoint)) { ChipLogProgress(Zcl, "Dishwasher Alarm feature: Unsupport Reset Command"); - return EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND; + return Status::UnsupportedCommand; } // A server that is unable to reset alarms SHALL respond with a status code of FAILURE @@ -366,7 +366,7 @@ static Status ResetHandler(const app::ConcreteCommandPath & commandPath, const B } // The cluster will do this update if delegate.ResetAlarmsCallback() returns true. - if (DishwasherAlarmServer::Instance().ResetLatchedAlarms(endpoint, alarms) != EMBER_ZCL_STATUS_SUCCESS) + if (DishwasherAlarmServer::Instance().ResetLatchedAlarms(endpoint, alarms) != Status::Success) { ChipLogProgress(Zcl, "reset alarms fail"); return Status::Failure; diff --git a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h index d03662f29333fd..5aff983ca6e84f 100644 --- a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h +++ b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -35,16 +36,16 @@ class DishwasherAlarmServer public: static DishwasherAlarmServer & Instance(); - EmberAfStatus GetMaskValue(EndpointId endpoint, BitMask * mask); - EmberAfStatus GetStateValue(EndpointId endpoint, BitMask * state); - EmberAfStatus GetLatchValue(EndpointId endpoint, BitMask * latch); - EmberAfStatus GetSupportedValue(EndpointId endpoint, BitMask * suppported); + Protocols::InteractionModel::Status GetMaskValue(EndpointId endpoint, BitMask * mask); + Protocols::InteractionModel::Status GetStateValue(EndpointId endpoint, BitMask * state); + Protocols::InteractionModel::Status GetLatchValue(EndpointId endpoint, BitMask * latch); + Protocols::InteractionModel::Status GetSupportedValue(EndpointId endpoint, BitMask * suppported); // Whenever there is change on Mask we should change State accordingly. - EmberAfStatus SetMaskValue(EndpointId endpoint, const BitMask mask); - EmberAfStatus SetLatchValue(EndpointId endpoint, const BitMask latch); + Protocols::InteractionModel::Status SetMaskValue(EndpointId endpoint, const BitMask mask); + Protocols::InteractionModel::Status SetLatchValue(EndpointId endpoint, const BitMask latch); // A change in supported value will result in a corresponding change in mask and state. - EmberAfStatus SetSupportedValue(EndpointId endpoint, const BitMask supported); + Protocols::InteractionModel::Status SetSupportedValue(EndpointId endpoint, const BitMask supported); /** * @brief Set the value of the State attribute @@ -60,7 +61,8 @@ class DishwasherAlarmServer * honoring the Mask and Supported attributes. * The default value for the ignoreLatchState parameter is false. */ - EmberAfStatus SetStateValue(EndpointId endpoint, const BitMask newState, bool ignoreLatchState = false); + Protocols::InteractionModel::Status SetStateValue(EndpointId endpoint, const BitMask newState, + bool ignoreLatchState = false); /** * @brief Reset the value of latched alarms in the State attribute. @@ -69,7 +71,7 @@ class DishwasherAlarmServer * @param[in] alarms Each bit set to a 1 in this parameter corresponds to a bit in the * State attribute will SHALL be reset to false. */ - EmberAfStatus ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms); + Protocols::InteractionModel::Status ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms); // check whether the Alarm featureMap has enabled Reset feature. bool HasResetFeature(EndpointId endpoint); 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 8f1037ac3fba17..c049e34ba0cec2 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -41,6 +41,7 @@ using namespace chip::app; using namespace chip::app::DataModel; using namespace chip::app::Clusters::DoorLock; using namespace chip::app::Clusters::DoorLock::Attributes; +using chip::Protocols::InteractionModel::ClusterStatusCode; using chip::Protocols::InteractionModel::Status; static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_HOUR = 23; @@ -120,9 +121,9 @@ void DoorLockServer::InitServer(chip::EndpointId endpointId) ChipLogProgress(Zcl, "Door Lock cluster initialized at endpoint #%u", endpointId); auto status = Attributes::LockState::SetNull(endpointId); - if (EMBER_ZCL_STATUS_SUCCESS != status) + if (Status::Success != status) { - ChipLogError(Zcl, "[InitDoorLockServer] Unable to set the Lock State attribute to null [status=%d]", status); + ChipLogError(Zcl, "[InitDoorLockServer] Unable to set the Lock State attribute to null [status=%d]", to_underlying(status)); } SetActuatorEnabled(endpointId, true); @@ -260,7 +261,7 @@ bool DoorLockServer::HandleWrongCodeEntry(chip::EndpointId endpointId) uint8_t wrongCodeEntryLimit = 0xFF; auto status = Attributes::WrongCodeEntryLimit::Get(endpointId, &wrongCodeEntryLimit); - if (EMBER_ZCL_STATUS_SUCCESS == status) + if (Status::Success == status) { if (++endpointContext->wrongCodeEntryAttempts >= wrongCodeEntryLimit) { @@ -269,7 +270,7 @@ bool DoorLockServer::HandleWrongCodeEntry(chip::EndpointId endpointId) engageLockout(endpointId); } } - else if (EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE != status) + else if (Status::UnsupportedAttribute != status) { ChipLogError(Zcl, "Failed to read Wrong Code Entry Limit attribute, status=0x%x", to_underlying(status)); return false; @@ -300,11 +301,11 @@ bool DoorLockServer::engageLockout(chip::EndpointId endpointId) } auto status = Attributes::UserCodeTemporaryDisableTime::Get(endpointId, &lockoutTimeout); - if (EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status) + if (Status::UnsupportedAttribute == status) { return false; } - if (EMBER_ZCL_STATUS_SUCCESS != status) + if (Status::Success != status) { ChipLogError(Zcl, "Unable to read the UserCodeTemporaryDisableTime attribute [status=%d]", to_underlying(status)); return false; @@ -401,7 +402,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb if (!SupportsUSR(commandPath.mEndpointId)) { ChipLogProgress(Zcl, "[SetUser] User management is not supported [endpointId=%d]", commandPath.mEndpointId); - sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::UnsupportedCommand)); return; } @@ -410,7 +411,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb { ChipLogError(Zcl, "[SetUser] Unable to get the fabric IDX [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); - sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_FAILURE); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::Failure)); return; } @@ -419,7 +420,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb { ChipLogError(Zcl, "[SetUser] Unable to get the source node index [endpointId=%d,userIndex=%d]", commandPath.mEndpointId, userIndex); - sendClusterResponse(commandObj, commandPath, EMBER_ZCL_STATUS_FAILURE); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::Failure)); return; } @@ -433,7 +434,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb if (!userIndexValid(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); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::InvalidCommand)); return; } @@ -443,7 +444,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb 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); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::InvalidCommand)); return; } @@ -453,7 +454,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb "[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); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::InvalidCommand)); return; } @@ -462,11 +463,11 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb 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); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(Status::InvalidCommand)); return; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + ClusterStatusCode status(Status::Success); switch (operationType) { case DataOperationTypeEnum::kAdd: @@ -474,14 +475,14 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb userType, credentialRule); break; case DataOperationTypeEnum::kModify: - status = modifyUser(commandPath.mEndpointId, fabricIdx, sourceNodeId, userIndex, userName, userUniqueId, userStatus, - userType, credentialRule); + status = ClusterStatusCode(modifyUser(commandPath.mEndpointId, fabricIdx, sourceNodeId, userIndex, userName, userUniqueId, + userStatus, userType, credentialRule)); break; case DataOperationTypeEnum::kClear: default: // 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; + status = ClusterStatusCode(Status::InvalidCommand); ChipLogProgress(Zcl, "[SetUser] Invalid operation type [endpointId=%d,operationType=%u]", commandPath.mEndpointId, to_underlying(operationType)); break; @@ -1873,25 +1874,25 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred return false; } -EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, - uint16_t userIndex, const Nullable & userName, - const Nullable & userUniqueId, const Nullable & userStatus, - const Nullable & userType, - const Nullable & credentialRule, - const Nullable & credential) +ClusterStatusCode DoorLockServer::createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, + chip::NodeId sourceNodeId, uint16_t userIndex, + const Nullable & userName, const Nullable & userUniqueId, + const Nullable & userStatus, const Nullable & userType, + const Nullable & credentialRule, + const Nullable & credential) { EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { ChipLogError(Zcl, "[createUser] Unable to get the user from app [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return EMBER_ZCL_STATUS_FAILURE; + return ClusterStatusCode(Status::Failure); } // 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) { ChipLogProgress(Zcl, "[createUser] Unable to overwrite existing user [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return static_cast(DlStatus::kOccupied); + return ClusterStatusCode::ClusterSpecificFailure(DlStatus::kOccupied); } const auto & newUserName = !userName.IsNull() ? userName.Value() : ""_span; @@ -1917,7 +1918,7 @@ EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::Fabr 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; + return ClusterStatusCode(Status::Failure); } ChipLogProgress(Zcl, @@ -1931,28 +1932,27 @@ EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::Fabr sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kUserIndex, DataOperationTypeEnum::kAdd, sourceNodeId, creatorFabricIdx, userIndex, userIndex); - return EMBER_ZCL_STATUS_SUCCESS; + return ClusterStatusCode(Status::Success); } -EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, - chip::NodeId sourceNodeId, uint16_t userIndex, const Nullable & userName, - const Nullable & userUniqueId, const Nullable & userStatus, - const Nullable & userType, - const Nullable & credentialRule) +Status DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, + uint16_t userIndex, const Nullable & userName, + const Nullable & userUniqueId, const Nullable & userStatus, + const Nullable & userType, const Nullable & credentialRule) { // We should get the user by that index first EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { ChipLogError(Zcl, "[modifyUser] Unable to get the user from app [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } // 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) { ChipLogProgress(Zcl, "[modifyUser] Unable to modify non-existing user [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return EMBER_ZCL_STATUS_INVALID_COMMAND; + return Status::InvalidCommand; } // appclusters, 5.2.4.34: UserName SHALL be null if modifying a user record that was not created by the accessing fabric @@ -1962,7 +1962,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr "[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; + return Status::InvalidCommand; } // appclusters, 5.2.4.34: UserUniqueID SHALL be null if modifying the user record that was not created by the accessing fabric. @@ -1972,7 +1972,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr "[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; + return Status::InvalidCommand; } const auto & newUserName = !userName.IsNull() ? userName.Value() : user.userName; @@ -1991,7 +1991,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr ",userType=%u,credentialRule=%u]", endpointId, modifierFabricIndex, userIndex, static_cast(newUserName.size()), newUserName.data(), newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), to_underlying(newCredentialRule)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } ChipLogProgress(Zcl, @@ -2004,7 +2004,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kUserIndex, DataOperationTypeEnum::kModify, sourceNodeId, modifierFabricIndex, userIndex, userIndex); - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } Status DoorLockServer::clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, chip::NodeId sourceNodeId, @@ -2129,15 +2129,17 @@ DlStatus DoorLockServer::createNewCredentialAndUser(chip::EndpointId endpointId, return DlStatus::kOccupied; } - auto status = + ClusterStatusCode status = createUser(endpointId, creatorFabricIdx, sourceNodeId, availableUserIndex, Nullable(), Nullable(), userStatus, userType, Nullable(), Nullable(credential)); - if (EMBER_ZCL_STATUS_SUCCESS != status) + if (!status.IsSuccess()) { 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); + endpointId, credential.credentialIndex, availableUserIndex, + status.HasClusterSpecificCode() ? status.GetClusterSpecificCode().Value() + : (to_underlying(status.GetStatus()))); return DlStatus::kFailure; } @@ -3406,18 +3408,17 @@ bool DoorLockServer::RemoteOperationEnabled(chip::EndpointId endpointId) const } void DoorLockServer::sendClusterResponse(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - EmberAfStatus status) + ClusterStatusCode status) { VerifyOrDie(nullptr != commandObj); - auto statusAsInteger = to_underlying(status); - if (statusAsInteger == to_underlying(DlStatus::kOccupied) || statusAsInteger == to_underlying(DlStatus::kDuplicate)) + if (status.HasClusterSpecificCode()) { - VerifyOrDie(commandObj->AddClusterSpecificFailure(commandPath, static_cast(status)) == CHIP_NO_ERROR); + VerifyOrDie(commandObj->AddClusterSpecificFailure(commandPath, status.GetClusterSpecificCode().Value()) == CHIP_NO_ERROR); } else { - commandObj->AddStatus(commandPath, status); + commandObj->AddStatus(commandPath, status.GetStatus()); } } @@ -3514,7 +3515,7 @@ bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * comma { auto status = Attributes::RequirePINforRemoteOperation::Get(endpoint, &requirePin); VerifyOrExit( - EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status || EMBER_ZCL_STATUS_SUCCESS == status, + Status::UnsupportedAttribute == status || Status::Success == status, ChipLogError(Zcl, "Failed to read Require PIN For Remote Operation attribute, status=0x%x", to_underlying(status))); } // If the PIN is required but not provided we should exit @@ -3627,10 +3628,10 @@ void DoorLockServer::SendEvent(chip::EndpointId endpointId, T & event) template bool DoorLockServer::GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value) const + Status (*getFn)(chip::EndpointId endpointId, T * value), T & value) const { - EmberAfStatus status = getFn(endpointId, &value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); + Status status = getFn(endpointId, &value); + bool success = (Status::Success == status); if (!success) { @@ -3642,10 +3643,10 @@ bool DoorLockServer::GetAttribute(chip::EndpointId endpointId, chip::AttributeId template bool DoorLockServer::SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value) + Status (*setFn)(chip::EndpointId endpointId, T value), T value) { - EmberAfStatus status = setFn(endpointId, value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); + Status status = setFn(endpointId, value); + bool success = (Status::Success == status); if (!success) { @@ -3951,13 +3952,13 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command return; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; if (!emberAfPluginDoorLockSetAliroReaderConfig(endpointID, signingKey, verificationKey, groupIdentifier, groupResolvingKey)) { ChipLogProgress(Zcl, "[SetAliroReaderConfig] Unable to set aliro reader config [endpointId=%d]", endpointID); - status = EMBER_ZCL_STATUS_FAILURE; + status = Status::Failure; } - sendClusterResponse(commandObj, commandPath, status); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(status)); } void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath) @@ -3973,13 +3974,13 @@ void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * comma return; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; if (!emberAfPluginDoorLockClearAliroReaderConfig(endpointID)) { ChipLogProgress(Zcl, "[SetAliroReaderConfig] Unable to set aliro reader config [endpointId=%d]", endpointID); - status = EMBER_ZCL_STATUS_FAILURE; + status = Status::Failure; } - sendClusterResponse(commandObj, commandPath, status); + sendClusterResponse(commandObj, commandPath, ClusterStatusCode(status)); } // ============================================================================= @@ -4125,7 +4126,7 @@ void DoorLockServer::DoorLockOnAutoRelockCallback(System::Layer *, void * callba auto endpointId = static_cast(reinterpret_cast(callbackContext)); Nullable lockState; - if (Attributes::LockState::Get(endpointId, lockState) != EMBER_ZCL_STATUS_SUCCESS || lockState.IsNull() || + if (Attributes::LockState::Get(endpointId, lockState) != Status::Success || lockState.IsNull() || lockState.Value() != DlLockState::kLocked) { ChipLogProgress(Zcl, "Door Auto relock timer expired. %s", "Locking..."); 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 9b1a7f6fd27791..f50a666ca67721 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -307,15 +307,17 @@ class DoorLockServer : public chip::app::AttributeAccessInterface bool findUserIndexByCredential(chip::EndpointId endpointId, CredentialTypeEnum credentialType, chip::ByteSpan credentialData, uint16_t & userIndex, uint16_t & credentialIndex, EmberAfPluginDoorLockUserInfo & userInfo); - EmberAfStatus createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, - uint16_t userIndex, const Nullable & userName, const Nullable & userUniqueId, - const Nullable & userStatus, const Nullable & userType, - const Nullable & credentialRule, - const Nullable & credential = Nullable()); - EmberAfStatus modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, - uint16_t userIndex, const Nullable & userName, const Nullable & userUniqueId, - const Nullable & userStatus, const Nullable & userType, - const Nullable & credentialRule); + chip::Protocols::InteractionModel::ClusterStatusCode + createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, uint16_t userIndex, + const Nullable & userName, const Nullable & userUniqueId, + const Nullable & userStatus, const Nullable & userType, + const Nullable & credentialRule, + const Nullable & credential = Nullable()); + chip::Protocols::InteractionModel::Status + modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, uint16_t userIndex, + const Nullable & userName, const Nullable & userUniqueId, + const Nullable & userStatus, const Nullable & userType, + const Nullable & credentialRule); chip::Protocols::InteractionModel::Status clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, chip::NodeId sourceNodeId, uint16_t userIndex, bool sendUserChangeEvent); chip::Protocols::InteractionModel::Status clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, @@ -477,7 +479,7 @@ class DoorLockServer : public chip::app::AttributeAccessInterface bool engageLockout(chip::EndpointId endpointId); static void sendClusterResponse(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - EmberAfStatus status); + chip::Protocols::InteractionModel::ClusterStatusCode status); /** * @brief Common handler for LockDoor, UnlockDoor, UnlockWithTimeout commands @@ -544,7 +546,7 @@ class DoorLockServer : public chip::app::AttributeAccessInterface */ template bool GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; + chip::Protocols::InteractionModel::Status (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; /** * @brief Set generic attribute value @@ -559,7 +561,7 @@ class DoorLockServer : public chip::app::AttributeAccessInterface */ template bool SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value); + chip::Protocols::InteractionModel::Status (*setFn)(chip::EndpointId endpointId, T value), T value); // AttributeAccessInterface's Read API CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath & aPath, chip::app::AttributeValueEncoder & aEncoder) override; diff --git a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h index 0b5d45f1dc447b..28af3fa0abb343 100644 --- a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h +++ b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h @@ -22,6 +22,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -31,8 +32,6 @@ namespace ElectricalPowerMeasurement { using namespace chip::app::Clusters::ElectricalPowerMeasurement::Attributes; using namespace chip::app::Clusters::ElectricalPowerMeasurement::Structs; -using chip::Protocols::InteractionModel::Status; - class Delegate { public: diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index dfead37517d4e8..2ff46f339ff6ad 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -38,7 +39,6 @@ constexpr int64_t kMinimumChargeCurrent = 0; constexpr int64_t kMaximumChargeCurrent = 80000; constexpr uint32_t kMaxRandomizationDelayWindow = 86400; -using chip::Protocols::InteractionModel::Status; /** @brief * Defines methods for implementing application-specific logic for the EVSE Management Cluster. */ @@ -55,30 +55,31 @@ class Delegate * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status Disable() = 0; + virtual Protocols::InteractionModel::Status Disable() = 0; /** * @brief Delegate should implement a handler to enable EVSE Charging. * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status EnableCharging(const DataModel::Nullable & enableChargeTime, const int64_t & minimumChargeCurrent, - const int64_t & maximumChargeCurrent) = 0; + virtual Protocols::InteractionModel::Status EnableCharging(const DataModel::Nullable & enableChargeTime, + const int64_t & minimumChargeCurrent, + const int64_t & maximumChargeCurrent) = 0; /** * @brief Delegate should implement a handler to enable EVSE Discharging. * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status EnableDischarging(const DataModel::Nullable & enableDischargeTime, - const int64_t & maximumDischargeCurrent) = 0; + virtual Protocols::InteractionModel::Status EnableDischarging(const DataModel::Nullable & enableDischargeTime, + const int64_t & maximumDischargeCurrent) = 0; /** * @brief Delegate should implement a handler to enable EVSE Diagnostics. * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status StartDiagnostics() = 0; + virtual Protocols::InteractionModel::Status StartDiagnostics() = 0; // ------------------------------------------------------------------ // Get attribute methods diff --git a/src/app/clusters/fan-control-server/fan-control-server.cpp b/src/app/clusters/fan-control-server/fan-control-server.cpp index 8bca0d1e86c129..b297acdd1e80cf 100644 --- a/src/app/clusters/fan-control-server/fan-control-server.cpp +++ b/src/app/clusters/fan-control-server/fan-control-server.cpp @@ -34,6 +34,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -41,6 +42,8 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::FanControl; using namespace chip::app::Clusters::FanControl::Attributes; +using Protocols::InteractionModel::Status; + namespace { constexpr size_t kFanControlDelegateTableSize = @@ -85,11 +88,11 @@ namespace { // Indicates if the write operation is from the cluster server itself bool gWriteFromClusterLogic = false; -EmberAfStatus SetFanModeToOff(EndpointId endpointId) +Status SetFanModeToOff(EndpointId endpointId) { FanModeEnum currentFanMode; - EmberAfStatus status = FanMode::Get(endpointId, ¤tFanMode); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + Status status = FanMode::Get(endpointId, ¤tFanMode); + VerifyOrReturnError(Status::Success == status, status); if (currentFanMode != FanModeEnum::kOff) { @@ -103,7 +106,7 @@ bool HasFeature(EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } @@ -163,8 +166,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute else if (*value == to_underlying(FanModeEnum::kSmart)) { FanModeSequenceEnum fanModeSequence; - EmberAfStatus status = FanModeSequence::Get(attributePath.mEndpointId, &fanModeSequence); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::Failure); + Status status = FanModeSequence::Get(attributePath.mEndpointId, &fanModeSequence); + VerifyOrReturnError(Status::Success == status, Status::Failure); if (SupportsAuto(attributePath.mEndpointId) && ((fanModeSequence == FanModeSequenceEnum::kOffLowHighAuto) || @@ -204,8 +207,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute else { uint8_t speedMax; - EmberAfStatus status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::ConstraintError); + Status status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); + VerifyOrReturnError(Status::Success == status, Status::ConstraintError); if (*value <= speedMax) { @@ -247,8 +250,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute if (SupportsRocking(attributePath.mEndpointId)) { BitMask rockSupport; - EmberAfStatus status = RockSupport::Get(attributePath.mEndpointId, &rockSupport); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::ConstraintError); + Status status = RockSupport::Get(attributePath.mEndpointId, &rockSupport); + VerifyOrReturnError(Status::Success == status, Status::ConstraintError); auto rawRockSupport = rockSupport.Raw(); if ((*value & rawRockSupport) == *value) { @@ -269,8 +272,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute if (SupportsWind(attributePath.mEndpointId)) { BitMask windSupport; - EmberAfStatus status = WindSupport::Get(attributePath.mEndpointId, &windSupport); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::ConstraintError); + Status status = WindSupport::Get(attributePath.mEndpointId, &windSupport); + VerifyOrReturnError(Status::Success == status, Status::ConstraintError); auto rawWindSupport = windSupport.Raw(); if ((*value & rawWindSupport) == *value) { @@ -312,30 +315,30 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt { case FanMode::Id: { FanModeEnum mode; - EmberAfStatus status = FanMode::Get(attributePath.mEndpointId, &mode); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status); + Status status = FanMode::Get(attributePath.mEndpointId, &mode); + VerifyOrReturn(Status::Success == status); // Setting the FanMode value to Off SHALL set the values of PercentSetting, PercentCurrent, // SpeedSetting, SpeedCurrent attributes to 0 (zero). if (mode == FanModeEnum::kOff) { status = PercentSetting::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", to_underlying(status))); status = PercentCurrent::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write PercentCurrent with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write PercentCurrent with error: 0x%02x", to_underlying(status))); if (SupportsMultiSpeed(attributePath.mEndpointId)) { status = SpeedSetting::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", to_underlying(status))); status = SpeedCurrent::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write SpeedCurrent with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write SpeedCurrent with error: 0x%02x", to_underlying(status))); } } @@ -345,30 +348,30 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt { gWriteFromClusterLogic = true; status = PercentSetting::SetNull(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", to_underlying(status))); if (SupportsMultiSpeed(attributePath.mEndpointId)) { gWriteFromClusterLogic = true; status = SpeedSetting::SetNull(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", to_underlying(status))); } } break; } case PercentSetting::Id: { DataModel::Nullable percentSetting; - EmberAfStatus status = PercentSetting::Get(attributePath.mEndpointId, percentSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status && !percentSetting.IsNull()); + Status status = PercentSetting::Get(attributePath.mEndpointId, percentSetting); + VerifyOrReturn(Status::Success == status && !percentSetting.IsNull()); // If PercentSetting is set to 0, the server SHALL set the FanMode attribute value to Off. if (percentSetting.Value() == 0) { status = SetFanModeToOff(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", to_underlying(status))); } if (SupportsMultiSpeed(attributePath.mEndpointId)) @@ -377,13 +380,13 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt // speed = ceil( SpeedMax * (percent * 0.01) ) uint8_t speedMax; status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", to_underlying(status))); DataModel::Nullable currentSpeedSetting; status = SpeedSetting::Get(attributePath.mEndpointId, currentSpeedSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get SpeedSetting with error: 0x%02x", to_underlying(status))); uint16_t percent = percentSetting.Value(); // Plus 99 then integer divide by 100 instead of multiplying 0.01 to avoid floating point precision error @@ -392,8 +395,8 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt if (currentSpeedSetting.IsNull() || speedSetting != currentSpeedSetting.Value()) { status = SpeedSetting::Set(attributePath.mEndpointId, speedSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set SpeedSetting with error: 0x%02x", to_underlying(status))); } } break; @@ -402,28 +405,28 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt if (SupportsMultiSpeed(attributePath.mEndpointId)) { DataModel::Nullable speedSetting; - EmberAfStatus status = SpeedSetting::Get(attributePath.mEndpointId, speedSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status && !speedSetting.IsNull()); + Status status = SpeedSetting::Get(attributePath.mEndpointId, speedSetting); + VerifyOrReturn(Status::Success == status && !speedSetting.IsNull()); // If SpeedSetting is set to 0, the server SHALL set the FanMode attribute value to Off. if (speedSetting.Value() == 0) { status = SetFanModeToOff(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", to_underlying(status))); } // Adjust PercentSetting from a speed value change for SpeedSetting // percent = floor( speed/SpeedMax * 100 ) uint8_t speedMax; status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", to_underlying(status))); DataModel::Nullable currentPercentSetting; status = PercentSetting::Get(attributePath.mEndpointId, currentPercentSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get PercentSetting with error: 0x%02x", to_underlying(status))); float speed = speedSetting.Value(); Percent percentSetting = static_cast(speed / speedMax * 100); @@ -431,8 +434,8 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt if (currentPercentSetting.IsNull() || percentSetting != currentPercentSetting.Value()) { status = PercentSetting::Set(attributePath.mEndpointId, percentSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set PercentSetting with error: 0x%02x", to_underlying(status))); } } break; diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index d591c3f3d6e331..65bfbc1c3e5952 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -102,40 +102,40 @@ static Status GroupAdd(FabricIndex fabricIndex, EndpointId endpointId, GroupId g return Status::ResourceExhausted; } -static EmberAfStatus GroupRemove(FabricIndex fabricIndex, EndpointId endpointId, GroupId groupId) +static Status GroupRemove(FabricIndex fabricIndex, EndpointId endpointId, GroupId groupId) { - VerifyOrReturnError(IsValidGroupId(groupId), EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - VerifyOrReturnError(GroupExists(fabricIndex, endpointId, groupId), EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrReturnError(IsValidGroupId(groupId), Status::ConstraintError); + VerifyOrReturnError(GroupExists(fabricIndex, endpointId, groupId), Status::NotFound); GroupDataProvider * provider = GetGroupDataProvider(); - VerifyOrReturnError(nullptr != provider, EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrReturnError(nullptr != provider, Status::NotFound); CHIP_ERROR err = provider->RemoveEndpoint(fabricIndex, groupId, endpointId); if (CHIP_NO_ERROR == err) { MatterReportingAttributeChangeCallback(kRootEndpointId, GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id); - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } ChipLogDetail(Zcl, "ERR: Failed to remove mapping (end:%d, group:0x%x), err:%" CHIP_ERROR_FORMAT, endpointId, groupId, err.Format()); - return EMBER_ZCL_STATUS_NOT_FOUND; + return Status::NotFound; } void emberAfGroupsClusterServerInitCallback(EndpointId endpointId) { // According to spec, highest bit (Group Names) MUST match feature bit 0 (Group Names) - EmberAfStatus status = Attributes::NameSupport::Set(endpointId, NameSupportBitmap::kGroupNames); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::NameSupport::Set(endpointId, NameSupportBitmap::kGroupNames); + if (status != Status::Success) { - ChipLogDetail(Zcl, "ERR: writing NameSupport %x", status); + ChipLogDetail(Zcl, "ERR: writing NameSupport %x", to_underlying(status)); } status = Attributes::FeatureMap::Set(endpointId, static_cast(Feature::kGroupNames)); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogDetail(Zcl, "ERR: writing group feature map %x", status); + ChipLogDetail(Zcl, "ERR: writing group feature map %x", to_underlying(status)); } } @@ -161,21 +161,21 @@ bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, con GroupDataProvider * provider = GetGroupDataProvider(); GroupDataProvider::GroupInfo info; Groups::Commands::ViewGroupResponse::Type response; - CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND; + CHIP_ERROR err = CHIP_NO_ERROR; + Status status = Status::NotFound; - VerifyOrExit(IsValidGroupId(groupId), status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - VerifyOrExit(nullptr != provider, status = EMBER_ZCL_STATUS_FAILURE); - VerifyOrExit(provider->HasEndpoint(fabricIndex, groupId, commandPath.mEndpointId), status = EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrExit(IsValidGroupId(groupId), status = Status::ConstraintError); + VerifyOrExit(nullptr != provider, status = Status::Failure); + VerifyOrExit(provider->HasEndpoint(fabricIndex, groupId, commandPath.mEndpointId), status = Status::NotFound); err = provider->GetGroupInfo(fabricIndex, groupId, info); - VerifyOrExit(CHIP_NO_ERROR == err, status = EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrExit(CHIP_NO_ERROR == err, status = Status::NotFound); response.groupName = CharSpan(info.name, strnlen(info.name, GroupDataProvider::GroupInfo::kGroupNameMax)); - status = EMBER_ZCL_STATUS_SUCCESS; + status = Status::Success; exit: response.groupID = groupId; - response.status = status; + response.status = to_underlying(status); commandObj->AddResponse(commandPath, response); return true; } @@ -297,7 +297,7 @@ bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, c ScenesManagement::ScenesServer::Instance().GroupWillBeRemoved(fabricIndex, commandPath.mEndpointId, commandData.groupID); #endif response.groupID = commandData.groupID; - response.status = GroupRemove(fabricIndex, commandPath.mEndpointId, commandData.groupID); + response.status = to_underlying(GroupRemove(fabricIndex, commandPath.mEndpointId, commandData.groupID)); commandObj->AddResponse(commandPath, response); return true; diff --git a/src/app/clusters/icd-management-server/icd-management-server.cpp b/src/app/clusters/icd-management-server/icd-management-server.cpp index 90953e3b814dd2..27ecfe778a33bb 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.cpp +++ b/src/app/clusters/icd-management-server/icd-management-server.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -36,6 +35,8 @@ using namespace chip::app::Clusters::IcdManagement; using namespace Protocols; using namespace chip::Access; +using chip::Protocols::InteractionModel::Status; + namespace { /** @@ -49,9 +50,11 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, FabricTable & fabricTable, ICDConfigurationData & icdConfigurationData) { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; - mFabricTable = &fabricTable; +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; + mFabricTable = &fabricTable; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP mICDConfigurationData = &icdConfigurationData; } @@ -61,6 +64,8 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface CHIP_ERROR ReadIdleModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadActiveModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadActiveModeThreshold(EndpointId endpoint, AttributeValueEncoder & encoder); + +#if CHIP_CONFIG_ENABLE_ICD_CIP CHIP_ERROR ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadICDCounter(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadClientsSupportedPerFabric(EndpointId endpoint, AttributeValueEncoder & encoder); @@ -68,7 +73,9 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface PersistentStorageDelegate * mStorage = nullptr; Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; FabricTable * mFabricTable = nullptr; - ICDConfigurationData * mICDConfigurationData = nullptr; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + + ICDConfigurationData * mICDConfigurationData = nullptr; }; CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) @@ -86,6 +93,7 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ActiveModeThreshold::Id: return ReadActiveModeThreshold(aPath.mEndpointId, aEncoder); +#if CHIP_CONFIG_ENABLE_ICD_CIP case IcdManagement::Attributes::RegisteredClients::Id: return ReadRegisteredClients(aPath.mEndpointId, aEncoder); @@ -94,6 +102,7 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ClientsSupportedPerFabric::Id: return ReadClientsSupportedPerFabric(aPath.mEndpointId, aEncoder); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP } return CHIP_NO_ERROR; @@ -114,6 +123,60 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeThreshold(EndpointId endp return encoder.Encode(mICDConfigurationData->GetActiveModeThreshold().count()); } +#if CHIP_CONFIG_ENABLE_ICD_CIP +/** + * @brief Implementation of Fabric Delegate for ICD Management cluster + */ +class IcdManagementFabricDelegate : public FabricTable::Delegate +{ +public: + void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, + ICDConfigurationData & icdConfigurationData) + { + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; + mICDConfigurationData = &icdConfigurationData; + } + + void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override + { + uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); + ICDMonitoringTable table(*mStorage, fabricIndex, supported_clients, mSymmetricKeystore); + table.RemoveAll(); + ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); + } + +private: + PersistentStorageDelegate * mStorage = nullptr; + Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; + ICDConfigurationData * mICDConfigurationData = nullptr; +}; + +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + +} // namespace + +/* + * ICD Management Implementation + */ +#if CHIP_CONFIG_ENABLE_ICD_CIP +PersistentStorageDelegate * ICDManagementServer::mStorage = nullptr; +Crypto::SymmetricKeystore * ICDManagementServer::mSymmetricKeystore = nullptr; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + +ICDConfigurationData * ICDManagementServer::mICDConfigurationData = nullptr; + +namespace { +IcdManagementAttributeAccess gAttribute; +#if CHIP_CONFIG_ENABLE_ICD_CIP +IcdManagementFabricDelegate gFabricDelegate; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP +} // namespace + +#if CHIP_CONFIG_ENABLE_ICD_CIP + +namespace { + CHIP_ERROR IcdManagementAttributeAccess::ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder) { uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); @@ -157,37 +220,6 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadClientsSupportedPerFabric(EndpointI return encoder.Encode(mICDConfigurationData->GetClientsSupportedPerFabric()); } -/** - * @brief Implementation of Fabric Delegate for ICD Management cluster - */ -class IcdManagementFabricDelegate : public FabricTable::Delegate -{ -public: - void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, - ICDConfigurationData & icdConfigurationData) - { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; - mICDConfigurationData = &icdConfigurationData; - } - - void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override - { - uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); - ICDMonitoringTable table(*mStorage, fabricIndex, supported_clients, mSymmetricKeystore); - table.RemoveAll(); - ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); - } - -private: - PersistentStorageDelegate * mStorage = nullptr; - Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; - ICDConfigurationData * mICDConfigurationData = nullptr; -}; - -IcdManagementFabricDelegate gFabricDelegate; -IcdManagementAttributeAccess gAttribute; - /** * @brief Function checks if the client has admin permissions to the cluster in the commandPath * @@ -214,14 +246,6 @@ CHIP_ERROR CheckAdmin(CommandHandler * commandObj, const ConcreteCommandPath & c } // namespace -/* - * ICD Management Implementation - */ - -PersistentStorageDelegate * ICDManagementServer::mStorage = nullptr; -Crypto::SymmetricKeystore * ICDManagementServer::mSymmetricKeystore = nullptr; -ICDConfigurationData * ICDManagementServer::mICDConfigurationData = nullptr; - Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::RegisterClient::DecodableType & commandData, uint32_t & icdCounter) { @@ -333,6 +357,13 @@ Status ICDManagementServer::UnregisterClient(CommandHandler * commandObj, const return InteractionModel::Status::Success; } +void ICDManagementServer::TriggerICDMTableUpdatedEvent() +{ + ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); +} + +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + Status ICDManagementServer::StayActiveRequest(FabricIndex fabricIndex) { // TODO: Implementent stay awake logic for end device @@ -341,16 +372,13 @@ Status ICDManagementServer::StayActiveRequest(FabricIndex fabricIndex) return InteractionModel::Status::UnsupportedCommand; } -void ICDManagementServer::TriggerICDMTableUpdatedEvent() -{ - ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); -} - void ICDManagementServer::Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, ICDConfigurationData & icdConfigurationData) { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP mICDConfigurationData = &icdConfigurationData; } @@ -358,6 +386,7 @@ void ICDManagementServer::Init(PersistentStorageDelegate & storage, Crypto::Symm * Callbacks Implementation *********************************************************/ +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief ICD Management Cluster RegisterClient Command callback (from client) * @@ -396,6 +425,7 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(CommandHandler * comman commandObj->AddStatus(commandPath, status); return true; } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief ICD Management Cluster StayActiveRequest Command callback (from client) @@ -413,13 +443,15 @@ bool emberAfIcdManagementClusterStayActiveRequestCallback(CommandHandler * comma void MatterIcdManagementPluginServerInitCallback() { PersistentStorageDelegate & storage = Server::GetInstance().GetPersistentStorage(); - FabricTable & fabricTable = Server::GetInstance().GetFabricTable(); Crypto::SymmetricKeystore * symmetricKeystore = Server::GetInstance().GetSessionKeystore(); + FabricTable & fabricTable = Server::GetInstance().GetFabricTable(); ICDConfigurationData & icdConfigurationData = ICDConfigurationData::GetInstance().GetInstance(); +#if CHIP_CONFIG_ENABLE_ICD_CIP // Configure and register Fabric delegate gFabricDelegate.Init(storage, symmetricKeystore, icdConfigurationData); fabricTable.AddFabricDelegate(&gFabricDelegate); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP // Configure and register Attribute Access Override gAttribute.Init(storage, symmetricKeystore, fabricTable, icdConfigurationData); diff --git a/src/app/clusters/icd-management-server/icd-management-server.h b/src/app/clusters/icd-management-server/icd-management-server.h index 308d50859d2d4b..4462cb96d9c9f2 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.h +++ b/src/app/clusters/icd-management-server/icd-management-server.h @@ -19,18 +19,29 @@ #include #include -#include #include -#include #include #include -#include #include #include #include +#include + +#if CHIP_CONFIG_ENABLE_ICD_CIP +#include +#include +#include +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + using chip::Protocols::InteractionModel::Status; +namespace chip { +namespace Crypto { +using SymmetricKeystore = SessionKeystore; +} // namespace Crypto +} // namespace chip + class ICDManagementServer { public: @@ -39,6 +50,7 @@ class ICDManagementServer static void Init(chip::PersistentStorageDelegate & storage, chip::Crypto::SymmetricKeystore * symmetricKeystore, chip::ICDConfigurationData & ICDConfigurationData); +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Function that executes the business logic of the RegisterClient Command * @@ -46,23 +58,31 @@ class ICDManagementServer * ICDConfigurationData If function fails, icdCounter will be unchanged * @return Status */ - Status RegisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::IcdManagement::Commands::RegisterClient::DecodableType & commandData, - uint32_t & icdCounter); + chip::Protocols::InteractionModel::Status + RegisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::IcdManagement::Commands::RegisterClient::DecodableType & commandData, + uint32_t & icdCounter); - Status UnregisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::DecodableType & commandData); + chip::Protocols::InteractionModel::Status + UnregisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::DecodableType & commandData); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP - Status StayActiveRequest(chip::FabricIndex fabricIndex); + chip::Protocols::InteractionModel::Status StayActiveRequest(chip::FabricIndex fabricIndex); private: +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Triggers table update events to notify subscribers that an entry was added or removed * from the ICDMonitoringTable. */ void TriggerICDMTableUpdatedEvent(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + static chip::ICDConfigurationData * mICDConfigurationData; + +#if CHIP_CONFIG_ENABLE_ICD_CIP static chip::PersistentStorageDelegate * mStorage; static chip::Crypto::SymmetricKeystore * mSymmetricKeystore; - static chip::ICDConfigurationData * mICDConfigurationData; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP }; diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp index c93d96d3016e7e..257adf934a5328 100644 --- a/src/app/clusters/identify-server/identify-server.cpp +++ b/src/app/clusters/identify-server/identify-server.cpp @@ -104,7 +104,7 @@ static void onIdentifyClusterTick(chip::System::Layer * systemLayer, void * appS { EndpointId endpoint = identify->mEndpoint; - if (EMBER_ZCL_STATUS_SUCCESS == Attributes::IdentifyTime::Get(endpoint, &identifyTime) && 0 != identifyTime) + if (Status::Success == Attributes::IdentifyTime::Get(endpoint, &identifyTime) && 0 != identifyTime) { identifyTime = static_cast(identifyTime == 0 ? 0 : identifyTime - 1); // This tick writes the new attribute, which will trigger the Attribute @@ -145,7 +145,7 @@ void MatterIdentifyClusterServerAttributeChangedCallback(const app::ConcreteAttr return; } - if (EMBER_ZCL_STATUS_SUCCESS == Attributes::IdentifyTime::Get(endpoint, &identifyTime)) + if (Status::Success == Attributes::IdentifyTime::Get(endpoint, &identifyTime)) { /* effect identifier changed during identify */ if (identify->mTargetEffectIdentifier != identify->mCurrentEffectIdentifier) @@ -229,8 +229,8 @@ bool emberAfIdentifyClusterTriggerEffectCallback(CommandHandler * commandObj, co identify->mEffectVariant = effectVariant; /* only call the callback if no identify is in progress */ - if (nullptr != identify->mOnEffectIdentifier && - EMBER_ZCL_STATUS_SUCCESS == Attributes::IdentifyTime::Get(endpoint, &identifyTime) && 0 == identifyTime) + if (nullptr != identify->mOnEffectIdentifier && Status::Success == Attributes::IdentifyTime::Get(endpoint, &identifyTime) && + 0 == identifyTime) { identify->mCurrentEffectIdentifier = identify->mTargetEffectIdentifier; identify->mOnEffectIdentifier(identify); diff --git a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp index c3107015ca6f0c..7a3d47f823c409 100644 --- a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp +++ b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp @@ -82,12 +82,12 @@ LaundryDryerControlsServer & LaundryDryerControlsServer::Instance() return sInstance; } -EmberAfStatus LaundryDryerControlsServer::SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel) +Status LaundryDryerControlsServer::SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel) { DataModel::Nullable selectedDrynessLevel; - EmberAfStatus res = SelectedDrynessLevel::Get(endpointId, selectedDrynessLevel); + Status res = SelectedDrynessLevel::Get(endpointId, selectedDrynessLevel); - if ((res == EMBER_ZCL_STATUS_SUCCESS) && (selectedDrynessLevel != newSelectedDrynessLevel)) + if ((res == Status::Success) && (selectedDrynessLevel != newSelectedDrynessLevel)) { res = SelectedDrynessLevel::Set(endpointId, newSelectedDrynessLevel); } @@ -95,8 +95,8 @@ EmberAfStatus LaundryDryerControlsServer::SetSelectedDrynessLevel(EndpointId end return res; } -EmberAfStatus LaundryDryerControlsServer::GetSelectedDrynessLevel(EndpointId endpointId, - DataModel::Nullable & selectedDrynessLevel) +Status LaundryDryerControlsServer::GetSelectedDrynessLevel(EndpointId endpointId, + DataModel::Nullable & selectedDrynessLevel) { return SelectedDrynessLevel::Get(endpointId, selectedDrynessLevel); } diff --git a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h index 454c029e21fc52..5a7123c0ee78e0 100644 --- a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h +++ b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -46,8 +47,9 @@ class LaundryDryerControlsServer : public AttributeAccessInterface /** * API to set/get the SelectedDrynessLevel attribute */ - EmberAfStatus SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel); - EmberAfStatus GetSelectedDrynessLevel(EndpointId endpointId, DataModel::Nullable & selectedDrynessLevel); + Protocols::InteractionModel::Status SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel); + Protocols::InteractionModel::Status GetSelectedDrynessLevel(EndpointId endpointId, + DataModel::Nullable & selectedDrynessLevel); private: CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; diff --git a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp index cc8d7100e07367..4e58236e9b2cad 100644 --- a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp +++ b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp @@ -81,11 +81,11 @@ LaundryWasherControlsServer & LaundryWasherControlsServer::Instance() return sInstance; } -EmberAfStatus LaundryWasherControlsServer::SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent) +Status LaundryWasherControlsServer::SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent) { DataModel::Nullable spinSpeedCurrentNow; - EmberAfStatus res = SpinSpeedCurrent::Get(endpointId, spinSpeedCurrentNow); - if ((res == EMBER_ZCL_STATUS_SUCCESS) && (spinSpeedCurrentNow != spinSpeedCurrent)) + Status res = SpinSpeedCurrent::Get(endpointId, spinSpeedCurrentNow); + if ((res == Status::Success) && (spinSpeedCurrentNow != spinSpeedCurrent)) { res = SpinSpeedCurrent::Set(endpointId, spinSpeedCurrent); } @@ -93,18 +93,17 @@ EmberAfStatus LaundryWasherControlsServer::SetSpinSpeedCurrent(EndpointId endpoi return res; } -EmberAfStatus LaundryWasherControlsServer::GetSpinSpeedCurrent(EndpointId endpointId, - DataModel::Nullable & spinSpeedCurrent) +Status LaundryWasherControlsServer::GetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable & spinSpeedCurrent) { return SpinSpeedCurrent::Get(endpointId, spinSpeedCurrent); } -EmberAfStatus LaundryWasherControlsServer::SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses) +Status LaundryWasherControlsServer::SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses) { NumberOfRinsesEnum numberOfRinses; - EmberAfStatus res = NumberOfRinses::Get(endpointId, &numberOfRinses); + Status res = NumberOfRinses::Get(endpointId, &numberOfRinses); - if ((res == EMBER_ZCL_STATUS_SUCCESS) && (numberOfRinses != newNumberOfRinses)) + if ((res == Status::Success) && (numberOfRinses != newNumberOfRinses)) { res = NumberOfRinses::Set(endpointId, newNumberOfRinses); } @@ -112,7 +111,7 @@ EmberAfStatus LaundryWasherControlsServer::SetNumberOfRinses(EndpointId endpoint return res; } -EmberAfStatus LaundryWasherControlsServer::GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses) +Status LaundryWasherControlsServer::GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses) { return NumberOfRinses::Get(endpointId, &numberOfRinses); } diff --git a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h index f01069135b3e7c..c19b6f88518bf8 100644 --- a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h +++ b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h @@ -22,6 +22,8 @@ #include #include +#include + namespace chip { namespace app { namespace Clusters { @@ -48,14 +50,14 @@ class LaundryWasherControlsServer : public AttributeAccessInterface /** * API to set/get the SpinSpeedCurrent attribute */ - EmberAfStatus SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent); - EmberAfStatus GetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable & spinSpeedCurrent); + Protocols::InteractionModel::Status SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent); + Protocols::InteractionModel::Status GetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable & spinSpeedCurrent); /** * API to set/get the NumberOfRinses attribute */ - EmberAfStatus SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses); - EmberAfStatus GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses); + Protocols::InteractionModel::Status SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses); + Protocols::InteractionModel::Status GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses); private: CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index b1edc341cdd3cc..b04d32fe69c448 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -161,12 +161,12 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; app::DataModel::Nullable level; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == Attributes::CurrentLevel::Get(endpoint, level), CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Status::Success == Attributes::CurrentLevel::Get(endpoint, level), CHIP_ERROR_READ_FAILED); AttributeValuePair pairs[kLevelMaxScenableAttributes]; uint8_t maxLevel; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == Attributes::MaxLevel::Get(endpoint, &maxLevel), CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Status::Success == Attributes::MaxLevel::Get(endpoint, &maxLevel), CHIP_ERROR_READ_FAILED); pairs[0].attributeID = Attributes::CurrentLevel::Id; if (!level.IsNull()) @@ -181,8 +181,7 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)) { uint16_t frequency; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == Attributes::CurrentFrequency::Get(endpoint, &frequency), - CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Status::Success == Attributes::CurrentFrequency::Get(endpoint, &frequency), CHIP_ERROR_READ_FAILED); pairs[attributeCount].attributeID = Attributes::CurrentFrequency::Id; pairs[attributeCount].attributeValue = frequency; attributeCount++; @@ -337,10 +336,10 @@ static EmberAfLevelControlState * getState(EndpointId endpoint) static void reallyUpdateCoupledColorTemp(EndpointId endpoint) { LevelControl::Attributes::Options::TypeInfo::Type options; - EmberAfStatus status = Attributes::Options::Get(endpoint, &options); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Options::Get(endpoint, &options); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", to_underlying(status)); return; } @@ -357,7 +356,7 @@ static void reallyUpdateCoupledColorTemp(EndpointId endpoint) void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) { EmberAfLevelControlState * state = getState(endpoint); - EmberAfStatus status; + Status status; app::DataModel::Nullable currentLevel; const auto callbackStartTimestamp = System::SystemClock().GetMonotonicTimestamp(); @@ -371,9 +370,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) // Read the attribute; print error message and return if it can't be read status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS || currentLevel.IsNull()) + if (status != Status::Success || currentLevel.IsNull()) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); writeRemainingTime(endpoint, 0); return; @@ -404,9 +403,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) ChipLogDetail(Zcl, "(diff %c1)", state->increasing ? '+' : '-'); status = Attributes::CurrentLevel::Set(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing current level %x", status); + ChipLogProgress(Zcl, "ERR: writing current level %x", to_underlying(status)); state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); writeRemainingTime(endpoint, 0); return; @@ -427,9 +426,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) { uint8_t storedLevel8u = (uint8_t) state->storedLevel; status = Attributes::CurrentLevel::Set(endpoint, storedLevel8u); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing current level %x", status); + ChipLogProgress(Zcl, "ERR: writing current level %x", to_underlying(status)); } else { @@ -469,10 +468,10 @@ static void writeRemainingTime(EndpointId endpoint, uint16_t remainingTimeMs) // This is done to ensure that the attribute, in tenths of a second, only // goes to zero when the remaining time in milliseconds is actually zero. uint16_t remainingTimeDs = static_cast((remainingTimeMs + 99) / 100); - EmberAfStatus status = LevelControl::Attributes::RemainingTime::Set(endpoint, remainingTimeDs); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = LevelControl::Attributes::RemainingTime::Set(endpoint, remainingTimeDs); + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing remaining time %x", status); + ChipLogProgress(Zcl, "ERR: writing remaining time %x", to_underlying(status)); } } #endif // IGNORE_LEVEL_CONTROL_CLUSTER_LEVEL_CONTROL_REMAINING_TIME @@ -515,19 +514,19 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, chip::O } LevelControl::Attributes::Options::TypeInfo::Type options; - EmberAfStatus status = Attributes::Options::Get(endpoint, &options); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Options::Get(endpoint, &options); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", to_underlying(status)); // If we can't read the attribute, then we should just assume that it has its // default value. } bool on; status = OnOff::Attributes::OnOff::Get(endpoint, &on); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Unable to read OnOff attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read OnOff attribute: 0x%X", to_underlying(status)); return true; } // The device is on - hence ExecuteIfOff does not matter @@ -803,10 +802,10 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 // Cancel any currently active command before fiddling with the state. cancelEndpointTimerCallback(endpoint); - EmberAfStatus status = Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::CurrentLevel::Get(endpoint, currentLevel); + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return status; } @@ -869,9 +868,9 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 { uint16_t onOffTransitionTime = 0; status = Attributes::OnOffTransitionTime::Get(endpoint, &onOffTransitionTime); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on/off transition time %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off transition time %x", to_underlying(status)); return status; } @@ -1243,7 +1242,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new app::DataModel::Nullable transitionTime; uint16_t currentOnOffTransitionTime; - EmberAfStatus status; + Status status; bool useOnLevel = false; EmberAfLevelControlState * state = getState(endpoint); @@ -1257,9 +1256,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new // "Temporarily store CurrentLevel." status = Attributes::CurrentLevel::Get(endpoint, temporaryCurrentLevelCache); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return; } @@ -1273,9 +1272,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new if (emberAfContainsAttribute(endpoint, LevelControl::Id, Attributes::OnLevel::Id)) { status = Attributes::OnLevel::Get(endpoint, resolvedLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on level %x", status); + ChipLogProgress(Zcl, "ERR: reading on level %x", to_underlying(status)); return; } @@ -1302,9 +1301,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new if (emberAfContainsAttribute(endpoint, LevelControl::Id, Attributes::OnOffTransitionTime::Id)) { status = Attributes::OnOffTransitionTime::Get(endpoint, ¤tOnOffTransitionTime); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return; } transitionTime.SetNonNull(currentOnOffTransitionTime); @@ -1322,9 +1321,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new // If newValue is OnOff::Commands::On::Id... // "Set CurrentLevel to minimum level allowed for the device." status = Attributes::CurrentLevel::Set(endpoint, minimumLevelAllowedForTheDevice); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return; } @@ -1386,8 +1385,8 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) } app::DataModel::Nullable currentLevel; - EmberAfStatus status = Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status == EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::CurrentLevel::Get(endpoint, currentLevel); + if (status == Status::Success) { #ifndef IGNORE_LEVEL_CONTROL_CLUSTER_START_UP_CURRENT_LEVEL // StartUp behavior relies StartUpCurrentLevel attributes being Non Volatile. @@ -1408,7 +1407,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) app::DataModel::Nullable startUpCurrentLevel; status = Attributes::StartUpCurrentLevel::Get(endpoint, startUpCurrentLevel); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { if (!startUpCurrentLevel.IsNull()) { @@ -1480,7 +1479,7 @@ bool LevelControlHasFeature(EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } diff --git a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp index 144665b1c03b19..88283325c7c380 100644 --- a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp +++ b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -37,6 +38,8 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::LocalizationConfiguration; using namespace chip::app::Clusters::LocalizationConfiguration::Attributes; +using chip::Protocols::InteractionModel::Status; + namespace { class LocalizationConfigurationAttrAccess : public AttributeAccessInterface @@ -163,9 +166,10 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi { char outBuf[Attributes::ActiveLocale::TypeInfo::MaxLength()]; MutableCharSpan activeLocale(outBuf); - EmberAfStatus status = ActiveLocale::Get(endpoint, activeLocale); + Status status = ActiveLocale::Get(endpoint, activeLocale); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(Zcl, "Failed to read ActiveLocale with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to read ActiveLocale with error: 0x%02x", to_underlying(status))); DeviceLayer::DeviceInfoProvider * provider = DeviceLayer::GetDeviceInfoProvider(); @@ -208,8 +212,8 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi { // If initial value is not one of the allowed values, write the valid value it. status = ActiveLocale::Set(endpoint, validLocale); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write active locale with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write active locale with error: 0x%02x", to_underlying(status))); } } } 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 02b114c648b2fd..3fe13985b1ff06 100644 --- a/src/app/clusters/media-input-server/media-input-server.cpp +++ b/src/app/clusters/media-input-server/media-input-server.cpp @@ -92,8 +92,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h index d82b353f7f3eb1..ef77717bc15480 100644 --- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h +++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.h @@ -23,7 +23,7 @@ #include #include #include -#include + #include namespace chip { diff --git a/src/app/clusters/mode-base-server/mode-base-server.cpp b/src/app/clusters/mode-base-server/mode-base-server.cpp index 6c5feb1d69c88e..76bd195376e9b0 100644 --- a/src/app/clusters/mode-base-server/mode-base-server.cpp +++ b/src/app/clusters/mode-base-server/mode-base-server.cpp @@ -135,7 +135,7 @@ CHIP_ERROR Instance::Init() DataModel::Nullable onMode = GetOnMode(); bool onOffValueForStartUp = false; if (!emberAfIsKnownVolatileAttribute(mEndpointId, OnOff::Id, OnOff::Attributes::StartUpOnOff::Id) && - OnOffServer::Instance().getOnOffValueForStartUp(mEndpointId, onOffValueForStartUp) == EMBER_ZCL_STATUS_SUCCESS) + OnOffServer::Instance().getOnOffValueForStartUp(mEndpointId, onOffValueForStartUp) == Status::Success) { if (onOffValueForStartUp && !onMode.IsNull()) { 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 e2a25904bd770a..f8d99474b24c9c 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -136,8 +136,8 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) // attribute are listed below. DataModel::Nullable startUpMode; - EmberAfStatus status = Attributes::StartUpMode::Get(endpointId, startUpMode); - if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpMode.IsNull()) + Status status = Attributes::StartUpMode::Get(endpointId, startUpMode); + if (status == Status::Success && !startUpMode.IsNull()) { #ifdef MATTER_DM_PLUGIN_ON_OFF // OnMode with Power Up @@ -150,9 +150,9 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) { Attributes::OnMode::TypeInfo::Type onMode; bool onOffValueForStartUp = false; - if (Attributes::OnMode::Get(endpointId, onMode) == EMBER_ZCL_STATUS_SUCCESS && + if (Attributes::OnMode::Get(endpointId, onMode) == Status::Success && !emberAfIsKnownVolatileAttribute(endpointId, OnOff::Id, OnOff::Attributes::StartUpOnOff::Id) && - OnOffServer::Instance().getOnOffValueForStartUp(endpointId, onOffValueForStartUp) == EMBER_ZCL_STATUS_SUCCESS) + OnOffServer::Instance().getOnOffValueForStartUp(endpointId, onOffValueForStartUp) == Status::Success) { if (onOffValueForStartUp && !onMode.IsNull()) { @@ -182,12 +182,12 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) uint8_t currentMode = 0; status = Attributes::CurrentMode::Get(endpointId, ¤tMode); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && (startUpMode.Value() != currentMode)) + if ((status == Status::Success) && (startUpMode.Value() != currentMode)) { status = Attributes::CurrentMode::Set(endpointId, startUpMode.Value()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogError(Zcl, "ModeSelect: Error initializing CurrentMode, EmberAfStatus code 0x%02x", status); + ChipLogError(Zcl, "ModeSelect: Error initializing CurrentMode, Status code 0x%02x", to_underlying(status)); } else { diff --git a/src/app/clusters/mode-select-server/supported-modes-manager.h b/src/app/clusters/mode-select-server/supported-modes-manager.h index 4a6ccd20c5f60a..3c36f188cb4a0e 100644 --- a/src/app/clusters/mode-select-server/supported-modes-manager.h +++ b/src/app/clusters/mode-select-server/supported-modes-manager.h @@ -19,7 +19,7 @@ #pragma once #include -#include + #include namespace chip { @@ -74,7 +74,7 @@ class SupportedModesManager * @param mode The mode for which to search the ModeOptionStruct. * @param dataPtr The pointer to receive the ModeOptionStruct, if one is found. * @return Status::Success if successfully found the option. Otherwise, returns appropriate status code (found in - * ) + * ) */ virtual Protocols::InteractionModel::Status getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const = 0; diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 6776897efce6fb..ffaff6bd49253a 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -135,6 +136,26 @@ void Instance::Shutdown() mpBaseDriver->Shutdown(); } +#if !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION +void Instance::SendNonConcurrentConnectNetworkResponse() +{ + auto commandHandleRef = std::move(mAsyncCommandHandle); + auto commandHandle = commandHandleRef.Get(); + if (commandHandle == nullptr) + { + return; + } + +#if CONFIG_NETWORK_LAYER_BLE + DeviceLayer::ConnectivityMgr().GetBleLayer()->IndicateBleClosing(); +#endif // CONFIG_NETWORK_LAYER_BLE + ChipLogProgress(NetworkProvisioning, "Non-concurrent mode. Send ConnectNetworkResponse(Success)"); + Commands::ConnectNetworkResponse::Type response; + response.networkingStatus = NetworkCommissioning::Status::kSuccess; + commandHandle->AddResponse(mPath, response); +} +#endif // CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + void Instance::InvokeCommand(HandlerContext & ctxt) { if (mAsyncCommandHandle.Get() != nullptr) @@ -177,12 +198,7 @@ void Instance::InvokeCommand(HandlerContext & ctxt) case Commands::ConnectNetwork::Id: { VerifyOrReturn(mFeatureFlags.Has(Feature::kWiFiNetworkInterface) || mFeatureFlags.Has(Feature::kThreadNetworkInterface)); -#if CONFIG_NETWORK_LAYER_BLE && !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - // If commissionee does not support Concurrent Connections, request the BLE to be stopped. - // Start the ConnectNetwork, but this will not complete until the BLE is off. - ChipLogProgress(NetworkProvisioning, "Closing BLE connections due to non-concurrent mode"); - DeviceLayer::DeviceControlServer::DeviceControlSvr().PostCloseAllBLEConnectionsToOperationalNetworkEvent(); -#endif + HandleCommand( ctxt, [this](HandlerContext & ctx, const auto & req) { HandleConnectNetwork(ctx, req); }); return; @@ -708,18 +724,22 @@ void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::Connec mAsyncCommandHandle = CommandHandler::Handle(&ctx.mCommandHandler); mCurrentOperationBreadcrumb = req.breadcrumb; - // In Non-concurrent mode postpone the final execution of ConnectNetwork until the operational - // network has been fully brought up and kWiFiDeviceAvailable is delivered. - // mConnectingNetworkIDLen and mConnectingNetworkID contains the received SSID #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION mpWirelessDriver->ConnectNetwork(req.networkID, this); +#else + // In Non-concurrent mode postpone the final execution of ConnectNetwork until the operational + // network has been fully brought up and kOperationalNetworkStarted is delivered. + // mConnectingNetworkIDLen and mConnectingNetworkID contain the received SSID + // As per spec, send the ConnectNetworkResponse(Success) prior to releasing the commissioning channel + SendNonConcurrentConnectNetworkResponse(); #endif } void Instance::HandleNonConcurrentConnectNetwork() { ByteSpan nonConcurrentNetworkID = ByteSpan(mConnectingNetworkID, mConnectingNetworkIDLen); - ChipLogProgress(NetworkProvisioning, "HandleNonConcurrentConnectNetwork() SSID=%s", mConnectingNetworkID); + ChipLogProgress(NetworkProvisioning, "Non-concurrent mode, Connect to Network SSID=%.*s", mConnectingNetworkIDLen, + mConnectingNetworkID); mpWirelessDriver->ConnectNetwork(nonConcurrentNetworkID, this); } @@ -826,13 +846,19 @@ void Instance::HandleQueryIdentity(HandlerContext & ctx, const Commands::QueryId void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t interfaceStatus) { auto commandHandleRef = std::move(mAsyncCommandHandle); - auto commandHandle = commandHandleRef.Get(); + + // In Non-concurrent mode the commandHandle will be null here, the ConnectNetworkResponse + // has already been sent and the BLE will have been stopped, however the other functionality + // is still required +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + auto commandHandle = commandHandleRef.Get(); if (commandHandle == nullptr) { // When the platform shutted down, interaction model engine will invalidate all commandHandle to avoid dangling references. // We may receive the callback after it and should make it noop. return; } +#endif // CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION Commands::ConnectNetworkResponse::Type response; response.networkingStatus = commissioningError; @@ -856,13 +882,10 @@ void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t i memcpy(mLastNetworkID, mConnectingNetworkID, mLastNetworkIDLen); mLastNetworkingStatusValue.SetNonNull(commissioningError); -#if CONFIG_NETWORK_LAYER_BLE && !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - ChipLogProgress(NetworkProvisioning, "Non-concurrent mode, ConnectNetworkResponse will NOT be sent"); - // Do not send the ConnectNetworkResponse if in non-concurrent mode - // Issue #30576 raised to modify CommandHandler to notify it if no response required -#else +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION commandHandle->AddResponse(mPath, response); -#endif +#endif // CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + if (commissioningError == Status::kSuccess) { CommitSavedBreadcrumb(); @@ -1063,8 +1086,11 @@ void Instance::OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event { this_->OnFailSafeTimerExpired(); } - else if (event->Type == DeviceLayer::DeviceEventType::kWiFiDeviceAvailable) + else if ((event->Type == DeviceLayer::DeviceEventType::kWiFiDeviceAvailable) || + (event->Type == DeviceLayer::DeviceEventType::kOperationalNetworkStarted)) + { + // In Non-Concurrent mode connect the operational channel, as BLE has been stopped this_->HandleNonConcurrentConnectNetwork(); } } diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index 03fa72f6bfbd26..a286b7c79c4f3b 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -78,6 +78,9 @@ class Instance : public CommandHandlerInterface, void OnCommissioningComplete(); void OnFailSafeTimerExpired(); +#if !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + void SendNonConcurrentConnectNetworkResponse(); +#endif const BitFlags mFeatureFlags; DeviceLayer::NetworkCommissioning::Internal::WirelessDriver * const mpWirelessDriver; 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 e5c7ae43fb188e..ac1c4a0c3bf3c6 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT @@ -151,10 +152,10 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl bool currentValue; // read current on/off value - EmberAfStatus status = Attributes::OnOff::Get(endpoint, ¤tValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::OnOff::Get(endpoint, ¤tValue); + if (status != Status::Success) { - ChipLogError(Zcl, "ERR: reading on/off %x", status); + ChipLogError(Zcl, "ERR: reading on/off %x", to_underlying(status)); return CHIP_ERROR_READ_FAILED; } @@ -311,18 +312,18 @@ bool OnOffServer::HasFeature(chip::EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } -EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue) +Status OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue) { // read current on/off value - EmberAfStatus status = Attributes::OnOff::Get(endpoint, currentOnOffValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::OnOff::Get(endpoint, currentOnOffValue); + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on/off %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off %x", to_underlying(status)); } ChipLogProgress(Zcl, "On/Off ep%d value: %d", endpoint, *currentOnOffValue); @@ -339,17 +340,17 @@ EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * curre * @param command Ver.: always * @param initiatedByLevelChange Ver.: always */ -EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange) +Status OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange) { MATTER_TRACE_SCOPE("setOnOffValue", "OnOff"); - EmberAfStatus status; + Status status; bool currentValue, newValue; // read current on/off value status = Attributes::OnOff::Get(endpoint, ¤tValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on/off %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off %x", to_underlying(status)); return status; } @@ -357,7 +358,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman if ((!currentValue && command == Commands::Off::Id) || (currentValue && command == Commands::On::Id)) { ChipLogProgress(Zcl, "Endpoint %x On/off already set to new value", endpoint); - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } // we either got a toggle, or an on when off, or an off when on, @@ -396,9 +397,9 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman // write the new on/off value status = Attributes::OnOff::Set(endpoint, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing on/off %x", status); + ChipLogProgress(Zcl, "ERR: writing on/off %x", to_underlying(status)); return status; } @@ -416,7 +417,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman emberAfContainsAttribute(endpoint, ModeSelect::Id, ModeSelect::Attributes::OnMode::Id)) { ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; - if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == EMBER_ZCL_STATUS_SUCCESS && !onMode.IsNull()) + if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == Status::Success && !onMode.IsNull()) { ChipLogProgress(Zcl, "Changing Current Mode to %x", onMode.Value()); status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); @@ -442,9 +443,9 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman { // write the new on/off value status = Attributes::OnOff::Set(endpoint, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing on/off %x", status); + ChipLogProgress(Zcl, "ERR: writing on/off %x", to_underlying(status)); return status; } @@ -466,7 +467,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman // The returned status is based solely on the On/Off cluster. Errors in the // Level Control and/or Scenes cluster are ignored. - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } void OnOffServer::initOnOffServer(chip::EndpointId endpoint) @@ -494,8 +495,8 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) // null Set the OnOff attribute to its previous value. bool onOffValueForStartUp = false; - EmberAfStatus status = getOnOffValueForStartUp(endpoint, onOffValueForStartUp); - if (status == EMBER_ZCL_STATUS_SUCCESS) + Status status = getOnOffValueForStartUp(endpoint, onOffValueForStartUp); + if (status == Status::Success) { status = setOnOffValue(endpoint, onOffValueForStartUp, true); } @@ -512,7 +513,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) emberAfContainsAttribute(endpoint, ModeSelect::Id, ModeSelect::Attributes::OnMode::Id)) { ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; - if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == EMBER_ZCL_STATUS_SUCCESS && !onMode.IsNull()) + if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == Status::Success && !onMode.IsNull()) { ChipLogProgress(Zcl, "Changing Current Mode to %x", onMode.Value()); status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); @@ -532,16 +533,16 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) * @param endpoint Ver.: always * @param onOffValueForStartUp Ver.: always */ -EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp) +Status OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp) { app::DataModel::Nullable startUpOnOff; - EmberAfStatus status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff); - if (status == EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff); + if (status == Status::Success) { // Initialise updated value to 0 bool updatedOnOff = false; status = Attributes::OnOff::Get(endpoint, &updatedOnOff); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { if (!startUpOnOff.IsNull()) { @@ -570,7 +571,7 @@ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bo bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { MATTER_TRACE_SCOPE("OffCommand", "OnOff"); - EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Off::Id, false); + Status status = setOnOffValue(commandPath.mEndpointId, Commands::Off::Id, false); commandObj->AddStatus(commandPath, status); return true; @@ -579,7 +580,7 @@ bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::Concre bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { MATTER_TRACE_SCOPE("OnCommand", "OnOff"); - EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::On::Id, false); + Status status = setOnOffValue(commandPath.mEndpointId, Commands::On::Id, false); commandObj->AddStatus(commandPath, status); return true; @@ -588,7 +589,7 @@ bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::Concret bool OnOffServer::toggleCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { MATTER_TRACE_SCOPE("ToggleCommand", "OnOff"); - EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Toggle::Id, false); + Status status = setOnOffValue(commandPath.mEndpointId, Commands::Toggle::Id, false); commandObj->AddStatus(commandPath, status); return true; diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index 26e62fb2ea1a73..2cb5b62958a6c7 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -24,6 +24,7 @@ #include #include #include +#include /********************************************************** * Defines and Macros @@ -61,9 +62,10 @@ class OnOffServer bool OnWithTimedOffCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::OnOff::Commands::OnWithTimedOff::DecodableType & commandData); void updateOnOffTimeCommand(chip::EndpointId endpoint); - EmberAfStatus getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue); - EmberAfStatus setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange); - EmberAfStatus getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp); + chip::Protocols::InteractionModel::Status getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue); + chip::Protocols::InteractionModel::Status setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, + bool initiatedByLevelChange); + chip::Protocols::InteractionModel::Status getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp); bool HasFeature(chip::EndpointId endpoint, Feature feature); inline bool SupportsLightingApplications(chip::EndpointId endpointId) { return HasFeature(endpointId, Feature::kLighting); } diff --git a/src/app/clusters/operational-state-server/operational-state-cluster-objects.h b/src/app/clusters/operational-state-server/operational-state-cluster-objects.h index 58fd8401e8adcc..7a2ffa96d04a89 100644 --- a/src/app/clusters/operational-state-server/operational-state-cluster-objects.h +++ b/src/app/clusters/operational-state-server/operational-state-cluster-objects.h @@ -19,7 +19,7 @@ #pragma once #include -#include + #include namespace chip { diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp b/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp index 213d9d64b8b5a4..edd0b5729c2708 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp +++ b/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp @@ -410,14 +410,13 @@ void DefaultOTARequestor::CancelImageUpdate() CHIP_ERROR DefaultOTARequestor::GetUpdateStateProgressAttribute(EndpointId endpointId, app::DataModel::Nullable & progress) { - VerifyOrReturnError(OtaRequestorServerGetUpdateStateProgress(endpointId, progress) == EMBER_ZCL_STATUS_SUCCESS, - CHIP_ERROR_BAD_REQUEST); + VerifyOrReturnError(OtaRequestorServerGetUpdateStateProgress(endpointId, progress) == Status::Success, CHIP_ERROR_BAD_REQUEST); return CHIP_NO_ERROR; } CHIP_ERROR DefaultOTARequestor::GetUpdateStateAttribute(EndpointId endpointId, OTAUpdateStateEnum & state) { - VerifyOrReturnError(OtaRequestorServerGetUpdateState(endpointId, state) == EMBER_ZCL_STATUS_SUCCESS, CHIP_ERROR_BAD_REQUEST); + VerifyOrReturnError(OtaRequestorServerGetUpdateState(endpointId, state) == Status::Success, CHIP_ERROR_BAD_REQUEST); return CHIP_NO_ERROR; } diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestor.h b/src/app/clusters/ota-requestor/DefaultOTARequestor.h index e0e45c2709af2e..025dc66975d8b3 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestor.h +++ b/src/app/clusters/ota-requestor/DefaultOTARequestor.h @@ -136,7 +136,7 @@ class DefaultOTARequestor : public OTARequestorInterface, public BDXDownloader:: chip::Messaging::SendFlags sendFlags; if (!event.msgTypeData.HasMessageType(chip::bdx::MessageType::BlockAckEOF) && - !event.msgTypeData.HasMessageType(chip::Protocols::SecureChannel::MsgType::StatusReport)) + !event.msgTypeData.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport)) { sendFlags.Set(chip::Messaging::SendMessageFlags::kExpectResponse); } @@ -162,7 +162,7 @@ class DefaultOTARequestor : public OTARequestorInterface, public BDXDownloader:: mDownloader->OnMessageReceived(payloadHeader, std::move(payload)); // For a receiver using BDX Protocol, all received messages will require a response except for a StatusReport - if (!payloadHeader.HasMessageType(chip::Protocols::SecureChannel::MsgType::StatusReport)) + if (!payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport)) { ec->WillSendMessage(); } diff --git a/src/app/clusters/ota-requestor/OTARequestorInterface.h b/src/app/clusters/ota-requestor/OTARequestorInterface.h index d81b67424f0b60..f03ccab4c75d2d 100644 --- a/src/app/clusters/ota-requestor/OTARequestorInterface.h +++ b/src/app/clusters/ota-requestor/OTARequestorInterface.h @@ -21,7 +21,7 @@ */ #include -#include + #include #pragma once diff --git a/src/app/clusters/ota-requestor/ota-requestor-server.cpp b/src/app/clusters/ota-requestor/ota-requestor-server.cpp index b5611b7d57c70f..8f5d1326aaf70a 100644 --- a/src/app/clusters/ota-requestor/ota-requestor-server.cpp +++ b/src/app/clusters/ota-requestor/ota-requestor-server.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -147,54 +148,54 @@ CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::WriteDefaultOtaProviders(const // ----------------------------------------------------------------------------- // Global functions -EmberAfStatus OtaRequestorServerSetUpdateState(OTAUpdateStateEnum value) +Status OtaRequestorServerSetUpdateState(OTAUpdateStateEnum value) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; // Find all endpoints that have OtaSoftwareUpdateRequestor implemented for (auto endpoint : EnabledEndpointsWithServerCluster(OtaSoftwareUpdateRequestor::Id)) { OTAUpdateStateEnum currentValue; status = Attributes::UpdateState::Get(endpoint, ¤tValue); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); if (currentValue != value) { status = Attributes::UpdateState::Set(endpoint, value); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); } } return status; } -EmberAfStatus OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, OTAUpdateStateEnum & value) +Status OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, OTAUpdateStateEnum & value) { return Attributes::UpdateState::Get(endpointId, &value); } -EmberAfStatus OtaRequestorServerSetUpdateStateProgress(app::DataModel::Nullable value) +Status OtaRequestorServerSetUpdateStateProgress(app::DataModel::Nullable value) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; // Find all endpoints that have OtaSoftwareUpdateRequestor implemented for (auto endpoint : EnabledEndpointsWithServerCluster(OtaSoftwareUpdateRequestor::Id)) { app::DataModel::Nullable currentValue; status = Attributes::UpdateStateProgress::Get(endpoint, currentValue); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); if (currentValue != value) { status = Attributes::UpdateStateProgress::Set(endpoint, value); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); } } return status; } -EmberAfStatus OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, DataModel::Nullable & value) +Status OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, DataModel::Nullable & value) { return Attributes::UpdateStateProgress::Get(endpointId, value); } diff --git a/src/app/clusters/ota-requestor/ota-requestor-server.h b/src/app/clusters/ota-requestor/ota-requestor-server.h index 323cb7b49c241e..b8874aa00109f5 100644 --- a/src/app/clusters/ota-requestor/ota-requestor-server.h +++ b/src/app/clusters/ota-requestor/ota-requestor-server.h @@ -19,13 +19,16 @@ #pragma once #include +#include -EmberAfStatus OtaRequestorServerSetUpdateState(chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value); -EmberAfStatus OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, - chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum & value); -EmberAfStatus OtaRequestorServerSetUpdateStateProgress(chip::app::DataModel::Nullable value); -EmberAfStatus OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, - chip::app::DataModel::Nullable & value); +chip::Protocols::InteractionModel::Status +OtaRequestorServerSetUpdateState(chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value); +chip::Protocols::InteractionModel::Status +OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, + chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum & value); +chip::Protocols::InteractionModel::Status OtaRequestorServerSetUpdateStateProgress(chip::app::DataModel::Nullable value); +chip::Protocols::InteractionModel::Status OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, + chip::app::DataModel::Nullable & value); void OtaRequestorServerOnStateTransition(chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum previousState, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum newState, 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 76f2a3d01830ed..c3eebe257c6b17 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 @@ -32,6 +32,8 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::PumpConfigurationAndControl; +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace app { namespace Clusters { @@ -232,7 +234,7 @@ bool HasFeature(EndpointId endpoint, Feature feature) { bool hasFeature; uint32_t featureMap; - hasFeature = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + hasFeature = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return hasFeature ? ((featureMap & to_underlying(feature)) != 0) : false; } diff --git a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp index a7fd3ed7d64c5f..620e113177c1c7 100644 --- a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp +++ b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp @@ -40,12 +40,12 @@ RefrigeratorAlarmServer & RefrigeratorAlarmServer::Instance() return instance; } -EmberAfStatus RefrigeratorAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) +Status RefrigeratorAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) { - EmberAfStatus status = Attributes::Mask::Get(endpoint, mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Mask::Get(endpoint, mask); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading mask, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading mask, err:0x%x", to_underlying(status)); } else { @@ -55,12 +55,12 @@ EmberAfStatus RefrigeratorAlarmServer::GetMaskValue(EndpointId endpoint, BitMask return status; } -EmberAfStatus RefrigeratorAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) +Status RefrigeratorAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) { - EmberAfStatus status = Attributes::State::Get(endpoint, state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::State::Get(endpoint, state); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", to_underlying(status)); } else { @@ -70,12 +70,12 @@ EmberAfStatus RefrigeratorAlarmServer::GetStateValue(EndpointId endpoint, BitMas return status; } -EmberAfStatus RefrigeratorAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) +Status RefrigeratorAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) { - EmberAfStatus status = Attributes::Supported::Get(endpoint, supported); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Supported::Get(endpoint, supported); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading supported, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading supported, err:0x%x", to_underlying(status)); } else { @@ -85,13 +85,13 @@ EmberAfStatus RefrigeratorAlarmServer::GetSupportedValue(EndpointId endpoint, Bi return status; } -EmberAfStatus RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) +Status RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - status = Attributes::Mask::Set(endpoint, mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Status::Success; + status = Attributes::Mask::Set(endpoint, mask); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing mask, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing mask, err:0x%x", to_underlying(status)); return status; } @@ -100,7 +100,7 @@ EmberAfStatus RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const B // Whenever there is change in Mask, State should change accordingly. BitMask state; status = GetStateValue(endpoint, &state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -113,22 +113,22 @@ EmberAfStatus RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const B return status; } -EmberAfStatus RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMask newState) +Status RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMask newState) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; BitMask currentState; status = Attributes::State::Get(endpoint, ¤tState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", to_underlying(status)); return status; } status = Attributes::State::Set(endpoint, newState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing state, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing state, err:0x%x", to_underlying(status)); return status; } @@ -143,7 +143,7 @@ EmberAfStatus RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMas BitMask mask; status = GetMaskValue(endpoint, &mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -152,13 +152,13 @@ EmberAfStatus RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMas return status; } -EmberAfStatus RefrigeratorAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) +Status RefrigeratorAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - status = Attributes::Supported::Set(endpoint, supported); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Status::Success; + status = Attributes::Supported::Set(endpoint, supported); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing supported, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing supported, err:0x%x", to_underlying(status)); return status; } @@ -167,7 +167,7 @@ EmberAfStatus RefrigeratorAlarmServer::SetSupportedValue(EndpointId endpoint, co // Whenever there is change in Supported attribute, Mask, State should change accordingly. BitMask mask; status = GetMaskValue(endpoint, &mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } diff --git a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h index 1ed6023a9dbeab..65df99d82bb2c0 100644 --- a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h +++ b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h @@ -23,28 +23,31 @@ #include #include #include +#include class RefrigeratorAlarmServer { public: static RefrigeratorAlarmServer & Instance(); - EmberAfStatus GetMaskValue(chip::EndpointId endpoint, chip::BitMask * mask); - EmberAfStatus GetStateValue(chip::EndpointId endpoint, chip::BitMask * state); - EmberAfStatus GetSupportedValue(chip::EndpointId endpoint, - chip::BitMask * suppported); + chip::Protocols::InteractionModel::Status GetMaskValue(chip::EndpointId endpoint, + chip::BitMask * mask); + chip::Protocols::InteractionModel::Status + GetStateValue(chip::EndpointId endpoint, chip::BitMask * state); + chip::Protocols::InteractionModel::Status + GetSupportedValue(chip::EndpointId endpoint, chip::BitMask * suppported); // A change in mask value will result in a corresponding change in state. - EmberAfStatus SetMaskValue(chip::EndpointId endpoint, - const chip::BitMask mask); + chip::Protocols::InteractionModel::Status + SetMaskValue(chip::EndpointId endpoint, const chip::BitMask mask); // When State changes we are generating Notify event. - EmberAfStatus SetStateValue(chip::EndpointId endpoint, - chip::BitMask newState); + chip::Protocols::InteractionModel::Status + SetStateValue(chip::EndpointId endpoint, chip::BitMask newState); // A change in supported value will result in a corresponding change in mask and state. - EmberAfStatus SetSupportedValue(chip::EndpointId endpoint, - const chip::BitMask supported); + chip::Protocols::InteractionModel::Status + SetSupportedValue(chip::EndpointId endpoint, const chip::BitMask supported); private: static RefrigeratorAlarmServer instance; diff --git a/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h b/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h index bd63dabca180c9..cdf64cc2c3dce2 100644 --- a/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h +++ b/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h @@ -20,7 +20,7 @@ #include #include -#include + #include namespace chip { diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h index da17d36f0d2c3d..8cdc74f34c1b0d 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h @@ -91,10 +91,10 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface bool HasFeature(ResourceMonitoring::Feature aFeature) const; // Attribute setters - chip::Protocols::InteractionModel::Status UpdateCondition(uint8_t aNewCondition); - chip::Protocols::InteractionModel::Status UpdateChangeIndication(ChangeIndicationEnum aNewChangeIndication); - chip::Protocols::InteractionModel::Status UpdateInPlaceIndicator(bool aNewInPlaceIndicator); - chip::Protocols::InteractionModel::Status UpdateLastChangedTime(DataModel::Nullable aNewLastChangedTime); + Protocols::InteractionModel::Status UpdateCondition(uint8_t aNewCondition); + Protocols::InteractionModel::Status UpdateChangeIndication(ChangeIndicationEnum aNewChangeIndication); + Protocols::InteractionModel::Status UpdateInPlaceIndicator(bool aNewInPlaceIndicator); + Protocols::InteractionModel::Status UpdateLastChangedTime(DataModel::Nullable aNewLastChangedTime); void SetReplacementProductListManagerInstance(ReplacementProductListManager * instance); @@ -196,7 +196,7 @@ class Delegate * @return Status::Success If the command was handled successfully. * @return All Other PreResetCondition() or PostResetCondition() failed, these are application specific. */ - virtual chip::Protocols::InteractionModel::Status OnResetCondition(); + virtual Protocols::InteractionModel::Status OnResetCondition(); /** * This method may be overwritten by the SDK User, if the SDK User wants to do something before the reset. @@ -206,7 +206,7 @@ class Delegate * @return Status::Success All good, the reset may proceed. * @return All Other The reset should not proceed. The reset command will fail. */ - virtual chip::Protocols::InteractionModel::Status PreResetCondition(); + virtual Protocols::InteractionModel::Status PreResetCondition(); /** * This method may be overwritten by the SDK User, if the SDK User wants to do something after the reset. @@ -217,7 +217,7 @@ class Delegate * @return All Other Something went wrong. The attributes will already be updated. But the reset command will report * the failure. */ - virtual chip::Protocols::InteractionModel::Status PostResetCondition(); + virtual Protocols::InteractionModel::Status PostResetCondition(); }; } // namespace ResourceMonitoring diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 330d7eb0bd4523..d05d7da84f9a53 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -41,6 +41,7 @@ using GroupDataProvider = chip::Credentials::GroupDataProvider; using SceneTable = chip::scenes::SceneTable; using AuthMode = chip::Access::AuthMode; using ScenesServer = chip::app::Clusters::ScenesManagement::ScenesServer; +using chip::Protocols::InteractionModel::Status; namespace chip { namespace app { @@ -65,6 +66,10 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res { resp.status = to_underlying(Protocols::InteractionModel::Status::NotFound); } + else if (CHIP_ERROR_NO_MEMORY == err) + { + resp.status = to_underlying(Protocols::InteractionModel::Status::ResourceExhausted); + } else { resp.status = to_underlying(StatusIB(err).mStatus); @@ -74,14 +79,14 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res return err; } -/// @brief Generate and add a response to a command handler context depending on an EmberAfStatus +/// @brief Generate and add a response to a command handler context depending on an InteractionModel::Status /// @tparam ResponseType Type of response, depends on the command /// @param ctx Command Handler context where to add reponse /// @param resp Response to add in ctx /// @param status Status to verify -/// @return EmberAfStatus -> CHIP_ERROR +/// @return InteractionModel::Status -> CHIP_ERROR template -CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, ResponseType & resp, EmberAfStatus status) +CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, ResponseType & resp, Status status) { return AddResponseOnError(ctx, resp, StatusIB(status).ToChipError()); } @@ -90,7 +95,7 @@ template CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) { Access::SubjectDescriptor descriptor = ctx.mCommandHandler.GetSubjectDescriptor(); - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; if (AuthMode::kCase == descriptor.authMode) { @@ -102,7 +107,7 @@ CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) } // LastConfiguredBy is optional, so we don't want to fail the command if it fails to update - VerifyOrReturnValue(!(EMBER_ZCL_STATUS_SUCCESS == status || EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status), CHIP_NO_ERROR); + VerifyOrReturnValue(!(Status::Success == status || Status::UnsupportedAttribute == status), CHIP_NO_ERROR); return AddResponseOnError(ctx, resp, status); } @@ -167,7 +172,6 @@ CHIP_ERROR UpdateFabricSceneInfo(EndpointId endpoint, FabricIndex fabric, Option /// @brief Gets the SceneInfoStruct array associated to an endpoint /// @param endpoint target endpoint -/// @param fabric target fabric /// @return Optional with no value not found, Span of SceneInfoStruct Span ScenesServer::FabricSceneInfo::GetFabricSceneInfo(EndpointId endpoint) { @@ -674,13 +678,21 @@ void ScenesServer::InvokeCommand(HandlerContext & ctxt) // AttributeAccessInterface CHIP_ERROR ScenesServer::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { + uint16_t endpointTableSize = 0; + ReturnErrorOnFailure(StatusIB(Attributes::SceneTableSize::Get(aPath.mEndpointId, &endpointTableSize)).ToChipError()); + + // Get Scene Table Instance + SceneTable * sceneTable = scenes::GetSceneTableImpl(aPath.mEndpointId, endpointTableSize); + switch (aPath.mAttributeId) { case Attributes::FabricSceneInfo::Id: { - return aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR { + return aEncoder.EncodeList([&, sceneTable](const auto & encoder) -> CHIP_ERROR { Span fabricSceneInfoSpan = mFabricSceneInfo.GetFabricSceneInfo(aPath.mEndpointId); for (auto & info : fabricSceneInfoSpan) { + // Update the SceneInfoStruct's Capacity in case it's capacity was limited by other fabrics + sceneTable->GetRemainingCapacity(info.fabricIndex, info.remainingCapacity); ReturnErrorOnFailure(encoder.Encode(info)); } return CHIP_NO_ERROR; @@ -917,12 +929,10 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS CHIP_ERROR err = StoreSceneParse(ctx.mCommandHandler.GetAccessingFabricIndex(), ctx.mRequestPath.mEndpointId, req.groupID, req.sceneID, mGroupProvider); - if (CHIP_NO_ERROR == err) - { - ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); - } + ReturnOnFailure(AddResponseOnError(ctx, response, err)); - response.status = to_underlying(StatusIB(err).mStatus); + ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); + response.status = to_underlying(Protocols::InteractionModel::Status::Success); ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); } @@ -1030,6 +1040,13 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce ReturnOnFailure(AddResponseOnError(ctx, response, sceneTable->GetRemainingCapacity(ctx.mCommandHandler.GetAccessingFabricIndex(), capacity))); + if (0 == capacity) + { + response.status = to_underlying(Protocols::InteractionModel::Status::ResourceExhausted); + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + return; + } + // Checks if we copy a single scene or all of them if (req.mode.GetField(app::Clusters::ScenesManagement::CopyModeBitmap::kCopyAllScenes)) { @@ -1042,13 +1059,6 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce ctx, response, sceneTable->GetAllSceneIdsInGroup(ctx.mCommandHandler.GetAccessingFabricIndex(), req.groupIdentifierFrom, sceneList))); - if (0 == capacity) - { - response.status = to_underlying(Protocols::InteractionModel::Status::ResourceExhausted); - ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); - return; - } - for (auto & sceneId : sceneList) { SceneTableEntry scene(SceneStorageId(sceneId, req.groupIdentifierFrom)); @@ -1061,13 +1071,13 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce ReturnOnFailure(AddResponseOnError( ctx, response, sceneTable->SetSceneTableEntry(ctx.mCommandHandler.GetAccessingFabricIndex(), scene))); - } - // Update SceneInfoStruct Attributes - ReturnOnFailure( - AddResponseOnError(ctx, response, - UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), - Optional(), Optional(), Optional()))); + // Update SceneInfoStruct Attributes after each insert in case we hit max capacity in the middle of the loop + ReturnOnFailure(AddResponseOnError( + ctx, response, + UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(), + Optional(), Optional(), Optional() /* = sceneValid*/))); + } ReturnOnFailure(UpdateLastConfiguredBy(ctx, response)); @@ -1108,10 +1118,10 @@ using namespace chip::app::Clusters::ScenesManagement; void emberAfScenesManagementClusterServerInitCallback(EndpointId endpoint) { - EmberAfStatus status = Attributes::LastConfiguredBy::SetNull(endpoint); - if (EMBER_ZCL_STATUS_SUCCESS != status) + Status status = Attributes::LastConfiguredBy::SetNull(endpoint); + if (Status::Success != status) { - ChipLogDetail(Zcl, "ERR: setting LastConfiguredBy on Endpoint %hu Status: %x", endpoint, status); + ChipLogDetail(Zcl, "ERR: setting LastConfiguredBy on Endpoint %hu Status: %x", endpoint, to_underlying(status)); } // Initialize the FabricSceneInfo by getting the number of scenes and the remaining capacity for storing fabric scene data @@ -1125,7 +1135,7 @@ void emberAfScenesManagementClusterServerInitCallback(EndpointId endpoint) void MatterScenesManagementClusterServerShutdownCallback(EndpointId endpoint) { uint16_t endpointTableSize = 0; - ReturnOnFailure(Attributes::SceneTableSize::Get(endpoint, &endpointTableSize)); + VerifyOrReturn(Status::Success == Attributes::SceneTableSize::Get(endpoint, &endpointTableSize)); // Get Scene Table Instance SceneTable * sceneTable = scenes::GetSceneTableImpl(endpoint, endpointTableSize); diff --git a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp index 2d5ae5fe2a2480..5b3da157d515e2 100644 --- a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp +++ b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp @@ -467,11 +467,11 @@ void SmokeCoAlarmServer::SendEvent(EndpointId endpointId, T & event) template bool SmokeCoAlarmServer::GetAttribute(EndpointId endpointId, AttributeId attributeId, - EmberAfStatus (*getFn)(EndpointId endpointId, T * value), T & value) const + Status (*getFn)(EndpointId endpointId, T * value), T & value) const { - EmberAfStatus status = getFn(endpointId, &value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); - bool unsupportedStatus = (EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status); + Status status = getFn(endpointId, &value); + bool success = (Status::Success == status); + bool unsupportedStatus = (Status::UnsupportedAttribute == status); if (unsupportedStatus) { @@ -487,10 +487,10 @@ bool SmokeCoAlarmServer::GetAttribute(EndpointId endpointId, AttributeId attribu template bool SmokeCoAlarmServer::SetAttribute(EndpointId endpointId, AttributeId attributeId, - EmberAfStatus (*setFn)(EndpointId endpointId, T value), T value) + Status (*setFn)(EndpointId endpointId, T value), T value) { - EmberAfStatus status = setFn(endpointId, value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); + Status status = setFn(endpointId, value); + bool success = (Status::Success == status); if (!success) { diff --git a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h index 37bd1f6bd11a83..42efc49ee8e092 100644 --- a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h +++ b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h @@ -26,6 +26,7 @@ #include #include #include +#include /** * @brief Smoke CO Alarm Server Plugin class @@ -139,7 +140,7 @@ class SmokeCoAlarmServer */ template bool GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; + chip::Protocols::InteractionModel::Status (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; /** * @brief Set generic attribute value @@ -154,7 +155,7 @@ class SmokeCoAlarmServer */ template bool SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value); + chip::Protocols::InteractionModel::Status (*setFn)(chip::EndpointId endpointId, T value), T value); friend bool emberAfSmokeCoAlarmClusterSelfTestRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, diff --git a/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.h b/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.h index 754be5701dd33c..5ff3db169261be 100644 --- a/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.h +++ b/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.h @@ -19,7 +19,7 @@ #pragma once #include -#include + #include namespace chip { diff --git a/src/app/clusters/temperature-control-server/temperature-control-server.cpp b/src/app/clusters/temperature-control-server/temperature-control-server.cpp index 6217288bf7cfaa..9194c168fb236a 100644 --- a/src/app/clusters/temperature-control-server/temperature-control-server.cpp +++ b/src/app/clusters/temperature-control-server/temperature-control-server.cpp @@ -99,7 +99,7 @@ bool TemperatureControlHasFeature(EndpointId endpoint, TemperatureControl::Featu { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } @@ -116,7 +116,6 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler auto & targetTemperatureLevel = commandData.targetTemperatureLevel; EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; - EmberAfStatus emberAfStatus = EMBER_ZCL_STATUS_SUCCESS; if (TemperatureControlHasFeature(endpoint, Feature::kTemperatureNumber) && TemperatureControlHasFeature(endpoint, Feature::kTemperatureLevel)) @@ -130,17 +129,15 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler { int16_t minTemperature = 0; int16_t maxTemperature = 0; - emberAfStatus = MinTemperature::Get(endpoint, &minTemperature); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = MinTemperature::Get(endpoint, &minTemperature); + if (status != Status::Success) { - status = emberAfStatus; goto exit; } - emberAfStatus = MaxTemperature::Get(endpoint, &maxTemperature); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = MaxTemperature::Get(endpoint, &maxTemperature); + if (status != Status::Success) { - status = emberAfStatus; goto exit; } @@ -151,11 +148,10 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler } if (TemperatureControlHasFeature(endpoint, TemperatureControl::Feature::kTemperatureStep)) { - int16_t step = 0; - emberAfStatus = Step::Get(endpoint, &step); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + int16_t step = 0; + status = Step::Get(endpoint, &step); + if (status != Status::Success) { - status = emberAfStatus; goto exit; } @@ -165,8 +161,8 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler goto exit; } } - emberAfStatus = TemperatureSetpoint::Set(endpoint, targetTemperature.Value()); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = TemperatureSetpoint::Set(endpoint, targetTemperature.Value()); + if (status != Status::Success) { /** * If the server is unable to execute the command at the time the command is received @@ -199,8 +195,8 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler if (targetTemperatureLevel.Value() < size) { - emberAfStatus = SelectedTemperatureLevel::Set(endpoint, targetTemperatureLevel.Value()); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = SelectedTemperatureLevel::Set(endpoint, targetTemperatureLevel.Value()); + if (status != Status::Success) { /** * If the server is unable to execute the command at the time the command is received diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 780d244bc71519..c0e43593316816 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -82,7 +82,7 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A VerifyOrDie(aPath.mClusterId == Thermostat::Id); uint32_t ourFeatureMap; - bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == EMBER_ZCL_STATUS_SUCCESS) && + bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); switch (aPath.mAttributeId) @@ -97,8 +97,8 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A if (localTemperatureNotExposedSupported) { BitMask valueRemoteSensing; - EmberAfStatus status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); - if (status != EMBER_ZCL_STATUS_SUCCESS) + imcode status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); + if (status != imcode::Success) { StatusIB statusIB(status); return statusIB.ToChipError(); @@ -139,7 +139,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrDie(aPath.mClusterId == Thermostat::Id); uint32_t ourFeatureMap; - bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == EMBER_ZCL_STATUS_SUCCESS) && + bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); switch (aPath.mAttributeId) @@ -153,8 +153,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } - - EmberAfStatus status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing); + imcode status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing); StatusIB statusIB(status); return statusIB.ToChipError(); } @@ -226,7 +225,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr bool CoolSupported = false; bool OccupancySupported = false; - if (FeatureMap::Get(endpoint, &OurFeatureMap) != EMBER_ZCL_STATUS_SUCCESS) + if (FeatureMap::Get(endpoint, &OurFeatureMap) != imcode::Success) OurFeatureMap = FEATURE_MAP_DEFAULT; if (OurFeatureMap & 1 << 5) // Bit 5 is Auto Mode supported @@ -243,60 +242,60 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (AutoSupported) { - if (MinSetpointDeadBand::Get(endpoint, &DeadBand) != EMBER_ZCL_STATUS_SUCCESS) + if (MinSetpointDeadBand::Get(endpoint, &DeadBand) != imcode::Success) { DeadBand = kDefaultDeadBand; } DeadBandTemp = static_cast(DeadBand * 10); } - if (AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit) != imcode::Success) AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; - if (AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit) != imcode::Success) AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; - if (MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit) != imcode::Success) MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - if (MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit) != imcode::Success) MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; - if (AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit) != imcode::Success) AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; - if (AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit) != imcode::Success) AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; - if (MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit) != imcode::Success) MinHeatSetpointLimit = AbsMinHeatSetpointLimit; - if (MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit) != imcode::Success) MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; if (CoolSupported) - if (OccupiedCoolingSetpoint::Get(endpoint, &OccupiedCoolingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(endpoint, &OccupiedCoolingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Occupied Cooling Setpoint"); return imcode::Failure; } if (HeatSupported) - if (OccupiedHeatingSetpoint::Get(endpoint, &OccupiedHeatingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(endpoint, &OccupiedHeatingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Occupied Heating Setpoint"); return imcode::Failure; } if (CoolSupported && OccupancySupported) - if (UnoccupiedCoolingSetpoint::Get(endpoint, &UnoccupiedCoolingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (UnoccupiedCoolingSetpoint::Get(endpoint, &UnoccupiedCoolingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Unoccupied Cooling Setpoint"); return imcode::Failure; } if (HeatSupported && OccupancySupported) - if (UnoccupiedHeatingSetpoint::Get(endpoint, &UnoccupiedHeatingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (UnoccupiedHeatingSetpoint::Get(endpoint, &UnoccupiedHeatingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Unoccupied Heating Setpoint"); return imcode::Failure; @@ -434,8 +433,8 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr case SystemMode::Id: { ControlSequenceOfOperationEnum ControlSequenceOfOperation; - EmberAfStatus status = ControlSequenceOfOperation::Get(endpoint, &ControlSequenceOfOperation); - if (status != EMBER_ZCL_STATUS_SUCCESS) + imcode status = ControlSequenceOfOperation::Get(endpoint, &ControlSequenceOfOperation); + if (status != imcode::Success) { return imcode::InvalidValue; } @@ -566,7 +565,7 @@ int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoin // Note that the limits are initialized above per the spec limits // if they are not present Get() will not update the value so the defaults are used - EmberAfStatus status; + imcode status; // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 // behavior is not specified when Abs * values are not present and user values are present @@ -576,24 +575,24 @@ int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoin // if a attribute is not present then it's default shall be used. status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); } status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); } status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MinHeatSetpointLimit = AbsMinHeatSetpointLimit; } status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; } @@ -637,7 +636,7 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin // Note that the limits are initialized above per the spec limits // if they are not present Get() will not update the value so the defaults are used - EmberAfStatus status; + imcode status; // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 // behavior is not specified when Abs * values are not present and user values are present @@ -647,25 +646,25 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin // if a attribute is not present then it's default shall be used. status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); } status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); } status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MinCoolSetpointLimit = AbsMinCoolSetpointLimit; } status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; } @@ -702,17 +701,17 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co EndpointId aEndpointId = commandPath.mEndpointId; int16_t HeatingSetpoint = kDefaultHeatingSetpoint, CoolingSetpoint = kDefaultCoolingSetpoint; // Set to defaults to be safe - EmberAfStatus status = EMBER_ZCL_STATUS_FAILURE; - EmberAfStatus WriteCoolingSetpointStatus = EMBER_ZCL_STATUS_FAILURE; - EmberAfStatus WriteHeatingSetpointStatus = EMBER_ZCL_STATUS_FAILURE; - int16_t DeadBandTemp = 0; - int8_t DeadBand = 0; + imcode status = imcode::Failure; + imcode WriteCoolingSetpointStatus = imcode::Failure; + imcode WriteHeatingSetpointStatus = imcode::Failure; + int16_t DeadBandTemp = 0; + int8_t DeadBand = 0; uint32_t OurFeatureMap; bool AutoSupported = false; bool HeatSupported = false; bool CoolSupported = false; - if (FeatureMap::Get(aEndpointId, &OurFeatureMap) != EMBER_ZCL_STATUS_SUCCESS) + if (FeatureMap::Get(aEndpointId, &OurFeatureMap) != imcode::Success) OurFeatureMap = FEATURE_MAP_DEFAULT; if (OurFeatureMap & 1 << 5) // Bit 5 is Auto Mode supported @@ -726,7 +725,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (AutoSupported) { - if (MinSetpointDeadBand::Get(aEndpointId, &DeadBand) != EMBER_ZCL_STATUS_SUCCESS) + if (MinSetpointDeadBand::Get(aEndpointId, &DeadBand) != imcode::Success) DeadBand = kDefaultDeadBand; DeadBandTemp = static_cast(DeadBand * 10); } @@ -737,13 +736,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (HeatSupported && CoolSupported) { int16_t DesiredCoolingSetpoint, CoolLimit, DesiredHeatingSetpoint, HeatLimit; - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - @@ -765,12 +764,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co } } WriteCoolingSetpointStatus = OccupiedCoolingSetpoint::Set(aEndpointId, DesiredCoolingSetpoint); - if (WriteCoolingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteCoolingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); } WriteHeatingSetpointStatus = OccupiedHeatingSetpoint::Set(aEndpointId, DesiredHeatingSetpoint); - if (WriteHeatingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteHeatingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); } @@ -782,12 +781,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (CoolSupported && !HeatSupported) { - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { CoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolingSetpoint = EnforceCoolingSetpointLimits(CoolingSetpoint, aEndpointId); WriteCoolingSetpointStatus = OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint); - if (WriteCoolingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteCoolingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); } @@ -796,34 +795,34 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (HeatSupported && !CoolSupported) { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { HeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatingSetpoint = EnforceHeatingSetpointLimits(HeatingSetpoint, aEndpointId); WriteHeatingSetpointStatus = OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint); - if (WriteHeatingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteHeatingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); } } } - if ((!HeatSupported || WriteHeatingSetpointStatus == EMBER_ZCL_STATUS_SUCCESS) && - (!CoolSupported || WriteCoolingSetpointStatus == EMBER_ZCL_STATUS_SUCCESS)) - status = EMBER_ZCL_STATUS_SUCCESS; + if ((!HeatSupported || WriteHeatingSetpointStatus == imcode::Success) && + (!CoolSupported || WriteCoolingSetpointStatus == imcode::Success)) + status = imcode::Success; break; case SetpointRaiseLowerModeEnum::kCool: if (CoolSupported) { - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { CoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolingSetpoint = EnforceCoolingSetpointLimits(CoolingSetpoint, aEndpointId); if (AutoSupported) { // Need to check if we can move the cooling setpoint while maintaining the dead band - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { if (CoolingSetpoint - HeatingSetpoint < DeadBandTemp) { @@ -834,10 +833,10 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { // Desired cooling setpoint is enforcable // Set the new cooling and heating setpoints - if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == imcode::Success) { - if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) - status = EMBER_ZCL_STATUS_SUCCESS; + if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == imcode::Success) + status = imcode::Success; } else ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); @@ -845,7 +844,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co else { ChipLogError(Zcl, "Error: Could Not adjust heating setpoint to maintain dead band!"); - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; } } else @@ -863,20 +862,20 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co ChipLogError(Zcl, "Error: GetOccupiedCoolingSetpoint failed!"); } else - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; break; case SetpointRaiseLowerModeEnum::kHeat: if (HeatSupported) { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { HeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatingSetpoint = EnforceHeatingSetpointLimits(HeatingSetpoint, aEndpointId); if (AutoSupported) { // Need to check if we can move the cooling setpoint while maintaining the dead band - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { if (CoolingSetpoint - HeatingSetpoint < DeadBandTemp) { @@ -887,10 +886,10 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { // Desired cooling setpoint is enforcable // Set the new cooling and heating setpoints - if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == imcode::Success) { - if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) - status = EMBER_ZCL_STATUS_SUCCESS; + if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == imcode::Success) + status = imcode::Success; } else ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); @@ -898,7 +897,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co else { ChipLogError(Zcl, "Error: Could Not adjust cooling setpoint to maintain dead band!"); - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; } } else @@ -916,11 +915,11 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co ChipLogError(Zcl, "Error: GetOccupiedHeatingSetpoint failed!"); } else - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; break; default: - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; break; } diff --git a/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp b/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp index 8539566e75dece..08e90207760603 100644 --- a/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp +++ b/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp @@ -39,6 +39,8 @@ using namespace chip::app::Clusters::TimeFormatLocalization; using namespace chip::app::Clusters::TimeFormatLocalization::Attributes; using namespace chip::DeviceLayer; +using chip::Protocols::InteractionModel::Status; + namespace { class TimeFormatLocalizationAttrAccess : public AttributeAccessInterface @@ -202,18 +204,18 @@ void emberAfTimeFormatLocalizationClusterServerInitCallback(EndpointId endpoint) { CalendarTypeEnum calendarType; CalendarTypeEnum validType; - EmberAfStatus status = ActiveCalendarType::Get(endpoint, &calendarType); + Status status = ActiveCalendarType::Get(endpoint, &calendarType); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to read calendar type with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to read calendar type with error: 0x%02x", to_underlying(status))); // We could have an invalid calendar type value if an OTA update removed support for the value we were using. // If initial value is not one of the allowed values, pick one valid value and write it. if (!IsSupportedCalendarType(calendarType, validType)) { status = ActiveCalendarType::Set(endpoint, validType); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write calendar type with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write calendar type with error: 0x%02x", to_underlying(status))); } } diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h b/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h index 6ef37f2403927d..7d5bad65ff0d2e 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h +++ b/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -43,7 +44,7 @@ class Delegate inline bool HasFeature(Feature feature) { uint32_t map; - bool success = (Attributes::FeatureMap::Get(mEndpoint, &map) == EMBER_ZCL_STATUS_SUCCESS); + bool success = (Attributes::FeatureMap::Get(mEndpoint, &map) == Protocols::InteractionModel::Status::Success); return success ? (map & to_underlying(feature)) : false; } diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp index 8e919ef5bb7976..cc6c3f509c8937 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp @@ -380,9 +380,9 @@ void TimeSynchronizationServer::OnTimeSyncCompletionFn(TimeSourceEnum timeSource } return; } - mGranularity = granularity; - EmberAfStatus status = TimeSource::Set(kRootEndpointId, timeSource); - if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) + mGranularity = granularity; + Status status = TimeSource::Set(kRootEndpointId, timeSource); + if (!(status == Status::Success || status == Status::UnsupportedAttribute)) { ChipLogError(Zcl, "Writing TimeSource failed."); } @@ -394,8 +394,8 @@ void TimeSynchronizationServer::OnFallbackNTPCompletionFn(bool timeSyncSuccessfu { mGranularity = GranularityEnum::kMillisecondsGranularity; // Non-matter SNTP because we know it's external and there's only one source - EmberAfStatus status = TimeSource::Set(kRootEndpointId, TimeSourceEnum::kNonMatterSNTP); - if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) + Status status = TimeSource::Set(kRootEndpointId, TimeSourceEnum::kNonMatterSNTP); + if (!(status == Status::Success || status == Status::UnsupportedAttribute)) { ChipLogError(Zcl, "Writing TimeSource failed."); } @@ -777,9 +777,9 @@ CHIP_ERROR TimeSynchronizationServer::SetUTCTime(EndpointId ep, uint64_t utcTime return err; } GetDelegate()->UTCTimeAvailabilityChanged(utcTime); - mGranularity = granularity; - EmberAfStatus status = TimeSource::Set(ep, source); - if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) + mGranularity = granularity; + Status status = TimeSource::Set(ep, source); + if (!(status == Status::Success || status == Status::UnsupportedAttribute)) { ChipLogError(Zcl, "Writing TimeSource failed."); return CHIP_IM_GLOBAL_STATUS(Failure); @@ -1264,7 +1264,7 @@ bool emberAfTimeSynchronizationClusterSetDefaultNTPCallback( return true; } bool dnsResolve; - if (EMBER_ZCL_STATUS_SUCCESS != SupportsDNSResolve::Get(commandPath.mEndpointId, &dnsResolve)) + if (Status::Success != SupportsDNSResolve::Get(commandPath.mEndpointId, &dnsResolve)) { commandObj->AddStatus(commandPath, Status::Failure); return true; diff --git a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp index 62d5e1b2c77da8..120cd2b3dd8416 100644 --- a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp +++ b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp @@ -280,19 +280,18 @@ CHIP_ERROR CloseValve(EndpointId ep) DataModel::Nullable rDuration; CHIP_ERROR attribute_error = CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kClosed), + VerifyOrReturnError(Status::Success == TargetState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kClosed), attribute_error); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == - CurrentState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning), + VerifyOrReturnError(Status::Success == CurrentState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning), attribute_error); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == OpenDuration::SetNull(ep), attribute_error); + VerifyOrReturnError(Status::Success == OpenDuration::SetNull(ep), attribute_error); if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetLevel::Set(ep, 0), attribute_error); + VerifyOrReturnError(Status::Success == TargetLevel::Set(ep, 0), attribute_error); } if (HasFeature(ep, ValveConfigurationAndControl::Feature::kTimeSync)) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AutoCloseTime::SetNull(ep), attribute_error); + VerifyOrReturnError(Status::Success == AutoCloseTime::SetNull(ep), attribute_error); } SetRemainingDurationNull(ep); RemainingDurationTable * item = GetRemainingDurationItem(ep); @@ -329,11 +328,11 @@ CHIP_ERROR SetValveLevel(EndpointId ep, DataModel::Nullable level, Data uint64_t time = openDuration.Value() * chip::kMicrosecondsPerSecond; autoCloseTime.SetNonNull(chipEpochTime + time); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AutoCloseTime::Set(ep, autoCloseTime), attribute_error); + VerifyOrReturnError(Status::Success == AutoCloseTime::Set(ep, autoCloseTime), attribute_error); } else { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AutoCloseTime::SetNull(ep), attribute_error); + VerifyOrReturnError(Status::Success == AutoCloseTime::SetNull(ep), attribute_error); } #else return CHIP_ERROR_NOT_IMPLEMENTED; @@ -343,19 +342,18 @@ CHIP_ERROR SetValveLevel(EndpointId ep, DataModel::Nullable level, Data // level can only be null if LVL feature is not supported if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel) && !level.IsNull()) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetLevel::Set(ep, level), attribute_error); + VerifyOrReturnError(Status::Success == TargetLevel::Set(ep, level), attribute_error); } - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == OpenDuration::Set(ep, openDuration), attribute_error); + VerifyOrReturnError(Status::Success == OpenDuration::Set(ep, openDuration), attribute_error); SetRemainingDuration(ep, openDuration); // Trigger report for remainingduration MatterReportingAttributeChangeCallback(ep, ValveConfigurationAndControl::Id, RemainingDuration::Id); // set targetstate to open - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kOpen), + VerifyOrReturnError(Status::Success == TargetState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kOpen), attribute_error); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == - CurrentState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning), + VerifyOrReturnError(Status::Success == CurrentState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning), attribute_error); // start movement towards target @@ -365,7 +363,7 @@ CHIP_ERROR SetValveLevel(EndpointId ep, DataModel::Nullable level, Data DataModel::Nullable cLevel = delegate->HandleOpenValve(level); if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == CurrentLevel::Set(ep, cLevel), attribute_error); + VerifyOrReturnError(Status::Success == CurrentLevel::Set(ep, cLevel), attribute_error); } } // start countdown @@ -378,8 +376,7 @@ CHIP_ERROR UpdateCurrentLevel(EndpointId ep, Percent currentLevel) { if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == CurrentLevel::Set(ep, currentLevel), - CHIP_IM_GLOBAL_STATUS(ConstraintError)); + VerifyOrReturnError(Status::Success == CurrentLevel::Set(ep, currentLevel), CHIP_IM_GLOBAL_STATUS(ConstraintError)); return CHIP_NO_ERROR; } return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); @@ -387,7 +384,7 @@ CHIP_ERROR UpdateCurrentLevel(EndpointId ep, Percent currentLevel) CHIP_ERROR UpdateCurrentState(EndpointId ep, ValveConfigurationAndControl::ValveStateEnum currentState) { - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == CurrentState::Set(ep, currentState), CHIP_IM_GLOBAL_STATUS(ConstraintError)); + VerifyOrReturnError(Status::Success == CurrentState::Set(ep, currentState), CHIP_IM_GLOBAL_STATUS(ConstraintError)); emitValveStateChangedEvent(ep, currentState); return CHIP_NO_ERROR; } @@ -406,7 +403,7 @@ void UpdateAutoCloseTime(uint64_t time) if (!d.IsNull() && d.Value() != 0) { uint64_t closingTime = d.Value() * chip::kMicrosecondsPerSecond + time; - if (EMBER_ZCL_STATUS_SUCCESS != AutoCloseTime::Set(t.endpoint, closingTime)) + if (Status::Success != AutoCloseTime::Set(t.endpoint, closingTime)) { ChipLogError(Zcl, "Unable to update AutoCloseTime"); } @@ -431,7 +428,7 @@ bool emberAfValveConfigurationAndControlClusterOpenCallback( Optional status = Optional::Missing(); // if fault is registered return FailureDueToFault - if (EMBER_ZCL_STATUS_SUCCESS == ValveFault::Get(ep, &fault) && fault.HasAny()) + if (Status::Success == ValveFault::Get(ep, &fault) && fault.HasAny()) { commandObj->AddClusterSpecificFailure(commandPath, to_underlying(ValveConfigurationAndControl::StatusCodeEnum::kFailureDueToFault)); @@ -450,7 +447,7 @@ bool emberAfValveConfigurationAndControlClusterOpenCallback( } else { - VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == DefaultOpenDuration::Get(ep, duration), status.Emplace(Status::Failure)); + VerifyOrExit(Status::Success == DefaultOpenDuration::Get(ep, duration), status.Emplace(Status::Failure)); } if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) @@ -460,7 +457,7 @@ bool emberAfValveConfigurationAndControlClusterOpenCallback( { level.SetNonNull(targetLevel.Value()); } - else if (EMBER_ZCL_STATUS_SUCCESS == DefaultOpenLevel::Get(ep, &defOpenLevel)) + else if (Status::Success == DefaultOpenLevel::Get(ep, &defOpenLevel)) { level.SetNonNull(defOpenLevel); } @@ -497,7 +494,7 @@ bool emberAfValveConfigurationAndControlClusterCloseCallback( BitMask fault(0); // if fault is registered return FailureDueToFault - if (EMBER_ZCL_STATUS_SUCCESS == ValveFault::Get(ep, &fault) && fault.HasAny()) + if (Status::Success == ValveFault::Get(ep, &fault) && fault.HasAny()) { commandObj->AddClusterSpecificFailure(commandPath, to_underlying(ValveConfigurationAndControl::StatusCodeEnum::kFailureDueToFault)); diff --git a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h index 5e94c000aeab27..74c8a623c02c61 100644 --- a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h +++ b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -49,7 +50,7 @@ void UpdateAutoCloseTime(uint64_t time); inline bool HasFeature(EndpointId ep, Feature feature) { uint32_t map; - bool success = (Attributes::FeatureMap::Get(ep, &map) == EMBER_ZCL_STATUS_SUCCESS); + bool success = (Attributes::FeatureMap::Get(ep, &map) == Protocols::InteractionModel::Status::Success); return success ? (map & to_underlying(feature)) : false; } 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 1b47b9c2e4d6a2..ba7d74c56583a5 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -118,8 +118,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } diff --git a/src/app/icd/icd.gni b/src/app/icd/icd.gni index 1f2ac247f6fb38..8994cf486106aa 100644 --- a/src/app/icd/icd.gni +++ b/src/app/icd/icd.gni @@ -17,6 +17,8 @@ declare_args() { # TODO - Add Specifics when the design is refined chip_enable_icd_server = false + chip_enable_icd_lit = false + # Matter SDK Configuration flag to enable ICD client functionality # TODO - Add Specifics when the design is refined chip_enable_icd_client = false @@ -29,3 +31,9 @@ declare_args() { # Set to true to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) icd_enforce_sit_slow_poll_limit = false } + +# Set the defaults for CIP and UAT features to be consistent with the LIT value. +declare_args() { + chip_enable_icd_checkin = chip_enable_icd_lit + chip_enable_icd_user_active_mode_trigger = chip_enable_icd_lit +} diff --git a/src/app/icd/server/BUILD.gn b/src/app/icd/server/BUILD.gn index 41c73b5f7e6bbc..9a10430a3303ff 100644 --- a/src/app/icd/server/BUILD.gn +++ b/src/app/icd/server/BUILD.gn @@ -22,8 +22,15 @@ buildconfig_header("icd-server-buildconfig") { header = "ICDServerBuildConfig.h" header_dir = "app/icd/server" + if (chip_enable_icd_lit) { + assert(chip_enable_icd_checkin && chip_enable_icd_user_active_mode_trigger) + } + defines = [ "CHIP_CONFIG_ENABLE_ICD_SERVER=${chip_enable_icd_server}", + "CHIP_CONFIG_ENABLE_ICD_LIT=${chip_enable_icd_lit}", + "CHIP_CONFIG_ENABLE_ICD_CIP=${chip_enable_icd_checkin}", + "CHIP_CONFIG_ENABLE_ICD_UAT=${chip_enable_icd_user_active_mode_trigger}", "ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_icd_report_on_active_mode}", "ICD_MAX_NOTIFICATION_SUBSCRIBERS=${icd_max_notification_subscribers}", "ICD_ENFORCE_SIT_SLOW_POLL_LIMIT=${icd_enforce_sit_slow_poll_limit}", @@ -66,13 +73,19 @@ source_set("manager") { public_deps = [ ":configuration-data", - ":monitoring-table", ":notifier", ":observer", - ":sender", "${chip_root}/src/app:subscription-manager", "${chip_root}/src/credentials:credentials", + "${chip_root}/src/messaging", ] + + if (chip_enable_icd_checkin) { + public_deps += [ + ":monitoring-table", + ":sender", + ] + } } source_set("sender") { diff --git a/src/app/icd/server/ICDManager.cpp b/src/app/icd/server/ICDManager.cpp index 05948feb3406a1..057cc089e9624f 100644 --- a/src/app/icd/server/ICDManager.cpp +++ b/src/app/icd/server/ICDManager.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -37,18 +36,23 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::IcdManagement; using namespace System::Clock; +using chip::Protocols::InteractionModel::Status; + static_assert(UINT8_MAX >= CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS, "ICDManager::mOpenExchangeContextCount cannot hold count for the max exchange count"); void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SymmetricKeystore * symmetricKeystore, - Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * manager) + Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * subInfoProvider) { +#if CHIP_CONFIG_ENABLE_ICD_CIP VerifyOrDie(storage != nullptr); VerifyOrDie(fabricTable != nullptr); VerifyOrDie(symmetricKeystore != nullptr); VerifyOrDie(exchangeManager != nullptr); - VerifyOrDie(manager != nullptr); + VerifyOrDie(subInfoProvider != nullptr); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP +#if CHIP_CONFIG_ENABLE_ICD_LIT // LIT ICD Verification Checks if (SupportsFeature(Feature::kLongIdleTimeSupport)) { @@ -63,18 +67,21 @@ void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricT // VerifyOrDieWithMsg((GetSlowPollingInterval() <= GetSITPollingThreshold()) , AppServer, // "LIT support is required for slow polling intervals superior to 15 seconds"); } +#endif // CHIP_CONFIG_ENABLE_ICD_LIT VerifyOrDie(ICDNotifier::GetInstance().Subscribe(this) == CHIP_NO_ERROR); +#if CHIP_CONFIG_ENABLE_ICD_CIP mStorage = storage; mFabricTable = fabricTable; mSymmetricKeystore = symmetricKeystore; mExchangeManager = exchangeManager; - mSubManager = manager; + mSubInfoProvider = subInfoProvider; VerifyOrDie(ICDConfigurationData::GetInstance().GetICDCounter().Init(mStorage, DefaultStorageKeyAllocator::ICDCheckInCounter(), ICDConfigurationData::kICDCounterPersistenceIncrement) == CHIP_NO_ERROR); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP UpdateICDMode(); UpdateOperationState(OperationalState::IdleMode); @@ -91,13 +98,14 @@ void ICDManager::Shutdown() ICDConfigurationData::GetInstance().SetICDMode(ICDConfigurationData::ICDMode::SIT); mOperationalState = OperationalState::ActiveMode; - - mStorage = nullptr; - mFabricTable = nullptr; - mSubManager = nullptr; - mStateObserverPool.ReleaseAll(); + +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = nullptr; + mFabricTable = nullptr; + mSubInfoProvider = nullptr; mICDSenderPool.ReleaseAll(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP } bool ICDManager::SupportsFeature(Feature feature) @@ -105,13 +113,14 @@ bool ICDManager::SupportsFeature(Feature feature) // Can't use attribute accessors/Attributes::FeatureMap::Get in unit tests #if !CONFIG_BUILD_FOR_HOST_UNIT_TEST uint32_t featureMap = 0; - bool success = (Attributes::FeatureMap::Get(kRootEndpointId, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + bool success = (Attributes::FeatureMap::Get(kRootEndpointId, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; #else return ((mFeatureMap & to_underlying(feature)) != 0); #endif // !CONFIG_BUILD_FOR_HOST_UNIT_TEST } +#if CHIP_CONFIG_ENABLE_ICD_CIP void ICDManager::SendCheckInMsgs() { #if !CONFIG_BUILD_FOR_HOST_UNIT_TEST @@ -148,7 +157,7 @@ void ICDManager::SendCheckInMsgs() continue; } - bool active = mSubManager->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject); + bool active = mSubInfoProvider->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject); if (active) { continue; @@ -179,12 +188,66 @@ void ICDManager::SendCheckInMsgs() #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST } +bool ICDManager::CheckInMessagesWouldBeSent() +{ + for (const auto & fabricInfo : *mFabricTable) + { + uint16_t supported_clients = ICDConfigurationData::GetInstance().GetClientsSupportedPerFabric(); + + ICDMonitoringTable table(*mStorage, fabricInfo.GetFabricIndex(), supported_clients /*Table entry limit*/, + mSymmetricKeystore); + if (table.IsEmpty()) + { + continue; + } + + for (uint16_t i = 0; i < table.Limit(); i++) + { + ICDMonitoringEntry entry(mSymmetricKeystore); + CHIP_ERROR err = table.Get(i, entry); + if (err == CHIP_ERROR_NOT_FOUND) + { + break; + } + + if (err != CHIP_NO_ERROR) + { + // Try to fetch the next entry upon failure (should not happen). + ChipLogError(AppServer, "Failed to retrieved ICDMonitoring entry, will try next entry."); + continue; + } + + // At least one registration would require a Check-In message + VerifyOrReturnValue(mSubInfoProvider->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject), true); + } + } + + // None of the registrations would require a Check-In message + return false; +} + +void ICDManager::TriggerCheckInMessages() +{ + VerifyOrReturn(SupportsFeature(Feature::kCheckInProtocolSupport)); + + // Only trigger Check-In messages when we are in IdleMode. + // If we are already in ActiveMode, Check-In messages have already been sent. + VerifyOrReturn(mOperationalState == OperationalState::IdleMode); + + // If we don't have any Check-In messages to send, do nothing + VerifyOrReturn(CheckInMessagesWouldBeSent()); + + UpdateOperationState(OperationalState::ActiveMode); +} +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + void ICDManager::UpdateICDMode() { assertChipStackLockedByCurrentThread(); ICDConfigurationData::ICDMode tempMode = ICDConfigurationData::ICDMode::SIT; +#if CHIP_CONFIG_ENABLE_ICD_LIT // Device can only switch to the LIT operating mode if LIT support is present if (SupportsFeature(Feature::kLongIdleTimeSupport)) { @@ -202,6 +265,7 @@ void ICDManager::UpdateICDMode() } } } +#endif // CHIP_CONFIG_ENABLE_ICD_LIT if (ICDConfigurationData::GetInstance().GetICDMode() != tempMode) { @@ -236,15 +300,21 @@ void ICDManager::UpdateOperationState(OperationalState state) // When the active mode interval is 0, we stay in idleMode until a notification brings the icd into active mode // unless the device would need to send Check-In messages // TODO(#30281) : Verify how persistent subscriptions affects this at ICDManager::Init - if (ICDConfigurationData::GetInstance().GetActiveModeDuration() > kZero || CheckInMessagesWouldBeSent()) + if (ICDConfigurationData::GetInstance().GetActiveModeDuration() > kZero +#if CHIP_CONFIG_ENABLE_ICD_CIP + || CheckInMessagesWouldBeSent() +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + ) { DeviceLayer::SystemLayer().StartTimer(ICDConfigurationData::GetInstance().GetIdleModeDuration(), OnIdleModeDone, this); } Milliseconds32 slowPollInterval = ICDConfigurationData::GetInstance().GetSlowPollingInterval(); +#if CHIP_CONFIG_ENABLE_ICD_CIP // Going back to Idle, all Check-In messages are sent mICDSenderPool.ReleaseAll(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(slowPollInterval); if (err != CHIP_NO_ERROR) @@ -285,10 +355,12 @@ void ICDManager::UpdateOperationState(OperationalState state) ChipLogError(AppServer, "Failed to set Fast Polling Interval: err %" CHIP_ERROR_FORMAT, err.Format()); } +#if CHIP_CONFIG_ENABLE_ICD_CIP if (SupportsFeature(Feature::kCheckInProtocolSupport)) { SendCheckInMsgs(); } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP postObserverEvent(ObserverEventType::EnterActiveMode); } @@ -371,12 +443,14 @@ void ICDManager::OnKeepActiveRequest(KeepActiveFlags request) this->mOpenExchangeContextCount++; } +#if CHIP_CONFIG_ENABLE_ICD_CIP if (request.Has(KeepActiveFlag::kCheckInInProgress)) { // There can be multiple check-in at the same time. // Keep track of the requests count. this->mCheckInRequestCount++; } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP this->SetKeepActiveModeRequirements(request, true /* state */); } @@ -406,6 +480,7 @@ void ICDManager::OnActiveRequestWithdrawal(KeepActiveFlags request) } } +#if CHIP_CONFIG_ENABLE_ICD_CIP if (request.Has(KeepActiveFlag::kCheckInInProgress)) { // There can be multiple open exchange contexts at the same time. @@ -424,6 +499,7 @@ void ICDManager::OnActiveRequestWithdrawal(KeepActiveFlags request) this->SetKeepActiveModeRequirements(KeepActiveFlag::kCheckInInProgress, false /* state */); } } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP if (request.Has(KeepActiveFlag::kCommissioningWindowOpen) || request.Has(KeepActiveFlag::kFailSafeArmed)) { @@ -506,57 +582,5 @@ void ICDManager::postObserverEvent(ObserverEventType event) }); } -bool ICDManager::CheckInMessagesWouldBeSent() -{ - for (const auto & fabricInfo : *mFabricTable) - { - uint16_t supported_clients = ICDConfigurationData::GetInstance().GetClientsSupportedPerFabric(); - - ICDMonitoringTable table(*mStorage, fabricInfo.GetFabricIndex(), supported_clients /*Table entry limit*/, - mSymmetricKeystore); - if (table.IsEmpty()) - { - continue; - } - - for (uint16_t i = 0; i < table.Limit(); i++) - { - ICDMonitoringEntry entry(mSymmetricKeystore); - CHIP_ERROR err = table.Get(i, entry); - if (err == CHIP_ERROR_NOT_FOUND) - { - break; - } - - if (err != CHIP_NO_ERROR) - { - // Try to fetch the next entry upon failure (should not happen). - ChipLogError(AppServer, "Failed to retrieved ICDMonitoring entry, will try next entry."); - continue; - } - - // At least one registration would require a Check-In message - VerifyOrReturnValue(mSubManager->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject), true); - } - } - - // None of the registrations would require a Check-In message - return false; -} - -void ICDManager::TriggerCheckInMessages() -{ - VerifyOrReturn(SupportsFeature(Feature::kCheckInProtocolSupport)); - - // Only trigger Check-In messages when we are in IdleMode. - // If we are already in ActiveMode, Check-In messages have already been sent. - VerifyOrReturn(mOperationalState == OperationalState::IdleMode); - - // If we don't have any Check-In messages to send, do nothing - VerifyOrReturn(CheckInMessagesWouldBeSent()); - - UpdateOperationState(OperationalState::ActiveMode); -} - } // namespace app } // namespace chip diff --git a/src/app/icd/server/ICDManager.h b/src/app/icd/server/ICDManager.h index f115a41bdddcc8..396e6be20d0606 100644 --- a/src/app/icd/server/ICDManager.h +++ b/src/app/icd/server/ICDManager.h @@ -17,18 +17,32 @@ #pragma once #include + +#include + +#if CHIP_CONFIG_ENABLE_ICD_CIP +#include // nogncheck +#include // nogncheck +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + #include -#include #include -#include #include #include #include +#include #include +#include #include #include #include +namespace chip { +namespace Crypto { +using SymmetricKeystore = SessionKeystore; +} +} // namespace chip + namespace chip { namespace app { @@ -94,8 +108,16 @@ class ICDManager : public ICDListener */ void postObserverEvent(ObserverEventType event); OperationalState GetOperationalState() { return mOperationalState; } + +#if CHIP_CONFIG_ENABLE_ICD_CIP void SendCheckInMsgs(); + /** + * @brief Trigger the ICDManager to send Check-In message if necessary + */ + void TriggerCheckInMessages(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + #ifdef CONFIG_BUILD_FOR_HOST_UNIT_TEST void SetTestFeatureMapValue(uint32_t featureMap) { mFeatureMap = featureMap; }; #endif @@ -108,11 +130,6 @@ class ICDManager : public ICDListener void OnICDManagementServerEvent(ICDManagementEvents event) override; void OnSubscriptionReport() override; - /** - * @brief Trigger the ICDManager to send Check-In message if necessary - */ - void TriggerCheckInMessages(); - protected: friend class TestICDManager; @@ -127,10 +144,14 @@ class ICDManager : public ICDListener */ static void OnTransitionToIdle(System::Layer * aLayer, void * appState); +#if CHIP_CONFIG_ENABLE_ICD_CIP + uint8_t mCheckInRequestCount = 0; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + uint8_t mOpenExchangeContextCount = 0; - uint8_t mCheckInRequestCount = 0; private: +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Function checks if at least one client registration would require a Check-In message * @@ -139,22 +160,23 @@ class ICDManager : public ICDListener * they all have associated subscriptions. */ bool CheckInMessagesWouldBeSent(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP KeepActiveFlags mKeepActiveFlags{ 0 }; // Initialize mOperationalState to ActiveMode so the init sequence at bootup triggers the IdleMode behaviour first. OperationalState mOperationalState = OperationalState::ActiveMode; + bool mTransitionToIdleCalled = false; + ObjectPool mStateObserverPool; +#if CHIP_CONFIG_ENABLE_ICD_CIP PersistentStorageDelegate * mStorage = nullptr; FabricTable * mFabricTable = nullptr; Messaging::ExchangeManager * mExchangeManager = nullptr; Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; - SubscriptionsInfoProvider * mSubManager = nullptr; - - bool mTransitionToIdleCalled = false; - - ObjectPool mStateObserverPool; + SubscriptionsInfoProvider * mSubInfoProvider = nullptr; ObjectPool mICDSenderPool; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP #ifdef CONFIG_BUILD_FOR_HOST_UNIT_TEST // feature map that can be changed at runtime for testing purposes diff --git a/src/app/reporting/SynchronizedReportSchedulerImpl.cpp b/src/app/reporting/SynchronizedReportSchedulerImpl.cpp index 1620d9d70e6bbc..a807469b34f910 100644 --- a/src/app/reporting/SynchronizedReportSchedulerImpl.cpp +++ b/src/app/reporting/SynchronizedReportSchedulerImpl.cpp @@ -51,7 +51,7 @@ void SynchronizedReportSchedulerImpl::OnTransitionToIdle() VerifyOrReturn(now >= mNextReportTimestamp); if (((mNextReportTimestamp - now) < Seconds16(targetIdleInterval)) && (now > mNextMinTimestamp)) { - // If the next report is due in less than the idle mode interval and we are past the min interval, we can just send it now + // If the next report is due in less than the idle mode duration and we are past the min interval, we can just send it now CancelReport(); TimerFired(); } diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 01509a41a2acd0..c523564382904c 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -89,8 +89,8 @@ void CommissioningWindowManager::OnPlatformEvent(const DeviceLayer::ChipDeviceEv #if CONFIG_NETWORK_LAYER_BLE else if (event->Type == DeviceLayer::DeviceEventType::kCloseAllBleConnections) { - ChipLogProgress(AppServer, "Received kCloseAllBleConnections"); - mServer->GetBleLayerObject()->CloseAllBleConnections(); + ChipLogProgress(AppServer, "Received kCloseAllBleConnections:%d", static_cast(event->Type)); + mServer->GetBleLayerObject()->Shutdown(); } #endif } diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index dfb1fc4d6062a4..1ec2fa0b8ffdb4 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -147,11 +147,21 @@ void DnssdServer::AddICDKeyToAdvertisement(AdvertisingParams & advParams) VerifyOrDieWithMsg(mICDManager != nullptr, Discovery, "Invalid pointer to the ICDManager which is required for the LIT operating mode"); + Dnssd::ICDModeAdvertise ICDModeToAdvertise = Dnssd::ICDModeAdvertise::kNone; // Only advertise the ICD key if the device can operate as a LIT if (mICDManager->SupportsFeature(Clusters::IcdManagement::Feature::kLongIdleTimeSupport)) { - advParams.SetICDOperatingAsLIT(Optional(mICDManager->GetICDMode() == ICDConfigurationData::ICDMode::LIT)); + if (mICDManager->GetICDMode() == ICDConfigurationData::ICDMode::LIT) + { + ICDModeToAdvertise = Dnssd::ICDModeAdvertise::kLIT; + } + else + { + ICDModeToAdvertise = Dnssd::ICDModeAdvertise::kSIT; + } } + + advParams.SetICDModeToAdvertise(ICDModeToAdvertise); } #endif @@ -181,7 +191,6 @@ CHIP_ERROR DnssdServer::AdvertiseOperational() .SetPort(GetSecuredPort()) .SetInterfaceId(GetInterfaceId()) .SetLocalMRPConfig(GetLocalMRPConfig()) - .SetTcpSupported(Optional(INET_CONFIG_ENABLE_TCP_ENDPOINT)) .EnableIpV4(true); #if CHIP_CONFIG_ENABLE_ICD_SERVER @@ -255,7 +264,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi advertiseParameters.SetDeviceName(chip::Optional::Value(deviceName)); } - advertiseParameters.SetLocalMRPConfig(GetLocalMRPConfig()).SetTcpSupported(Optional(INET_CONFIG_ENABLE_TCP_ENDPOINT)); + advertiseParameters.SetLocalMRPConfig(GetLocalMRPConfig()); #if CHIP_CONFIG_ENABLE_ICD_SERVER AddICDKeyToAdvertisement(advertiseParameters); diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 6228c10bb46698..f2a562020091a3 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -436,7 +436,7 @@ void Server::OnPlatformEvent(const DeviceLayer::ChipDeviceEvent & event) } break; case DeviceEventType::kServerReady: -#if CHIP_CONFIG_ENABLE_ICD_SERVER +#if CHIP_CONFIG_ENABLE_ICD_SERVER && CHIP_CONFIG_ENABLE_ICD_CIP // Only Trigger Check-In messages if we are not in the middle of a commissioning. // This check is only necessary for the first commissioiner since the kServerReady event // is triggered once we join the network. @@ -445,7 +445,7 @@ void Server::OnPlatformEvent(const DeviceLayer::ChipDeviceEvent & event) { mICDManager.TriggerCheckInMessages(); } -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && CHIP_CONFIG_ENABLE_ICD_CIP #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS ResumeSubscriptions(); #endif diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 5e51254e76753e..302471b8bebb89 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -609,7 +609,7 @@ class Server FabricTable mFabrics; secure_channel::MessageCounterManager mMessageCounterManager; #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT - chip::Protocols::UserDirectedCommissioning::UserDirectedCommissioningClient * gUDCClient = nullptr; + Protocols::UserDirectedCommissioning::UserDirectedCommissioningClient * gUDCClient = nullptr; // mUdcTransportMgr is for insecure communication (ex. user directed commissioning) // specifically, the commissioner declaration message (sent by commissioner to commissionee) UdcTransportMgr * mUdcTransportMgr = nullptr; diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 7d9a3fa9efe376..d8f80e20162fc3 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -141,8 +141,6 @@ chip_test_suite_using_nltest("tests") { "TestEventOverflow.cpp", "TestEventPathParams.cpp", "TestFabricScopedEventLogging.cpp", - "TestICDManager.cpp", - "TestICDMonitoringTable.cpp", "TestInteractionModelEngine.cpp", "TestMessageDef.cpp", "TestNumericAttributeTraits.cpp", @@ -208,7 +206,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/app", "${chip_root}/src/app/common:cluster-objects", "${chip_root}/src/app/icd/client:manager", - "${chip_root}/src/app/icd/server:manager", "${chip_root}/src/app/tests:helpers", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", @@ -218,6 +215,16 @@ chip_test_suite_using_nltest("tests") { "${nlunit_test_root}:nlunit-test", ] + if (chip_enable_icd_server) { + public_deps += [ "${chip_root}/src/app/icd/server:manager" ] + + test_sources += [ "TestICDManager.cpp" ] + } + + if (chip_enable_icd_checkin) { + test_sources += [ "TestICDMonitoringTable.cpp" ] + } + if (chip_device_platform != "android") { test_sources += [ "TestExtensionFieldSets.cpp", diff --git a/src/app/tests/TestBindingTable.cpp b/src/app/tests/TestBindingTable.cpp index 2bd5ed865502c0..fa314d1c1fd1dc 100644 --- a/src/app/tests/TestBindingTable.cpp +++ b/src/app/tests/TestBindingTable.cpp @@ -42,17 +42,17 @@ void TestAdd(nlTestSuite * aSuite, void * aContext) chip::TestPersistentStorageDelegate testStorage; table.SetPersistentStorage(&testStorage); EmberBindingTableEntry unusedEntry; - unusedEntry.type = EMBER_UNUSED_BINDING; + unusedEntry.type = MATTER_UNUSED_BINDING; NL_TEST_ASSERT(aSuite, table.Add(unusedEntry) == CHIP_ERROR_INVALID_ARGUMENT); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, NullOptional)) == CHIP_NO_ERROR); } NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 0, 0, 0, NullOptional)) == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE); auto iter = table.begin(); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, iter != table.end()); NL_TEST_ASSERT(aSuite, iter->nodeId == i); @@ -73,14 +73,14 @@ void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iter == table.end()); NL_TEST_ASSERT(aSuite, table.Size() == 0); NL_TEST_ASSERT(aSuite, table.begin() == table.end()); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, i, 0, 0, NullOptional)) == CHIP_NO_ERROR); } iter = table.begin(); ++iter; NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE - 1); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE - 1); NL_TEST_ASSERT(aSuite, iter->nodeId == 2); NL_TEST_ASSERT(aSuite, iter.GetIndex() == 2); auto iterCheck = table.begin(); @@ -88,9 +88,9 @@ void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iter == iterCheck); NL_TEST_ASSERT(aSuite, table.Add(EmberBindingTableEntry::ForNode(0, 1, 0, 0, NullOptional)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE); iter = table.begin(); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE - 1; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE - 1; i++) { ++iter; } @@ -100,11 +100,11 @@ void TestRemoveThenAdd(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, iter == table.end()); iter = table.begin(); NL_TEST_ASSERT(aSuite, table.RemoveAt(iter) == CHIP_NO_ERROR); - NL_TEST_ASSERT(aSuite, table.Size() == EMBER_BINDING_TABLE_SIZE - 1); + NL_TEST_ASSERT(aSuite, table.Size() == MATTER_BINDING_TABLE_SIZE - 1); NL_TEST_ASSERT(aSuite, iter == table.begin()); NL_TEST_ASSERT(aSuite, iter.GetIndex() == 2); NL_TEST_ASSERT(aSuite, iter->nodeId == 2); - NL_TEST_ASSERT(aSuite, table.GetAt(0).type == EMBER_UNUSED_BINDING); + NL_TEST_ASSERT(aSuite, table.GetAt(0).type == MATTER_UNUSED_BINDING); } void VerifyTableSame(nlTestSuite * aSuite, BindingTable & table, const std::vector & expected) diff --git a/src/app/tests/TestPendingNotificationMap.cpp b/src/app/tests/TestPendingNotificationMap.cpp index b635f3a654cc9b..31aa133977d1be 100644 --- a/src/app/tests/TestPendingNotificationMap.cpp +++ b/src/app/tests/TestPendingNotificationMap.cpp @@ -44,7 +44,7 @@ void ClearBindingTable(BindingTable & table) void CreateDefaultFullBindingTable(BindingTable & table) { - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { table.Add(EmberBindingTableEntry::ForNode(i / 10, i % 5, 0, 0, MakeOptional(i))); } @@ -63,15 +63,15 @@ void TestAddRemove(nlTestSuite * aSuite, void * aContext) PendingNotificationMap pendingMap; ClearBindingTable(BindingTable::GetInstance()); CreateDefaultFullBindingTable(BindingTable::GetInstance()); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(i, nullptr) == CHIP_NO_ERROR); } // Confirm adding in one more element fails - NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(EMBER_BINDING_TABLE_SIZE, nullptr) == CHIP_ERROR_NO_MEMORY); + NL_TEST_ASSERT(aSuite, pendingMap.AddPendingNotification(MATTER_BINDING_TABLE_SIZE, nullptr) == CHIP_ERROR_NO_MEMORY); auto iter = pendingMap.begin(); - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { PendingNotificationEntry entry = *iter; NL_TEST_ASSERT(aSuite, entry.mBindingEntryId == i); diff --git a/src/app/tests/suites/TestDiagnosticLogs.yaml b/src/app/tests/suites/TestDiagnosticLogs.yaml index cf31a96b8ddf58..57ab8cb0fa04f8 100644 --- a/src/app/tests/suites/TestDiagnosticLogs.yaml +++ b/src/app/tests/suites/TestDiagnosticLogs.yaml @@ -18,6 +18,7 @@ config: nodeId: 0x12344321 cluster: "Diagnostic Logs" endpoint: 0 + timeout: 120 end_user_support_log_file_path: "/tmp/end_user_support_log.txt" end_user_support_log_file_content: "End User Support Log Content" end_user_support_log_file_content_long: @@ -31,6 +32,113 @@ config: bdx_transfer_file_path: "/tmp/end_user_support_bdx_output.txt" bdx_transfer_file_name: "end_user_support_bdx_output.txt" + bdx_transfer_file_path_1: "/tmp/bdx_log_output_1.txt" + bdx_transfer_file_name_1: "bdx_log_output_1.txt" + bdx_transfer_file_path_2: "/tmp/bdx_log_output_2.txt" + bdx_transfer_file_name_2: "bdx_log_output_2.txt" + + long_log_file_content: + "This is a long log content... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ......................................................." + tests: # # Set up the test by adding some destination log files for the target accessory: @@ -658,3 +766,180 @@ tests: values: - name: "filePath" value: bdx_transfer_file_path + + # + # Validate that multiple BDX transfers can run in parallels. + # + - label: "Delete possible leftover from previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_1 + + - label: "Delete possible leftover from previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_2 + + - label: "Update End User Support logs with a long log" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: end_user_support_log_file_path + - name: "fileContent" + value: long_log_file_content + + - label: "Update Network Diagnostic logs with a long log" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: network_diagnostics_log_file_path + - name: "fileContent" + value: long_log_file_content + + - label: "Start a second accessory" + cluster: "SystemCommands" + command: "Start" + arguments: + values: + - name: "discriminator" + value: 50 + - name: "port" + value: 5601 + - name: "kvs" + value: "/tmp/chip_kvs_second" + - name: "endUserSupportLogPath" + value: end_user_support_log_file_path + - name: "networkDiagnosticsLogPath" + value: network_diagnostics_log_file_path + - name: "registerKey" + value: "default#2" + + - label: "Commission second accessory from beta" + identity: "beta" + cluster: "CommissionerCommands" + command: "PairWithCode" + arguments: + values: + - name: "nodeId" + value: nodeId + - name: "payload" + value: "MT:-24J0IX4122-.548G00" + + - label: "Wait for the second commissioned device to be retrieved for beta" + identity: "beta" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "BDX: Request End User Support from the first accessory" + command: "RetrieveLogsRequest" + identity: "alpha" + arguments: + values: + - name: "Intent" + value: 1 # NetworkDiagnostics + - name: "RequestedProtocol" + value: 1 # BDX + - name: "TransferFileDesignator" + value: bdx_transfer_file_name_1 + response: + values: + - name: "Status" + value: 0 # Success + - name: "LogContent" + value: "" + + - label: "BDX: Request End User Support from the second accessory" + command: "RetrieveLogsRequest" + identity: "beta" + arguments: + values: + - name: "Intent" + value: 1 # NetworkDiagnostics + - name: "RequestedProtocol" + value: 1 # BDX + - name: "TransferFileDesignator" + value: bdx_transfer_file_name_2 + response: + values: + - name: "Status" + value: 0 # Success + - name: "LogContent" + value: "" + + - label: + "BDX: Wait for 'Diagnostic logs transfer: Success' message from the + first accessory" + cluster: "DelayCommands" + command: "WaitForMessage" + arguments: + values: + - name: "registerKey" + value: "default" + - name: "message" + value: "Diagnostic logs transfer: Success" + + - label: + "BDX: Wait for 'Diagnostic logs transfer: Success' message from the + second accessory" + cluster: "DelayCommands" + command: "WaitForMessage" + arguments: + values: + - name: "registerKey" + value: "default#2" + - name: "message" + value: "Diagnostic logs transfer: Success" + + - label: + "Compare the content the original log and the file that has been + created as the result of the BDX transfer" + cluster: "SystemCommands" + command: "CompareFiles" + arguments: + values: + - name: "file1" + value: end_user_support_log_file_path + - name: "file2" + value: bdx_transfer_file_path_1 + + - label: + "Compare the content the original log and the file that has been + created as the result of the BDX transfer" + cluster: "SystemCommands" + command: "CompareFiles" + arguments: + values: + - name: "file1" + value: network_diagnostics_log_file_path + - name: "file2" + value: bdx_transfer_file_path_2 + + - label: "Delete the result of the previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_1 + + - label: "Delete the result of the previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_2 diff --git a/src/app/tests/suites/TestDiagnosticLogsDownloadCommand.yaml b/src/app/tests/suites/TestDiagnosticLogsDownloadCommand.yaml new file mode 100644 index 00000000000000..a67acdd837b54f --- /dev/null +++ b/src/app/tests/suites/TestDiagnosticLogsDownloadCommand.yaml @@ -0,0 +1,598 @@ +# Copyright (c) 2024 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: Diagnostic Logs Tests for Darwin + +config: + nodeId: 0x12344321 + cluster: "Bdx" + timeout: 180 + end_user_support_log_file_path: "/tmp/end_user_support_log.txt" + end_user_support_log_file_content: "End User Support Log Content" + network_diagnostics_log_file_path: "/tmp/network_diagnostics_log.txt" + + bdx_transfer_file_path_1: "/tmp/bdx_log_output_1.txt" + bdx_transfer_file_name_1: "bdx_log_output_1.txt" + bdx_transfer_file_path_2: "/tmp/bdx_log_output_2.txt" + bdx_transfer_file_name_2: "bdx_log_output_2.txt" + + long_log_file_content: + "Network Diagnostic Log Content is more than 1024 bytes + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ....................................................... + ......................................................." + +tests: + # + # Set up the test by adding some destination log files for the target server: + # 1. End User Support + # 2. Network Diagnostics + # 3. Crash + # + # The first thing to do is to delete them if they exist. There could be some + # left over from a previous test run. + # + + - label: "Delete EndUserSupport logs" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: end_user_support_log_file_path + + - label: "Delete NetworkDiag logs" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: network_diagnostics_log_file_path + + - label: "Stop the server" + cluster: "SystemCommands" + command: "Stop" + + - label: "Create End User Support logs" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: end_user_support_log_file_path + - name: "fileContent" + value: end_user_support_log_file_content + + - label: "Create NetworkDiag logs" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: network_diagnostics_log_file_path + - name: "fileContent" + value: long_log_file_content + + - label: "Start the server with the destination logs files" + cluster: "SystemCommands" + command: "Start" + arguments: + values: + - name: "endUserSupportLogPath" + value: end_user_support_log_file_path + - name: "networkDiagnosticsLogPath" + value: network_diagnostics_log_file_path + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read End User Support log intent" + command: "Download" + arguments: + values: + - name: "LogType" + value: 0 # EndUserSupport + - name: "Timeout" + value: 0 + response: + values: + - name: "logContent" + value: end_user_support_log_file_content + constraints: + minLength: 28 + maxLength: 28 + + - label: "Read Network Diagnostic log intent" + command: "Download" + arguments: + values: + - name: "LogType" + value: 1 # Network Diagnostic + - name: "Timeout" + value: 0 + response: + values: + - name: "logContent" + value: long_log_file_content + constraints: + minLength: 9238 + maxLength: 9238 + + - label: "Read Crash log intent" + command: "Download" + arguments: + values: + - name: "LogType" + value: 2 # Crash + - name: "Timeout" + value: 0 + response: + values: + - name: "logContent" + value: "" + + - label: + "Read Network Diagnostic log intent with a very short timeout and a + very long log" + command: "Download" + arguments: + values: + - name: "LogType" + value: 1 # Network Diagnostic + - name: "Timeout" + value: 1 + response: + values: + - name: "error" + value: "FAILURE" + + - label: + "Read End User Support log intent after a failure to make sure that + everything still works" + command: "Download" + arguments: + values: + - name: "LogType" + value: 0 # EndUserSupport + - name: "Timeout" + value: 0 + response: + values: + - name: "logContent" + value: end_user_support_log_file_content + constraints: + minLength: 28 + maxLength: 28 + + # + # Validate that we handle Busy properly + # + - label: + "BDX: Wait for 'Diagnostic logs transfer: Success' message from the + previous steps" + cluster: "DelayCommands" + command: "WaitForMessage" + arguments: + values: + - name: "registerKey" + value: "default" + - name: "message" + value: "Diagnostic logs transfer: Success" + + - label: "Delete possible leftover from previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_1 + + - label: "Update End User Support logs with a long log" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: end_user_support_log_file_path + - name: "fileContent" + value: long_log_file_content + + - label: "BDX: Request End User Support from the server" + command: "Download" + arguments: + values: + - name: "LogType" + value: 0 # EndUserSupport + - name: "Timeout" + value: 0 + - name: "async" + value: true + - name: "filepath" + value: bdx_transfer_file_path_1 + + - label: + "BDX: Request End User Support from the server again while it is busy" + command: "Download" + arguments: + values: + - name: "LogType" + value: 0 # EndUserSupport + - name: "Timeout" + value: 0 + - name: "filepath" + value: bdx_transfer_file_path_2 + response: + values: + - name: "logContent" + value: null + - name: "error" + value: "FAILURE" + + - label: "BDX: Wait for 'Diagnostic logs transfer: Success' message" + cluster: "DelayCommands" + command: "WaitForMessage" + arguments: + values: + - name: "registerKey" + value: "default" + - name: "message" + value: "Diagnostic logs transfer: Success" + - name: "timeoutInSeconds" + value: 60 + + - label: "Delete the result of the previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_1 + + # + # Validate that multiple BDX transfers can run in parallel. + # + - label: "Delete possible leftover from previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_1 + + - label: "Delete possible leftover from previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_2 + + - label: "Update End User Support logs with a long log" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: end_user_support_log_file_path + - name: "fileContent" + value: long_log_file_content + + - label: "Update Network Diagnostic logs with a long log" + cluster: "SystemCommands" + command: "CreateFile" + arguments: + values: + - name: "filePath" + value: network_diagnostics_log_file_path + - name: "fileContent" + value: long_log_file_content + + - label: "Start a second server" + cluster: "SystemCommands" + command: "Start" + arguments: + values: + - name: "discriminator" + value: 50 + - name: "port" + value: 5601 + - name: "kvs" + value: "/tmp/chip_kvs_second" + - name: "endUserSupportLogPath" + value: end_user_support_log_file_path + - name: "networkDiagnosticsLogPath" + value: network_diagnostics_log_file_path + - name: "registerKey" + value: "default#2" + + - label: "Commission second server from beta" + identity: "beta" + cluster: "CommissionerCommands" + command: "PairWithCode" + arguments: + values: + - name: "nodeId" + value: nodeId + - name: "payload" + value: "MT:-24J0IX4122-.548G00" + + - label: "Wait for the second commissioned device to be retrieved for beta" + identity: "beta" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "BDX: Request End User Support from the first server" + command: "Download" + arguments: + values: + - name: "LogType" + value: 1 # Network Diagnostic + - name: "Timeout" + value: 0 + - name: "async" + value: true + - name: "filepath" + value: bdx_transfer_file_path_1 + + - label: "BDX: Request End User Support from the second server" + identity: "beta" + command: "Download" + arguments: + values: + - name: "LogType" + value: 1 # Network Diagnostic + - name: "Timeout" + value: 0 + - name: "async" + value: true + - name: "filepath" + value: bdx_transfer_file_path_2 + + - label: + "BDX: Wait for 'Diagnostic logs transfer: Success' message from the + first server" + cluster: "DelayCommands" + command: "WaitForMessage" + arguments: + values: + - name: "registerKey" + value: "default" + - name: "message" + value: "Diagnostic logs transfer: Success" + - name: "timeoutInSeconds" + value: 60 + + - label: + "BDX: Wait for 'Diagnostic logs transfer: Success' message from the + second server" + cluster: "DelayCommands" + command: "WaitForMessage" + arguments: + values: + - name: "registerKey" + value: "default#2" + - name: "message" + value: "Diagnostic logs transfer: Success" + - name: "timeoutInSeconds" + value: 60 + + - label: + "Compare the content the original log and the file that has been + created as the result of the BDX transfer" + cluster: "SystemCommands" + command: "CompareFiles" + arguments: + values: + - name: "file1" + value: end_user_support_log_file_path + - name: "file2" + value: bdx_transfer_file_path_1 + + - label: + "Compare the content the original log and the file that has been + created as the result of the BDX transfer" + cluster: "SystemCommands" + command: "CompareFiles" + arguments: + values: + - name: "file1" + value: network_diagnostics_log_file_path + - name: "file2" + value: bdx_transfer_file_path_2 + + - label: "Delete the result of the previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_1 + + - label: "Delete the result of the previous run" + cluster: "SystemCommands" + command: "DeleteFile" + arguments: + values: + - name: "filePath" + value: bdx_transfer_file_path_2 diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml index c4f1afc08be9f8..77c0615a27bc8d 100644 --- a/src/app/tests/suites/TestDiscovery.yaml +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -203,7 +203,7 @@ tests: - name: "productId" value: productId - - label: "Optional TXT key for MRP Sleepy Idle Interval (SII)" + - label: "Optional TXT key for MRP Session Idle Interval (SII)" PICS: MCORE.SC.SII_COMM_DISCOVERY_KEY cluster: "DiscoveryCommands" command: "FindCommissionable" @@ -214,7 +214,7 @@ tests: minValue: 0 maxValue: 3600000 - - label: "Optional TXT key for MRP Sleepy Active Interval (SAI)" + - label: "Optional TXT key for MRP Session Active Interval (SAI)" PICS: MCORE.SC.SAI_COMM_DISCOVERY_KEY cluster: "DiscoveryCommands" command: "FindCommissionable" diff --git a/src/app/tests/suites/TestScenesMaxCapacity.yaml b/src/app/tests/suites/TestScenesMaxCapacity.yaml new file mode 100644 index 00000000000000..b9ec7593237812 --- /dev/null +++ b/src/app/tests/suites/TestScenesMaxCapacity.yaml @@ -0,0 +1,890 @@ +# 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. + +# !!!!!!!!!! TEST INFORMATION !!!!!!!!!!!!!!!!!! +# This test covers multi fabric support for scenes cluster attributes such as LastConfiguredBy and FabricSceneInfo + +name: Scenes Multi-fabric testing + +PICS: + - MCORE.ROLE.COMMISSIONEE + - APPDEVICE.S + +config: + nodeId: 0x12344321 + cluster: "Scenes Management" + endpoint: 1 + payload: + type: char_string + defaultValue: "MT:-24J0AFN00KA0648G00" + discriminator: + type: int16u + defaultValue: 3840 + waitAfterCommissioning: + type: int16u + defaultValue: 5000 + PakeVerifier: + type: octet_string + defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" + G1: + type: group_id + defaultValue: 0x0001 + G2: + type: group_id + defaultValue: 0x0002 + +tests: + - label: "Commission DUT to TH1" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH1 reads the fabric index" + cluster: "Operational Credentials" + endpoint: 0 + command: "readAttribute" + attribute: "CurrentFabricIndex" + response: + saveAs: th1FabricIndex + + - label: "Read the commissioner node ID from the alpha fabric" + identity: "alpha" + endpoint: 0 + cluster: "CommissionerCommands" + command: "GetCommissionerNodeId" + response: + values: + - name: "nodeId" + saveAs: commissionerNodeIdAlpha + + - label: "Open Commissioning Window from alpha" + endpoint: 0 + cluster: "Administrator Commissioning" + command: "OpenCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + - name: "PAKEPasscodeVerifier" + value: PakeVerifier + - name: "Discriminator" + value: discriminator + - name: "Iterations" + value: 1000 + - name: "Salt" + value: "SPAKE2P Key Salt" + + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + + - label: "Commission from TH2" + identity: "beta" + endpoint: 0 + cluster: "CommissionerCommands" + command: "PairWithCode" + arguments: + values: + - name: "nodeId" + value: nodeId + - name: "payload" + value: payload + + - label: "Wait for the commissioned device to be retrieved for TH2" + endpoint: 0 + identity: beta + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH2 reads the fabric index" + identity: "beta" + endpoint: 0 + cluster: "Operational Credentials" + command: "readAttribute" + attribute: "CurrentFabricIndex" + response: + saveAs: th2FabricIndex + + - label: "Read the commissioner node ID from the beta fabric" + identity: "beta" + endpoint: 0 + cluster: "CommissionerCommands" + command: "GetCommissionerNodeId" + response: + values: + - name: "nodeId" + saveAs: commissionerNodeIdBeta + + - label: "Open Commissioning Window from alpha" + endpoint: 0 + cluster: "Administrator Commissioning" + command: "OpenCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + - name: "PAKEPasscodeVerifier" + value: PakeVerifier + - name: "Discriminator" + value: discriminator + - name: "Iterations" + value: 1000 + - name: "Salt" + value: "SPAKE2P Key Salt" + + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + + - label: "Commission from TH3" + identity: "gamma" + endpoint: 0 + cluster: "CommissionerCommands" + command: "PairWithCode" + arguments: + values: + - name: "nodeId" + value: nodeId + - name: "payload" + value: payload + + - label: "Wait for the commissioned device to be retrieved for TH3" + endpoint: 0 + identity: gamma + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH3 reads the fabric index" + identity: "gamma" + endpoint: 0 + cluster: "Operational Credentials" + command: "readAttribute" + attribute: "CurrentFabricIndex" + response: + saveAs: th3FabricIndex + + - label: "Read the commissioner node ID from the gamma fabric" + identity: "gamma" + endpoint: 0 + cluster: "CommissionerCommands" + command: "GetCommissionerNodeId" + response: + values: + - name: "nodeId" + saveAs: commissionerNodeIdBeta + + - label: "Read the FabricSceneInfo attribute (0x0007) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + constraints: + type: list + + - label: "TH reads from the DUT the (0x0006) SceneTableSize attribute" + command: "readAttribute" + attribute: "SceneTableSize" + response: + values: + - name: "SceneTableSize" + saveAs: maxScenes + + - label: "Arithmetic operation to get the maxScenes - 1" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenes - 1 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: maxScenesMinusOne + value: maxScenes - 1 + + - label: "Arithmetic operation to get the fabric Capacity" + cluster: "Unit Testing" + command: "TestAddArguments" + arguments: + values: + - name: "arg1" + value: maxScenesMinusOne / 2 + - name: "arg2" + value: 0 + response: + values: + - name: "returnValue" + saveAs: fabricCapacity + value: maxScenesMinusOne / 2 + + - label: "Preparation step : TH 1 Add Group KeySet." + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: "Preparation step TH1 Map KeySets to GroupId." + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: + [ + { FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a1 }, + { FabricIndex: 0, GroupId: G2, GroupKeySetID: 0x01a1 }, + ] + + - label: "TH1 sends a RemoveAllGroups command to DUT." + cluster: "Groups" + command: "RemoveAllGroups" + + - label: "TH1 sends a AddGroup command to DUT for G1." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH1 sends a AddGroup command to DUT for G2." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "GroupName" + value: "Group2" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G2 + + - label: "Preparation step : TH 2 Add Group KeySet." + identity: "beta" + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a2, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1120000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1120001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1120002, + } + + - label: "Preparation step TH2 Map KeySets to GroupId." + identity: "beta" + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: + [ + { FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a2 }, + { FabricIndex: 0, GroupId: G2, GroupKeySetID: 0x01a2 }, + ] + + - label: "TH2 sends a AddGroup command to DUT for G1." + identity: "beta" + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH2 sends a AddGroup command to DUT for G2." + identity: "beta" + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G2 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G2 + + - label: "TH2 confirms the Fabric Capacity is Maximum" + command: "GetSceneMembership" + identity: "beta" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity + - name: "GroupID" + value: G1 + + - label: "Preparation step : TH 3 Add Group KeySet." + identity: "gamma" + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a2, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1120000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1120001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1120002, + } + + - label: "Preparation step TH3 Map KeySets to GroupId." + identity: "gamma" + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: [{ FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a2 }] + + - label: "TH3 sends a AddGroup command to DUT for G1." + identity: "gamma" + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: "TH3 confirms the Fabric Capacity is Maximum" + command: "GetSceneMembership" + identity: "gamma" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity + - name: "GroupID" + value: G1 + + - label: "TH1 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0001 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0001 + + - label: "TH2 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + identity: "beta" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0001 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0001 + + - label: "TH3 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + identity: "gamma" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0001 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0001 + + - label: "TH1 confirms the Fabric Capacity is 0" + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity - 1 + - name: "GroupID" + value: G1 + + - label: "TH2 confirms the Fabric Capacity is 7" + command: "GetSceneMembership" + identity: "beta" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity - 1 + - name: "GroupID" + value: G1 + + - label: "TH2 confirms the Fabric Capacity is 7" + command: "GetSceneMembership" + identity: "beta" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "Capacity" + value: fabricCapacity - 1 + - name: "GroupID" + value: G1 + + # Now we fill TH1 + - label: "TH1 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0002 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0002 + + - label: "TH1 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0003 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0003 + + - label: "TH1 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0004 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0004 + + - label: "TH1 copies Scenes from G1 to G2" + command: "CopyScene" + arguments: + values: + - name: "Mode" + value: 0x01 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + - name: "GroupIdentifierTo" + value: G2 + - name: "SceneIdentifierTo" + value: 0x02 + response: + values: + - name: "Status" + value: 0x89 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + + - label: "TH1 Read the FabricSceneInfo attribute (0x0002) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 7, + CurrentScene: 0x04, + CurrentGroup: 0x0001, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 7, + }, + ] + + - label: "TH2 Read the FabricSceneInfo attribute (0x0002) " + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: 0x01, + FabricIndex: th2FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + - label: "TH3 Read the FabricSceneInfo attribute (0x0002) " + identity: "gamma" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: 0x01, + FabricIndex: th3FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 1, + }, + ] + + # Now we fill TH2 + - label: "TH2 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + identity: "beta" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0002 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0002 + + - label: "TH2 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + identity: "beta" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0003 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0003 + + - label: "TH2 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + command: "StoreScene" + identity: "beta" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0004 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0004 + + - label: "TH2 copies Scenes from G1 to G2" + cluster: "Scenes Management" + identity: "beta" + command: "CopyScene" + arguments: + values: + - name: "Mode" + value: 0x01 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + - name: "GroupIdentifierTo" + value: G2 + - name: "SceneIdentifierTo" + value: 0x02 + response: + values: + - name: "Status" + value: 0x89 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + + - label: "TH1 Read the FabricSceneInfo attribute (0x0002) " + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 7, + CurrentScene: 0x04, + CurrentGroup: 0x0001, + FabricIndex: th1FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 7, + }, + ] + + - label: "TH2 Read the FabricSceneInfo attribute (0x0002) " + identity: "beta" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 7, + CurrentScene: 0x04, + CurrentGroup: 0x0001, + FabricIndex: th2FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 7, + }, + ] + + - label: "TH3 Read the FabricSceneInfo attribute (0x0002) " + identity: "gamma" + command: "readAttribute" + attribute: "FabricSceneInfo" + response: + value: + [ + { + SceneCount: 1, + CurrentScene: 0x01, + CurrentGroup: 0x01, + FabricIndex: th3FabricIndex, + SceneValid: true, + RemainingCapacity: fabricCapacity - 6, + }, + ] + + - label: "TH3 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + identity: "gamma" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0002 + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0002 + + - label: "TH3 sends a StoreScene command to DUT for G1." + cluster: "Scenes Management" + identity: "gamma" + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0003 + response: + values: + - name: "Status" + value: 0x89 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x0003 + + - label: "TH3 copies Scene 0x01 from G1 to 0x02 in G1" + cluster: "Scenes Management" + identity: "beta" + command: "CopyScene" + arguments: + values: + - name: "Mode" + value: 0x00 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 + - name: "GroupIdentifierTo" + value: G1 + - name: "SceneIdentifierTo" + value: 0x04 + response: + values: + - name: "Status" + value: 0x89 + - name: "GroupIdentifierFrom" + value: G1 + - name: "SceneIdentifierFrom" + value: 0x01 diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 2022b27bd22f12..407851320ca31c 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -3628,6 +3628,9 @@ PICS: - label: "Indicates that node is configured for test event triggers." id: DGGEN.S.C00.Rsp + - label: "Indicates cluster supports Payload Test Request." + id: DGGEN.S.C03.Rsp + # # server / Events # @@ -3649,6 +3652,13 @@ PICS: - label: "Indicates the reason that caused the device to reboot start-up." id: DGGEN.S.E03 + # + # server / features + # + - label: + "Support specific commands needed for extended Data Model features." + id: DGGEN.S.F00 + # # client / attributes # @@ -8848,6 +8858,94 @@ PICS: command?" id: OPSTATE.S.C04.Tx + # + #Oven Operational State + # + - label: + "Does the device implement the Operational State cluster as a server?" + id: OVENOPSTATE.S + + - label: + "Does the device implement the Operational State cluster as a client?" + id: OVENOPSTATE.C + + #ManuallyControlled + + - label: "Does the DUT support testing the Stopped(0x00) operational state" + id: OVENOPSTATE.S.M.ST_STOPPED + + - label: "Does the DUT support testing the Running(0x01) operational state" + id: OVENOPSTATE.S.M.ST_RUNNING + + - label: "Does the DUT support testing the Paused(0x02) operational state" + id: OVENOPSTATE.S.M.ST_PAUSED + + - label: "Does the DUT support testing the Error(0x03) operational state?" + id: OVENOPSTATE.S.M.ST_ERROR + + - label: "Does the DUT support testing the NoError(0x00) error state?" + id: OVENOPSTATE.S.M.ERR_NO_ERROR + + - label: + "Does the DUT support testing the UnableToStartOrResume(0x01) error + state?" + id: OVENOPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME + + - label: + "Does the DUT support testing the UnableToCompleteOperation(0x02) + error state?" + id: OVENOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION + + - label: + "Does the DUT support testing the CommandInvalidInState(0x03) error + state?" + id: OVENOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE + + #Server Attributes + - label: "Does the device implement the PhaseList attribute?" + id: OVENOPSTATE.S.A0000 + + - label: "Does the device implement the CurrentPhase attribute?" + id: OVENOPSTATE.S.A0001 + + - label: "Does the device implement the CountdownTime attribute?" + id: OVENOPSTATE.S.A0002 + + - label: "Does the device implement the OperationalStateList attribute?" + id: OVENOPSTATE.S.A0003 + + - label: "Does the device implement the OperationalState attribute?" + id: OVENOPSTATE.S.A0004 + + - label: "Does the device implement the OperationalError attribute?" + id: OVENOPSTATE.S.A0005 + #Events Generated + + - label: "Does the device generate the OperationalError event?" + id: OVENOPSTATE.S.E00 + + - label: "Does the device generate the OperationCompltion event?" + id: OVENOPSTATE.S.E01 + + #Server Commands Received + - label: "Does the device implement receiving the Pause command?" + id: OVENOPSTATE.S.C00.Rsp + + - label: "Does the device implement receiving the Stop command?" + id: OVENOPSTATE.S.C01.Rsp + + - label: "Does the device implement receiving the Start command?" + id: OVENOPSTATE.S.C02.Rsp + + - label: "Does the device implement receiving the Resume command?" + id: OVENOPSTATE.S.C03.Rsp + + #Commands generated + - label: + "Does the device implement generating the OperationalCommandResponse + command?" + id: OVENOPSTATE.S.C04.Tx + # Smoke CO Alarm Cluster Test Plan - label: "Does the device implement the SMOKECO cluster as a server?" id: SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml index fc10b3d02eeaba..6641fcf879939c 100644 --- a/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DGGEN_1_1.yaml @@ -40,9 +40,20 @@ tests: type: int16u - label: "Step 3: TH reads from the DUT the FeatureMap attribute." + PICS: "!DGGEN.S.F00" command: "readAttribute" attribute: "FeatureMap" response: + value: 0 + constraints: + type: bitmap32 + + - label: "Step 3: TH reads from the DUT the FeatureMap attribute." + PICS: DGGEN.S.F00 + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 1 constraints: type: bitmap32 diff --git a/src/app/tests/suites/certification/Test_TC_DGGEN_2_3.yaml b/src/app/tests/suites/certification/Test_TC_DGGEN_2_3.yaml index 9690cafcf66c73..ba5ba54b9c22d7 100644 --- a/src/app/tests/suites/certification/Test_TC_DGGEN_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_DGGEN_2_3.yaml @@ -78,7 +78,21 @@ tests: - label: "Step 4: Invoke the TestEventTrigger command with EnableKey field set - to PIXIT.DGGEN.ENABLEKEY and EventTrigger field set to 0." + to all zeros and EventTrigger field set to 0." + PICS: DGGEN.S.C00.Rsp + command: "TestEventTrigger" + arguments: + values: + - name: "EnableKey" + value: "hex:00000000000000000000000000000000" + - name: "EventTrigger" + value: 0 + response: + error: CONSTRAINT_ERROR + + - label: + "Step 5: Invoke the TestEventTrigger command with EnableKey field set + to 8-bytes to zeros and EventTrigger field set to 0." PICS: DGGEN.S.C00.Rsp command: "TestEventTrigger" arguments: @@ -89,3 +103,55 @@ tests: value: 0 response: error: CONSTRAINT_ERROR + + - label: + "Step 6: Invoke the PayloadTestRequest command with EnableKey field + set to PIXIT.DGGEN.ENABLEKEY, Value field set to 0x1 and Count set to + 1." + runIf: IsExpectedValue + PICS: DGGEN.S.C03.Rsp + command: "PayloadTestRequest" + arguments: + values: + - name: "EnableKey" + value: PIXIT.DGGEN.ENABLEKEY + - name: "Value" + value: 0x1 + - name: "Count" + value: 1 + response: + - values: + - name: "Payload" + value: "hex:01" + + - label: + "Step 7: Invoke the PayloadTestRequest command with EnableKey field + set to all zeros, Value field set to 0x1 and Count set to 1." + PICS: DGGEN.S.C03.Rsp + command: "PayloadTestRequest" + arguments: + values: + - name: "EnableKey" + value: "hex:00000000000000000000000000000000" + - name: "Value" + value: 0x1 + - name: "Count" + value: 1 + response: + error: CONSTRAINT_ERROR + + - label: + "Step 8: Invoke the PayloadTestRequest command with EnableKey field + set to 8-bytes to zeros, Value field set to 0x1 and Count set to 1." + PICS: DGGEN.S.C03.Rsp + command: "PayloadTestRequest" + arguments: + values: + - name: "EnableKey" + value: "hex:00000000000000000000000000000000" + - name: "Value" + value: 0x1 + - name: "Count" + value: 1 + response: + error: CONSTRAINT_ERROR diff --git a/src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml deleted file mode 100644 index 21d6c7e9785e07..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml +++ /dev/null @@ -1,162 +0,0 @@ -# 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: 201.1.1. [TC-OPSTATE-1.1] Global Attributes with DUT as Server - -PICS: - - OPSTATE.S - -config: - nodeId: 0x12344321 - cluster: "Operational State" - endpoint: 1 - -tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - constraints: - type: int16u - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute" - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - constraints: - type: bitmap32 - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: - [0, 1, 3, 4, 5, 65528, 65529, 65530, 65531, 65532, 65533] - - - label: "Step 4a: TH reads from the DUT the AttributeList attribute" - PICS: "!PICS_EVENT_LIST_ENABLED" - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [0, 1, 3, 4, 5, 65528, 65529, 65531, 65532, 65533] - - - label: - "Step 4b: TH reads from the DUT the optional attribute(CountdownTime) - in the AttributeList from the DUT" - PICS: OPSTATE.S.A0002 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [2] - - - label: "Step 5a: TH reads from the DUT the EventList attribute" - PICS: PICS_EVENT_LIST_ENABLED - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0x00] - - - label: - "Step 5b: TH reads from the DUT the optional - event(OperationCompletion) in EventList." - PICS: PICS_EVENT_LIST_ENABLED && OPSTATE.S.E01 - command: "readAttribute" - attribute: "EventList" - response: - constraints: - type: list - contains: [0x01] - - - label: - "Step 6a: TH reads the optional command(Start) in AcceptedCommandList" - PICS: OPSTATE.S.C02.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1, 2] - - - label: - "Step 6b: TH reads the optional command(Stop) in AcceptedCommandList" - PICS: OPSTATE.S.C01.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [1] - - - label: - "Step 6c: TH reads the optional command(Pause) in AcceptedCommandList" - PICS: OPSTATE.S.C00.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 3] - - - label: - "Step 6d: TH reads the optional command(Resume) in AcceptedCommandList" - PICS: OPSTATE.S.C03.Rsp - command: "readAttribute" - attribute: "AcceptedCommandList" - response: - constraints: - type: list - contains: [0, 3] - - - label: "Step 7: TH reads from the DUT the AcceptedCommandList attribute" - PICS: - "!OPSTATE.S.C00.Rsp && !OPSTATE.S.C01.Rsp && !OPSTATE.S.C02.Rsp && - !OPSTATE.S.C03.Rsp" - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - value: [] - constraints: - type: list - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute" - PICS: - (OPSTATE.S.C00.Rsp || OPSTATE.S.C01.Rsp || OPSTATE.S.C02.Rsp || - OPSTATE.S.C03.Rsp) - command: "readAttribute" - attribute: "GeneratedCommandList" - response: - constraints: - type: list - contains: [4] diff --git a/src/app/tests/suites/certification/Test_TC_OPSTATE_2_2.yaml b/src/app/tests/suites/certification/Test_TC_OPSTATE_2_2.yaml deleted file mode 100644 index 43dc0dda3dc01e..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OPSTATE_2_2.yaml +++ /dev/null @@ -1,335 +0,0 @@ -# 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 202.2.2. [TC-OPSTATE-2.2] Start and Stop commands with DUT as Server - -PICS: - - OPSTATE.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Note" - verification: | - This is a simulated example log for instructional purposes only. In real scenarios, the actual log may vary depending on the feature implementation in Reference App. - disabled: true - - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)" - verification: | - - disabled: true - - - label: - "Step 2: Manually put the DUT into a state wherein it can receive a - Start Command" - verification: | - Manually put the DUT into a state wherein it can receive a Start Command - disabled: true - - - label: "Step 3: TH reads from the DUT the OperationalStateList attribute" - PICS: OPSTATE.S.A0003 - verification: | - ./chip-tool operationalstate read operational-state-list 1 1 - - Via the TH (chip-tool), verify: - - all entries include an ID (enum8) and a label (string) - - all provided IDs are in the allowed range - - the list includes IDs for Error (0x03), Running (0x01), and Stopped (0x00) - - [1689674049.504261][17222:17224] CHIP:DMG: } - [1689674049.504390][17222:17224] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0003 DataVersion: 2102885775 - [1689674049.504440][17222:17224] CHIP:TOO: OperationalStateList: 4 entries - [1689674049.504462][17222:17224] CHIP:TOO: [1]: { - [1689674049.504469][17222:17224] CHIP:TOO: OperationalStateID: 0 - [1689674049.504476][17222:17224] CHIP:TOO: } - [1689674049.504484][17222:17224] CHIP:TOO: [2]: { - [1689674049.504490][17222:17224] CHIP:TOO: OperationalStateID: 1 - [1689674049.504495][17222:17224] CHIP:TOO: } - [1689674049.504503][17222:17224] CHIP:TOO: [3]: { - [1689674049.504508][17222:17224] CHIP:TOO: OperationalStateID: 2 - [1689674049.504514][17222:17224] CHIP:TOO: } - [1689674049.504521][17222:17224] CHIP:TOO: [4]: { - [1689674049.504527][17222:17224] CHIP:TOO: OperationalStateID: 3 - [1689674049.504533][17222:17224] CHIP:TOO: } - [1689674049.504605][17222:17224] CHIP:EM: <<< [E:22830i S:37151 M:4250114 (Ack:140781365)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674049.504620][17222:17224] CHIP:IN: (S) Sending msg 4250114 on secure session with LSID: 37151 - disabled: true - - - label: "Step 4: TH sends Start command to the DUT" - PICS: OPSTATE.S.C02.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate start 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674139.018639][17233:17235] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674139.018658][17233:17235] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674139.018704][17233:17235] CHIP:TOO: OperationalCommandResponse: { - [1689674139.018712][17233:17235] CHIP:TOO: commandResponseState: { - [1689674139.018719][17233:17235] CHIP:TOO: ErrorStateID: 0 - [1689674139.018726][17233:17235] CHIP:TOO: } - [1689674139.018732][17233:17235] CHIP:TOO: } - [1689674139.018755][17233:17235] CHIP:DMG: ICR moving to [AwaitingDe] - [1689674139.018818][17233:17235] CHIP:EM: <<< [E:26021i S:33879 M:235550100 (Ack:58905970)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674139.018837][17233:17235] CHIP:IN: (S) Sending msg 235550100 on secure session with LSID: 33879 - [1689674139.018885][17233:17235] CHIP:EM: Flushed pending ack for MessageCounter:58905970 on exchange 26021i - disabled: true - - - label: "Step 5: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x01 (Running) - - [1689674196.878722][17249:17251] CHIP:DMG: InteractionModelRevision = 1 - [1689674196.878727][17249:17251] CHIP:DMG: } - [1689674196.878800][17249:17251] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689674196.878834][17249:17251] CHIP:TOO: OperationalState: { - [1689674196.878841][17249:17251] CHIP:TOO: OperationalStateID: 1 - [1689674196.878847][17249:17251] CHIP:TOO: } - [1689674196.878914][17249:17251] CHIP:EM: <<< [E:56939i S:28614 M:63040141 (Ack:57012545)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674196.878928][17249:17251] CHIP:IN: (S) Sending msg 63040141 on secure session with LSID: 28614 - disabled: true - - - label: "Step 6: TH reads from the DUT the OperationalError attribute" - PICS: OPSTATE.S.A0005 - verification: | - ./chip-tool operationalstate read operational-error 1 1 - - Via the TH (chip-tool), verify: - - the response contains the ErrorStateId set to NoError(0x00) - - [1689674342.832448][17274:17276] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0005 DataVersion: 2102885775 - [1689674342.832482][17274:17276] CHIP:TOO: OperationalError: { - [1689674342.832500][17274:17276] CHIP:TOO: ErrorStateID: 0 - [1689674342.832509][17274:17276] CHIP:TOO: } - [1689674342.832570][17274:17276] CHIP:EM: <<< [E:37158i S:10451 M:72875113 (Ack:195983315)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674342.832585][17274:17276] CHIP:IN: (S) Sending msg 72875113 on secure session with LSID: 10451 - [1689674342.832614][17274:17276] CHIP:EM: Flushed pending ack for MessageCounter:195983315 on exchange 37158i - disabled: true - - - label: "Step 7: TH reads from the DUT the CountdownTime attribute" - PICS: OPSTATE.S.A0002 - verification: | - ./chip-tool operationalstate read countdown-time 1 1 - - Via the TH (chip-tool), verify: - - that CountdownTime attribute contains either null our a uint32 value - - if non-null, verify that the value is in the range 1 to 259200 - - store the value in 'initialcountdown-time' - - [1689674384.271623][17278:17280] CHIP:DMG: InteractionModelRevision = 1 - [1689674384.271625][17278:17280] CHIP:DMG: } - [1689674384.271649][17278:17280] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0002 DataVersion: 2102885775 - [1689674384.271662][17278:17280] CHIP:TOO: CountdownTime: null - [1689674384.271683][17278:17280] CHIP:EM: <<< [E:24665i S:47371 M:757241 (Ack:152992659)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674384.271687][17278:17280] CHIP:IN: (S) Sending msg 757241 on secure session with LSID: 47371 - [1689674384.271696][17278:17280] CHIP:EM: Flushed pending ack for MessageCounter:152992659 on exchange 24665i - disabled: true - - - label: "Step 8: TH reads from the DUT the PhaseList attribute" - PICS: OPSTATE.S.A0000 - verification: | - ./chip-tool operationalstate read phase-list 1 1 - - Via the TH (chip-tool), verify: - - that PhaseList attribute value contains either null or a list of strings. - - If not null, receord the number of entries in the list as 'phase-list-size'; execute step 7. - If null, go to step 8. - - [1689674447.761859][17290:17292] CHIP:DMG: InteractionModelRevision = 1 - [1689674447.761865][17290:17292] CHIP:DMG: } - [1689674447.761938][17290:17292] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0000 DataVersion: 2102885775 - [1689674447.761972][17290:17292] CHIP:TOO: PhaseList: null - [1689674447.762041][17290:17292] CHIP:EM: <<< [E:58737i S:13847 M:251354926 (Ack:137738036)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674447.762055][17290:17292] CHIP:IN: (S) Sending msg 251354926 on secure session with LSID: 13847 - [1689674447.762109][17290:17292] CHIP:EM: Flushed pending ack for MessageCounter:137738036 on exchange 58737i - disabled: true - - - label: "Step 9: TH reads from the DUT the CurrentPhase attribute" - PICS: OPSTATE.S.A0001 - verification: | - ./chip-tool operationalstate read current-phase 1 1 - - Via the TH (chip-tool), verify: - - that the CurrentPhase attribute value contains contains a uint8 value - - that the value is between 0 and 'phase-list-size - 1'. - - [1689674497.950563][17299:17301] CHIP:DMG: } - [1689674497.950635][17299:17301] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0001 DataVersion: 2102885775 - [1689674497.950664][17299:17301] CHIP:TOO: CurrentPhase: null - [1689674497.950737][17299:17301] CHIP:EM: <<< [E:64019i S:52010 M:245677798 (Ack:138696372)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674497.950752][17299:17301] CHIP:IN: (S) Sending msg 245677798 on secure session with LSID: 52010 - [1689674497.950798][17299:17301] CHIP:EM: Flushed pending ack for MessageCounter:138696372 on exchange 64019i - [1689674497.950899][17299:17299] CHIP:CTL: Shutting down the commissioner - disabled: true - - - label: - "Step 10: TH waits for a vendor defined wait time, this being a period - of time less than the expected duration of the operation that has been - started" - verification: | - TH waits for a vendor defined wait time, this being a period of time less than the expected duration of the operation that has been started - disabled: true - - - label: "Step 11: TH reads from the DUT the CountdownTime attribute" - PICS: OPSTATE.S.A0002 - verification: | - ./chip-tool operationalstate read countdown-time 1 1 - - - Via the TH (chip-tool), verify: - - that CountdownTime attribute contains either null our a uint32 value - - if non-null, verify that the value is in the range 1 to 259200 - - that the value is approximately 'initialcountdown-time minus the vendor defined wait time' - - - [1689674623.673661][17320:17322] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0002 DataVersion: 2102885775 - [1689674623.673697][17320:17322] CHIP:TOO: CountdownTime: null - [1689674623.673755][17320:17322] CHIP:EM: <<< [E:42152i S:37580 M:19654175 (Ack:176515710)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674623.673768][17320:17322] CHIP:IN: (S) Sending msg 19654175 on secure session with LSID: 37580 - [1689674623.673795][17320:17322] CHIP:EM: Flushed pending ack for MessageCounter:176515710 on exchange 42152i - disabled: true - - - label: "Step 12: TH sends Start command to the DUT" - PICS: OPSTATE.S.C02.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate start 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674637.555734][17326:17328] CHIP:DMG: - [1689674637.555742][17326:17328] CHIP:DMG: InteractionModelRevision = 1 - [1689674637.555751][17326:17328] CHIP:DMG: }, - [1689674637.555784][17326:17328] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674637.555805][17326:17328] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674637.555853][17326:17328] CHIP:TOO: OperationalCommandResponse: { - [1689674637.555862][17326:17328] CHIP:TOO: commandResponseState: { - [1689674637.555872][17326:17328] CHIP:TOO: ErrorStateID: 0 - [1689674637.555883][17326:17328] CHIP:TOO: } - [1689674637.555891][17326:17328] CHIP:TOO: } - [1689674637.555913][17326:17328] CHIP:DMG: ICR moving to [AwaitingDe] - [1689674637.555956][17326:17328] CHIP:EM: <<< [E:28742i S:49023 M:139320570 (Ack:91983883)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674637.555971][17326:17328] CHIP:IN: (S) Sending msg 139320570 on secure session with LSID: 49023 - [1689674637.556001][17326:17328] CHIP:EM: Flushed pending ack for MessageCounter:91983883 on exchange 28742i - disabled: true - - - label: "Step 13: TH sends Stop command to the DUT" - PICS: OPSTATE.S.C01.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate stop 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674653.322963][17330:17332] CHIP:DMG: }, - [1689674653.322994][17330:17332] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674653.323014][17330:17332] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674653.323058][17330:17332] CHIP:TOO: OperationalCommandResponse: { - [1689674653.323066][17330:17332] CHIP:TOO: commandResponseState: { - [1689674653.323076][17330:17332] CHIP:TOO: ErrorStateID: 0 - [1689674653.323085][17330:17332] CHIP:TOO: } - [1689674653.323094][17330:17332] CHIP:TOO: } - [1689674653.323113][17330:17332] CHIP:DMG: ICR moving to [AwaitingDe] - [1689674653.323154][17330:17332] CHIP:EM: <<< [E:62878i S:64455 M:173921517 (Ack:216732582)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674653.323168][17330:17332] CHIP:IN: (S) Sending msg 173921517 on secure session with LSID: 64455 - [1689674653.323195][17330:17332] CHIP:EM: Flushed pending ack for MessageCounter:216732582 on exchange 62878i - [1689674653.323284][17330:17330] CHIP:CTL: Shutting down the commissioner - disabled: true - - - label: "Step 14: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x00 (Stopped) - - [1689674675.459656][17333:17335] CHIP:DMG: } - [1689674675.459738][17333:17335] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689674675.459772][17333:17335] CHIP:TOO: OperationalState: { - [1689674675.459790][17333:17335] CHIP:TOO: OperationalStateID: 0 - [1689674675.459799][17333:17335] CHIP:TOO: } - [1689674675.459869][17333:17335] CHIP:EM: <<< [E:17771i S:16165 M:1572532 (Ack:102448631)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674675.459886][17333:17335] CHIP:IN: (S) Sending msg 1572532 on secure session with LSID: 16165 - [1689674675.459930][17333:17335] CHIP:EM: Flushed pending ack for MessageCounter:102448631 on exchange 17771i - disabled: true - - - label: "Step 15: TH sends Stop command to the DUT" - PICS: OPSTATE.S.C01.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate stop 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674689.588712][17337:17339] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674689.588722][17337:17339] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674689.588745][17337:17339] CHIP:TOO: OperationalCommandResponse: { - [1689674689.588749][17337:17339] CHIP:TOO: commandResponseState: { - [1689674689.588757][17337:17339] CHIP:TOO: ErrorStateID: 0 - [1689674689.588762][17337:17339] CHIP:TOO: } - [1689674689.588765][17337:17339] CHIP:TOO: } - [1689674689.588775][17337:17339] CHIP:DMG: ICR moving to [AwaitingDe] - [1689674689.588802][17337:17339] CHIP:EM: <<< [E:63921i S:35027 M:16881995 (Ack:220265764)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674689.588810][17337:17339] CHIP:IN: (S) Sending msg 16881995 on secure session with LSID: 35027 - disabled: true - - - label: - "Step 16: Manually put the DUT into a state wherein it cannot receive - a Start Command" - PICS: OPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME - verification: | - Manually put the DUT into a state wherein it cannot receive a Start Command - disabled: true - - - label: "Step 17: TH sends Start command to the DUT" - PICS: - OPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME && OPSTATE.S.C02.Rsp && - OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate start 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x01 (UnableToStartOrResume) - - [1689674700.385183][17340:17342] CHIP:DMG: }, - [1689674700.385214][17340:17342] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674700.385233][17340:17342] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674700.385266][17340:17342] CHIP:TOO: OperationalCommandResponse: { - [1689674700.385274][17340:17342] CHIP:TOO: commandResponseState: { - [1689674700.385281][17340:17342] CHIP:TOO: ErrorStateID: 1 - [1689674700.385289][17340:17342] CHIP:TOO: } - [1689674700.385295][17340:17342] CHIP:TOO: } - [1689674700.385311][17340:17342] CHIP:DMG: ICR moving to [AwaitingDe] - [1689674700.385361][17340:17342] CHIP:EM: <<< [E:55029i S:46795 M:80501191 (Ack:176711722)] (S) Msg TX to 1:0000000000000001 [BFDE] --- Type 0000:10 (SecureChannel:StandaloneAck) - [1689674700.385375][17340:17342] CHIP:IN: (S) Sending msg 80501191 on secure session with LSID: 46795 - [1689674700.385419][17340:17342] CHIP:EM: Flushed pending ack for MessageCounter:176711722 on exchange 55029i - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_OPSTATE_2_4.yaml b/src/app/tests/suites/certification/Test_TC_OPSTATE_2_4.yaml deleted file mode 100644 index f8d07da34446a9..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OPSTATE_2_4.yaml +++ /dev/null @@ -1,94 +0,0 @@ -# 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: 202.2.4. [TC-OPSTATE-2.4] Mandatory Events with DUT as Server - -PICS: - - OPSTATE.S - -config: - nodeId: 0x12344321 - cluster: "Operational State" - endpoint: 1 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: Set up a subscription to the OperationalError event" - PICS: OPSTATE.S.E00 - command: "subscribeEvent" - event: "OperationalError" - minInterval: 10 - maxInterval: 5000 - - - label: - "Step 3: At the DUT take the vendor defined action to generate an - OperationalError event" - PICS: OPSTATE.S.E00 && PICS_SKIP_SAMPLE_APP - verification: | - After the subscription interval via the TH (chip-tool) verify: - - reception of an OperationalError Event - - ErrorStateID is a defined error - - If the ErrorStateID is manufacturer specific, inclusion of an ErrorStateLabel, not present otherwise - - Optionally an ErrorStateDetails - - NOTE : There's a PIXIT value controlling the ability to execute that ({PIXIT_ERROREVENTGEN}), which as the test case notes, requires vendor specific actions to generated the error at the DUT. This is dependent on the vendor app supporting this. The SDK as it stands won't provide the error, this may be testable by some of the vendors depending on their implementations. - - - [1692859386.707176][6658:6660] CHIP:EM: Rxd Ack; Removing MessageCounter:212756536 from Retrans Table on exchange 36888i - [1692859386.707295][6658:6660] CHIP:DMG: ReportDataMessage = - [1692859386.707360][6658:6660] CHIP:DMG: { - [1692859386.707416][6658:6660] CHIP:DMG: SubscriptionId = 0x97bb846c, - [1692859386.707477][6658:6660] CHIP:DMG: InteractionModelRevision = 10 - [1692859386.707533][6658:6660] CHIP:DMG: } - [1692859386.707621][6658:6660] CHIP:DMG: MoveToState ReadClient[0xffff80011a90]: Moving to [AwaitingSu] - [1692859386.707815][6658:6660] CHIP:EM: <<< [E:36888i S:54523 M:212756537 (Ack:12760634)] (S) Msg TX to 1:0000000000000001 [853D] --- Type 0001:01 (IM:StatusResponse) - [1692859386.707901][6658:6660] CHIP:IN: (S) Sending msg 212756537 on secure session with LSID: 54523 - [1692859386.708167][6658:6660] CHIP:DL: HandlePlatformSpecificBLEEvent 32793 - [1692859386.708237][6658:6660] CHIP:DL: HandlePlatformSpecificBLEEvent 32793 - [1692859386.749217][6658:6660] CHIP:EM: >>> [E:36888i S:54523 M:12760635 (Ack:212756537)] (S) Msg RX from 1:0000000000000001 [853D] --- Type 0001:04 (IM:SubscribeResponse) - [1692859386.749285][6658:6660] CHIP:EM: Found matching exchange: 36888i, Delegate: 0xffff80011aa0 - [1692859386.749350][6658:6660] CHIP:EM: Rxd Ack; Removing MessageCounter:212756537 from Retrans Table on exchange 36888i - [1692859386.749417][6658:6660] CHIP:DMG: SubscribeResponse is received - [1692859386.749489][6658:6660] CHIP:DMG: SubscribeResponseMessage = - [1692859386.749538][6658:6660] CHIP:DMG: { - [1692859386.749584][6658:6660] CHIP:DMG: SubscriptionId = 0x97bb846c, - [1692859386.749637][6658:6660] CHIP:DMG: MaxInterval = 0x6, - [1692859386.749687][6658:6660] CHIP:DMG: InteractionModelRevision = 10 - [1692859386.749734][6658:6660] CHIP:DMG: } - [1692859386.749787][6658:6660] CHIP:DMG: Subscription established with SubscriptionID = 0x97bb846c MinInterval = 5s MaxInterval = 6s Peer = 01:0000000000000001 - [1692859386.749843][6658:6660] CHIP:DMG: MoveToState ReadClient[0xffff80011a90]: Moving to [Subscripti] - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 4: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 && PICS_SKIP_SAMPLE_APP - command: "readAttribute" - attribute: "OperationalState" - response: - value: 0x03 - constraints: - type: enum8 diff --git a/src/app/tests/suites/certification/Test_TC_OPSTATE_2_5.yaml b/src/app/tests/suites/certification/Test_TC_OPSTATE_2_5.yaml deleted file mode 100644 index 6dcc447fbf3dd1..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_OPSTATE_2_5.yaml +++ /dev/null @@ -1,353 +0,0 @@ -# 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 204.2.5. [TC-OPSTATE-2.5] Optional Events with DUT as Server - -PICS: - - OPSTATE.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Note" - verification: | - This test case can be continuted only when countdown-time read in step 5 is not null - disabled: true - - - label: "Step 1: Commission DUT to TH" - verification: | - - disabled: true - - - label: "Step 2: Set up a subscription to the OperationCompletion event" - PICS: OPSTATE.S.E01 - verification: | - ./chip-tool interactive start - - operationalstate read-event operation-completion 1 1 - - [1702376916.193452][4893:4896] CHIP:DMG: ReportDataMessage = - [1702376916.193461][4893:4896] CHIP:DMG: { - [1702376916.193469][4893:4896] CHIP:DMG: SubscriptionId = 0x85d7a607, - [1702376916.193497][4893:4896] CHIP:DMG: InteractionModelRevision = 11 - [1702376916.193504][4893:4896] CHIP:DMG: } - disabled: true - - - label: "Step 3: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response includes an ID (enum8) amd a label (string) - - the provided ID is found in the set provided in step 4 - - the provided ID is in the allowed range - - [1689673213.434610][16591:16593] CHIP:DMG: } - [1689673213.434686][16591:16593] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689673213.434721][16591:16593] CHIP:TOO: OperationalState: { - [1689673213.434728][16591:16593] CHIP:TOO: OperationalStateID: 0 - [1689673213.434735][16591:16593] CHIP:TOO: } - disabled: true - - - label: - "Step 4: Manually put the DUT into a state wherein it can receive a - Start Command" - verification: | - - disabled: true - - - label: "Step 5: TH reads from the DUT the CountdownTime attribute" - PICS: OPSTATE.S.A0002 - verification: | - ./chip-tool operationalstate read countdown-time 1 1 - - Via the TH (chip-tool), verify: - - that CountdownTime attribute contains either null our a uint32 value - - if non-null, verify that the value is in the range 1 to 259200 - - store the value in 'initialcountdown-time' - - [1690457637.895405][18808:18810] CHIP:DMG: } - [1690457637.895474][18808:18810] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0002 DataVersion: 4112784416 - [1690457637.895503][18808:18810] CHIP:TOO: CountdownTime: null - disabled: true - - - label: "Step 6: TH sends Start command to the DUT" - PICS: OPSTATE.S.C02.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate start 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674637.555734][17326:17328] CHIP:DMG: - [1689674637.555742][17326:17328] CHIP:DMG: InteractionModelRevision = 1 - [1689674637.555751][17326:17328] CHIP:DMG: }, - [1689674637.555784][17326:17328] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674637.555805][17326:17328] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674637.555853][17326:17328] CHIP:TOO: OperationalCommandResponse: { - [1689674637.555862][17326:17328] CHIP:TOO: commandResponseState: { - [1689674637.555872][17326:17328] CHIP:TOO: ErrorStateID: 0 - [1689674637.555883][17326:17328] CHIP:TOO: } - disabled: true - - - label: "Step 7: TH waits for {PIXIT.WAITTIME}" - verification: | - - disabled: true - - - label: "Step 8: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x01 (Running) - - [1689674196.878722][17249:17251] CHIP:DMG: InteractionModelRevision = 1 - [1689674196.878727][17249:17251] CHIP:DMG: } - [1689674196.878800][17249:17251] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689674196.878834][17249:17251] CHIP:TOO: OperationalState: { - [1689674196.878841][17249:17251] CHIP:TOO: OperationalStateID: 1 - [1689674196.878847][17249:17251] CHIP:TOO: } - disabled: true - - - label: "Step 9: TH waits for initial-countdown-time" - verification: | - As the initial-countdown-time in null this test cannot be executed further in case of RPI platform. - Note: The below log are for instructional purpose. In real scenarios, the actual log may vary depending on the feature implementation in the Reference App. - disabled: true - - - label: "Step 10: TH sends Stop command to the DUT" - PICS: OPSTATE.S.C01.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate stop 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674653.322963][17330:17332] CHIP:DMG: }, - [1689674653.322994][17330:17332] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674653.323014][17330:17332] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674653.323058][17330:17332] CHIP:TOO: OperationalCommandResponse: { - [1689674653.323066][17330:17332] CHIP:TOO: commandResponseState: { - [1689674653.323076][17330:17332] CHIP:TOO: ErrorStateID: 0 - [1689674653.323085][17330:17332] CHIP:TOO: } - [1689674653.323094][17330:17332] CHIP:TOO: } - disabled: true - - - label: - "Step 11: erify TH receives an OperationCompletion event from the DUT - with the following fields populated as follows: 1)CompletionErrorCode - set to NoError(0x00) 2)TotalOperationalTime is approximately - initial-countdown-time or null 3)PausedTime is zero" - PICS: OPSTATE.S.E01 - verification: | - operationalstate read-event operation-completion 1 1 - - [1657193007.841358][5422:5427] CHIP:TOO: Endpoint: 0 Endpoint: 1 Cluster: 0x0000_0060 Event 0x0000_0001 - [1657193007.841387][5422:5427] CHIP:TOO: Event number: 1 - [1657193007.841409][5422:5427] CHIP:TOO: Priority: INFO - [1657193007.841431][5422:5427] CHIP:TOO: Timestamp: 132146 - [1657193007.841531][5422:5427] CHIP:TOO: OperationCompletion: { - [1657193007.841570][5422:5427] CHIP:TOO: CompletionErrorCode: 0x00 - TotalOperationalTime: null - PausedTime: 0 - [1657193007.841594][5422:5427] CHIP:TOO: } - disabled: true - - - label: "Step 12: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x00 (Stopped) - - [1689674675.459656][17333:17335] CHIP:DMG: } - [1689674675.459738][17333:17335] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689674675.459772][17333:17335] CHIP:TOO: OperationalState: { - [1689674675.459790][17333:17335] CHIP:TOO: OperationalStateID: 0 - [1689674675.459799][17333:17335] CHIP:TOO: } - disabled: true - - - label: "Step 13: Restart DUT and repeat step 5" - verification: | - - disabled: true - - - label: "Step 14: TH sends Start command to the DUT" - PICS: OPSTATE.S.C02.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate start 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674637.555734][17326:17328] CHIP:DMG: - [1689674637.555742][17326:17328] CHIP:DMG: InteractionModelRevision = 1 - [1689674637.555751][17326:17328] CHIP:DMG: }, - [1689674637.555784][17326:17328] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674637.555805][17326:17328] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674637.555853][17326:17328] CHIP:TOO: OperationalCommandResponse: { - [1689674637.555862][17326:17328] CHIP:TOO: commandResponseState: { - [1689674637.555872][17326:17328] CHIP:TOO: ErrorStateID: 0 - [1689674637.555883][17326:17328] CHIP:TOO: } - [1689674637.555891][17326:17328] CHIP:TOO: } - disabled: true - - - label: "Step 15: TH waits for {PIXIT.WAITTIME}" - verification: | - - disabled: true - - - label: "Step 16: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x01 (Running) - - [1689674196.878722][17249:17251] CHIP:DMG: InteractionModelRevision = 1 - [1689674196.878727][17249:17251] CHIP:DMG: } - [1689674196.878800][17249:17251] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689674196.878834][17249:17251] CHIP:TOO: OperationalState: { - [1689674196.878841][17249:17251] CHIP:TOO: OperationalStateID: 1 - [1689674196.878847][17249:17251] CHIP:TOO: } - disabled: true - - - label: "Step 17: TH sends Pause command to the DUT" - PICS: OPSTATE.S.C00.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate pause 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1690457565.893634][18795:18797] CHIP:DMG: }, - [1690457565.893663][18795:18797] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1690457565.893681][18795:18797] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1690457565.893714][18795:18797] CHIP:TOO: OperationalCommandResponse: { - [1690457565.893729][18795:18797] CHIP:TOO: commandResponseState: { - [1690457565.893736][18795:18797] CHIP:TOO: ErrorStateID: 0 - [1690457565.893744][18795:18797] CHIP:TOO: } - [1690457565.893750][18795:18797] CHIP:TOO: } - disabled: true - - - label: "Step 18: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x02 (Paused) - - [1690457601.103082][18800:18802] CHIP:DMG: InteractionModelRevision = 1 - [1690457601.103090][18800:18802] CHIP:DMG: } - [1690457601.103210][18800:18802] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 4112784416 - [1690457601.103259][18800:18802] CHIP:TOO: OperationalState: 2 - disabled: true - - - label: "Step 19: TH waits for half of initial-countdown-time" - verification: | - - disabled: true - - - label: "Step 20: TH sends Resume command to the DUT" - PICS: OPSTATE.S.C03.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate resume 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x03 (CommandInvalidInState) - - [1690457852.049135][18877:18879] CHIP:DMG: }, - [1690457852.049164][18877:18879] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1690457852.049183][18877:18879] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1690457852.049217][18877:18879] CHIP:TOO: OperationalCommandResponse: { - [1690457852.049224][18877:18879] CHIP:TOO: commandResponseState: { - [1690457852.049238][18877:18879] CHIP:TOO: ErrorStateID: 3 - [1690457852.049246][18877:18879] CHIP:TOO: } - [1690457852.049252][18877:18879] CHIP:TOO: } - disabled: true - - - label: "Step 21: TH reads from the DUT the OperationalState attribute" - PICS: OPSTATE.S.A0004 - verification: | - ./chip-tool operationalstate read operational-state 1 1 - - Via the TH (chip-tool), verify: - - the response has an OperationalStateID field that is set to 0x01 (Running) - - [1689674196.878722][17249:17251] CHIP:DMG: InteractionModelRevision = 1 - [1689674196.878727][17249:17251] CHIP:DMG: } - [1689674196.878800][17249:17251] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Attribute 0x0000_0004 DataVersion: 2102885775 - [1689674196.878834][17249:17251] CHIP:TOO: OperationalState: { - [1689674196.878841][17249:17251] CHIP:TOO: OperationalStateID: 1 - [1689674196.878847][17249:17251] CHIP:TOO: } - disabled: true - - - label: "Step 22: TH waits for initial-countdown-time" - verification: | - TH waits for initial-countdown-time - disabled: true - - - label: "Step 23: TH sends Stop command to the DUT" - PICS: OPSTATE.S.C01.Rsp && OPSTATE.S.C04.Tx - verification: | - ./chip-tool operationalstate stop 1 1 - - Via the TH (chip-tool), verify: - - the response is an instance of OperationalCommandResponse - - The ErrorStateID field is set to 0x00 (NoError) - - [1689674653.322963][17330:17332] CHIP:DMG: }, - [1689674653.322994][17330:17332] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0060 Command=0x0000_0004 - [1689674653.323014][17330:17332] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0060 Command 0x0000_0004 - [1689674653.323058][17330:17332] CHIP:TOO: OperationalCommandResponse: { - [1689674653.323066][17330:17332] CHIP:TOO: commandResponseState: { - [1689674653.323076][17330:17332] CHIP:TOO: ErrorStateID: 0 - [1689674653.323085][17330:17332] CHIP:TOO: } - [1689674653.323094][17330:17332] CHIP:TOO: } - disabled: true - - - label: - "Step 24: Verify TH receives an OperationCompletion event with the - following fields populated as follows: 1. CompletionErrorCode set to - NoError(0x00) 2. TotalOperationalTime is approximately 1.5 times the - initial-countdown-time or null 3. PausedTime is 0.5 times the - initial-countdown-time" - PICS: OPSTATE.S.E01 - verification: | - operationalstate read-event operation-completion 1 1 - - [1657193007.841358][5422:5427] CHIP:TOO: Endpoint: 0 Endpoint: 1 Cluster: 0x0000_0060 Event 0x0000_0001 - [1657193007.841387][5422:5427] CHIP:TOO: Event number: 1 - [1657193007.841409][5422:5427] CHIP:TOO: Priority: INFO - [1657193007.841431][5422:5427] CHIP:TOO: Timestamp: 155146 - [1657193007.841531][5422:5427] CHIP:TOO: OperationCompletion: { - [1657193007.841570][5422:5427] CHIP:TOO: CompletionErrorCode: 0x00 - TotalOperationalTime: null - } - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_PS_3_1.yaml b/src/app/tests/suites/certification/Test_TC_PS_3_1.yaml deleted file mode 100644 index d64c29714436f8..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_PS_3_1.yaml +++ /dev/null @@ -1,85 +0,0 @@ -# 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 63.2.3. [TC-PS-3.1] Endpoint composition and EndpointList - -PICS: - - PS.S - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: - "Step 1: TH performs a wildcard read of all attributes and endpoints" - verification: | - TH(chip-tool) sends the wildcard read command to read all attributes and endpoints from DUT(Reference app/all-clusters-app) - ./chip-tool any read-by-id 0xFFFFFFFF 0xFFFFFFFF 1 0xFFFF - disabled: true - - - label: - "Step 2: For each power source cluster with a non-empty EndpointsList - attribute, verify that the endpoint exists on the device; also verify - that the EndpointsList attribute includes the endpoint on which the - cluster is located" - verification: | - TH(chip-tool) sends the wildcard read command to read all attributes and endpoints from DUT(Reference app/all-clusters-app) - - ./chip-tool any read-by-id 0xFFFFFFFF 0xFFFFFFFF 1 0xFFFF - - [1690195509.133521][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_000F DataVersion: 2929707991 - [1690195509.133523][44004:44006] CHIP:TOO: BatReplacementNeeded: FALSE - [1690195509.133531][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_0010 DataVersion: 2929707991 - [1690195509.133534][44004:44006] CHIP:TOO: BatReplaceability: 0 - [1690195509.133549][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_001F DataVersion: 2929707991 - [1690195509.133556][44004:44006] CHIP:TOO: EndpointList: 0 entries - [1690195509.133558][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_FFFC DataVersion: 2929707991 - [1690195509.133560][44004:44006] CHIP:TOO: FeatureMap: 2 - - [1690195509.203569][44004:44006] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_002F Attribute 0x0000_0010 DataVersion: 1378119001 - [1690195509.203572][44004:44006] CHIP:TOO: BatReplaceability: 0 - [1690195509.203587][44004:44006] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_002F Attribute 0x0000_001F DataVersion: 1378119001 - [1690195509.203592][44004:44006] CHIP:TOO: EndpointList: 0 entries - [1690195509.203595][44004:44006] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_002F Attribute 0x0000_FFFC DataVersion: 1378119001 - [1690195509.203597][44004:44006] CHIP:TOO: FeatureMap: 2 - - - [1690195509.133531][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_0010 DataVersion: 2929707991 - [1690195509.133534][44004:44006] CHIP:TOO: BatReplaceability: 0 - [1690195509.133549][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_001F DataVersion: 2929707991 - [1690195509.133556][44004:44006] CHIP:TOO: EndpointList: 0 entries - [1690195509.133558][44004:44006] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_002F Attribute 0x0000_FFFC DataVersion: 2929707991 - [1690195509.133560][44004:44006] CHIP:TOO: FeatureMap: 2 - disabled: true - - - label: - "Step 3: For each power source cluster on an endpoint with the Bridged - Node device type, ensure the EndpointList in the Power Source cluster - includes all the endpoints listed in the PartsList of the Descriptor - cluster as well as its own endpoint id." - verification: | - - disabled: true - - - label: - "Step 4: For each power source cluster on an endpoint that is a child - endpoint of an endpoint with a Bridged Node device type, ensure the - EndpointList in the Power Source cluster contains a list with one - entry that lists its own endpoint id" - verification: | - - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_SC_3_3.yaml b/src/app/tests/suites/certification/Test_TC_SC_3_3.yaml index f6b17380499be0..048b5241da7a20 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_3_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_3_3.yaml @@ -99,8 +99,8 @@ tests: responderSessionID is of uint16 sigma2ResumeMIC is of Octet String maximum of length 16 bytes responderSEDParams is from any one of the following: - SLEEPY_IDLE_INTERVAL - Verify that it is of uint32 - SLEEPY_ACTIVE_INTERVAL - Verify that it is of uint32 + SESSION_IDLE_INTERVAL - Verify that it is of uint32 + SESSION_ACTIVE_INTERVAL - Verify that it is of uint32 [1683973658.044236][21637:21637] CHIP:EM: Rxd Ack; Removing MessageCounter:113416101 from Retrans Table on exchange 32995r diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml index 298b831b262f41..987bc6279093a8 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml @@ -42,7 +42,7 @@ tests: verification: | avahi-browse -rt _matter._tcp On the TH(Chip-tool) Log: Verify the DUT is advertising for: - -SII key is higher than the SLEEPY_IDLE_INTERVAL default value (> 300 milliseconds) + - SII key is higher than the SESSION_IDLE_INTERVAL default value (> 500 milliseconds) - SII key and SAI key is less than 3600000 (1hour in milliseconds) + eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local diff --git a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml index 36314424458714..c8a8c359e1cdc8 100644 --- a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml @@ -62,7 +62,7 @@ tests: hasMasksSet: [0x1] - label: - "Step 4: TH reads AttributeList mandatory attributes(global attribute + "Step 4a: TH reads AttributeList mandatory attributes(global attribute 65531)" PICS: S.S command: "readAttribute" @@ -70,7 +70,18 @@ tests: response: constraints: type: list - contains: [0, 1, 2, 65528, 65529, 65531, 65532, 65533] + contains: [1, 2, 65528, 65529, 65531, 65532, 65533] + + - label: + "Step 4b: TH reads the LastConfiguredBy optional attribute from the + AttributeList (global attribute 65531)" + PICS: S.S.A0000 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0] - label: "Step 5: TH reads from the DUT the EventList attribute" PICS: PICS_EVENT_LIST_ENABLED diff --git a/src/app/tests/suites/certification/Test_TC_S_2_1.yaml b/src/app/tests/suites/certification/Test_TC_S_2_1.yaml index ed8e61f47f6d09..152539147ca37a 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_1.yaml @@ -17,8 +17,6 @@ name: 123.2.1. [TC-S-2.1] Attributes with DUT as Server PICS: - S.S - - S.S.AM - - S.S.AO config: nodeId: 0x12344321 diff --git a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml index d569b12d512a8a..b27d4bfd333cee 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml @@ -344,7 +344,6 @@ tests: type: int16u - label: "Step 3d: TH reads attribute FabricSceneInfo from DUT" - PICS: PICS_SDK_CI_ONLY command: "readAttribute" attribute: "FabricSceneInfo" response: @@ -753,7 +752,7 @@ tests: set to G1, the SceneID field set to 0x01, the TransitionTime field set to 70 000 000 (70 000s) and no extension field sets. This should fail and return a status of 0x85 (INVALID_COMMAND)." - PICS: S.S.C00.Rsp && PICS_SDK_CI_ONLY + PICS: S.S.C00.Rsp command: "AddScene" arguments: values: @@ -781,7 +780,7 @@ tests: set to G1, the SceneID field set to 0x01, the TransitionTime field set to 60 000 001 (60 000.001s) and no extension field sets. This should fail and return a status of 0x85 (INVALID_COMMAND)." - PICS: S.S.C00.Rsp && PICS_SDK_CI_ONLY + PICS: S.S.C00.Rsp command: "AddScene" arguments: values: diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index 21549a843b29ac..eeeabe22dc4f4c 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -309,48 +309,19 @@ tests: to G1, the SceneID field set to 0x01, the TransitionTime field set to 1000 (1s) and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenes add-scene GroupID SceneID TransitionTime "SceneName" '[{"clusterId": value, "attributeValueList":[{"attributeId": value, "attributeValue": value}]}' nodeId endpointId + ./chip-tool scenesmanagement add-scene GroupID SceneID TransitionTime "SceneName" '[{"clusterId": value, "attributeValueList":[{"attributeId": value, "attributeValue": value}]}' nodeId endpointId Note: The number of ExtensionFieldSets, the value of clusterId of each ExtensionFieldSet, the number of attributes in attributeValueList and their values varies for each application Verify the "status is success" on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - [1670970505.887060][5742:5744] CHIP:DMG: InvokeResponseMessage = - [1670970505.887118][5742:5744] CHIP:DMG: { - [1670970505.887172][5742:5744] CHIP:DMG: suppressResponse = false, - [1670970505.887231][5742:5744] CHIP:DMG: InvokeResponseIBs = - [1670970505.887307][5742:5744] CHIP:DMG: [ - [1670970505.887366][5742:5744] CHIP:DMG: InvokeResponseIB = - [1670970505.887444][5742:5744] CHIP:DMG: { - [1670970505.887507][5742:5744] CHIP:DMG: CommandDataIB = - [1670970505.887576][5742:5744] CHIP:DMG: { - [1670970505.887713][5742:5744] CHIP:DMG: CommandPathIB = - [1670970505.887804][5742:5744] CHIP:DMG: { - [1670970505.887940][5742:5744] CHIP:DMG: EndpointId = 0x1, - [1670970505.888093][5742:5744] CHIP:DMG: ClusterId = 0x5, - [1670970505.888242][5742:5744] CHIP:DMG: CommandId = 0x0, - [1670970505.888385][5742:5744] CHIP:DMG: }, - [1670970505.888692][5742:5744] CHIP:DMG: - [1670970505.888769][5742:5744] CHIP:DMG: CommandFields = - [1670970505.888852][5742:5744] CHIP:DMG: { - [1670970505.889030][5742:5744] CHIP:DMG: 0x0 = 0, - [1670970505.889183][5742:5744] CHIP:DMG: 0x1 = 1, - [1670970505.889406][5742:5744] CHIP:DMG: 0x2 = 1, - [1670970505.889515][5742:5744] CHIP:DMG: }, - [1670970505.889603][5742:5744] CHIP:DMG: }, - [1670970505.889684][5742:5744] CHIP:DMG: - [1670970505.889745][5742:5744] CHIP:DMG: }, - [1670970505.889821][5742:5744] CHIP:DMG: - [1670970505.889878][5742:5744] CHIP:DMG: ], - [1670970505.889953][5742:5744] CHIP:DMG: - [1670970505.890009][5742:5744] CHIP:DMG: InteractionModelRevision = 1 - [1670970505.890066][5742:5744] CHIP:DMG: }, - [1670970505.890212][5742:5744] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0005 Command=0x0000_0000 - [1670970505.890328][5742:5744] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - [1670970505.890458][5742:5744] CHIP:TOO: AddSceneResponse: { - [1670970505.890551][5742:5744] CHIP:TOO: status: 0 - [1670970505.890608][5742:5744] CHIP:TOO: groupId: 257 - [1670970505.890717][5742:5744] CHIP:TOO: sceneId: 1 - [1670970505.890774][5742:5744] CHIP:TOO: } + [1705680175.863785][5823:5825] CHIP:DMG: }, + [1705680175.863851][5823:5825] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1705680175.863880][5823:5825] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1705680175.863931][5823:5825] CHIP:TOO: AddSceneResponse: { + [1705680175.863956][5823:5825] CHIP:TOO: status: 0 + [1705680175.863967][5823:5825] CHIP:TOO: groupID: 257 + [1705680175.863977][5823:5825] CHIP:TOO: sceneID: 1 + [1705680175.863986][5823:5825] CHIP:TOO: } cluster: "LogCommands" command: "UserPrompt" PICS: S.S.C00.Rsp && PICS_SKIP_SAMPLE_APP @@ -405,15 +376,50 @@ tests: set to G1 and the SceneID field set to 0x01." PICS: S.S.C01.Rsp && PICS_SKIP_SAMPLE_APP verification: | - ./chip-tool scenes view-scene GroupId SceneId Node-Id EndpointId + ./chip-tool scenesmanagement view-scene GroupId SceneId Node-Id EndpointId Note: The number of ExtensionFieldSets, the value of clusterId of each ExtensionFieldSet, the number of attributes in attributeValueList and their values varies for each application - Verify that the extension fields in the log match the ones expected and that - Status = 0x00 - GroupID = G1 - SceneID = 0x01 - TransitionTime = 0x0001 + Verify that the extension fields in the log match the ones expected in the following log: + [1705680224.968551][5827:5829] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0001 + [1705680224.968559][5827:5829] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0001 + CHIP:TOO: ViewSceneResponse: { + CHIP:TOO: status: 0 + CHIP:TOO: groupID: 1 + CHIP:TOO: sceneID: 1 + CHIP:TOO: transitionTime: 1000 + CHIP:TOO: sceneName: + CHIP:TOO: extensionFieldSets: 3 entries + CHIP:TOO: [1]: { + CHIP:TOO: ClusterID: XX + CHIP:TOO: AttributeValueList: X entries + CHIP:TOO: [1]: { + CHIP:TOO: AttributeID: XX + CHIP:TOO: AttributeValue:XX + CHIP:TOO: } + CHIP:TOO: } + CHIP:TOO: [2]: { + CHIP:TOO: ClusterID: XX + CHIP:TOO: AttributeValueList: X entries + CHIP:TOO: [1]: { + CHIP:TOO: AttributeID: XX + CHIP:TOO: AttributeValue: XX + CHIP:TOO: } + CHIP:TOO: } + CHIP:TOO: [3]: { + CHIP:TOO: ClusterID: XX + CHIP:TOO: AttributeValueList: XX entries + CHIP:TOO: [X]: { + CHIP:TOO: AttributeID: XX + CHIP:TOO: AttributeValue: XX + CHIP:TOO: } + ... + CHIP:TOO: [X]: { + CHIP:TOO: AttributeID: XX + CHIP:TOO: AttributeValue: XX + CHIP:TOO: } + CHIP:TOO: } + CHIP:TOO: } cluster: "LogCommands" command: "UserPrompt" arguments: @@ -449,7 +455,7 @@ tests: - label: "Step 5a: TH configures AC2 on DUT for all implemented application - clusters supporting scenes." + clusters supporting scenesmanagement." cluster: "Level Control" PICS: PICS_SDK_CI_ONLY command: "MoveToLevelWithOnOff" @@ -466,7 +472,7 @@ tests: - label: "Step 5a: TH configures AC2 on DUT for all implemented application - clusters supporting scenes." + clusters supporting scenesmanagement." verification: | Is DUT configured with AC2? cluster: "LogCommands" @@ -563,41 +569,8 @@ tests: field set to G1, the SceneID field set to 0x03, the TransitionTime field set to G1 and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenes add-scene GroupID SceneID TransitionTime "SceneName" '[{"clusterId": value, "attributeValueList":[{"attributeId": value, "attributeValue": value}]}' groupID endpointId - - Note: The number of ExtensionFieldSets, the value of clusterId of each ExtensionFieldSet, the number of attributes in attributeValueList and their values varies for each application - - Verify the "status is success" on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - [1670970505.887060][5742:5744] CHIP:DMG: InvokeResponseMessage = - [1670970505.887118][5742:5744] CHIP:DMG: { - [1670970505.887172][5742:5744] CHIP:DMG: suppressResponse = false, - [1670970505.887231][5742:5744] CHIP:DMG: InvokeResponseIBs = - [1670970505.887307][5742:5744] CHIP:DMG: [ - [1670970505.887366][5742:5744] CHIP:DMG: InvokeResponseIB = - [1670970505.887444][5742:5744] CHIP:DMG: { - [1670970505.887507][5742:5744] CHIP:DMG: CommandDataIB = - [1670970505.887576][5742:5744] CHIP:DMG: { - [1670970505.887713][5742:5744] CHIP:DMG: CommandPathIB = - [1670970505.887804][5742:5744] CHIP:DMG: { - [1670970505.887940][5742:5744] CHIP:DMG: EndpointId = 0x1, - [1670970505.888093][5742:5744] CHIP:DMG: ClusterId = 0x5, - [1670970505.888242][5742:5744] CHIP:DMG: CommandId = 0x0, - [1670970505.888385][5742:5744] CHIP:DMG: }, - [1670970505.888692][5742:5744] CHIP:DMG: - [1670970505.888769][5742:5744] CHIP:DMG: CommandFields = - [1670970505.888852][5742:5744] CHIP:DMG: { - [1670970505.889030][5742:5744] CHIP:DMG: 0x0 = 0, - [1670970505.889183][5742:5744] CHIP:DMG: 0x1 = 1, - [1670970505.889406][5742:5744] CHIP:DMG: 0x2 = 1, - [1670970505.889515][5742:5744] CHIP:DMG: }, - [1670970505.889603][5742:5744] CHIP:DMG: }, - [1670970505.889684][5742:5744] CHIP:DMG: - [1670970505.889745][5742:5744] CHIP:DMG: }, - [1670970505.889821][5742:5744] CHIP:DMG: - [1670970505.889878][5742:5744] CHIP:DMG: ], - [1670970505.889953][5742:5744] CHIP:DMG: - [1670970505.890009][5742:5744] CHIP:DMG: InteractionModelRevision = 1 - [1670970505.890066][5742:5744] CHIP:DMG: }, + ./chip-tool scenesmanagement add-scene 0x0101 0x03 1 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4002", "attributeValue": "0x01"}]}]' 0xffffffffffff0101 1 + Note: As this is a multicast command, no log is expected. cluster: "LogCommands" command: "UserPrompt" PICS: S.S.C00.Rsp && PICS_SKIP_SAMPLE_APP @@ -651,15 +624,30 @@ tests: set to G1 and the SceneID field set to 0x03." PICS: S.S.C01.Rsp && PICS_SKIP_SAMPLE_APP verification: | - ./chip-tool scenes view-scene GroupId SceneId Node-Id EndpointId + ./chip-tool scenesmanagement view-scene GroupId SceneId Node-Id EndpointId Note: The number of ExtensionFieldSets, the value of clusterId of each ExtensionFieldSet, the number of attributes in attributeValueList and their values varies for each application - Verify that the extension fields in the log match the ones expected and that - Status = 0x00 - GroupID = G1 - SceneID = 0x03 - TransitionTime = 0x03E8 + Verify that the extension fields in the log match the ones expected and that the log output is similar to the following: + [1707285444.028460][13682:13684] CHIP:DMG: }, + [1707285444.028553][13682:13684] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0001 + [1707285444.028579][13682:13684] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0001 + [1707285444.028670][13682:13684] CHIP:TOO: ViewSceneResponse: { + [1707285444.028685][13682:13684] CHIP:TOO: status: 0 + [1707285444.028696][13682:13684] CHIP:TOO: groupID: 257 + [1707285444.028706][13682:13684] CHIP:TOO: sceneID: 3 + [1707285444.028717][13682:13684] CHIP:TOO: transitionTime: 1 + [1707285444.028728][13682:13684] CHIP:TOO: sceneName: scene name + [1707285444.028766][13682:13684] CHIP:TOO: extensionFieldSets: XX entries + [1707285444.028814][13682:13684] CHIP:TOO: [XX]: { + [1707285444.028828][13682:13684] CHIP:TOO: ClusterID: XX + [1707285444.028853][13682:13684] CHIP:TOO: AttributeValueList: XX entries + [1707285444.028882][13682:13684] CHIP:TOO: [XX]: { + [1707285444.028896][13682:13684] CHIP:TOO: AttributeID: XX + [1707285444.028913][13682:13684] CHIP:TOO: AttributeValue: XX + [1707285444.028925][13682:13684] CHIP:TOO: } + [1707285444.028937][13682:13684] CHIP:TOO: } + [1707285444.028950][13682:13684] CHIP:TOO: } cluster: "LogCommands" command: "UserPrompt" arguments: @@ -676,7 +664,7 @@ tests: - label: "Step 6c: TH sends a ViewScene command to group G1 with the GroupID field set to G1 and the SceneID field set to 0x03." - PICS: S.S.C01.Rsp && PICS_SDK_CI_ONLY + PICS: S.S.C01.Rsp command: "ViewScene" groupId: G1 arguments: @@ -711,7 +699,7 @@ tests: - label: "Step 6e: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x03." - PICS: S.S.C01.Rsp && PICS_SDK_CI_ONLY + PICS: S.S.C01.Rsp command: "ViewScene" arguments: values: diff --git a/src/app/tests/suites/certification/Test_TC_S_2_4.yaml b/src/app/tests/suites/certification/Test_TC_S_2_4.yaml index eac34fdea1fee6..c3ba72dcf05b80 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_4.yaml @@ -296,7 +296,7 @@ tests: - label: "Step 6a: TH configures AC2 on DUT for all implemented application clusters supporting scenes." - PICS: PICS_SDK_CI_ONLY + PICS: S.S.C05.Rsp && PICS_SDK_CI_ONLY cluster: "Level Control" command: "MoveToLevelWithOnOff" arguments: @@ -317,7 +317,7 @@ tests: Is DUT configured with AC2? cluster: "LogCommands" command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP + PICS: S.S.C05.Rsp && PICS_SKIP_SAMPLE_APP arguments: values: - name: "message" diff --git a/src/app/tests/suites/certification/Test_TC_S_2_5.yaml b/src/app/tests/suites/certification/Test_TC_S_2_5.yaml index 31ed8b17a2bcdb..e1624bf79d7e64 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_5.yaml @@ -61,14 +61,51 @@ tests: the GroupKeyMap attribute with one entry as follows: List item 1: FabricIndex: 1 GroupId: 0x0001 GroupKeySetId: 0x01a1" verification: | - ./chip-tool groupkeymanagement write group-key-map '[{"groupId": 1, "groupKeySetID": 1, "fabricIndex": 1}]' 1 0 - - [1688019387.509419][1710:1712] CHIP:DMG: } - [1688019387.509461][1710:1712] CHIP:DMG: - [1688019387.509497][1710:1712] CHIP:DMG: StatusIB = - [1688019387.509534][1710:1712] CHIP:DMG: { - [1688019387.509572][1710:1712] CHIP:DMG: status = 0x00 (SUCCESS), - [1688019387.509610][1710:1712] CHIP:DMG: }, + ./chip-tool groupkeymanagement write group-key-map '[{"groupId": "0x0001", "groupKeySetID": "0x01a1", "fabricIndex": 1} ]' 1 0 + + Verify DUT responds with SUCCESS status response on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: + + [1701076939.782934][16287:16289] CHIP:DMG: WriteResponseMessage = + [1701076939.782939][16287:16289] CHIP:DMG: { + [1701076939.782942][16287:16289] CHIP:DMG: AttributeStatusIBs = + [1701076939.782948][16287:16289] CHIP:DMG: [ + [1701076939.782951][16287:16289] CHIP:DMG: AttributeStatusIB = + [1701076939.782956][16287:16289] CHIP:DMG: { + [1701076939.782960][16287:16289] CHIP:DMG: AttributePathIB = + [1701076939.782965][16287:16289] CHIP:DMG: { + [1701076939.782970][16287:16289] CHIP:DMG: Endpoint = 0x0, + [1701076939.782973][16287:16289] CHIP:DMG: Cluster = 0x3f, + [1701076939.782977][16287:16289] CHIP:DMG: Attribute = 0x0000_0000, + [1701076939.782981][16287:16289] CHIP:DMG: } + [1701076939.782986][16287:16289] CHIP:DMG: + [1701076939.782990][16287:16289] CHIP:DMG: StatusIB = + [1701076939.782993][16287:16289] CHIP:DMG: { + [1701076939.782997][16287:16289] CHIP:DMG: status = 0x00 (SUCCESS), + [1701076939.783000][16287:16289] CHIP:DMG: }, + [1701076939.783004][16287:16289] CHIP:DMG: + [1701076939.783007][16287:16289] CHIP:DMG: }, + [1701076939.783014][16287:16289] CHIP:DMG: + [1701076939.783017][16287:16289] CHIP:DMG: AttributeStatusIB = + [1701076939.783021][16287:16289] CHIP:DMG: { + [1701076939.783024][16287:16289] CHIP:DMG: AttributePathIB = + [1701076939.783027][16287:16289] CHIP:DMG: { + [1701076939.783030][16287:16289] CHIP:DMG: Endpoint = 0x0, + [1701076939.783034][16287:16289] CHIP:DMG: Cluster = 0x3f, + [1701076939.783038][16287:16289] CHIP:DMG: Attribute = 0x0000_0000, + [1701076939.783042][16287:16289] CHIP:DMG: ListIndex = Null, + [1701076939.783045][16287:16289] CHIP:DMG: } + [1701076939.783050][16287:16289] CHIP:DMG: + [1701076939.783053][16287:16289] CHIP:DMG: StatusIB = + [1701076939.783056][16287:16289] CHIP:DMG: { + [1701076939.783060][16287:16289] CHIP:DMG: status = 0x00 (SUCCESS), + [1701076939.783063][16287:16289] CHIP:DMG: }, + [1701076939.783067][16287:16289] CHIP:DMG: + [1701076939.783069][16287:16289] CHIP:DMG: }, + [1701076939.783074][16287:16289] CHIP:DMG: + [1701076939.783077][16287:16289] CHIP:DMG: ], + [1701076939.783084][16287:16289] CHIP:DMG: + [1701076939.783087][16287:16289] CHIP:DMG: InteractionModelRevision = 11 + [1701076939.783090][16287:16289] CHIP:DMG: } disabled: true - label: "Step 1: TH sends a RemoveAllGroups command to DUT." @@ -76,12 +113,12 @@ tests: verification: | ./chip-tool groups remove-all-groups 1 1 - [1688019423.251477][1716:1718] CHIP:DMG: }, + Verify DUT responds with SUCCESS status response on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: [1688019423.251524][1716:1718] CHIP:DMG: - [1688019423.251561][1716:1718] CHIP:DMG: StatusIB = - [1688019423.251602][1716:1718] CHIP:DMG: { - [1688019423.251643][1716:1718] CHIP:DMG: status = 0x00 (SUCCESS), - [1688019423.251686][1716:1718] CHIP:DMG: }, + [1688019423.251561][1716:1718] CHIP:DMG: StatusIB = + [1688019423.251602][1716:1718] CHIP:DMG: { + [1688019423.251643][1716:1718] CHIP:DMG: status = 0x00 (SUCCESS), + [1688019423.251686][1716:1718] CHIP:DMG: }, [1688019423.251727][1716:1718] CHIP:DMG: disabled: true @@ -92,11 +129,16 @@ tests: verification: | ./chip-tool groups add-group 0x0001 grp1 1 1 - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0004 Command 0x0000_0000 - CHIP:TOO: AddGroupResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 1 - CHIP:TOO: } + Verify the AddGroupResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1701259653.925863][10637:10639] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0004 Command=0x0000_0000 + [1701259653.925872][10637:10639] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0004 Command 0x0000_0000 + [1701259653.925891][10637:10639] CHIP:TOO: AddGroupResponse: { + [1701259653.925896][10637:10639] CHIP:TOO: status: 0 + [1701259653.925899][10637:10639] CHIP:TOO: groupID: 1 + [1701259653.925902][10637:10639] CHIP:TOO: } disabled: true - label: @@ -106,32 +148,137 @@ tests: verification: | ./chip-tool scenesmanagement remove-all-scenes 0x0001 1 1 - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0003 - CHIP:TOO: RemoveAllScenesResponse: { - CHIP:TOO: status: 1 - CHIP:TOO: groupID: 1 - CHIP:TOO: } + Verify the RemoveAllScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1706764352.114217][4432:4434] CHIP:DMG: }, + [1706764352.114233][4432:4434] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0003 + [1706764352.114241][4432:4434] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0003 + [1706764352.114257][4432:4434] CHIP:TOO: RemoveAllScenesResponse: { + [1706764352.114264][4432:4434] CHIP:TOO: status: 0 + [1706764352.114267][4432:4434] CHIP:TOO: groupID: 1 + [1706764352.114269][4432:4434] CHIP:TOO: } disabled: true - label: "Step 4a: TH reads from the DUT the SceneTableSize attribute" verification: | ./chip-tool scenesmanagement read scene-table-size 1 1 - [1688019474.695136][1726:1728] CHIP:DMG: } - [1688019474.695335][1726:1728] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Attribute 0x0000_0006 DataVersion: 1550229741 - [1688019474.695397][1726:1728] CHIP:TOO: SceneTableSize: (Default table size: 16) + Verify the "SceneTableSize" attribute value is SceneTableSize(minimum=16) on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + [1706764370.034843][4435:4437] CHIP:DMG: } + [1706764370.034970][4435:4437] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0001 DataVersion: 3964423870 + [1706764370.035000][4435:4437] CHIP:TOO: SceneTableSize: 16 disabled: true - label: "Step 4b: TH sends a subscription request action for FabricSceneInfo to the DUT." verification: | + Please use Interactive mode to Verify the subscription of an event + Here the command to enter interactive mode:-- ./chip-tool interactive start - >>> any subscribe-by-id 0x0062 0x0002 min-interval max-interval node-id endpoint + + Set up the subscription between DUT and TH by sending the command mentioned below, and verify that the subscription is activated successfully + + scenesmanagement subscribe fabric-scene-info 0 200 1 1 + + Verify the DUT sends a report data for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into RemainingCapacity and is equals to (MaxRemainingCapacity) on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + [1706764401.002841][4438:4440] CHIP:DMG: ReportDataMessage = + [1706764401.002862][4438:4440] CHIP:DMG: { + [1706764401.002879][4438:4440] CHIP:DMG: SubscriptionId = 0x679cab48, + [1706764401.002891][4438:4440] CHIP:DMG: AttributeReportIBs = + [1706764401.002916][4438:4440] CHIP:DMG: [ + [1706764401.002926][4438:4440] CHIP:DMG: AttributeReportIB = + [1706764401.002950][4438:4440] CHIP:DMG: { + [1706764401.002960][4438:4440] CHIP:DMG: AttributeDataIB = + [1706764401.002972][4438:4440] CHIP:DMG: { + [1706764401.002985][4438:4440] CHIP:DMG: DataVersion = 0xec4c4ebe, + [1706764401.002996][4438:4440] CHIP:DMG: AttributePathIB = + [1706764401.003008][4438:4440] CHIP:DMG: { + [1706764401.003021][4438:4440] CHIP:DMG: Endpoint = 0x1, + [1706764401.003035][4438:4440] CHIP:DMG: Cluster = 0x62, + [1706764401.003048][4438:4440] CHIP:DMG: Attribute = 0x0000_0002, + [1706764401.003059][4438:4440] CHIP:DMG: } + [1706764401.003076][4438:4440] CHIP:DMG: + [1706764401.003088][4438:4440] CHIP:DMG: Data = [ + [1706764401.003105][4438:4440] CHIP:DMG: + [1706764401.003121][4438:4440] CHIP:DMG: { + [1706764401.003136][4438:4440] CHIP:DMG: 0x0 = 0, + [1706764401.003150][4438:4440] CHIP:DMG: 0x1 = 1, + [1706764401.003162][4438:4440] CHIP:DMG: 0x2 = 1, + [1706764401.003175][4438:4440] CHIP:DMG: 0x3 = false, + [1706764401.003190][4438:4440] CHIP:DMG: 0x4 = 7, + [1706764401.003203][4438:4440] CHIP:DMG: 0xfe = 1, + [1706764401.003216][4438:4440] CHIP:DMG: }, + [1706764401.003229][4438:4440] CHIP:DMG: ], + [1706764401.003239][4438:4440] CHIP:DMG: }, + [1706764401.003260][4438:4440] CHIP:DMG: + [1706764401.003270][4438:4440] CHIP:DMG: }, + [1706764401.003292][4438:4440] CHIP:DMG: + [1706764401.003301][4438:4440] CHIP:DMG: ], + [1706764401.003324][4438:4440] CHIP:DMG: + [1706764401.003334][4438:4440] CHIP:DMG: InteractionModelRevision = 11 + [1706764401.003343][4438:4440] CHIP:DMG: } + [1706764401.003557][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3964423870 + [1706764401.003615][4438:4440] CHIP:TOO: FabricSceneInfo: 1 entries + [1706764401.003676][4438:4440] CHIP:TOO: [1]: { + [1706764401.003698][4438:4440] CHIP:TOO: SceneCount: 0 + [1706764401.003708][4438:4440] CHIP:TOO: CurrentScene: 1 + [1706764401.003718][4438:4440] CHIP:TOO: CurrentGroup: 1 + [1706764401.003728][4438:4440] CHIP:TOO: SceneValid: FALSE + [1706764401.003740][4438:4440] CHIP:TOO: RemainingCapacity: 7 + [1706764401.003750][4438:4440] CHIP:TOO: FabricIndex: 1 + [1706764401.003761][4438:4440] CHIP:TOO: } + disabled: true + + - label: + "Step 4c: Keep subscription session active for the remainder of the + test" + verification: | + Keep subscription session active for the remainder of the test + + Confirm that the subscription session is active for the remainder of the test by the reception of Liveness checks: + [1706798074.365883][5179:5181] CHIP:DMG: Refresh LivenessCheckTime for 64224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 + disabled: true + + - label: + "Step 5a: TH sends a AddScene command to DUT with the GroupID field + set to G1, the SceneID field set to 0x01, the TransitionTime field set + to 20000 (20s) and no extension field sets." + PICS: S.S.C00.Rsp + verification: | + scenesmanagement add-scene 0x0001 0x01 20 scene1 [] 1 1 + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 + SceneID field set to 0x01 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1706764438.086631][4438:4440] CHIP:DMG: }, + [1706764438.086653][4438:4440] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1706764438.086665][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1706764438.086681][4438:4440] CHIP:TOO: AddSceneResponse: { + [1706764438.086685][4438:4440] CHIP:TOO: status: 0 + [1706764438.086688][4438:4440] CHIP:TOO: groupID: 1 + [1706764438.086690][4438:4440] CHIP:TOO: sceneID: 1 + [1706764438.086692][4438:4440] CHIP:TOO: } + disabled: true + + - label: + "Step 5b: Verify that the DUT sends a report data for FabricSceneInfo + after the MinIntervalFloor time; store the RemainingCapacity field + from this fabric’s entry reported in FabricSceneInfo into + RemainingCapacity; verify RemainingCapacity equals + (MaxRemainingCapacity-1)." + verification: | + Verify that the DUT sends a report data for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into RemainingCapacity and is equals to (MaxRemainingCapacity-1). [1706764465.493922][4438:4440] CHIP:DMG: ReportDataMessage = [1706764465.493926][4438:4440] CHIP:DMG: { - [1706764465.493928][4438:4440] CHIP:DMG: SubscriptionId = 0x8537dfcd, + [1706764465.493928][4438:4440] CHIP:DMG: SubscriptionId = 0xcd5a528f, [1706764465.493931][4438:4440] CHIP:DMG: AttributeReportIBs = [1706764465.493937][4438:4440] CHIP:DMG: [ [1706764465.493939][4438:4440] CHIP:DMG: AttributeReportIB = @@ -175,102 +322,6 @@ tests: [1706764465.494167][4438:4440] CHIP:TOO: RemainingCapacity: 6 [1706764465.494170][4438:4440] CHIP:TOO: FabricIndex: 1 [1706764465.494174][4438:4440] CHIP:TOO: } - ... - [1706797894.367789][5179:5181] CHIP:DMG: Subscription established with SubscriptionID = 0x8537dfcd MinInterval = 0s MaxInterval = 60s Peer = 01:0000000000000001 - ... - [1706798074.365189][5179:5181] CHIP:EM: >>> [E:29283r S:30665 M:266174816] (S) Msg RX from 1:0000000000000001 [0714] --- Type 0001:05 (IM:ReportData) - [1706798074.365317][5179:5181] CHIP:EM: Handling via exchange: 29283r, Delegate: 0xaaaacccf2a88 - [1706798074.365449][5179:5181] CHIP:DMG: ReportDataMessage = - [1706798074.365517][5179:5181] CHIP:DMG: { - [1706798074.365576][5179:5181] CHIP:DMG: SubscriptionId = 0x8537dfcd, - [1706798074.365638][5179:5181] CHIP:DMG: InteractionModelRevision = 11 - [1706798074.365696][5179:5181] CHIP:DMG: } - [1706798074.365883][5179:5181] CHIP:DMG: Refresh LivenessCheckTime for 64224 milliseconds with SubscriptionId = 0x85 - 37dfcd Peer = 01:0000000000000001 - - disabled: true - - - label: - "Step 4c: Keep subscription session active for the remainder of the - test" - verification: | - Confirm that the subscription session is active for the remainder of the test by the reception of Liveness checks: - - [1706798074.365883][5179:5181] CHIP:DMG: Refresh LivenessCheckTime for 64224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 - - disabled: true - - - label: - "Step 5a: TH sends a AddScene command to DUT with the GroupID field - set to G1, the SceneID field set to 0x01, the TransitionTime field set - to 20000 (20s) and no extension field sets." - PICS: S.S.C00.Rsp - verification: | - ./chip-tool scenesmanagement add-scene 0x0001 0x1 20000 scene1 [] 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 1 - CHIP:TOO: sceneID: 1 - CHIP:TOO: } - disabled: true - - - label: - "Step 5b: Verify that the DUT sends a report data for FabricSceneInfo - after the MinIntervalFloor time; store the RemainingCapacity field - from this fabric’s entry reported in FabricSceneInfo into - RemainingCapacity; verify RemainingCapacity equals - (MaxRemainingCapacity-1)." - verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0x8537dfcd, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb45d, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 1, - CHIP:DMG: 0x1 = 0, - CHIP:DMG: 0x2 = 0, - CHIP:DMG: 0x3 = false, - CHIP:DMG: 0x4 = 6, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 1 - CHIP:TOO: CurrentScene: 0 - CHIP:TOO: CurrentGroup: 0 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 6 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 - disabled: true - label: @@ -280,14 +331,21 @@ tests: 8a." PICS: S.S.C04.Rsp verification: | - ./chip-tool scenesmanagement store-scene 0x0001 0x2 20000 scene2 [] 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 1 - CHIP:TOO: sceneID: 2 - CHIP:TOO: } + ./chiptool scenesmanagement store-scene 0x0001 0x02 1 1 + + Verify the StoreSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 + SceneID field set to 0x02 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1706764492.588457][4438:4440] CHIP:DMG: }, + [1706764492.588474][4438:4440] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0004 + [1706764492.588479][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0004 + [1706764492.588490][4438:4440] CHIP:TOO: StoreSceneResponse: { + [1706764492.588494][4438:4440] CHIP:TOO: status: 0 + [1706764492.588497][4438:4440] CHIP:TOO: groupID: 1 + [1706764492.588500][4438:4440] CHIP:TOO: sceneID: 2 + [1706764492.588503][4438:4440] CHIP:TOO: } disabled: true - label: @@ -297,53 +355,54 @@ tests: RemainingCapacity; verify RemainingCapacity equals (MaxRemainingCapacity-2)." verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0x8537dfcd, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb45d, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 2, - CHIP:DMG: 0x1 = 2, - CHIP:DMG: 0x2 = 1, - CHIP:DMG: 0x3 = true, - CHIP:DMG: 0x4 = 5, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 2 - CHIP:TOO: CurrentScene: 2 - CHIP:TOO: CurrentGroup: 1 - CHIP:TOO: SceneValid: TRUE - CHIP:TOO: RemainingCapacity: 5 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 + Verify that the DUT sends a report data for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into RemainingCapacity and is equals to (MaxRemainingCapacity-2). + + [1706764510.478452][4438:4440] CHIP:DMG: ReportDataMessage = + [1706764510.478456][4438:4440] CHIP:DMG: { + [1706764510.478462][4438:4440] CHIP:DMG: SubscriptionId = 0x6b998a6d, + [1706764510.478466][4438:4440] CHIP:DMG: AttributeReportIBs = + [1706764510.478475][4438:4440] CHIP:DMG: [ + [1706764510.478478][4438:4440] CHIP:DMG: AttributeReportIB = + [1706764510.478485][4438:4440] CHIP:DMG: { + [1706764510.478488][4438:4440] CHIP:DMG: AttributeDataIB = + [1706764510.478492][4438:4440] CHIP:DMG: { + [1706764510.478496][4438:4440] CHIP:DMG: DataVersion = 0xec4c4ec3, + [1706764510.478499][4438:4440] CHIP:DMG: AttributePathIB = + [1706764510.478503][4438:4440] CHIP:DMG: { + [1706764510.478507][4438:4440] CHIP:DMG: Endpoint = 0x1, + [1706764510.478511][4438:4440] CHIP:DMG: Cluster = 0x62, + [1706764510.478515][4438:4440] CHIP:DMG: Attribute = 0x0000_0002, + [1706764510.478518][4438:4440] CHIP:DMG: } + [1706764510.478522][4438:4440] CHIP:DMG: + [1706764510.478526][4438:4440] CHIP:DMG: Data = [ + [1706764510.478530][4438:4440] CHIP:DMG: + [1706764510.478535][4438:4440] CHIP:DMG: { + [1706764510.478542][4438:4440] CHIP:DMG: 0x0 = 2, + [1706764510.478547][4438:4440] CHIP:DMG: 0x1 = 2, + [1706764510.478551][4438:4440] CHIP:DMG: 0x2 = 1, + [1706764510.478556][4438:4440] CHIP:DMG: 0x3 = true, + [1706764510.478561][4438:4440] CHIP:DMG: 0x4 = 5, + [1706764510.478566][4438:4440] CHIP:DMG: 0xfe = 1, + [1706764510.478570][4438:4440] CHIP:DMG: }, + [1706764510.478575][4438:4440] CHIP:DMG: ], + [1706764510.478578][4438:4440] CHIP:DMG: }, + [1706764510.478586][4438:4440] CHIP:DMG: + [1706764510.478589][4438:4440] CHIP:DMG: }, + [1706764510.478597][4438:4440] CHIP:DMG: + [1706764510.478601][4438:4440] CHIP:DMG: ], + [1706764510.478609][4438:4440] CHIP:DMG: + [1706764510.478612][4438:4440] CHIP:DMG: InteractionModelRevision = 11 + [1706764510.478616][4438:4440] CHIP:DMG: } + [1706764510.478681][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3964423875 + [1706764510.478697][4438:4440] CHIP:TOO: FabricSceneInfo: 1 entries + [1706764510.478710][4438:4440] CHIP:TOO: [1]: { + [1706764510.478714][4438:4440] CHIP:TOO: SceneCount: 2 + [1706764510.478718][4438:4440] CHIP:TOO: CurrentScene: 2 + [1706764510.478721][4438:4440] CHIP:TOO: CurrentGroup: 1 + [1706764510.478725][4438:4440] CHIP:TOO: SceneValid: TRUE + [1706764510.478729][4438:4440] CHIP:TOO: RemainingCapacity: 5 + [1706764510.478733][4438:4440] CHIP:TOO: FabricIndex: 1 + [1706764510.478737][4438:4440] CHIP:TOO: } disabled: true - label: @@ -353,7 +412,21 @@ tests: field sets. If RemainingCapacity is 0, continue to Step 8a." PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0001 0x3 20000 scene3 [] 1 1 + ./chip-tool scenesmanagement add-scene 0x0001 0x03 20 scene1 [] 1 1 + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 + SceneID field set to 0x03 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1706764534.554889][4438:4440] CHIP:DMG: }, + [1706764534.554927][4438:4440] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1706764534.554933][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1706764534.554947][4438:4440] CHIP:TOO: AddSceneResponse: { + [1706764534.554952][4438:4440] CHIP:TOO: status: 0 + [1706764534.554955][4438:4440] CHIP:TOO: groupID: 1 + [1706764534.554958][4438:4440] CHIP:TOO: sceneID: 3 + [1706764534.554961][4438:4440] CHIP:TOO: } disabled: true - label: @@ -363,53 +436,54 @@ tests: RemainingCapacity; verify RemainingCapacity equals (MaxRemainingCapacity-3)." verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0x8537dfcd, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb45d, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 3, - CHIP:DMG: 0x1 = 2, - CHIP:DMG: 0x2 = 1, - CHIP:DMG: 0x3 = true, - CHIP:DMG: 0x4 = 4, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 3 - CHIP:TOO: CurrentScene: 2 - CHIP:TOO: CurrentGroup: 1 - CHIP:TOO: SceneValid: TRUE - CHIP:TOO: RemainingCapacity: 4 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 + Verify that the DUT sends a report data for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into RemainingCapacity and is equals to (MaxRemainingCapacity-3). + + [1706764553.457875][4438:4440] CHIP:DMG: ReportDataMessage = + [1706764553.457878][4438:4440] CHIP:DMG: { + [1706764553.457880][4438:4440] CHIP:DMG: SubscriptionId = 0xa7ba9271, + [1706764553.457883][4438:4440] CHIP:DMG: AttributeReportIBs = + [1706764553.457888][4438:4440] CHIP:DMG: [ + [1706764553.457892][4438:4440] CHIP:DMG: AttributeReportIB = + [1706764553.457901][4438:4440] CHIP:DMG: { + [1706764553.457905][4438:4440] CHIP:DMG: AttributeDataIB = + [1706764553.457910][4438:4440] CHIP:DMG: { + [1706764553.457913][4438:4440] CHIP:DMG: DataVersion = 0xec4c4ec5, + [1706764553.457915][4438:4440] CHIP:DMG: AttributePathIB = + [1706764553.457918][4438:4440] CHIP:DMG: { + [1706764553.457920][4438:4440] CHIP:DMG: Endpoint = 0x1, + [1706764553.457923][4438:4440] CHIP:DMG: Cluster = 0x62, + [1706764553.457926][4438:4440] CHIP:DMG: Attribute = 0x0000_0002, + [1706764553.457929][4438:4440] CHIP:DMG: } + [1706764553.457932][4438:4440] CHIP:DMG: + [1706764553.457935][4438:4440] CHIP:DMG: Data = [ + [1706764553.457938][4438:4440] CHIP:DMG: + [1706764553.457941][4438:4440] CHIP:DMG: { + [1706764553.457944][4438:4440] CHIP:DMG: 0x0 = 3, + [1706764553.457947][4438:4440] CHIP:DMG: 0x1 = 2, + [1706764553.457950][4438:4440] CHIP:DMG: 0x2 = 1, + [1706764553.457953][4438:4440] CHIP:DMG: 0x3 = true, + [1706764553.457957][4438:4440] CHIP:DMG: 0x4 = 4, + [1706764553.457963][4438:4440] CHIP:DMG: 0xfe = 1, + [1706764553.457968][4438:4440] CHIP:DMG: }, + [1706764553.457973][4438:4440] CHIP:DMG: ], + [1706764553.457977][4438:4440] CHIP:DMG: }, + [1706764553.457985][4438:4440] CHIP:DMG: + [1706764553.457990][4438:4440] CHIP:DMG: }, + [1706764553.457998][4438:4440] CHIP:DMG: + [1706764553.458002][4438:4440] CHIP:DMG: ], + [1706764553.458011][4438:4440] CHIP:DMG: + [1706764553.458016][4438:4440] CHIP:DMG: InteractionModelRevision = 11 + [1706764553.458019][4438:4440] CHIP:DMG: } + [1706764553.458074][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3964423877 + [1706764553.458086][4438:4440] CHIP:TOO: FabricSceneInfo: 1 entries + [1706764553.458095][4438:4440] CHIP:TOO: [1]: { + [1706764553.458098][4438:4440] CHIP:TOO: SceneCount: 3 + [1706764553.458100][4438:4440] CHIP:TOO: CurrentScene: 2 + [1706764553.458102][4438:4440] CHIP:TOO: CurrentGroup: 1 + [1706764553.458104][4438:4440] CHIP:TOO: SceneValid: TRUE + [1706764553.458107][4438:4440] CHIP:TOO: RemainingCapacity: 4 + [1706764553.458109][4438:4440] CHIP:TOO: FabricIndex: 1 + [1706764553.458111][4438:4440] CHIP:TOO: } disabled: true - label: @@ -417,14 +491,20 @@ tests: set to G1 and the SceneID field set to 0x01." PICS: S.S.C02.Rsp verification: | - ./chip-tool scenesmanagement remove-scene 0x0001 0x1 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0002 - CHIP:TOO: RemoveSceneResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 1 - CHIP:TOO: sceneID: 1 - CHIP:TOO: } + ./chip-tool scenesmanagement remove-scene 0x0001 0x01 1 1 + + Verify the RemoveScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 + SceneID field set to 0x01 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1706764583.008025][4438:4440] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0002 + [1706764583.008031][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0002 + [1706764583.008044][4438:4440] CHIP:TOO: RemoveSceneResponse: { + [1706764583.008049][4438:4440] CHIP:TOO: status: 0 + [1706764583.008054][4438:4440] CHIP:TOO: groupID: 1 + [1706764583.008059][4438:4440] CHIP:TOO: sceneID: 1 + [1706764583.008064][4438:4440] CHIP:TOO: } disabled: true - label: @@ -434,53 +514,54 @@ tests: RemainingCapacity; verify RemainingCapacity equals (MaxRemainingCapacity-2)." verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0x8537dfcd, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb45d, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 2, - CHIP:DMG: 0x1 = 2, - CHIP:DMG: 0x2 = 1, - CHIP:DMG: 0x3 = true, - CHIP:DMG: 0x4 = 5, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 2 - CHIP:TOO: CurrentScene: 2 - CHIP:TOO: CurrentGroup: 1 - CHIP:TOO: SceneValid: TRUE - CHIP:TOO: RemainingCapacity: 5 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 + Verify that the DUT sends a report data for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into RemainingCapacity and is equals to (MaxRemainingCapacity-2). + + [1706764600.346946][4438:4440] CHIP:DMG: ReportDataMessage = + [1706764600.346951][4438:4440] CHIP:DMG: { + [1706764600.346955][4438:4440] CHIP:DMG: SubscriptionId = 0xb5fdbb95, + [1706764600.346959][4438:4440] CHIP:DMG: AttributeReportIBs = + [1706764600.346968][4438:4440] CHIP:DMG: [ + [1706764600.346973][4438:4440] CHIP:DMG: AttributeReportIB = + [1706764600.346982][4438:4440] CHIP:DMG: { + [1706764600.346986][4438:4440] CHIP:DMG: AttributeDataIB = + [1706764600.346992][4438:4440] CHIP:DMG: { + [1706764600.346999][4438:4440] CHIP:DMG: DataVersion = 0xec4c4ec7, + [1706764600.347003][4438:4440] CHIP:DMG: AttributePathIB = + [1706764600.347010][4438:4440] CHIP:DMG: { + [1706764600.347016][4438:4440] CHIP:DMG: Endpoint = 0x1, + [1706764600.347021][4438:4440] CHIP:DMG: Cluster = 0x62, + [1706764600.347027][4438:4440] CHIP:DMG: Attribute = 0x0000_0002, + [1706764600.347031][4438:4440] CHIP:DMG: } + [1706764600.347038][4438:4440] CHIP:DMG: + [1706764600.347043][4438:4440] CHIP:DMG: Data = [ + [1706764600.347048][4438:4440] CHIP:DMG: + [1706764600.347054][4438:4440] CHIP:DMG: { + [1706764600.347060][4438:4440] CHIP:DMG: 0x0 = 2, + [1706764600.347065][4438:4440] CHIP:DMG: 0x1 = 2, + [1706764600.347071][4438:4440] CHIP:DMG: 0x2 = 1, + [1706764600.347077][4438:4440] CHIP:DMG: 0x3 = true, + [1706764600.347083][4438:4440] CHIP:DMG: 0x4 = 5, + [1706764600.347089][4438:4440] CHIP:DMG: 0xfe = 1, + [1706764600.347094][4438:4440] CHIP:DMG: }, + [1706764600.347098][4438:4440] CHIP:DMG: ], + [1706764600.347103][4438:4440] CHIP:DMG: }, + [1706764600.347111][4438:4440] CHIP:DMG: + [1706764600.347115][4438:4440] CHIP:DMG: }, + [1706764600.347124][4438:4440] CHIP:DMG: + [1706764600.347128][4438:4440] CHIP:DMG: ], + [1706764600.347135][4438:4440] CHIP:DMG: + [1706764600.347138][4438:4440] CHIP:DMG: InteractionModelRevision = 11 + [1706764600.347140][4438:4440] CHIP:DMG: } + [1706764600.347196][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3964423879 + [1706764600.347211][4438:4440] CHIP:TOO: FabricSceneInfo: 1 entries + [1706764600.347224][4438:4440] CHIP:TOO: [1]: { + [1706764600.347230][4438:4440] CHIP:TOO: SceneCount: 2 + [1706764600.347234][4438:4440] CHIP:TOO: CurrentScene: 2 + [1706764600.347257][4438:4440] CHIP:TOO: CurrentGroup: 1 + [1706764600.347261][4438:4440] CHIP:TOO: SceneValid: TRUE + [1706764600.347267][4438:4440] CHIP:TOO: RemainingCapacity: 5 + [1706764600.347272][4438:4440] CHIP:TOO: FabricIndex: 1 + [1706764600.347276][4438:4440] CHIP:TOO: } disabled: true - label: @@ -488,13 +569,19 @@ tests: field set to G1." PICS: S.S.C03.Rsp verification: | - ./chip-tool scenesmanagement remove-all-scenes 0x0001 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0003 - CHIP:TOO: RemoveAllScenesResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 1 - CHIP:TOO: } + scenesmanagement remove-all-scenes 0x0001 1 1 + + Verify the RemoveAllScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0001 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1706764629.391457][4438:4440] CHIP:DMG: }, + [1706764629.391475][4438:4440] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0003 + [1706764629.391479][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0003 + [1706764629.391488][4438:4440] CHIP:TOO: RemoveAllScenesResponse: { + [1706764629.391492][4438:4440] CHIP:TOO: status: 0 + [1706764629.391495][4438:4440] CHIP:TOO: groupID: 1 + [1706764629.391498][4438:4440] CHIP:TOO: } disabled: true - label: @@ -504,53 +591,54 @@ tests: RemainingCapacity; verify RemainingCapacity equals (MaxRemainingCapacity)." verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0x8537dfcd, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb45d, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 0, - CHIP:DMG: 0x1 = 2, - CHIP:DMG: 0x2 = 1, - CHIP:DMG: 0x3 = false, - CHIP:DMG: 0x4 = 7, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 0 - CHIP:TOO: CurrentScene: 2 - CHIP:TOO: CurrentGroup: 1 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 7 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0x8537dfcd Peer = 01:0000000000000001 + Verify that the DUT sends a report data for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into RemainingCapacity and is equals to (MaxRemainingCapacity). + + [1706764645.968086][4438:4440] CHIP:DMG: ReportDataMessage = + [1706764645.968089][4438:4440] CHIP:DMG: { + [1706764645.968092][4438:4440] CHIP:DMG: SubscriptionId = 0x8dd9174a, + [1706764645.968094][4438:4440] CHIP:DMG: AttributeReportIBs = + [1706764645.968101][4438:4440] CHIP:DMG: [ + [1706764645.968103][4438:4440] CHIP:DMG: AttributeReportIB = + [1706764645.968109][4438:4440] CHIP:DMG: { + [1706764645.968112][4438:4440] CHIP:DMG: AttributeDataIB = + [1706764645.968115][4438:4440] CHIP:DMG: { + [1706764645.968119][4438:4440] CHIP:DMG: DataVersion = 0xec4c4ec9, + [1706764645.968122][4438:4440] CHIP:DMG: AttributePathIB = + [1706764645.968127][4438:4440] CHIP:DMG: { + [1706764645.968130][4438:4440] CHIP:DMG: Endpoint = 0x1, + [1706764645.968134][4438:4440] CHIP:DMG: Cluster = 0x62, + [1706764645.968137][4438:4440] CHIP:DMG: Attribute = 0x0000_0002, + [1706764645.968140][4438:4440] CHIP:DMG: } + [1706764645.968145][4438:4440] CHIP:DMG: + [1706764645.968148][4438:4440] CHIP:DMG: Data = [ + [1706764645.968151][4438:4440] CHIP:DMG: + [1706764645.968154][4438:4440] CHIP:DMG: { + [1706764645.968158][4438:4440] CHIP:DMG: 0x0 = 0, + [1706764645.968162][4438:4440] CHIP:DMG: 0x1 = 2, + [1706764645.968166][4438:4440] CHIP:DMG: 0x2 = 1, + [1706764645.968169][4438:4440] CHIP:DMG: 0x3 = false, + [1706764645.968173][4438:4440] CHIP:DMG: 0x4 = 7, + [1706764645.968177][4438:4440] CHIP:DMG: 0xfe = 1, + [1706764645.968180][4438:4440] CHIP:DMG: }, + [1706764645.968184][4438:4440] CHIP:DMG: ], + [1706764645.968186][4438:4440] CHIP:DMG: }, + [1706764645.968192][4438:4440] CHIP:DMG: + [1706764645.968195][4438:4440] CHIP:DMG: }, + [1706764645.968201][4438:4440] CHIP:DMG: + [1706764645.968203][4438:4440] CHIP:DMG: ], + [1706764645.968210][4438:4440] CHIP:DMG: + [1706764645.968212][4438:4440] CHIP:DMG: InteractionModelRevision = 11 + [1706764645.968215][4438:4440] CHIP:DMG: } + [1706764645.968262][4438:4440] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3964423881 + [1706764645.968272][4438:4440] CHIP:TOO: FabricSceneInfo: 1 entries + [1706764645.968283][4438:4440] CHIP:TOO: [1]: { + [1706764645.968286][4438:4440] CHIP:TOO: SceneCount: 0 + [1706764645.968289][4438:4440] CHIP:TOO: CurrentScene: 2 + [1706764645.968291][4438:4440] CHIP:TOO: CurrentGroup: 1 + [1706764645.968294][4438:4440] CHIP:TOO: SceneValid: FALSE + [1706764645.968297][4438:4440] CHIP:TOO: RemainingCapacity: 7 + [1706764645.968300][4438:4440] CHIP:TOO: FabricIndex: 1 + [1706764645.968303][4438:4440] CHIP:TOO: } disabled: true - label: @@ -558,12 +646,14 @@ tests: KeySetRemove command to the GroupKeyManagement cluster with the GroupKeySetID field set to 0x01a1" verification: | - ./chip-tool groupkeymanagement key-set-remove 1 1 0 + ./chip-tool groupkeymanagement key-set-remove 0x01a1 1 0 + + Verify DUT responds with SUCCESS status response on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: - [1688019719.867880][1746:1748] CHIP:DMG: }, + [1688019719.867880][1746:1748] CHIP:DMG: }, [1688019719.867923][1746:1748] CHIP:DMG: - [1688019719.867956][1746:1748] CHIP:DMG: StatusIB = - [1688019719.867995][1746:1748] CHIP:DMG: { - [1688019719.868033][1746:1748] CHIP:DMG: status = 0x00 (SUCCESS), - [1688019719.868071][1746:1748] CHIP:DMG: }, + [1688019719.867956][1746:1748] CHIP:DMG: StatusIB = + [1688019719.867995][1746:1748] CHIP:DMG: { + [1688019719.868033][1746:1748] CHIP:DMG: status = 0x00 (SUCCESS), + [1688019719.868071][1746:1748] CHIP:DMG: }, disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_S_2_6.yaml b/src/app/tests/suites/certification/Test_TC_S_2_6.yaml index 2d5e5cf0df2b99..4c81d96190abfc 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_6.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_6.yaml @@ -27,11 +27,64 @@ config: endpoint: 0 tests: - - label: "Precondition" + - label: "Precondition: Commission DUT to TH1" verification: | - - TH1, TH2, and TH3 should be on separate, distinct fabrics. - - A given fabric SHALL NOT consume more than half (rounded down towards 0) of the Scene Table entries (as indicated in the SceneTableSize attribute). - - MaxRemainingCapacity is SceneTableSize/2. + Once DUT reach the commissionable state send the following command on TH1: + ./chip-tool pairing onnetwork 1 20202021 + Verify the commissioning completed with success on TH(chip-tool) from DUT + [1650455358.501816][4366:4371] CHIP:TOO: Device commissioning completed with success + disabled: true + + - label: "Precondition: Commission DUT to TH2 (Open Commissioning Window)" + verification: | + Open a commissioning window On TH1(Chiptool)using below command + + ./chip-tool pairing open-commissioning-window 1 1 400 2000 3841 + + Verify the Successfully opened pairing window On TH1(Chiptool)e device + + [1657186324.710951][10820:10825] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0000 Status=0x0 + [1657186324.710980][10820:10825] CHIP:CTL: Successfully opened pairing window On TH(Chiptool)e device + [1657186324.711048][10820:10825] CHIP:CTL: Manual pairing code: [36253605617] + [1657186324.711108][10820:10825] CHIP:CTL: SetupQRCode: [MT:-24J0IRV01A7TB7E700] + disabled: true + + - label: "Precondition: Commission DUT to TH2 (Pairing)" + verification: | + Now send the below command for commissionin DUT to TH2 with Manual pairing code generated in TH1 using open commission window + + ./chip-tool pairing code 2 36253605617 --commissioner-name beta + + Verify the commissioning completed with success on TH2(chip-tool) from DUT + + [1657186359.584672][3509:3514] CHIP:CTL: Successfully finished commissioning step 'Cleanup' + [1657186359.584743][3509:3514] CHIP:TOO: Device commissioning completed with success + disabled: true + + - label: "Precondition: Commission DUT to TH3 (Open Commissioning Window)" + verification: | + Open a commissioning window On TH1(Chiptool)using below command + + ./chip-tool pairing open-commissioning-window 1 1 400 2000 3842 + + Verify the Successfully opened pairing window On TH1(Chiptool)e device + + [1701254594.851779][10096:10098] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0000 Status=0x0 + [1701254594.851783][10096:10098] CHIP:CTL: Successfully opened pairing window on the device + [1701254594.851789][10096:10098] CHIP:CTL: Manual pairing code: [36545248276] + [1701254594.851795][10096:10098] CHIP:CTL: SetupQRCode: [MT:-24J0Q1212K4.08JP10] + disabled: true + + - label: "Precondition: Commission DUT to TH3 (Pairing)" + verification: | + send the below command for commissionin DUT to TH3 with Manual pairing code generated in TH1 using open commission window + + ./chip-tool pairing code 3 36545248276 --commissioner-name gamma + + Verify the commissioning completed with success on TH3(chip-tool) from DUT + + [1657186359.584672][3509:3514] CHIP:CTL: Successfully finished commissioning step 'Cleanup' + [1657186359.584743][3509:3514] CHIP:TOO: Device commissioning completed with success disabled: true - label: @@ -52,85 +105,119 @@ tests: PICS: S.S.C03.Rsp verification: | ./chip-tool scenesmanagement remove-all-scenes 0x0000 2 1 --commissioner-name beta + + Verify the RemoveAllScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1700826575.191275][15971:15973] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0003 + [1700826575.191321][15971:15973] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0003 + [1700826575.191938][15971:15973] CHIP:TOO: RemoveAllScenesResponse: { + [1700826575.191974][15971:15973] CHIP:TOO: status: 0 + [1700826575.191985][15971:15973] CHIP:TOO: groupID: 0 + [1700826575.191995][15971:15973] CHIP:TOO: } + ./chip-tool scenesmanagement remove-all-scenes 0x0000 3 1 --commissioner-name gamma + + Verify the RemoveAllScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1700826595.190538][15975:15977] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0003 + [1700826595.190578][15975:15977] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0003 + [1700826595.190637][15975:15977] CHIP:TOO: RemoveAllScenesResponse: { + [1700826595.190652][15975:15977] CHIP:TOO: status: 0 + [1700826595.190661][15975:15977] CHIP:TOO: groupID: 0 + [1700826595.190669][15975:15977] CHIP:TOO: } disabled: true - label: "Step 2a: TH1 reads from the DUT the SceneTableSize attribute" verification: | ./chip-tool scenesmanagement read scene-table-size 1 1 - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Attribute 0x0000_0006 DataVersion: 2793536935 - CHIP:TOO: SceneTableSize: 16 + Verify the "SceneTableSize" attribute value is SceneTableSize(minimum=16) which is recorded into SceneTableSize on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + [1700826614.634340][15990:15992] CHIP:DMG: } + [1700826614.634390][15990:15992] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0006 DataVersion: 1908396086 + [1700826614.634399][15990:15992] CHIP:TOO: SceneTableSize: 16 disabled: true - label: "Step 2b: TH1 sends a subscription request action for FabricSceneInfo to the DUT." verification: | - ./chipt-tool interactive start - any subscribe-by-id 0x0062 0x0002 0 5 1 1 - - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0xce6a96bc, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb46c, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 0, - CHIP:DMG: 0x1 = 0, - CHIP:DMG: 0x2 = 0, - CHIP:DMG: 0x3 = false, - CHIP:DMG: 0x4 = 7, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2464986220 - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 0 - CHIP:TOO: CurrentScene: 0 - CHIP:TOO: CurrentGroup: 0 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 7 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - + Please use Interactive mode to Verify the subscription + Here the command to enter interactive mode:-- + ./chip-tool interactive start + + Set up the subscription between DUT and TH by sending the command mentioned below, and verify that the subscription is activated successfully + + scenesmanagement subscribe fabric-scene-info 100 200 1 1 + + Verify the DUT sends a report data to TH1 for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into Remaining1stCapacity and is equals to (MaxRemainingCapacity) on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + [1701251118.633541][8779:8781] CHIP:DMG: ReportDataMessage = + [1701251118.633544][8779:8781] CHIP:DMG: { + [1701251118.633547][8779:8781] CHIP:DMG: SubscriptionId = 0x349c4fb0, + [1701251118.633550][8779:8781] CHIP:DMG: AttributeReportIBs = + [1701251118.633557][8779:8781] CHIP:DMG: [ + [1701251118.633560][8779:8781] CHIP:DMG: AttributeReportIB = + [1701251118.633567][8779:8781] CHIP:DMG: { + [1701251118.633570][8779:8781] CHIP:DMG: AttributeDataIB = + [1701251118.633574][8779:8781] CHIP:DMG: { + [1701251118.633577][8779:8781] CHIP:DMG: DataVersion = 0xe203cd66, + [1701251118.633581][8779:8781] CHIP:DMG: AttributePathIB = + [1701251118.633584][8779:8781] CHIP:DMG: { + [1701251118.633587][8779:8781] CHIP:DMG: Endpoint = 0x1, + [1701251118.633591][8779:8781] CHIP:DMG: Cluster = 0x62, + [1701251118.633594][8779:8781] CHIP:DMG: Attribute = 0x0000_0002, + [1701251118.633598][8779:8781] CHIP:DMG: } + [1701251118.633602][8779:8781] CHIP:DMG: + [1701251118.633606][8779:8781] CHIP:DMG: Data = [ + [1701251118.633610][8779:8781] CHIP:DMG: + [1701251118.633614][8779:8781] CHIP:DMG: { + [1701251118.633618][8779:8781] CHIP:DMG: 0x0 = 0, + [1701251118.633621][8779:8781] CHIP:DMG: 0x1 = 0, + [1701251118.633625][8779:8781] CHIP:DMG: 0x2 = 0, + [1701251118.633629][8779:8781] CHIP:DMG: 0x3 = false, + [1701251118.633633][8779:8781] CHIP:DMG: 0x4 = 7, + [1701251118.633637][8779:8781] CHIP:DMG: 0xfe = 1, + [1701251118.633640][8779:8781] CHIP:DMG: }, + [1701251118.633644][8779:8781] CHIP:DMG: ], + [1701251118.633646][8779:8781] CHIP:DMG: }, + [1701251118.633652][8779:8781] CHIP:DMG: + [1701251118.633655][8779:8781] CHIP:DMG: }, + [1701251118.633661][8779:8781] CHIP:DMG: + [1701251118.633663][8779:8781] CHIP:DMG: ], + [1701251118.633669][8779:8781] CHIP:DMG: + [1701251118.633672][8779:8781] CHIP:DMG: InteractionModelRevision = 11 + [1701251118.633675][8779:8781] CHIP:DMG: } + [1701251118.633729][8779:8781] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3791900006 + [1701251118.633743][8779:8781] CHIP:TOO: FabricSceneInfo: 1 entries + [1701251118.633758][8779:8781] CHIP:TOO: [1]: { + [1701251118.633765][8779:8781] CHIP:TOO: SceneCount: 0 + [1701251118.633768][8779:8781] CHIP:TOO: CurrentScene: 0 + [1701251118.633770][8779:8781] CHIP:TOO: CurrentGroup: 0 + [1701251118.633773][8779:8781] CHIP:TOO: SceneValid: FALSE + [1701251118.633776][8779:8781] CHIP:TOO: RemainingCapacity: 7 + [1701251118.633779][8779:8781] CHIP:TOO: FabricIndex: 1 + [1701251118.633783][8779:8781] CHIP:TOO: } disabled: true - label: "Step 2c: Keep subscription session active for the remaining of the test" verification: | + Keep subscription session active for the remaining of the test + Confirm that the subscription session is active for the remainder of the test by the reception of Liveness checks: CHIP:EM: >>> [E:44665r S:45698 M:201545516] (S) Msg RX from 1:0000000000000001 [1042] --- Type 0001:05 (IM:ReportData) CHIP:EM: Handling via exchange: 44665r, Delegate: 0xaaaaea044808 CHIP:DMG: ReportDataMessage = CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0xce6a96bc, - CHIP:DMG: InteractionModelRevision = 11 + CHIP:DMG: SubscriptionId = 0xce6a96bc, + CHIP:DMG: InteractionModelRevision = 11 CHIP:DMG: } CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0xce6a96bc Peer = 01:0000000000000001 disabled: true @@ -138,28 +225,123 @@ tests: - label: "Step 2d: Repeat Step 2b and 2c with TH2 and TH3" verification: | TH2: - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Attribute 0x0000_0007 DataVersion: 2793536968 - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 0 - CHIP:TOO: CurrentScene: 0 - CHIP:TOO: CurrentGroup: 0 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 7 - CHIP:TOO: FabricIndex: 2 - CHIP:TOO: } + + Please use Interactive mode to Verify the subscription of an event + Here the command to enter interactive mode:-- + ./chip-tool interactive start + + Set up the subscription between DUT and TH by sending the command mentioned below, and verify that the subscription is activated successfully + + scenesmanagement subscribe fabric-scene-info 100 200 2 1 --commissioner-name beta + + Verify the DUT sends a report data to TH2 for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into Remaining2ndCapacity and is equals to (MaxRemainingCapacity) on the TH2 (Chip-tool) and below is the sample log provided for the raspi platform: + + [1701242801.625064][7636:7638] CHIP:DMG: ReportDataMessage = + [1701242801.625076][7636:7638] CHIP:DMG: { + [1701242801.625089][7636:7638] CHIP:DMG: SubscriptionId = 0x9682625a, + [1701242801.625100][7636:7638] CHIP:DMG: AttributeReportIBs = + [1701242801.625126][7636:7638] CHIP:DMG: [ + [1701242801.625136][7636:7638] CHIP:DMG: AttributeReportIB = + [1701242801.625161][7636:7638] CHIP:DMG: { + [1701242801.625172][7636:7638] CHIP:DMG: AttributeDataIB = + [1701242801.625184][7636:7638] CHIP:DMG: { + [1701242801.625198][7636:7638] CHIP:DMG: DataVersion = 0x4daee67b, + [1701242801.625209][7636:7638] CHIP:DMG: AttributePathIB = + [1701242801.625223][7636:7638] CHIP:DMG: { + [1701242801.625237][7636:7638] CHIP:DMG: Endpoint = 0x1, + [1701242801.625250][7636:7638] CHIP:DMG: Cluster = 0x62, + [1701242801.625263][7636:7638] CHIP:DMG: Attribute = 0x0000_0002, + [1701242801.625275][7636:7638] CHIP:DMG: } + [1701242801.625291][7636:7638] CHIP:DMG: + [1701242801.625303][7636:7638] CHIP:DMG: Data = [ + [1701242801.625316][7636:7638] CHIP:DMG: + [1701242801.625330][7636:7638] CHIP:DMG: { + [1701242801.625346][7636:7638] CHIP:DMG: 0x0 = 0, + [1701242801.625361][7636:7638] CHIP:DMG: 0x1 = 0, + [1701242801.625375][7636:7638] CHIP:DMG: 0x2 = 0, + [1701242801.625390][7636:7638] CHIP:DMG: 0x3 = false, + [1701242801.625405][7636:7638] CHIP:DMG: 0x4 = 7, + [1701242801.625418][7636:7638] CHIP:DMG: 0xfe = 2, + [1701242801.625432][7636:7638] CHIP:DMG: }, + [1701242801.625444][7636:7638] CHIP:DMG: ], + [1701242801.625455][7636:7638] CHIP:DMG: }, + [1701242801.625477][7636:7638] CHIP:DMG: + [1701242801.625487][7636:7638] CHIP:DMG: }, + [1701242801.625509][7636:7638] CHIP:DMG: + [1701242801.625519][7636:7638] CHIP:DMG: ], + [1701242801.625541][7636:7638] CHIP:DMG: + [1701242801.625552][7636:7638] CHIP:DMG: InteractionModelRevision = 11 + [1701242801.625562][7636:7638] CHIP:DMG: } + [1701242801.625758][7636:7638] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 1303307899 + [1701242801.625808][7636:7638] CHIP:TOO: FabricSceneInfo: 1 entries + [1701242801.625852][7636:7638] CHIP:TOO: [1]: { + [1701242801.625874][7636:7638] CHIP:TOO: SceneCount: 0 + [1701242801.625885][7636:7638] CHIP:TOO: CurrentScene: 0 + [1701242801.625896][7636:7638] CHIP:TOO: CurrentGroup: 0 + [1701242801.625907][7636:7638] CHIP:TOO: SceneValid: FALSE + [1701242801.625919][7636:7638] CHIP:TOO: RemainingCapacity: 7 + [1701242801.625930][7636:7638] CHIP:TOO: FabricIndex: 2 + [1701242801.625941][7636:7638] CHIP:TOO: } + TH3: - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Attribute 0x0000_0007 DataVersion: 2793536968 - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 0 - CHIP:TOO: CurrentScene: 0 - CHIP:TOO: CurrentGroup: 0 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 7 - CHIP:TOO: FabricIndex: 3 - CHIP:TOO: } + + Please use Interactive mode to Verify the subscription of an event + Here the command to enter interactive mode:-- + ./chip-tool interactive start + + Set up the subscription between DUT and TH by sending the command mentioned below, and verify that the subscription is activated successfully + + scenesmanagement subscribe fabric-scene-info 100 200 3 1 --commissioner-name gamma + + Verify the DUT sends a report data to TH3 for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into Remaining3ndCapacity and is equals to (MaxRemainingCapacity) on the TH3 (Chip-tool) and below is the sample log provided for the raspi platform: + + [1701242829.236595][7642:7644] CHIP:DMG: ReportDataMessage = + [1701242829.236616][7642:7644] CHIP:DMG: { + [1701242829.236629][7642:7644] CHIP:DMG: SubscriptionId = 0x31889fa9, + [1701242829.236640][7642:7644] CHIP:DMG: AttributeReportIBs = + [1701242829.236665][7642:7644] CHIP:DMG: [ + [1701242829.236675][7642:7644] CHIP:DMG: AttributeReportIB = + [1701242829.236702][7642:7644] CHIP:DMG: { + [1701242829.236712][7642:7644] CHIP:DMG: AttributeDataIB = + [1701242829.236724][7642:7644] CHIP:DMG: { + [1701242829.236738][7642:7644] CHIP:DMG: DataVersion = 0x4daee67b, + [1701242829.236750][7642:7644] CHIP:DMG: AttributePathIB = + [1701242829.236766][7642:7644] CHIP:DMG: { + [1701242829.236778][7642:7644] CHIP:DMG: Endpoint = 0x1, + [1701242829.236792][7642:7644] CHIP:DMG: Cluster = 0x62, + [1701242829.236807][7642:7644] CHIP:DMG: Attribute = 0x0000_0001, + [1701242829.236818][7642:7644] CHIP:DMG: } + [1701242829.236834][7642:7644] CHIP:DMG: + [1701242829.236847][7642:7644] CHIP:DMG: Data = [ + [1701242829.236861][7642:7644] CHIP:DMG: + [1701242829.236875][7642:7644] CHIP:DMG: { + [1701242829.236891][7642:7644] CHIP:DMG: 0x0 = 0, + [1701242829.236905][7642:7644] CHIP:DMG: 0x1 = 0, + [1701242829.236921][7642:7644] CHIP:DMG: 0x2 = 0, + [1701242829.236935][7642:7644] CHIP:DMG: 0x3 = false, + [1701242829.236952][7642:7644] CHIP:DMG: 0x4 = 7, + [1701242829.236966][7642:7644] CHIP:DMG: 0xfe = 3, + [1701242829.236979][7642:7644] CHIP:DMG: }, + [1701242829.236992][7642:7644] CHIP:DMG: ], + [1701242829.237003][7642:7644] CHIP:DMG: }, + [1701242829.237026][7642:7644] CHIP:DMG: + [1701242829.237036][7642:7644] CHIP:DMG: }, + [1701242829.237059][7642:7644] CHIP:DMG: + [1701242829.237069][7642:7644] CHIP:DMG: ], + [1701242829.237092][7642:7644] CHIP:DMG: + [1701242829.237102][7642:7644] CHIP:DMG: InteractionModelRevision = 11 + [1701242829.237112][7642:7644] CHIP:DMG: } + [1701242829.237312][7642:7644] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0001 DataVersion: 1303307899 + [1701242829.237369][7642:7644] CHIP:TOO: FabricSceneInfo: 1 entries + [1701242829.237411][7642:7644] CHIP:TOO: [1]: { + [1701242829.237433][7642:7644] CHIP:TOO: SceneCount: 0 + [1701242829.237443][7642:7644] CHIP:TOO: CurrentScene: 0 + [1701242829.237454][7642:7644] CHIP:TOO: CurrentGroup: 0 + [1701242829.237465][7642:7644] CHIP:TOO: SceneValid: FALSE + [1701242829.237477][7642:7644] CHIP:TOO: RemainingCapacity: 7 + [1701242829.237487][7642:7644] CHIP:TOO: FabricIndex: 3 + [1701242829.237498][7642:7644] CHIP:TOO: } disabled: true - label: @@ -168,14 +350,20 @@ tests: set to 20000 (20s) and no extension field sets." PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0000 0x1 20000 scene1 [] 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 1 - CHIP:TOO: } + ./chip-tool scenesmanagement add-scene 0x0000 0x01 20 scene1 [] 1 1 + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 + SceneID field set to 0x01 on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1700827169.206479][16026:16028] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1700827169.206492][16026:16028] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1700827169.206523][16026:16028] CHIP:TOO: AddSceneResponse: { + [1700827169.206537][16026:16028] CHIP:TOO: status: 0 + [1700827169.206548][16026:16028] CHIP:TOO: groupID: 0 + [1700827169.206558][16026:16028] CHIP:TOO: sceneID: 1 + [1700827169.206568][16026:16028] CHIP:TOO: } disabled: true - label: @@ -185,53 +373,56 @@ tests: FabricSceneInfo into Remaining1stCapacity; verify Remaining1stCapacity equals (MaxRemainingCapacity-1)." verification: | - Confirm that a report data message is received with the updated data: - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0xce6a96bc, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb46e, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 1, - CHIP:DMG: 0x1 = 0, - CHIP:DMG: 0x2 = 0, - CHIP:DMG: 0x3 = false, - CHIP:DMG: 0x4 = 6, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2464986222 - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 0 - CHIP:TOO: CurrentScene: 0 - CHIP:TOO: CurrentGroup: 0 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 6 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 1 1 + + Verify the DUT sends a report data to TH1 for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into Remaining1stCapacity and is equals to (MaxRemainingCapacity-1) on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + [1701246692.659639][8121:8123] CHIP:DMG: ReportDataMessage = + [1701246692.659654][8121:8123] CHIP:DMG: { + [1701246692.659667][8121:8123] CHIP:DMG: SubscriptionId = 0xceee757a, + [1701246692.659678][8121:8123] CHIP:DMG: AttributeReportIBs = + [1701246692.659702][8121:8123] CHIP:DMG: [ + [1701246692.659711][8121:8123] CHIP:DMG: AttributeReportIB = + [1701246692.659737][8121:8123] CHIP:DMG: { + [1701246692.659748][8121:8123] CHIP:DMG: AttributeDataIB = + [1701246692.659758][8121:8123] CHIP:DMG: { + [1701246692.659772][8121:8123] CHIP:DMG: DataVersion = 0xa64c547f, + [1701246692.659783][8121:8123] CHIP:DMG: AttributePathIB = + [1701246692.659797][8121:8123] CHIP:DMG: { + [1701246692.659810][8121:8123] CHIP:DMG: Endpoint = 0x1, + [1701246692.659822][8121:8123] CHIP:DMG: Cluster = 0x62, + [1701246692.659836][8121:8123] CHIP:DMG: Attribute = 0x0000_0002, + [1701246692.659847][8121:8123] CHIP:DMG: } + [1701246692.659864][8121:8123] CHIP:DMG: + [1701246692.659876][8121:8123] CHIP:DMG: Data = [ + [1701246692.659889][8121:8123] CHIP:DMG: + [1701246692.659903][8121:8123] CHIP:DMG: { + [1701246692.659918][8121:8123] CHIP:DMG: 0x0 = 1, + [1701246692.659932][8121:8123] CHIP:DMG: 0x1 = 0, + [1701246692.659946][8121:8123] CHIP:DMG: 0x2 = 0, + [1701246692.659960][8121:8123] CHIP:DMG: 0x3 = false, + [1701246692.659974][8121:8123] CHIP:DMG: 0x4 = 6, + [1701246692.659987][8121:8123] CHIP:DMG: 0xfe = 1, + [1701246692.660001][8121:8123] CHIP:DMG: }, + [1701246692.660024][8121:8123] CHIP:DMG: ], + [1701246692.660035][8121:8123] CHIP:DMG: }, + [1701246692.660055][8121:8123] CHIP:DMG: + [1701246692.660065][8121:8123] CHIP:DMG: }, + [1701246692.660090][8121:8123] CHIP:DMG: + [1701246692.660100][8121:8123] CHIP:DMG: ], + [1701246692.660125][8121:8123] CHIP:DMG: + [1701246692.660135][8121:8123] CHIP:DMG: InteractionModelRevision = 11 + [1701246692.660145][8121:8123] CHIP:DMG: } + [1701246692.660363][8121:8123] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2790020223 + [1701246692.660403][8121:8123] CHIP:TOO: FabricSceneInfo: 1 entries + [1701246692.660436][8121:8123] CHIP:TOO: [1]: { + [1701246692.660449][8121:8123] CHIP:TOO: SceneCount: 1 + [1701246692.660459][8121:8123] CHIP:TOO: CurrentScene: 0 + [1701246692.660471][8121:8123] CHIP:TOO: CurrentGroup: 0 + [1701246692.660482][8121:8123] CHIP:TOO: SceneValid: FALSE + [1701246692.660494][8121:8123] CHIP:TOO: RemainingCapacity: 6 + [1701246692.660505][8121:8123] CHIP:TOO: FabricIndex: 1 + [1701246692.660516][8121:8123] CHIP:TOO: } disabled: true - label: @@ -281,51 +472,367 @@ tests: field sets." PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0000 0x08 20000 scene101 [] 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 137 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 8 - CHIP:TOO: } + ./chip-tool scenesmanagement add-scene 0x0000 0x08 0x0014 scene9 [] 1 1 + + Verify the AddSceneResponse with following fields: + Status is RESOURCE_EXHAUSTED(0x89) on the TH1(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1701244361.448569][7642:7644] CHIP:DMG: }, + [1701244361.448586][7642:7644] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1701244361.448590][7642:7644] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1701244361.448600][7642:7644] CHIP:TOO: AddSceneResponse: { + [1701244361.448604][7642:7644] CHIP:TOO: status: 137 + [1701244361.448608][7642:7644] CHIP:TOO: groupID: 0 + [1701244361.448611][7642:7644] CHIP:TOO: sceneID: 8 + [1701244361.448614][7642:7644] CHIP:TOO: } disabled: true - label: "Step 5a: Repeat Step 4a with TH2" PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0000 0x2 20000 scene1 [] 2 1 --commissioner-name beta - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 2 - CHIP:TOO: } + ./chip-tool scenesmanagement add-scene 0x0000 0x02 0x0014 scene1 [] 2 1 --commissioner-name beta + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 + SceneID field set to 0x02 on the TH2(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1700828173.261569][16115:16117] CHIP:DMG: }, + [1700828173.261586][16115:16117] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1700828173.261600][16115:16117] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1700828173.261629][16115:16117] CHIP:TOO: AddSceneResponse: { + [1700828173.261633][16115:16117] CHIP:TOO: status: 0 + [1700828173.261636][16115:16117] CHIP:TOO: groupID: 0 + [1700828173.261638][16115:16117] CHIP:TOO: sceneID: 2 + [1700828173.261640][16115:16117] CHIP:TOO: } + + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 2 1 --commissioner-name beta + + Verify the DUT sends a report data messages after the MinIntervalFloor time to TH2 for RemainingCapacity field in FabricSceneInfo for that fabric with updated value on the TH2 (Chip-tool) and below is the sample log provided for the raspi platform: + + [1701244532.841112][7824:7826] CHIP:DMG: ReportDataMessage = + [1701244532.841116][7824:7826] CHIP:DMG: { + [1701244532.841120][7824:7826] CHIP:DMG: SubscriptionId = 0xf6c52c20, + [1701244532.841123][7824:7826] CHIP:DMG: AttributeReportIBs = + [1701244532.841131][7824:7826] CHIP:DMG: [ + [1701244532.841134][7824:7826] CHIP:DMG: AttributeReportIB = + [1701244532.841141][7824:7826] CHIP:DMG: { + [1701244532.841144][7824:7826] CHIP:DMG: AttributeDataIB = + [1701244532.841148][7824:7826] CHIP:DMG: { + [1701244532.841152][7824:7826] CHIP:DMG: DataVersion = 0x4daee699, + [1701244532.841155][7824:7826] CHIP:DMG: AttributePathIB = + [1701244532.841159][7824:7826] CHIP:DMG: { + [1701244532.841163][7824:7826] CHIP:DMG: Endpoint = 0x1, + [1701244532.841167][7824:7826] CHIP:DMG: Cluster = 0x62, + [1701244532.841171][7824:7826] CHIP:DMG: Attribute = 0x0000_0002, + [1701244532.841175][7824:7826] CHIP:DMG: } + [1701244532.841179][7824:7826] CHIP:DMG: + [1701244532.841183][7824:7826] CHIP:DMG: Data = [ + [1701244532.841187][7824:7826] CHIP:DMG: + [1701244532.841192][7824:7826] CHIP:DMG: { + [1701244532.841196][7824:7826] CHIP:DMG: 0x0 = 1, + [1701244532.841200][7824:7826] CHIP:DMG: 0x1 = 0, + [1701244532.841204][7824:7826] CHIP:DMG: 0x2 = 0, + [1701244532.841209][7824:7826] CHIP:DMG: 0x3 = false, + [1701244532.841213][7824:7826] CHIP:DMG: 0x4 = 6, + [1701244532.841217][7824:7826] CHIP:DMG: 0xfe = 2, + [1701244532.841221][7824:7826] CHIP:DMG: }, + [1701244532.841225][7824:7826] CHIP:DMG: ], + [1701244532.841228][7824:7826] CHIP:DMG: }, + [1701244532.841237][7824:7826] CHIP:DMG: + [1701244532.841240][7824:7826] CHIP:DMG: }, + [1701244532.841248][7824:7826] CHIP:DMG: + [1701244532.841251][7824:7826] CHIP:DMG: ], + [1701244532.841257][7824:7826] CHIP:DMG: + [1701244532.841261][7824:7826] CHIP:DMG: InteractionModelRevision = 11 + [1701244532.841264][7824:7826] CHIP:DMG: } + [1701244532.841324][7824:7826] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 1303307929 + [1701244532.841340][7824:7826] CHIP:TOO: FabricSceneInfo: 1 entries + [1701244532.841351][7824:7826] CHIP:TOO: [1]: { + [1701244532.841355][7824:7826] CHIP:TOO: SceneCount: 1 + [1701244532.841358][7824:7826] CHIP:TOO: CurrentScene: 0 + [1701244532.841361][7824:7826] CHIP:TOO: CurrentGroup: 0 + [1701244532.841365][7824:7826] CHIP:TOO: SceneValid: FALSE + [1701244532.841368][7824:7826] CHIP:TOO: RemainingCapacity: 6 + [1701244532.841371][7824:7826] CHIP:TOO: FabricIndex: 2 + [1701244532.841375][7824:7826] CHIP:TOO: } + . + . + . + ./chip-tool scenesmanagement add-scene 0x0000 0x08 0x0014 scene7 [] 2 1 --commissioner-name beta + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 + SceneID field set to 0x08 on the TH2(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1700829509.052437][16198:16200] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1700829509.052452][16198:16200] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1700829509.052485][16198:16200] CHIP:TOO: AddSceneResponse: { + [1700829509.052500][16198:16200] CHIP:TOO: status: 0 + [1700829509.052511][16198:16200] CHIP:TOO: groupID: 0 + [1700829509.052521][16198:16200] CHIP:TOO: sceneID: 8 + [1700829509.052532][16198:16200] CHIP:TOO: } + + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 2 1 --commissioner-name beta + + Verify the DUT sends a report data messages after the MinIntervalFloor time to TH2 for RemainingCapacity field in FabricSceneInfo for that fabric with updated value(decreasing to 0) on the TH2 (Chip-tool) and below is the sample log provided for the raspi platform: + + [1701245132.869725][7824:7826] CHIP:DMG: ReportDataMessage = + [1701245132.869737][7824:7826] CHIP:DMG: { + [1701245132.869748][7824:7826] CHIP:DMG: SubscriptionId = 0xf6c52c20, + [1701245132.869756][7824:7826] CHIP:DMG: AttributeReportIBs = + [1701245132.869779][7824:7826] CHIP:DMG: [ + [1701245132.869790][7824:7826] CHIP:DMG: AttributeReportIB = + [1701245132.869814][7824:7826] CHIP:DMG: { + [1701245132.869825][7824:7826] CHIP:DMG: AttributeDataIB = + [1701245132.869835][7824:7826] CHIP:DMG: { + [1701245132.869854][7824:7826] CHIP:DMG: DataVersion = 0x4daee6a5, + [1701245132.869866][7824:7826] CHIP:DMG: AttributePathIB = + [1701245132.869879][7824:7826] CHIP:DMG: { + [1701245132.869893][7824:7826] CHIP:DMG: Endpoint = 0x1, + [1701245132.869906][7824:7826] CHIP:DMG: Cluster = 0x62, + [1701245132.869923][7824:7826] CHIP:DMG: Attribute = 0x0000_0002, + [1701245132.869935][7824:7826] CHIP:DMG: } + [1701245132.869951][7824:7826] CHIP:DMG: + [1701245132.869963][7824:7826] CHIP:DMG: Data = [ + [1701245132.869978][7824:7826] CHIP:DMG: + [1701245132.869995][7824:7826] CHIP:DMG: { + [1701245132.870010][7824:7826] CHIP:DMG: 0x0 = 7, + [1701245132.870026][7824:7826] CHIP:DMG: 0x1 = 0, + [1701245132.870038][7824:7826] CHIP:DMG: 0x2 = 0, + [1701245132.870052][7824:7826] CHIP:DMG: 0x3 = false, + [1701245132.870066][7824:7826] CHIP:DMG: 0x4 = 0, + [1701245132.870081][7824:7826] CHIP:DMG: 0xfe = 2, + [1701245132.870094][7824:7826] CHIP:DMG: }, + [1701245132.870106][7824:7826] CHIP:DMG: ], + [1701245132.870117][7824:7826] CHIP:DMG: }, + [1701245132.870140][7824:7826] CHIP:DMG: + [1701245132.870149][7824:7826] CHIP:DMG: }, + [1701245132.870171][7824:7826] CHIP:DMG: + [1701245132.870180][7824:7826] CHIP:DMG: ], + [1701245132.870205][7824:7826] CHIP:DMG: + [1701245132.870215][7824:7826] CHIP:DMG: InteractionModelRevision = 11 + [1701245132.870225][7824:7826] CHIP:DMG: } + [1701245132.870446][7824:7826] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 1303307941 + [1701245132.870486][7824:7826] CHIP:TOO: FabricSceneInfo: 1 entries + [1701245132.870517][7824:7826] CHIP:TOO: [1]: { + [1701245132.870530][7824:7826] CHIP:TOO: SceneCount: 7 + [1701245132.870541][7824:7826] CHIP:TOO: CurrentScene: 0 + [1701245132.870549][7824:7826] CHIP:TOO: CurrentGroup: 0 + [1701245132.870561][7824:7826] CHIP:TOO: SceneValid: FALSE + [1701245132.870573][7824:7826] CHIP:TOO: RemainingCapacity: 0 + [1701245132.870584][7824:7826] CHIP:TOO: FabricIndex: 2 + [1701245132.870594][7824:7826] CHIP:TOO: } + + + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 3 1 --commissioner-name gamma + + Verify that the DUT sends report data messages after the MinIntervalFloor time to TH3 for RemainingCapacity field in FabricSceneInfo for that fabric with updated value (decreasing to SceneTableSize - (2 * MaxRemainingCapacity)) on the TH2 (Chip-tool) and below is the sample log provided for the raspi platform: + + [1705916737.108024][21608:21610] CHIP:DMG: ReportDataMessage = + [1705916737.108028][21608:21610] CHIP:DMG: { + [1705916737.108031][21608:21610] CHIP:DMG: SubscriptionId = 0xbb681f96, + [1705916737.108034][21608:21610] CHIP:DMG: AttributeReportIBs = + [1705916737.108041][21608:21610] CHIP:DMG: [ + [1705916737.108043][21608:21610] CHIP:DMG: AttributeReportIB = + [1705916737.108050][21608:21610] CHIP:DMG: { + [1705916737.108053][21608:21610] CHIP:DMG: AttributeDataIB = + [1705916737.108056][21608:21610] CHIP:DMG: { + [1705916737.108060][21608:21610] CHIP:DMG: DataVersion = 0xb6069420, + [1705916737.108063][21608:21610] CHIP:DMG: AttributePathIB = + [1705916737.108066][21608:21610] CHIP:DMG: { + [1705916737.108070][21608:21610] CHIP:DMG: Endpoint = 0x1, + [1705916737.108073][21608:21610] CHIP:DMG: Cluster = 0x62, + [1705916737.108077][21608:21610] CHIP:DMG: Attribute = 0x0000_0002, + [1705916737.108080][21608:21610] CHIP:DMG: } + [1705916737.108084][21608:21610] CHIP:DMG: + [1705916737.108087][21608:21610] CHIP:DMG: Data = [ + [1705916737.108091][21608:21610] CHIP:DMG: + [1705916737.108094][21608:21610] CHIP:DMG: { + [1705916737.108098][21608:21610] CHIP:DMG: 0x0 = 0, + [1705916737.108102][21608:21610] CHIP:DMG: 0x1 = 0, + [1705916737.108106][21608:21610] CHIP:DMG: 0x2 = 0, + [1705916737.108109][21608:21610] CHIP:DMG: 0x3 = false, + [1705916737.108113][21608:21610] CHIP:DMG: 0x4 = 7, + [1705916737.108117][21608:21610] CHIP:DMG: 0xfe = 3, + [1705916737.108120][21608:21610] CHIP:DMG: }, + [1705916737.108123][21608:21610] CHIP:DMG: ], + [1705916737.108126][21608:21610] CHIP:DMG: }, + [1705916737.108132][21608:21610] CHIP:DMG: + [1705916737.108135][21608:21610] CHIP:DMG: }, + [1705916737.108141][21608:21610] CHIP:DMG: + [1705916737.108144][21608:21610] CHIP:DMG: ], + [1705916737.108150][21608:21610] CHIP:DMG: + [1705916737.108153][21608:21610] CHIP:DMG: InteractionModelRevision = 11 + [1705916737.108155][21608:21610] CHIP:DMG: } + [1705916737.108218][21608:21610] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 3053884448 + [1705916737.108239][21608:21610] CHIP:TOO: FabricSceneInfo: 1 entries + [1705916737.108259][21608:21610] CHIP:TOO: [1]: { + [1705916737.108266][21608:21610] CHIP:TOO: SceneCount: 0 + [1705916737.108268][21608:21610] CHIP:TOO: CurrentScene: 0 + [1705916737.108271][21608:21610] CHIP:TOO: CurrentGroup: 0 + [1705916737.108274][21608:21610] CHIP:TOO: SceneValid: FALSE + [1705916737.108277][21608:21610] CHIP:TOO: RemainingCapacity: 2 + [1705916737.108280][21608:21610] CHIP:TOO: FabricIndex: 3 + [1705916737.108283][21608:21610] CHIP:TOO: } disabled: true - label: "Step 5b: Repeat Step 4b with TH2" PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0000 0x11 20000 scene201 [] 2 1 --commissioner-name beta - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 137 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 17 - CHIP:TOO: } + ./chip-tool scenesmanagement add-scene 0x0000 0x09 0x0014 scene8 [] 2 1 --commissioner-name beta + + Verify the AddSceneResponse with following fields: + Status is RESOURCE_EXHAUSTED(0x89) on the TH2(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1701245223.543911][7824:7826] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1701245223.543925][7824:7826] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1701245223.543957][7824:7826] CHIP:TOO: AddSceneResponse: { + [1701245223.543971][7824:7826] CHIP:TOO: status: 137 + [1701245223.543983][7824:7826] CHIP:TOO: groupID: 0 + [1701245223.543994][7824:7826] CHIP:TOO: sceneID: 9 + [1701245223.544004][7824:7826] CHIP:TOO: } disabled: true - label: "Step 6a: Repeat Step 4a with TH3" PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0000 0x3 20000 scene1 [] 2 1 --commissioner-name gamma - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 3 - CHIP:TOO: } + ./chip-tool scenesmanagement add-scene 0x0000 0x02 0x0014 scene1 [] 3 1 --commissioner-name gamma + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 + SceneID field set to 0x02 on the TH3(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915133.113882][21363:21365] CHIP:DMG: }, + [1705915133.113949][21363:21365] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1705915133.113982][21363:21365] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1705915133.114065][21363:21365] CHIP:TOO: AddSceneResponse: { + [1705915133.114081][21363:21365] CHIP:TOO: status: 0 + [1705915133.114092][21363:21365] CHIP:TOO: groupID: 0 + [1705915133.114103][21363:21365] CHIP:TOO: sceneID: 1 + [1705915133.114113][21363:21365] CHIP:TOO: } + + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 3 1 --commissioner-name gamma + + Verify that the DUT sends report data messages after the MinIntervalFloor time to TH3 for RemainingCapacity field in FabricSceneInfo for that fabric with updated value on the TH3(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915183.311738][21363:21365] CHIP:DMG: ReportDataMessage = + [1705915183.311752][21363:21365] CHIP:DMG: { + [1705915183.311765][21363:21365] CHIP:DMG: SubscriptionId = 0x62039a894, + [1705915183.311775][21363:21365] CHIP:DMG: AttributeReportIBs = + [1705915183.311801][21363:21365] CHIP:DMG: [ + [1705915183.311811][21363:21365] CHIP:DMG: AttributeReportIB = + [1705915183.311835][21363:21365] CHIP:DMG: { + [1705915183.311845][21363:21365] CHIP:DMG: AttributeDataIB = + [1705915183.311858][21363:21365] CHIP:DMG: { + [1705915183.311871][21363:21365] CHIP:DMG: DataVersion = 0x7e84d696, + [1705915183.311882][21363:21365] CHIP:DMG: AttributePathIB = + [1705915183.311896][21363:21365] CHIP:DMG: { + [1705915183.311909][21363:21365] CHIP:DMG: Endpoint = 0x1, + [1705915183.311923][21363:21365] CHIP:DMG: Cluster = 0x62, + [1705915183.311937][21363:21365] CHIP:DMG: Attribute = 0x0000_0002, + [1705915183.311948][21363:21365] CHIP:DMG: } + [1705915183.311964][21363:21365] CHIP:DMG: + [1705915183.311976][21363:21365] CHIP:DMG: Data = [ + [1705915183.311990][21363:21365] CHIP:DMG: + [1705915183.312003][21363:21365] CHIP:DMG: { + [1705915183.312018][21363:21365] CHIP:DMG: 0x0 = 1, + [1705915183.312033][21363:21365] CHIP:DMG: 0x1 = 0, + [1705915183.312047][21363:21365] CHIP:DMG: 0x2 = 0, + [1705915183.312072][21363:21365] CHIP:DMG: 0x3 = false, + [1705915183.312093][21363:21365] CHIP:DMG: 0x4 = 1, + [1705915183.312115][21363:21365] CHIP:DMG: 0xfe = 3, + [1705915183.312134][21363:21365] CHIP:DMG: }, + [1705915183.312154][21363:21365] CHIP:DMG: ], + [1705915183.312170][21363:21365] CHIP:DMG: }, + [1705915183.312197][21363:21365] CHIP:DMG: + [1705915183.312207][21363:21365] CHIP:DMG: }, + [1705915183.312228][21363:21365] CHIP:DMG: + [1705915183.312239][21363:21365] CHIP:DMG: ], + [1705915183.312263][21363:21365] CHIP:DMG: + [1705915183.312274][21363:21365] CHIP:DMG: InteractionModelRevision = 11 + [1705915183.312283][21363:21365] CHIP:DMG: } + [1705915183.312491][21363:21365] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2122634902 + [1705915183.312553][21363:21365] CHIP:TOO: FabricSceneInfo: 1 entries + [1705915183.312599][21363:21365] CHIP:TOO: [1]: { + [1705915183.312613][21363:21365] CHIP:TOO: SceneCount: 1 + [1705915183.312623][21363:21365] CHIP:TOO: CurrentScene: 0 + [1705915183.312645][21363:21365] CHIP:TOO: CurrentGroup: 0 + [1705915183.312656][21363:21365] CHIP:TOO: SceneValid: FALSE + [1705915183.312669][21363:21365] CHIP:TOO: RemainingCapacity: 1 + [1705915183.312679][21363:21365] CHIP:TOO: FabricIndex: 3 + [1705915183.312690][21363:21365] CHIP:TOO: } + + + ./chip-tool scenesmanagement add-scene 0x0000 0x03 0x0014 scene2 [] 3 1 --commissioner-name gamma + + Verify the AddSceneResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 + SceneID field set to 0x03 on the TH3(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915237.987013][21363:21365] CHIP:DMG: }, + [1705915237.987077][21363:21365] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1705915237.987093][21363:21365] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1705915237.987124][21363:21365] CHIP:TOO: AddSceneResponse: { + [1705915237.987140][21363:21365] CHIP:TOO: status: 0 + [1705915237.987150][21363:21365] CHIP:TOO: groupID: 0 + [1705915237.987161][21363:21365] CHIP:TOO: sceneID: 3 + [1705915237.987171][21363:21365] CHIP:TOO: } + + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 3 1 --commissioner-name gamma + + Verify that the DUT sends report data messages after the MinIntervalFloor time to TH3 for RemainingCapacity field in FabricSceneInfo for that fabric with updated value((decreasing to 0)) on the TH3(Chip-tool) log and below is the sample log provided for the raspi platform: + + + [1705915281.585175][21387:21389] CHIP:DMG: ReportDataMessage = + [1705915281.585187][21387:21389] CHIP:DMG: { + [1705915281.585198][21387:21389] CHIP:DMG: SubscriptionId = 0x111160d4, + [1705915281.585206][21387:21389] CHIP:DMG: AttributeReportIBs = + [1705915281.585228][21387:21389] CHIP:DMG: [ + [1705915281.585236][21387:21389] CHIP:DMG: AttributeReportIB = + [1705915281.585263][21387:21389] CHIP:DMG: { + [1705915281.585273][21387:21389] CHIP:DMG: AttributeDataIB = + [1705915281.585285][21387:21389] CHIP:DMG: { + [1705915281.585299][21387:21389] CHIP:DMG: DataVersion = 0x7e84d698, + [1705915281.585310][21387:21389] CHIP:DMG: AttributePathIB = + [1705915281.585323][21387:21389] CHIP:DMG: { + [1705915281.585336][21387:21389] CHIP:DMG: Endpoint = 0x1, + [1705915281.585349][21387:21389] CHIP:DMG: Cluster = 0x62, + [1705915281.585362][21387:21389] CHIP:DMG: Attribute = 0x0000_0002, + [1705915281.585374][21387:21389] CHIP:DMG: } + [1705915281.585390][21387:21389] CHIP:DMG: + [1705915281.585402][21387:21389] CHIP:DMG: Data = [ + [1705915281.585415][21387:21389] CHIP:DMG: + [1705915281.585428][21387:21389] CHIP:DMG: { + [1705915281.585443][21387:21389] CHIP:DMG: 0x0 = 2, + [1705915281.585458][21387:21389] CHIP:DMG: 0x1 = 0, + [1705915281.585472][21387:21389] CHIP:DMG: 0x2 = 0, + [1705915281.585486][21387:21389] CHIP:DMG: 0x3 = false, + [1705915281.585500][21387:21389] CHIP:DMG: 0x4 = 0, + [1705915281.585513][21387:21389] CHIP:DMG: 0xfe = 3, + [1705915281.585527][21387:21389] CHIP:DMG: }, + [1705915281.585539][21387:21389] CHIP:DMG: ], + [1705915281.585550][21387:21389] CHIP:DMG: }, + [1705915281.585573][21387:21389] CHIP:DMG: + [1705915281.585583][21387:21389] CHIP:DMG: }, + [1705915281.585605][21387:21389] CHIP:DMG: + [1705915281.585615][21387:21389] CHIP:DMG: ], + [1705915281.585638][21387:21389] CHIP:DMG: + [1705915281.585648][21387:21389] CHIP:DMG: InteractionModelRevision = 11 + [1705915281.585657][21387:21389] CHIP:DMG: } + [1705915281.585866][21387:21389] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2122634904 + [1705915281.585940][21387:21389] CHIP:TOO: FabricSceneInfo: 1 entries + [1705915281.586006][21387:21389] CHIP:TOO: [1]: { + [1705915281.586029][21387:21389] CHIP:TOO: SceneCount: 2 + [1705915281.586040][21387:21389] CHIP:TOO: CurrentScene: 0 + [1705915281.586051][21387:21389] CHIP:TOO: CurrentGroup: 0 + [1705915281.586061][21387:21389] CHIP:TOO: SceneValid: FALSE + [1705915281.586073][21387:21389] CHIP:TOO: RemainingCapacity: 0 + [1705915281.586084][21387:21389] CHIP:TOO: FabricIndex: 3 + [1705915281.586095][21387:21389] CHIP:TOO: } disabled: true - label: @@ -334,14 +841,19 @@ tests: set to 20000 20s and no extension field sets." PICS: S.S.C00.Rsp verification: | - ./chip-tool scenesmanagement add-scene 0x0000 0x01 20000 scene301 [] 3 1 --commissioner-name gamma - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0000 - CHIP:TOO: AddSceneResponse: { - CHIP:TOO: status: 137 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 1 - CHIP:TOO: } + ./chip-tool scenesmanagement add-scene 0x0000 0x01 0x0014 scene [] 3 1 --commissioner-name gamma + + Verify the AddSceneResponse with following fields: + Status is RESOURCE_EXHAUSTED(0x89) on the TH3(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915365.772920][21387:21389] CHIP:DMG: }, + [1705915365.772985][21387:21389] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0000 + [1705915365.773001][21387:21389] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0000 + [1705915365.773063][21387:21389] CHIP:TOO: AddSceneResponse: { + [1705915365.773079][21387:21389] CHIP:TOO: status: 137 + [1705915365.773091][21387:21389] CHIP:TOO: groupID: 0 + [1705915365.773102][21387:21389] CHIP:TOO: sceneID: 1 + [1705915365.773112][21387:21389] CHIP:TOO: } disabled: true - label: @@ -349,31 +861,41 @@ tests: set to 0x0000, the SceneID field set to 0x01." PICS: S.S.C04.Rsp verification: | - ./chip-tool scenesmanagement store-scene 0x0000 0xFE 20000 sceneFE [] 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0004 - CHIP:TOO: StoreSceneResponse: { - CHIP:TOO: status: 137 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 0xFE - CHIP:TOO: } + ./chip-tool scenesmanagement store-scene 0x0000 0x01 3 1 --commissioner-name gamma + + Verify the StoreSceneResponse with following fields: + Status is RESOURCE_EXHAUSTED(0x89) on the TH3(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915551.740537][21417:21419] CHIP:DMG: }, + [1705915551.740557][21417:21419] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0004 + [1705915551.740566][21417:21419] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0004 + [1705915551.740585][21417:21419] CHIP:TOO: StoreSceneResponse: { + [1705915551.740590][21417:21419] CHIP:TOO: status: 137 + [1705915551.740593][21417:21419] CHIP:TOO: groupID: 0 + [1705915551.740596][21417:21419] CHIP:TOO: sceneID: 1 + [1705915551.740598][21417:21419] CHIP:TOO: } disabled: true - label: - "TH sends a CopyScene command to DUT with the mode field set to 0x00, - the group identifier from field set to 0x0000, the scene identifier - from field set to 0x01, the group identifier to field set to 0x0000 - and the scene identifier to field set to 0xFE." + "Step 8: TH sends a CopyScene command to DUT with the mode field set + to 0x00, the group identifier from field set to 0x0000, the scene + identifier from field set to 0x01, the group identifier to field set + to 0x0000 and the scene identifier to field set to 0xFE." PICS: S.S.C40.Rsp verification: | - ./chip-tool scenesmanagement copy-scene 0 0x0000 0x01 0x4E20 sceneFE [] 1 1 - - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0040 - CHIP:TOO: CopySceneResponse: { - CHIP:TOO: status: 137 - CHIP:TOO: groupID: 0 - CHIP:TOO: sceneID: 0xFE - CHIP:TOO: } + ./chip-tool scenesmanagement copy-scene 0x00 0x0000 0x02 0x0000 0x00 3 1 --commissioner-name gamma + + Verify the CopySceneResponse with following fields: + Status is RESOURCE_EXHAUSTED(0x89) on the TH(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915659.672801][21417:21419] CHIP:DMG: }, + [1705915659.672875][21417:21419] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0040 + [1705915659.672891][21417:21419] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0040 + [1705915659.672923][21417:21419] CHIP:TOO: CopySceneResponse: { + [1705915659.672937][21417:21419] CHIP:TOO: status: 133 + [1705915659.672950][21417:21419] CHIP:TOO: groupIdentifierFrom: 0 + [1705915659.672979][21417:21419] CHIP:TOO: sceneIdentifierFrom: 2 + [1705915659.672991][21417:21419] CHIP:TOO: } disabled: true - label: @@ -383,11 +905,16 @@ tests: verification: | ./chip-tool scenesmanagement remove-all-scenes 0x0000 1 1 - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0003 - CHIP:TOO: RemoveAllScenesResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 0 - CHIP:TOO: } + Verify the RemoveAllScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 on TH1(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1700829746.586347][16198:16200] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0003 + [1700829746.586351][16198:16200] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0003 + [1700829746.586362][16198:16200] CHIP:TOO: RemoveAllScenesResponse: { + [1700829746.586366][16198:16200] CHIP:TOO: status: 0 + [1700829746.586368][16198:16200] CHIP:TOO: groupID: 0 + [1700829746.586370][16198:16200] CHIP:TOO: } disabled: true - label: "Step 9b: Verify that the DUT sends a report data to TH1 for @@ -401,11 +928,21 @@ tests: should send 'empty' report data since there is no update for this attribute for TH2)." verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0xa9f0f186, - CHIP:DMG: InteractionModelRevision = 1 - CHIP:DMG: } + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 1 1 + + Verify that the DUT sends a report data to TH1 for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry the reported in FabricSceneInfo into Remaining1stCapacity; verify Remaining1stCapacity equals (MaxRemainingCapacity) on TH1(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915725.959835][21417:21419] CHIP:DMG: } + [1705915725.959889][21417:21419] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2122634911 + [1705915725.959913][21417:21419] CHIP:TOO: FabricSceneInfo: 1 entries + [1705915725.959926][21417:21419] CHIP:TOO: [1]: { + [1705915725.959929][21417:21419] CHIP:TOO: SceneCount: 0 + [1705915725.959931][21417:21419] CHIP:TOO: CurrentScene: 0 + [1705915725.959935][21417:21419] CHIP:TOO: CurrentGroup: 0 + [1705915725.959939][21417:21419] CHIP:TOO: SceneValid: FALSE + [1705915725.959943][21417:21419] CHIP:TOO: RemainingCapacity: 7 + [1705915725.959945][21417:21419] CHIP:TOO: FabricIndex: 1 + [1705915725.959948][21417:21419] CHIP:TOO: } disabled: true - label: @@ -415,11 +952,17 @@ tests: verification: | ./chip-tool scenesmanagement remove-all-scenes 0x0000 2 1 --commissioner-name beta - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0005 Command 0x0000_0003 - CHIP:TOO: RemoveAllScenesResponse: { - CHIP:TOO: status: 0 - CHIP:TOO: groupID: 0 - CHIP:TOO: } + Verify the RemoveAllScenesResponse with following fields: + Status is SUCCESS + Group ID is 0x0000 on TH2(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915798.595482][21433:21435] CHIP:DMG: }, + [1705915798.595500][21433:21435] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_0062 Command=0x0000_0003 + [1705915798.595509][21433:21435] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Command 0x0000_0003 + [1705915798.595529][21433:21435] CHIP:TOO: RemoveAllScenesResponse: { + [1705915798.595534][21433:21435] CHIP:TOO: status: 0 + [1705915798.595537][21433:21435] CHIP:TOO: groupID: 0 + [1705915798.595540][21433:21435] CHIP:TOO: } disabled: true - label: @@ -429,51 +972,20 @@ tests: Remaining2ndCapacity; verify Remaining2ndCapacity equals (MaxRemainingCapacity). verification: | - CHIP:DMG: ReportDataMessage = - CHIP:DMG: { - CHIP:DMG: SubscriptionId = 0x7049d607, - CHIP:DMG: AttributeReportIBs = - CHIP:DMG: [ - CHIP:DMG: AttributeReportIB = - CHIP:DMG: { - CHIP:DMG: AttributeDataIB = - CHIP:DMG: { - CHIP:DMG: DataVersion = 0x92ecb45d, - CHIP:DMG: AttributePathIB = - CHIP:DMG: { - CHIP:DMG: Endpoint = 0x1, - CHIP:DMG: Cluster = 0x62, - CHIP:DMG: Attribute = 0x0000_0002, - CHIP:DMG: } - CHIP:DMG: - CHIP:DMG: Data = [ - CHIP:DMG: - CHIP:DMG: { - CHIP:DMG: 0x0 = 4, - CHIP:DMG: 0x1 = 4, - CHIP:DMG: 0x2 = 0, - CHIP:DMG: 0x3 = false, - CHIP:DMG: 0x4 = 3, - CHIP:DMG: 0xfe = 1, - CHIP:DMG: }, - CHIP:DMG: ], - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: }, - CHIP:DMG: - CHIP:DMG: ], - CHIP:DMG: - CHIP:DMG: InteractionModelRevision = 11 - CHIP:DMG: } - CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2464986205 - CHIP:TOO: FabricSceneInfo: 1 entries - CHIP:TOO: [1]: { - CHIP:TOO: SceneCount: 4 - CHIP:TOO: CurrentScene: 4 - CHIP:TOO: CurrentGroup: 0 - CHIP:TOO: SceneValid: FALSE - CHIP:TOO: RemainingCapacity: 7 - CHIP:TOO: FabricIndex: 1 - CHIP:TOO: } - CHIP:DMG: Refresh LivenessCheckTime for 9224 milliseconds with SubscriptionId = 0x7049d607 Peer = 01:0000000000000001 + ./chip-tool scenesmanagement subscribe fabric-scene-info 100 200 2 1 --commissioner-name beta + + Verify that the DUT sends a report data to TH2 for FabricSceneInfo after the MinIntervalFloor time; store the RemainingCapacity field from this fabric’s entry reported in FabricSceneInfo into Remaining2ndCapacity; verify Remaining2ndCapacity equals (MaxRemainingCapacity) on TH2(Chip-tool) log and below is the sample log provided for the raspi platform: + + [1705915866.717469][21433:21435] CHIP:DMG: } + [1705915866.717543][21433:21435] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0062 Attribute 0x0000_0002 DataVersion: 2122634913 + [1705915866.717578][21433:21435] CHIP:TOO: FabricSceneInfo: 1 entries + [1705915866.717600][21433:21435] CHIP:TOO: [1]: { + [1705915866.717607][21433:21435] CHIP:TOO: SceneCount: 0 + [1705915866.717613][21433:21435] CHIP:TOO: CurrentScene: 0 + [1705915866.717619][21433:21435] CHIP:TOO: CurrentGroup: 0 + [1705915866.717624][21433:21435] CHIP:TOO: SceneValid: FALSE + [1705915866.717630][21433:21435] CHIP:TOO: RemainingCapacity: 7 + [1705915866.717635][21433:21435] CHIP:TOO: FabricIndex: 2 + [1705915866.717640][21433:21435] CHIP:TOO: } + disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_S_3_1.yaml b/src/app/tests/suites/certification/Test_TC_S_3_1.yaml index 9fd90636871873..b968868f50f830 100644 --- a/src/app/tests/suites/certification/Test_TC_S_3_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_3_1.yaml @@ -29,66 +29,234 @@ tests: For DUT as client test cases, Chip-tool command used below are an example to verify the functionality. For certification test, we expect DUT should have a capability or way to run the equivalent command. disabled: true - - label: "Step 0:" + - label: "Step 0a: Precondition 1" verification: | - "Step 0: Preparation: - TH as server exposes a Scenes Management server cluster on Endpoint: EndpointID, supporting all possible commands and corresponding attributes. - Commission DUT to TH disabled: true + - label: + "Step 0b: Precondition 2: TH sends KeySetWrite command in the + GroupKeyManagement cluster to DUT using a key that is pre-installed on + the TH. GroupKeySet fields are as follows: * GroupKeySetID: 0x01a1 * + GroupKeySecurityPolicy: TrustFirst (0) * EpochKey0: + a0a1a2a3a4a5a6a7a8a9aaabacadaeaf * EpochStartTime0: 1110000 * + EpochKey1: b0b1b2b3b4b5b6b7b8b9babbbcbdbebf * EpochStartTime1: 1110001 + * EpochKey2: c0c1c2c3c4c5c6c7c8c9cacbcccdcecf * EpochStartTime2: + 1110002" + verification: | + Please execute the below commands before starting the test case : + + ./chip-tool groupkeymanagement key-set-write '{"groupKeySetID": "0x01a1","groupKeySecurityPolicy": 0, "epochKey0":"a0a1a2a3a4a5a6a7a8a9aaabacadaeaf","epochStartTime0": 1110000,"epochKey1":"b0b1b2b3b4b5b6b7b8b9babbbcbdbebf", "epochStartTime1": 1110001,"epochKey2":"c0c1c2c3c4c5c6c7c8c9cacbcccdcecf", "epochStartTime2": 1110002 }' 1 0 + + Verify the KeySetWrite command On TH (all-Clusters-app) log and below is the sample log provided for the raspi platform: + + [1706722808.568204][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706722808.568218][5404:5404] CHIP:DMG: { + [1706722808.568225][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722808.568237][5404:5404] CHIP:DMG: timedRequest = false, + [1706722808.568247][5404:5404] CHIP:DMG: InvokeRequests = + [1706722808.568272][5404:5404] CHIP:DMG: [ + [1706722808.568281][5404:5404] CHIP:DMG: CommandDataIB = + [1706722808.568290][5404:5404] CHIP:DMG: { + [1706722808.568298][5404:5404] CHIP:DMG: CommandPathIB = + [1706722808.568315][5404:5404] CHIP:DMG: { + [1706722808.568328][5404:5404] CHIP:DMG: EndpointId = 0x0, + [1706722808.568341][5404:5404] CHIP:DMG: ClusterId = 0x3f, + [1706722808.568356][5404:5404] CHIP:DMG: CommandId = 0x0, + [1706722808.568366][5404:5404] CHIP:DMG: }, + [1706722808.568381][5404:5404] CHIP:DMG: + [1706722808.568391][5404:5404] CHIP:DMG: CommandFields = + [1706722808.568403][5404:5404] CHIP:DMG: { + [1706722808.568414][5404:5404] CHIP:DMG: 0x0 = + [1706722808.568426][5404:5404] CHIP:DMG: { + [1706722808.568439][5404:5404] CHIP:DMG: 0x0 = 417, + [1706722808.568453][5404:5404] CHIP:DMG: 0x1 = 0, + [1706722808.568465][5404:5404] CHIP:DMG: 0x2 = [ + [1706722808.568482][5404:5404] CHIP:DMG: 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + [1706722808.568498][5404:5404] CHIP:DMG: ] (16 bytes) + [1706722808.568511][5404:5404] CHIP:DMG: 0x3 = 1110000, + [1706722808.568523][5404:5404] CHIP:DMG: 0x4 = [ + [1706722808.568539][5404:5404] CHIP:DMG: 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + [1706722808.568553][5404:5404] CHIP:DMG: ] (16 bytes) + [1706722808.568578][5404:5404] CHIP:DMG: 0x5 = 1110001, + [1706722808.568594][5404:5404] CHIP:DMG: 0x6 = [ + [1706722808.568610][5404:5404] CHIP:DMG: 0xc2, 0xc1, 0xc2, 0xc3, 0cd4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + [1706722808.568623][5404:5404] CHIP:DMG: ] (16 bytes) + [1706722808.568633][5404:5404] CHIP:DMG: 0x7 = 1110002, + [1706722808.568645][5404:5404] CHIP:DMG: }, + [1706722808.568661][5404:5404] CHIP:DMG: }, + [1706722808.568671][5404:5404] CHIP:DMG: }, + [1706722808.568695][5404:5404] CHIP:DMG: + [1706722808.568704][5404:5404] CHIP:DMG: ], + [1706722808.568729][5404:5404] CHIP:DMG: + [1706722808.568739][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722808.568747][5404:5404] CHIP:DMG: }, + disabled: true + + - label: + "Step 0c: Precondition 3: TH binds GroupIds 0x0001 and 0x0002 with + GroupKeySetID 0x01a1 in the GroupKeyMap attribute list on + GroupKeyManagement cluster by writing the GroupKeyMap attribute with + two entries as follows: * List item 1: - FabricIndex: 1 - GroupId: + 0x0001 - GroupKeySetId: 0x01a1" + verification: | + Please execute the below commands before starting the test case : + + ./chip-tool groupkeymanagement write group-key-map '[{"groupId": "0x0001", "groupKeySetID": "0x01a1", "fabricIndex": 1} ]' 1 0 + + Verify the GroupKeyMap attribute On TH (all-Clusters-app) log and below is the sample log provided for the raspi platform: + + [1706722844.841613][5404:5404] CHIP:DMG: WriteRequestMessage = + [1706722844.841616][5404:5404] CHIP:DMG: { + [1706722844.841619][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722844.841621][5404:5404] CHIP:DMG: timedRequest = false, + [1706722844.841625][5404:5404] CHIP:DMG: AttributeDataIBs = + [1706722844.841629][5404:5404] CHIP:DMG: [ + [1706722844.841632][5404:5404] CHIP:DMG: AttributeDataIB = + [1706722844.841636][5404:5404] CHIP:DMG: { + [1706722844.841639][5404:5404] CHIP:DMG: AttributePathIB = + [1706722844.841643][5404:5404] CHIP:DMG: { + [1706722844.841646][5404:5404] CHIP:DMG: Endpoint = 0x0, + [1706722844.841649][5404:5404] CHIP:DMG: Cluster = 0x3f, + [1706722844.841652][5404:5404] CHIP:DMG: Attribute = 0x0000_0000, + [1706722844.841655][5404:5404] CHIP:DMG: } + [1706722844.841659][5404:5404] CHIP:DMG: + [1706722844.841662][5404:5404] CHIP:DMG: Data = [ + [1706722844.841665][5404:5404] CHIP:DMG: + [1706722844.841668][5404:5404] CHIP:DMG: ], + [1706722844.841670][5404:5404] CHIP:DMG: }, + [1706722844.841677][5404:5404] CHIP:DMG: + [1706722844.841680][5404:5404] CHIP:DMG: AttributeDataIB = + [1706722844.841682][5404:5404] CHIP:DMG: { + [1706722844.841685][5404:5404] CHIP:DMG: AttributePathIB = + [1706722844.841687][5404:5404] CHIP:DMG: { + [1706722844.841690][5404:5404] CHIP:DMG: Endpoint = 0x0, + [1706722844.841693][5404:5404] CHIP:DMG: Cluster = 0x3f, + [1706722844.841696][5404:5404] CHIP:DMG: Attribute = 0x0000_0000, + [1706722844.841699][5404:5404] CHIP:DMG: ListIndex = Null, + [1706722844.841702][5404:5404] CHIP:DMG: } + [1706722844.841706][5404:5404] CHIP:DMG: + [1706722844.841708][5404:5404] CHIP:DMG: Data = + [1706722844.841711][5404:5404] CHIP:DMG: { + [1706722844.841715][5404:5404] CHIP:DMG: 0x1 = 1, + [1706722844.841718][5404:5404] CHIP:DMG: 0x2 = 417, + [1706722844.841721][5404:5404] CHIP:DMG: }, + [1706722844.841723][5404:5404] CHIP:DMG: }, + [1706722844.841727][5404:5404] CHIP:DMG: + [1706722844.841730][5404:5404] CHIP:DMG: ], + [1706722844.841736][5404:5404] CHIP:DMG: + [1706722844.841738][5404:5404] CHIP:DMG: moreChunkedMessages = false, + [1706722844.841741][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722844.841743][5404:5404] CHIP:DMG: }, + disabled: true + + - label: + "Step 0d: Precondition 4: TH sends a RemoveAllGroups command to DUT." + verification: | + Please execute the below commands before starting the test case : + + ./chip-tool groups remove-all-groups 1 1 + + Verify DUT responds with SUCCESS status response on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: + + [1653485455.344097][11508:11513] CHIP:DMG: StatusIB = + [1653485455.344141][11508:11513] CHIP:DMG: { + [1653485455.344190][11508:11513] CHIP:DMG: status = 0x00 (SUCCESS), + [1653485455.344236][11508:11513] CHIP:DMG: }, + disabled: true + + - label: + "Step 0e: Precondition 5: TH sends a AddGroup command to DUT with the + GroupID field set to G1." + verification: | + Please execute the below commands before starting the test case : + + ./chip-tool groups add-group 0x01 Gp1 1 1 + + Verify the AddGroup Command on TH (all-Clusters-app) log and below is the sample log provided for the raspi platform: + + [1706722872.295182][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706722872.295185][5404:5404] CHIP:DMG: { + [1706722872.295188][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722872.295191][5404:5404] CHIP:DMG: timedRequest = false, + [1706722872.295194][5404:5404] CHIP:DMG: InvokeRequests = + [1706722872.295199][5404:5404] CHIP:DMG: [ + [1706722872.295201][5404:5404] CHIP:DMG: CommandDataIB = + [1706722872.295205][5404:5404] CHIP:DMG: { + [1706722872.295207][5404:5404] CHIP:DMG: CommandPathIB = + [1706722872.295211][5404:5404] CHIP:DMG: { + [1706722872.295214][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706722872.295217][5404:5404] CHIP:DMG: ClusterId = 0x4, + [1706722872.295220][5404:5404] CHIP:DMG: CommandId = 0x0, + [1706722872.295223][5404:5404] CHIP:DMG: }, + [1706722872.295226][5404:5404] CHIP:DMG: + [1706722872.295229][5404:5404] CHIP:DMG: CommandFields = + [1706722872.295233][5404:5404] CHIP:DMG: { + [1706722872.295236][5404:5404] CHIP:DMG: 0x0 = 1, + [1706722872.295240][5404:5404] CHIP:DMG: 0x1 = "Gp1" (3 chars), + [1706722872.295243][5404:5404] CHIP:DMG: }, + [1706722872.295246][5404:5404] CHIP:DMG: }, + [1706722872.295250][5404:5404] CHIP:DMG: + [1706722872.295253][5404:5404] CHIP:DMG: ], + [1706722872.295257][5404:5404] CHIP:DMG: + [1706722872.295260][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722872.295262][5404:5404] CHIP:DMG: }, + disabled: true + - label: "Step 1: DUT issues a C_ADD_SCENE command to the Test Harness." PICS: S.C.C00.Tx verification: | - ./chip-tool scenesmanagement add-scene 0x0001 0x01 1 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4001", "attributeValue": "0x01"}]}]' 1 1 + ./chip-tool scenesmanagement add-scene 0x0001 0x01 20 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4001", "attributeValue": "0x01"}]}]' 1 1 - Verify TH recieves "AddScene" command with following parameters: + Verify TH recieves "AddScene(0x0)" command with following parameters: - ID 0 (GroupID): the type is a group-id. - ID 1 (SceneID): the type is an uint8. - ID 2 (TransitionTime): the type is an uint16; max of 60000. - ID 3 (SceneName): the type is a string; max of 16 bytes - ID 4 (ExtensionFieldSetStructs): the type is a list of ExtensionFieldSetStruct: ClusterID and AttributeValueList. on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701765953.034002][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701765953.034015][9503:9503] CHIP:DMG: { - [1701765953.034025][9503:9503] CHIP:DMG: suppressResponse = false, - [1701765953.034040][9503:9503] CHIP:DMG: timedRequest = false, - [1701765953.034049][9503:9503] CHIP:DMG: InvokeRequests = - [1701765953.034078][9503:9503] CHIP:DMG: [ - [1701765953.034088][9503:9503] CHIP:DMG: CommandDataIB = - [1701765953.034103][9503:9503] CHIP:DMG: { - [1701765953.034115][9503:9503] CHIP:DMG: CommandPathIB = - [1701765953.034128][9503:9503] CHIP:DMG: { - [1701765953.034139][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701765953.034152][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701765953.034165][9503:9503] CHIP:DMG: CommandId = 0x0, - [1701765953.034176][9503:9503] CHIP:DMG: }, - [1701765953.034195][9503:9503] CHIP:DMG: - [1701765953.034206][9503:9503] CHIP:DMG: CommandFields = - [1701765953.034219][9503:9503] CHIP:DMG: { - [1701765953.034232][9503:9503] CHIP:DMG: 0x0 = 1, - [1701765953.034246][9503:9503] CHIP:DMG: 0x1 = 1, - [1701765953.034259][9503:9503] CHIP:DMG: 0x2 = 1, - [1701765953.034286][9503:9503] CHIP:DMG: 0x3 = "scene name" (10 chars), - [1701765953.034299][9503:9503] CHIP:DMG: 0x4 = [ - [1701765953.034313][9503:9503] CHIP:DMG: - [1701765953.034342][9503:9503] CHIP:DMG: { - [1701765953.034356][9503:9503] CHIP:DMG: 0x0 = 768, - [1701765953.034368][9503:9503] CHIP:DMG: 0x1 = [ - [1701765953.034382][9503:9503] CHIP:DMG: - [1701765953.034397][9503:9503] CHIP:DMG: { - [1701765953.034416][9503:9503] CHIP:DMG: 0x0 = 16385, - [1701765953.034432][9503:9503] CHIP:DMG: 0x1 = 1, - [1701765953.034448][9503:9503] CHIP:DMG: }, - [1701765953.034463][9503:9503] CHIP:DMG: ], - [1701765953.034475][9503:9503] CHIP:DMG: }, - [1701765953.034487][9503:9503] CHIP:DMG: ], - [1701765953.034500][9503:9503] CHIP:DMG: }, - [1701765953.034510][9503:9503] CHIP:DMG: }, - [1701765953.034537][9503:9503] CHIP:DMG: - [1701765953.034547][9503:9503] CHIP:DMG: ], - [1701765953.034573][9503:9503] CHIP:DMG: - [1701765953.034584][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701765953.034594][9503:9503] CHIP:DMG: }, + [1706722915.343620][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706722915.343637][5404:5404] CHIP:DMG: { + [1706722915.343649][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722915.343664][5404:5404] CHIP:DMG: timedRequest = false, + [1706722915.343676][5404:5404] CHIP:DMG: InvokeRequests = + [1706722915.343714][5404:5404] CHIP:DMG: [ + [1706722915.343729][5404:5404] CHIP:DMG: CommandDataIB = + [1706722915.343743][5404:5404] CHIP:DMG: { + [1706722915.343758][5404:5404] CHIP:DMG: CommandPathIB = + [1706722915.343776][5404:5404] CHIP:DMG: { + [1706722915.343794][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706722915.343812][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706722915.343831][5404:5404] CHIP:DMG: CommandId = 0x0, + [1706722915.343846][5404:5404] CHIP:DMG: }, + [1706722915.343867][5404:5404] CHIP:DMG: + [1706722915.343883][5404:5404] CHIP:DMG: CommandFields = + [1706722915.343900][5404:5404] CHIP:DMG: { + [1706722915.343920][5404:5404] CHIP:DMG: 0x0 = 1, + [1706722915.343939][5404:5404] CHIP:DMG: 0x1 = 1, + [1706722915.343958][5404:5404] CHIP:DMG: 0x2 = 20, + [1706722915.343981][5404:5404] CHIP:DMG: 0x3 = "scene name" (10 chars), + [1706722915.343999][5404:5404] CHIP:DMG: 0x4 = [ + [1706722915.344018][5404:5404] CHIP:DMG: + [1706722915.344037][5404:5404] CHIP:DMG: { + [1706722915.344073][5404:5404] CHIP:DMG: 0x0 = 768, + [1706722915.344094][5404:5404] CHIP:DMG: 0x1 = [ + [1706722915.344117][5404:5404] CHIP:DMG: + [1706722915.344142][5404:5404] CHIP:DMG: { + [1706722915.344174][5404:5404] CHIP:DMG: 0x0 = 16385, + [1706722915.344200][5404:5404] CHIP:DMG: 0x1 = 1, + [1706722915.344226][5404:5404] CHIP:DMG: }, + [1706722915.344248][5404:5404] CHIP:DMG: ], + [1706722915.344268][5404:5404] CHIP:DMG: }, + [1706722915.344286][5404:5404] CHIP:DMG: ], + [1706722915.344303][5404:5404] CHIP:DMG: }, + [1706722915.344317][5404:5404] CHIP:DMG: }, + [1706722915.344355][5404:5404] CHIP:DMG: + [1706722915.344368][5404:5404] CHIP:DMG: ], + [1706722915.344408][5404:5404] CHIP:DMG: + [1706722915.344422][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722915.344436][5404:5404] CHIP:DMG: }, disabled: true - label: "Step 2: DUT issues a C_VIEW_SCENE command to the Test Harness." @@ -96,36 +264,36 @@ tests: verification: | ./chip-tool scenesmanagement view-scene 0x0001 0x01 1 1 - Verify TH recieves "ViewScene" command with following parameters: + Verify TH recieves "ViewScene(0x1)" command with following parameters: - ID 0 (GroupID): the type is a group-id. - ID 1 (SceneID): the type is an uint8.on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701766130.182823][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766130.182837][9503:9503] CHIP:DMG: { - [1701766130.182848][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766130.182859][9503:9503] CHIP:DMG: timedRequest = false, - [1701766130.182869][9503:9503] CHIP:DMG: InvokeRequests = - [1701766130.182889][9503:9503] CHIP:DMG: [ - [1701766130.182899][9503:9503] CHIP:DMG: CommandDataIB = - [1701766130.182911][9503:9503] CHIP:DMG: { - [1701766130.182919][9503:9503] CHIP:DMG: CommandPathIB = - [1701766130.182935][9503:9503] CHIP:DMG: { - [1701766130.182947][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766130.182960][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766130.182971][9503:9503] CHIP:DMG: CommandId = 0x1, - [1701766130.182982][9503:9503] CHIP:DMG: }, - [1701766130.182996][9503:9503] CHIP:DMG: - [1701766130.183007][9503:9503] CHIP:DMG: CommandFields = - [1701766130.183018][9503:9503] CHIP:DMG: { - [1701766130.183032][9503:9503] CHIP:DMG: 0x0 = 1, - [1701766130.183044][9503:9503] CHIP:DMG: 0x1 = 1, - [1701766130.183056][9503:9503] CHIP:DMG: }, - [1701766130.183066][9503:9503] CHIP:DMG: }, - [1701766130.183082][9503:9503] CHIP:DMG: - [1701766130.183091][9503:9503] CHIP:DMG: ], - [1701766130.183110][9503:9503] CHIP:DMG: - [1701766130.183120][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766130.183129][9503:9503] CHIP:DMG: }, + [1706722945.925814][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706722945.925826][5404:5404] CHIP:DMG: { + [1706722945.925837][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722945.925850][5404:5404] CHIP:DMG: timedRequest = false, + [1706722945.925860][5404:5404] CHIP:DMG: InvokeRequests = + [1706722945.925888][5404:5404] CHIP:DMG: [ + [1706722945.925903][5404:5404] CHIP:DMG: CommandDataIB = + [1706722945.925924][5404:5404] CHIP:DMG: { + [1706722945.925937][5404:5404] CHIP:DMG: CommandPathIB = + [1706722945.925950][5404:5404] CHIP:DMG: { + [1706722945.925965][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706722945.925980][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706722945.925998][5404:5404] CHIP:DMG: CommandId = 0x1, + [1706722945.926014][5404:5404] CHIP:DMG: }, + [1706722945.926035][5404:5404] CHIP:DMG: + [1706722945.926051][5404:5404] CHIP:DMG: CommandFields = + [1706722945.926070][5404:5404] CHIP:DMG: { + [1706722945.926090][5404:5404] CHIP:DMG: 0x0 = 1, + [1706722945.926110][5404:5404] CHIP:DMG: 0x1 = 1, + [1706722945.926126][5404:5404] CHIP:DMG: }, + [1706722945.926141][5404:5404] CHIP:DMG: }, + [1706722945.926165][5404:5404] CHIP:DMG: + [1706722945.926176][5404:5404] CHIP:DMG: ], + [1706722945.926197][5404:5404] CHIP:DMG: + [1706722945.926208][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722945.926218][5404:5404] CHIP:DMG: }, disabled: true - label: "Step 3: DUT issues a C_REMOVE_SCENE command to the Test Harness." @@ -133,37 +301,37 @@ tests: verification: | ./chip-tool scenesmanagement remove-scene 0x0001 0x01 1 1 - Verify TH recieves "RemoveScene" command with following parameters: + Verify TH recieves "RemoveScene(0x2)" command with following parameters: - ID 0 (GroupID): the type is a group-id. - ID 1 (SceneID): the type is an uint8. on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701766180.585251][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766180.585255][9503:9503] CHIP:DMG: { - [1701766180.585259][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766180.585263][9503:9503] CHIP:DMG: timedRequest = false, - [1701766180.585267][9503:9503] CHIP:DMG: InvokeRequests = - [1701766180.585273][9503:9503] CHIP:DMG: [ - [1701766180.585276][9503:9503] CHIP:DMG: CommandDataIB = - [1701766180.585279][9503:9503] CHIP:DMG: { - [1701766180.585282][9503:9503] CHIP:DMG: CommandPathIB = - [1701766180.585286][9503:9503] CHIP:DMG: { - [1701766180.585289][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766180.585292][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766180.585296][9503:9503] CHIP:DMG: CommandId = 0x2, - [1701766180.585298][9503:9503] CHIP:DMG: }, - [1701766180.585302][9503:9503] CHIP:DMG: - [1701766180.585305][9503:9503] CHIP:DMG: CommandFields = - [1701766180.585308][9503:9503] CHIP:DMG: { - [1701766180.585312][9503:9503] CHIP:DMG: 0x0 = 1, - [1701766180.585315][9503:9503] CHIP:DMG: 0x1 = 1, - [1701766180.585318][9503:9503] CHIP:DMG: }, - [1701766180.585320][9503:9503] CHIP:DMG: }, - [1701766180.585325][9503:9503] CHIP:DMG: - [1701766180.585327][9503:9503] CHIP:DMG: ], - [1701766180.585332][9503:9503] CHIP:DMG: - [1701766180.585334][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766180.585337][9503:9503] CHIP:DMG: }, + [1706722967.651552][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706722967.651557][5404:5404] CHIP:DMG: { + [1706722967.651561][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722967.651565][5404:5404] CHIP:DMG: timedRequest = false, + [1706722967.651570][5404:5404] CHIP:DMG: InvokeRequests = + [1706722967.651577][5404:5404] CHIP:DMG: [ + [1706722967.651580][5404:5404] CHIP:DMG: CommandDataIB = + [1706722967.651585][5404:5404] CHIP:DMG: { + [1706722967.651588][5404:5404] CHIP:DMG: CommandPathIB = + [1706722967.651593][5404:5404] CHIP:DMG: { + [1706722967.651598][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706722967.651602][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706722967.651606][5404:5404] CHIP:DMG: CommandId = 0x2, + [1706722967.651610][5404:5404] CHIP:DMG: }, + [1706722967.651615][5404:5404] CHIP:DMG: + [1706722967.651619][5404:5404] CHIP:DMG: CommandFields = + [1706722967.651623][5404:5404] CHIP:DMG: { + [1706722967.651628][5404:5404] CHIP:DMG: 0x0 = 1, + [1706722967.651633][5404:5404] CHIP:DMG: 0x1 = 1, + [1706722967.651636][5404:5404] CHIP:DMG: }, + [1706722967.651640][5404:5404] CHIP:DMG: }, + [1706722967.651646][5404:5404] CHIP:DMG: + [1706722967.651649][5404:5404] CHIP:DMG: ], + [1706722967.651655][5404:5404] CHIP:DMG: + [1706722967.651658][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722967.651661][5404:5404] CHIP:DMG: }, disabled: true - label: @@ -172,35 +340,35 @@ tests: verification: | ./chip-tool scenesmanagement remove-all-scenes 0x0001 1 1 - Verify TH recieves "RemoveAllScenes" command with following parameters: + Verify TH recieves "RemoveAllScenes(0x3)" command with following parameters: - ID 0 (GroupID): the type is a group-id. on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701766227.694588][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766227.694600][9503:9503] CHIP:DMG: { - [1701766227.694608][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766227.694618][9503:9503] CHIP:DMG: timedRequest = false, - [1701766227.694625][9503:9503] CHIP:DMG: InvokeRequests = - [1701766227.694641][9503:9503] CHIP:DMG: [ - [1701766227.694648][9503:9503] CHIP:DMG: CommandDataIB = - [1701766227.694669][9503:9503] CHIP:DMG: { - [1701766227.694680][9503:9503] CHIP:DMG: CommandPathIB = - [1701766227.694692][9503:9503] CHIP:DMG: { - [1701766227.694704][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766227.694717][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766227.694729][9503:9503] CHIP:DMG: CommandId = 0x3, - [1701766227.694739][9503:9503] CHIP:DMG: }, - [1701766227.694753][9503:9503] CHIP:DMG: - [1701766227.694763][9503:9503] CHIP:DMG: CommandFields = - [1701766227.694775][9503:9503] CHIP:DMG: { - [1701766227.694788][9503:9503] CHIP:DMG: 0x0 = 1, - [1701766227.694800][9503:9503] CHIP:DMG: }, - [1701766227.694810][9503:9503] CHIP:DMG: }, - [1701766227.694826][9503:9503] CHIP:DMG: - [1701766227.694836][9503:9503] CHIP:DMG: ], - [1701766227.694853][9503:9503] CHIP:DMG: - [1701766227.694863][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766227.694872][9503:9503] CHIP:DMG: }, + [1706722986.792332][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706722986.792353][5404:5404] CHIP:DMG: { + [1706722986.792374][5404:5404] CHIP:DMG: suppressResponse = false, + [1706722986.792388][5404:5404] CHIP:DMG: timedRequest = false, + [1706722986.792395][5404:5404] CHIP:DMG: InvokeRequests = + [1706722986.792415][5404:5404] CHIP:DMG: [ + [1706722986.792425][5404:5404] CHIP:DMG: CommandDataIB = + [1706722986.792446][5404:5404] CHIP:DMG: { + [1706722986.792460][5404:5404] CHIP:DMG: CommandPathIB = + [1706722986.792475][5404:5404] CHIP:DMG: { + [1706722986.792490][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706722986.792508][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706722986.792522][5404:5404] CHIP:DMG: CommandId = 0x3, + [1706722986.792535][5404:5404] CHIP:DMG: }, + [1706722986.792553][5404:5404] CHIP:DMG: + [1706722986.792568][5404:5404] CHIP:DMG: CommandFields = + [1706722986.792585][5404:5404] CHIP:DMG: { + [1706722986.792600][5404:5404] CHIP:DMG: 0x0 = 1, + [1706722986.792612][5404:5404] CHIP:DMG: }, + [1706722986.792621][5404:5404] CHIP:DMG: }, + [1706722986.792638][5404:5404] CHIP:DMG: + [1706722986.792647][5404:5404] CHIP:DMG: ], + [1706722986.792669][5404:5404] CHIP:DMG: + [1706722986.792679][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706722986.792689][5404:5404] CHIP:DMG: }, disabled: true - label: "Step 5: DUT issues a C_STORE_SCENE command to the Test Harness." @@ -208,74 +376,76 @@ tests: verification: | ./chip-tool scenesmanagement store-scene 0x0001 0x01 1 1 - Verify TH recieves "StoreScene" command with following parameters: + Verify TH recieves "StoreScene(0x4)" command with following parameters: - ID 0 (GroupID): the type is a group-id. - ID 1 (SceneID): the type is an uint8. on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701766289.958764][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766289.958776][9503:9503] CHIP:DMG: { - [1701766289.958784][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766289.958794][9503:9503] CHIP:DMG: timedRequest = false, - [1701766289.958801][9503:9503] CHIP:DMG: InvokeRequests = - [1701766289.958818][9503:9503] CHIP:DMG: [ - [1701766289.958825][9503:9503] CHIP:DMG: CommandDataIB = - [1701766289.958845][9503:9503] CHIP:DMG: { - [1701766289.958855][9503:9503] CHIP:DMG: CommandPathIB = - [1701766289.958868][9503:9503] CHIP:DMG: { - [1701766289.958879][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766289.958892][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766289.958911][9503:9503] CHIP:DMG: CommandId = 0x4, - [1701766289.958924][9503:9503] CHIP:DMG: }, - [1701766289.958937][9503:9503] CHIP:DMG: - [1701766289.958948][9503:9503] CHIP:DMG: CommandFields = - [1701766289.958960][9503:9503] CHIP:DMG: { - [1701766289.958973][9503:9503] CHIP:DMG: 0x0 = 1, - [1701766289.958986][9503:9503] CHIP:DMG: 0x1 = 1, - [1701766289.958997][9503:9503] CHIP:DMG: }, - [1701766289.959007][9503:9503] CHIP:DMG: }, - [1701766289.959024][9503:9503] CHIP:DMG: - [1701766289.959033][9503:9503] CHIP:DMG: ], - [1701766289.959051][9503:9503] CHIP:DMG: - [1701766289.959061][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766289.959070][9503:9503] CHIP:DMG: }, + [1706723006.082174][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706723006.082187][5404:5404] CHIP:DMG: { + [1706723006.082196][5404:5404] CHIP:DMG: suppressResponse = false, + [1706723006.082208][5404:5404] CHIP:DMG: timedRequest = false, + [1706723006.082218][5404:5404] CHIP:DMG: InvokeRequests = + [1706723006.082237][5404:5404] CHIP:DMG: [ + [1706723006.082247][5404:5404] CHIP:DMG: CommandDataIB = + [1706723006.082258][5404:5404] CHIP:DMG: { + [1706723006.082268][5404:5404] CHIP:DMG: CommandPathIB = + [1706723006.082280][5404:5404] CHIP:DMG: { + [1706723006.082292][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706723006.082304][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706723006.082316][5404:5404] CHIP:DMG: CommandId = 0x4, + [1706723006.082326][5404:5404] CHIP:DMG: }, + [1706723006.082341][5404:5404] CHIP:DMG: + [1706723006.082351][5404:5404] CHIP:DMG: CommandFields = + [1706723006.082362][5404:5404] CHIP:DMG: { + [1706723006.082376][5404:5404] CHIP:DMG: 0x0 = 1, + [1706723006.082388][5404:5404] CHIP:DMG: 0x1 = 1, + [1706723006.082399][5404:5404] CHIP:DMG: }, + [1706723006.082409][5404:5404] CHIP:DMG: }, + [1706723006.082425][5404:5404] CHIP:DMG: + [1706723006.082434][5404:5404] CHIP:DMG: ], + [1706723006.082451][5404:5404] CHIP:DMG: + [1706723006.082461][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706723006.082471][5404:5404] CHIP:DMG: }, disabled: true - label: "Step 6: DUT issues a C_RECALL_SCENE command to the Test Harness." PICS: S.C.C05.Tx verification: | - ./chip-tool scenesmanagement recall-scene 0x0001 0x01 1 1 + ./chip-tool scenesmanagement recall-scene 0x0001 0x01 1 1 --TransitionTime 10 - Verify TH recieves "RecallScene" command with following parameters: + Verify TH recieves "RecallScene(0x5)" command with following parameters: - ID 0 (GroupID): the type is a group-id. - - ID 1 (SceneID): the type is an uint8 on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - - [1701766368.793204][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766368.793216][9503:9503] CHIP:DMG: { - [1701766368.793226][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766368.793238][9503:9503] CHIP:DMG: timedRequest = false, - [1701766368.793248][9503:9503] CHIP:DMG: InvokeRequests = - [1701766368.793267][9503:9503] CHIP:DMG: [ - [1701766368.793276][9503:9503] CHIP:DMG: CommandDataIB = - [1701766368.793288][9503:9503] CHIP:DMG: { - [1701766368.793298][9503:9503] CHIP:DMG: CommandPathIB = - [1701766368.793309][9503:9503] CHIP:DMG: { - [1701766368.793321][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766368.793334][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766368.793346][9503:9503] CHIP:DMG: CommandId = 0x5, - [1701766368.793355][9503:9503] CHIP:DMG: }, - [1701766368.793369][9503:9503] CHIP:DMG: - [1701766368.793380][9503:9503] CHIP:DMG: CommandFields = - [1701766368.793392][9503:9503] CHIP:DMG: { - [1701766368.793405][9503:9503] CHIP:DMG: 0x0 = 1, - [1701766368.793417][9503:9503] CHIP:DMG: 0x1 = 1, - [1701766368.793429][9503:9503] CHIP:DMG: }, - [1701766368.793439][9503:9503] CHIP:DMG: }, - [1701766368.793456][9503:9503] CHIP:DMG: - [1701766368.793465][9503:9503] CHIP:DMG: ], - [1701766368.793483][9503:9503] CHIP:DMG: - [1701766368.793493][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766368.793502][9503:9503] CHIP:DMG: }, + - ID 1 (SceneID): the type is an uint8 + - Optional ID 2 (TransitionTime): the type is an uint32; max of 60000000 on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: + + [1706723348.325563][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706723348.325580][5404:5404] CHIP:DMG: { + [1706723348.325596][5404:5404] CHIP:DMG: suppressResponse = false, + [1706723348.325613][5404:5404] CHIP:DMG: timedRequest = false, + [1706723348.325628][5404:5404] CHIP:DMG: InvokeRequests = + [1706723348.325657][5404:5404] CHIP:DMG: [ + [1706723348.325671][5404:5404] CHIP:DMG: CommandDataIB = + [1706723348.325689][5404:5404] CHIP:DMG: { + [1706723348.325703][5404:5404] CHIP:DMG: CommandPathIB = + [1706723348.325721][5404:5404] CHIP:DMG: { + [1706723348.325740][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706723348.325758][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706723348.325776][5404:5404] CHIP:DMG: CommandId = 0x5, + [1706723348.325792][5404:5404] CHIP:DMG: }, + [1706723348.325812][5404:5404] CHIP:DMG: + [1706723348.325829][5404:5404] CHIP:DMG: CommandFields = + [1706723348.325846][5404:5404] CHIP:DMG: { + [1706723348.325865][5404:5404] CHIP:DMG: 0x0 = 1, + [1706723348.325885][5404:5404] CHIP:DMG: 0x1 = 1, + [1706723348.325904][5404:5404] CHIP:DMG: 0x2 = 10, + [1706723348.325924][5404:5404] CHIP:DMG: }, + [1706723348.325938][5404:5404] CHIP:DMG: }, + [1706723348.325965][5404:5404] CHIP:DMG: + [1706723348.325979][5404:5404] CHIP:DMG: ], + [1706723348.326007][5404:5404] CHIP:DMG: + [1706723348.326022][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706723348.326035][5404:5404] CHIP:DMG: }, disabled: true - label: @@ -285,76 +455,76 @@ tests: verification: | ./chip-tool scenesmanagement get-scene-membership 0x00001 1 1 - Verify TH recieves "GetSceneMembership" command with following parameters: + Verify TH recieves "GetSceneMembership(0x6)" command with following parameters: - ID 0 (GroupID): the type is a group-id. on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701766468.058659][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766468.058673][9503:9503] CHIP:DMG: { - [1701766468.058684][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766468.058695][9503:9503] CHIP:DMG: timedRequest = false, - [1701766468.058705][9503:9503] CHIP:DMG: InvokeRequests = - [1701766468.058724][9503:9503] CHIP:DMG: [ - [1701766468.058733][9503:9503] CHIP:DMG: CommandDataIB = - [1701766468.058745][9503:9503] CHIP:DMG: { - [1701766468.058754][9503:9503] CHIP:DMG: CommandPathIB = - [1701766468.058766][9503:9503] CHIP:DMG: { - [1701766468.058778][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766468.058790][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766468.058802][9503:9503] CHIP:DMG: CommandId = 0x6, - [1701766468.058813][9503:9503] CHIP:DMG: }, - [1701766468.058827][9503:9503] CHIP:DMG: - [1701766468.058837][9503:9503] CHIP:DMG: CommandFields = - [1701766468.058849][9503:9503] CHIP:DMG: { - [1701766468.058862][9503:9503] CHIP:DMG: 0x0 = 1, - [1701766468.058874][9503:9503] CHIP:DMG: }, - [1701766468.058883][9503:9503] CHIP:DMG: }, - [1701766468.058900][9503:9503] CHIP:DMG: - [1701766468.058909][9503:9503] CHIP:DMG: ], - [1701766468.058927][9503:9503] CHIP:DMG: - [1701766468.058937][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766468.058946][9503:9503] CHIP:DMG: }, + [1706723042.993627][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706723042.993631][5404:5404] CHIP:DMG: { + [1706723042.993634][5404:5404] CHIP:DMG: suppressResponse = false, + [1706723042.993639][5404:5404] CHIP:DMG: timedRequest = false, + [1706723042.993644][5404:5404] CHIP:DMG: InvokeRequests = + [1706723042.993651][5404:5404] CHIP:DMG: [ + [1706723042.993655][5404:5404] CHIP:DMG: CommandDataIB = + [1706723042.993660][5404:5404] CHIP:DMG: { + [1706723042.993664][5404:5404] CHIP:DMG: CommandPathIB = + [1706723042.993669][5404:5404] CHIP:DMG: { + [1706723042.993674][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706723042.993685][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706723042.993690][5404:5404] CHIP:DMG: CommandId = 0x6, + [1706723042.993694][5404:5404] CHIP:DMG: }, + [1706723042.993699][5404:5404] CHIP:DMG: + [1706723042.993703][5404:5404] CHIP:DMG: CommandFields = + [1706723042.993708][5404:5404] CHIP:DMG: { + [1706723042.993713][5404:5404] CHIP:DMG: 0x0 = 1, + [1706723042.993718][5404:5404] CHIP:DMG: }, + [1706723042.993722][5404:5404] CHIP:DMG: }, + [1706723042.993728][5404:5404] CHIP:DMG: + [1706723042.993732][5404:5404] CHIP:DMG: ], + [1706723042.993739][5404:5404] CHIP:DMG: + [1706723042.993743][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706723042.993746][5404:5404] CHIP:DMG: }, disabled: true - label: "Step 8: DUT issues a C_COPY_SCENE command to the Test Harness." - PICS: S.C.C09.Tx + PICS: S.C.C40.Tx verification: | ./chip-tool scenesmanagement copy-scene 0x00 0x01 0x01 0x01 0x02 1 1 - Verify TH recieves "CopyScene" command with following parameters: + Verify TH recieves "CopyScene( 0x40)" command with following parameters: - ID 0 (Mode): the type is a CopyModeBitmap; If this value is set to 1, all scenes are to be copied. Otherwise this bit is set to 0 - ID 1 (GroupIdentifierFrom): the type is an group-id. - ID 2 (SceneIdentifierFrom): the type is an uint8. - ID 3 (GroupIdentifierTo): the type is an group-id. - ID 4 (SceneIdentifierTo): the type is an uint8. on TH (all-cluster-app) log and below is the sample log provided for the raspi platform: - [1701766693.900630][9503:9503] CHIP:DMG: InvokeRequestMessage = - [1701766693.900646][9503:9503] CHIP:DMG: { - [1701766693.900662][9503:9503] CHIP:DMG: suppressResponse = false, - [1701766693.900680][9503:9503] CHIP:DMG: timedRequest = false, - [1701766693.900694][9503:9503] CHIP:DMG: InvokeRequests = - [1701766693.900723][9503:9503] CHIP:DMG: [ - [1701766693.900735][9503:9503] CHIP:DMG: CommandDataIB = - [1701766693.900752][9503:9503] CHIP:DMG: { - [1701766693.900766][9503:9503] CHIP:DMG: CommandPathIB = - [1701766693.900784][9503:9503] CHIP:DMG: { - [1701766693.900801][9503:9503] CHIP:DMG: EndpointId = 0x1, - [1701766693.900819][9503:9503] CHIP:DMG: ClusterId = 0x5, - [1701766693.900836][9503:9503] CHIP:DMG: CommandId = 0x42, - [1701766693.900850][9503:9503] CHIP:DMG: }, - [1701766693.900870][9503:9503] CHIP:DMG: - [1701766693.900884][9503:9503] CHIP:DMG: CommandFields = - [1701766693.900902][9503:9503] CHIP:DMG: { - [1701766693.900921][9503:9503] CHIP:DMG: 0x0 = 0, - [1701766693.900938][9503:9503] CHIP:DMG: 0x1 = 1, - [1701766693.900955][9503:9503] CHIP:DMG: 0x2 = 1, - [1701766693.900973][9503:9503] CHIP:DMG: 0x3 = 1, - [1701766693.900990][9503:9503] CHIP:DMG: 0x4 = 2, - [1701766693.901006][9503:9503] CHIP:DMG: }, - [1701766693.901020][9503:9503] CHIP:DMG: }, - [1701766693.901047][9503:9503] CHIP:DMG: - [1701766693.901057][9503:9503] CHIP:DMG: ], - [1701766693.901085][9503:9503] CHIP:DMG: - [1701766693.901097][9503:9503] CHIP:DMG: InteractionModelRevision = 11 - [1701766693.901111][9503:9503] CHIP:DMG: }, + [1706723061.022072][5404:5404] CHIP:DMG: InvokeRequestMessage = + [1706723061.022075][5404:5404] CHIP:DMG: { + [1706723061.022077][5404:5404] CHIP:DMG: suppressResponse = false, + [1706723061.022081][5404:5404] CHIP:DMG: timedRequest = false, + [1706723061.022084][5404:5404] CHIP:DMG: InvokeRequests = + [1706723061.022089][5404:5404] CHIP:DMG: [ + [1706723061.022092][5404:5404] CHIP:DMG: CommandDataIB = + [1706723061.022095][5404:5404] CHIP:DMG: { + [1706723061.022098][5404:5404] CHIP:DMG: CommandPathIB = + [1706723061.022101][5404:5404] CHIP:DMG: { + [1706723061.022105][5404:5404] CHIP:DMG: EndpointId = 0x1, + [1706723061.022108][5404:5404] CHIP:DMG: ClusterId = 0x62, + [1706723061.022111][5404:5404] CHIP:DMG: CommandId = 0x40, + [1706723061.022114][5404:5404] CHIP:DMG: }, + [1706723061.022117][5404:5404] CHIP:DMG: + [1706723061.022120][5404:5404] CHIP:DMG: CommandFields = + [1706723061.022123][5404:5404] CHIP:DMG: { + [1706723061.022127][5404:5404] CHIP:DMG: 0x0 = 0, + [1706723061.022130][5404:5404] CHIP:DMG: 0x1 = 1, + [1706723061.022133][5404:5404] CHIP:DMG: 0x2 = 1, + [1706723061.022136][5404:5404] CHIP:DMG: 0x3 = 1, + [1706723061.022139][5404:5404] CHIP:DMG: 0x4 = 2, + [1706723061.022142][5404:5404] CHIP:DMG: }, + [1706723061.022145][5404:5404] CHIP:DMG: }, + [1706723061.022150][5404:5404] CHIP:DMG: + [1706723061.022152][5404:5404] CHIP:DMG: ], + [1706723061.022157][5404:5404] CHIP:DMG: + [1706723061.022160][5404:5404] CHIP:DMG: InteractionModelRevision = 11 + [1706723061.022162][5404:5404] CHIP:DMG: }, disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_TCTL_3_2.yaml b/src/app/tests/suites/certification/Test_TC_TCTL_3_2.yaml index 2c22fc392f5d52..b2ca70136c3618 100644 --- a/src/app/tests/suites/certification/Test_TC_TCTL_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_TCTL_3_2.yaml @@ -135,7 +135,7 @@ tests: Operate device such that a temperature number cannot be accepted cluster: "LogCommands" command: "UserPrompt" - PICS: PICS_USER_PROMPT && TCTL.S.M.SupportsInvalidInMode + PICS: PICS_USER_PROMPT && TCTL.S.M.SupportsInvalidInState arguments: values: - name: "message" @@ -147,7 +147,8 @@ tests: "Step 10: TH sends command SetTemperatureCommand with a temperature number between minTemp and maxTemp inclusive, saved as setTemp" command: "SetTemperature" - PICS: TCTL.S.C00.Rsp && PICS_USER_PROMPT && TCTL.S.M.SupportsInvalidInMode + PICS: + TCTL.S.C00.Rsp && PICS_USER_PROMPT && TCTL.S.M.SupportsInvalidInState arguments: values: - name: "TargetTemperature" @@ -164,7 +165,7 @@ tests: value: 5000 - label: "Step 11: TH reads from the DUT the TemperatureSetpoint attribute" - PICS: TCTL.S.A0000 && TCTL.S.M.SupportsInvalidInMode + PICS: TCTL.S.A0000 && TCTL.S.M.SupportsInvalidInState command: "readAttribute" attribute: "TemperatureSetpoint" response: diff --git a/src/app/tests/suites/certification/Test_TC_TCTL_3_3.yaml b/src/app/tests/suites/certification/Test_TC_TCTL_3_3.yaml index bca4e83790ee2b..1ab48b81dfa8af 100644 --- a/src/app/tests/suites/certification/Test_TC_TCTL_3_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_TCTL_3_3.yaml @@ -101,7 +101,7 @@ tests: Operate device such that a temperature level cannot be accepted cluster: "LogCommands" command: "UserPrompt" - PICS: PICS_USER_PROMPT && TCTL.S.M.SupportsInvalidInMode + PICS: PICS_USER_PROMPT && TCTL.S.M.SupportsInvalidInState arguments: values: - name: "message" @@ -111,7 +111,7 @@ tests: - label: "Step 7: TH sends command SetTemperatureCommand with an invalid value" - PICS: TCTL.S.C00.Rsp && TCTL.S.M.SupportsInvalidInMode + PICS: TCTL.S.C00.Rsp && TCTL.S.M.SupportsInvalidInState command: "SetTemperature" arguments: values: @@ -121,7 +121,7 @@ tests: error: CONSTRAINT_ERROR - label: "Wait for 5s" - PICS: TCTL.S.C00.Rsp && TCTL.S.M.SupportsInvalidInMode + PICS: TCTL.S.C00.Rsp && TCTL.S.M.SupportsInvalidInState cluster: "DelayCommands" command: "WaitForMs" arguments: @@ -131,7 +131,7 @@ tests: - label: "Step 8: TH reads from the DUT the SelectedTemperatureLevel attribute" - PICS: TCTL.S.A0004 && TCTL.S.M.SupportsInvalidInMode + PICS: TCTL.S.A0004 && TCTL.S.M.SupportsInvalidInState command: "readAttribute" attribute: "SelectedTemperatureLevel" response: diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 055a8101fc1f0f..fd11f3ae2ac007 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -931,10 +931,12 @@ DGGEN.S.A0006=1 DGGEN.S.A0007=1 DGGEN.S.A0008=1 DGGEN.S.C00.Rsp=1 +DGGEN.S.C03.Rsp=1 DGGEN.S.E00=1 DGGEN.S.E01=1 DGGEN.S.E02=1 DGGEN.S.E03=1 +DGGEN.S.F00=1 DGGEN.C=1 DGGEN.C.A0000=1 @@ -1866,6 +1868,39 @@ OPSTATE.S.C04.Tx=1 OPSTATE.S.E00=1 OPSTATE.S.E01=1 + +# Oven Operational State + +OVENOPSTATE.S=1 +OVENOPSTATE.C=1 +#ManuallyControlled + +OVENOPSTATE.S.M.ST_STOPPED=1 +OVENOPSTATE.S.M.ST_RUNNING=1 +OVENOPSTATE.S.M.ST_PAUSED=1 +OVENOPSTATE.S.M.ST_ERROR=1 +OVENOPSTATE.S.M.ERR_NO_ERROR=1 +OVENOPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME=1 +OVENOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION=1 +OVENOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE=1 + +# Server Attributes +OVENOPSTATE.S.A0000=1 +OVENOPSTATE.S.A0001=1 +OVENOPSTATE.S.A0002=1 +OVENOPSTATE.S.A0003=1 +OVENOPSTATE.S.A0004=1 +OVENOPSTATE.S.A0005=1 +OVENOPSTATE.S.C00.Rsp=1 +OVENOPSTATE.S.C01.Rsp=1 +OVENOPSTATE.S.C02.Rsp=1 +OVENOPSTATE.S.C03.Rsp=1 +OVENOPSTATE.S.C04.Tx=1 + +# Server Events +OVENOPSTATE.S.E00=1 +OVENOPSTATE.S.E01=1 + # Thermostat # Server TSTAT.S=1 @@ -2760,7 +2795,7 @@ DEM.S.A0005=0 DEM.S.A0006=0 DEM.S.A0007=0 -# Features +# Features DEM.S.F00=0 DEM.S.F01=0 DEM.S.F02=0 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 9594ea623d1717..8c17e1876c36ec 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -177,7 +177,6 @@ "Test_TC_OO_2_2", "Test_TC_OO_2_4" ], - "OperationalState": ["Test_TC_OPSTATE_1_1", "Test_TC_OPSTATE_2_4"], "PowerSource": ["Test_TC_PS_1_1", "Test_TC_PS_2_1"], "PressureMeasurement": [ "Test_TC_PRS_1_1", @@ -340,6 +339,7 @@ "TestScenesFabricRemoval", "TestScenesFabricSceneInfo", "TestScenesMultiFabric", + "TestScenesMaxCapacity", "Test_TC_S_1_1", "Test_TC_S_2_1", "Test_TC_S_2_2", diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index 0263fc258b8db0..8f67fe1348a802 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -261,7 +261,7 @@ "FlowMeasurement": ["Test_TC_FLW_2_2"], "GroupKeyManagement": ["Test_TC_GRPKEY_5_4"], "OccupancySensing": ["Test_TC_OCC_3_1"], - "PowerSource": ["Test_TC_PS_2_2", "Test_TC_PS_3_1"], + "PowerSource": ["Test_TC_PS_2_2"], "BooleanState": ["Test_TC_BOOL_2_2"], "ColorControl": [ "Test_TC_CC_3_1", @@ -276,7 +276,6 @@ "LevelControl": [], "LaundryWasherMode": ["Test_TC_LWM_1_2"], "OnOff": ["Test_TC_OO_2_3"], - "OperationalState": ["Test_TC_OPSTATE_2_2", "Test_TC_OPSTATE_2_5"], "RelativeHumidityMeasurement": ["Test_TC_RH_2_2"], "SmokeCOAlarm": [], "RefrigeratorAlarm": ["Test_TC_REFALM_2_2", "Test_TC_REFALM_2_3"], @@ -354,7 +353,6 @@ "LaundryWasherMode", "OnOff", "OvenMode", - "OperationalState", "OvenMode", "RelativeHumidityMeasurement", "SmokeCOAlarm", diff --git a/src/app/util/af-enums.h b/src/app/util/af-enums.h deleted file mode 100644 index 411f042032a758..00000000000000 --- a/src/app/util/af-enums.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Contains standard enum values (non-generated) - */ -#pragma once - -#include -#include - -typedef chip::Protocols::InteractionModel::Status EmberAfStatus; - -#define EMBER_ZCL_STATUS_SUCCESS chip::Protocols::InteractionModel::Status::Success -#define EMBER_ZCL_STATUS_FAILURE chip::Protocols::InteractionModel::Status::Failure -#define EMBER_ZCL_STATUS_INVALID_SUBSCRIPTION chip::Protocols::InteractionModel::Status::InvalidSubscription -#define EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS chip::Protocols::InteractionModel::Status::UnsupportedAccess -#define EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT chip::Protocols::InteractionModel::Status::UnsupportedEndpoint -#define EMBER_ZCL_STATUS_MALFORMED_COMMAND chip::Protocols::InteractionModel::Status::InvalidAction -#define EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND chip::Protocols::InteractionModel::Status::UnsupportedCommand -#define EMBER_ZCL_STATUS_DEPRECATED82 chip::Protocols::InteractionModel::Status::Deprecated82 -#define EMBER_ZCL_STATUS_DEPRECATED83 chip::Protocols::InteractionModel::Status::Deprecated83 -#define EMBER_ZCL_STATUS_DEPRECATED84 chip::Protocols::InteractionModel::Status::Deprecated84 -#define EMBER_ZCL_STATUS_INVALID_COMMAND chip::Protocols::InteractionModel::Status::InvalidCommand -#define EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE chip::Protocols::InteractionModel::Status::UnsupportedAttribute -#define EMBER_ZCL_STATUS_CONSTRAINT_ERROR chip::Protocols::InteractionModel::Status::ConstraintError -#define EMBER_ZCL_STATUS_UNSUPPORTED_WRITE chip::Protocols::InteractionModel::Status::UnsupportedWrite -#define EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED chip::Protocols::InteractionModel::Status::ResourceExhausted -#define EMBER_ZCL_STATUS_NOT_FOUND chip::Protocols::InteractionModel::Status::NotFound -#define EMBER_ZCL_STATUS_UNREPORTABLE_ATTRIBUTE chip::Protocols::InteractionModel::Status::UnreportableAttribute -#define EMBER_ZCL_STATUS_INVALID_DATA_TYPE chip::Protocols::InteractionModel::Status::InvalidDataType -#define EMBER_ZCL_STATUS_DEPRECATED8E chip::Protocols::InteractionModel::Status::Deprecated8e -#define EMBER_ZCL_STATUS_UNSUPPORTED_READ chip::Protocols::InteractionModel::Status::UnsupportedRead -#define EMBER_ZCL_STATUS_DEPRECATED90 chip::Protocols::InteractionModel::Status::Deprecated90 -#define EMBER_ZCL_STATUS_DEPRECATED91 chip::Protocols::InteractionModel::Status::Deprecated91 -#define EMBER_ZCL_STATUS_DATA_VERSION_MISMATCH chip::Protocols::InteractionModel::Status::DataVersionMismatch -#define EMBER_ZCL_STATUS_DEPRECATED93 chip::Protocols::InteractionModel::Status::Deprecated93 -#define EMBER_ZCL_STATUS_TIMEOUT chip::Protocols::InteractionModel::Status::Timeout -#define EMBER_ZCL_STATUS_RESERVED95 chip::Protocols::InteractionModel::Status::Reserved95 -#define EMBER_ZCL_STATUS_RESERVED96 chip::Protocols::InteractionModel::Status::Reserved96 -#define EMBER_ZCL_STATUS_RESERVED97 chip::Protocols::InteractionModel::Status::Reserved97 -#define EMBER_ZCL_STATUS_RESERVED98 chip::Protocols::InteractionModel::Status::Reserved98 -#define EMBER_ZCL_STATUS_RESERVED99 chip::Protocols::InteractionModel::Status::Reserved99 -#define EMBER_ZCL_STATUS_RESERVED9A chip::Protocols::InteractionModel::Status::Reserved9a -#define EMBER_ZCL_STATUS_BUSY chip::Protocols::InteractionModel::Status::Busy -#define EMBER_ZCL_STATUS_DEPRECATEDC0 chip::Protocols::InteractionModel::Status::Deprecatedc0 -#define EMBER_ZCL_STATUS_DEPRECATEDC1 chip::Protocols::InteractionModel::Status::Deprecatedc1 -#define EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER chip::Protocols::InteractionModel::Status::UnsupportedCluster -#define EMBER_ZCL_STATUS_DEPRECATEDC4 chip::Protocols::InteractionModel::Status::Deprecatedc4 -#define EMBER_ZCL_STATUS_NO_UPSTREAM_SUBSCRIPTION chip::Protocols::InteractionModel::Status::NoUpstreamSubscription -#define EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION chip::Protocols::InteractionModel::Status::NeedsTimedInteraction -#define EMBER_ZCL_STATUS_UNSUPPORTED_EVENT chip::Protocols::InteractionModel::Status::UnsupportedEvent -#define EMBER_ZCL_STATUS_PATHS_EXHAUSTED chip::Protocols::InteractionModel::Status::PathsExhausted -#define EMBER_ZCL_STATUS_TIMED_REQUEST_MISMATCH chip::Protocols::InteractionModel::Status::TimedRequestMismatch -#define EMBER_ZCL_STATUS_FAILSAFE_REQUIRED chip::Protocols::InteractionModel::Status::FailsafeRequired -#define EMBER_ZCL_STATUS_INVALID_IN_STATE chip::Protocols::InteractionModel::Status::InvalidInState -#define EMBER_ZCL_STATUS_NO_COMMAND_RESPONSE chip::Protocols::InteractionModel::Status::NoCommandResponse -#define EMBER_ZCL_STATUS_WRITE_IGNORED chip::Protocols::InteractionModel::Status::WriteIgnored // NOT SPEC COMPLIANT FOR TEST ONLY diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index 66738e101394b8..0c343185f70576 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -27,7 +27,6 @@ #include // For NULL. #include // For various uint*_t types -#include #include #include // For various types. @@ -43,8 +42,6 @@ #include #include -using chip::Protocols::InteractionModel::Status; - /** * @brief Type for the cluster mask */ @@ -293,8 +290,8 @@ typedef void (*EmberAfClusterAttributeChangedCallback)(const chip::app::Concrete * * This function is called before an attribute changes. */ -typedef Status (*EmberAfClusterPreAttributeChangedCallback)(const chip::app::ConcreteAttributePath & attributePath, - EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); +typedef chip::Protocols::InteractionModel::Status (*EmberAfClusterPreAttributeChangedCallback)( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); #define MAX_INT32U_VALUE (0xFFFFFFFFUL) #define MAX_INT16U_VALUE (0xFFFF) diff --git a/src/app/util/af.h b/src/app/util/af.h index e53b613916ca76..f7f772a4f2f4d2 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -31,8 +31,6 @@ #include #include -using chip::Protocols::InteractionModel::Status; - /** @name Attribute Storage */ // @{ @@ -98,8 +96,9 @@ bool emberAfContainsClient(chip::EndpointId endpoint, chip::ClusterId clusterId) * data type (as Accessors.h/cpp have this correct by default). * TODO: this not checking seems off - what if this is run without Accessors.h ? */ -Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, - EmberAfAttributeType dataType); +chip::Protocols::InteractionModel::Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, + chip::AttributeId attributeID, uint8_t * dataPtr, + EmberAfAttributeType dataType); /** * @brief Read the attribute value, performing all the checks. @@ -110,8 +109,9 @@ Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, * dataPtr may be NULL, signifying that we don't need the value, just the status * (i.e. whether the attribute can be read). */ -Status emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, - uint16_t readLength); +chip::Protocols::InteractionModel::Status emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, + chip::AttributeId attributeID, uint8_t * dataPtr, + uint16_t readLength); /** * @brief macro that returns size of attribute in bytes. diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index d44c598a737b93..bd785c5b9682b1 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -1177,7 +1177,7 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, Optional clusterI for (ep = 0; ep < epCount; ep++) { EmberAfDefinedEndpoint * de; - if (endpoint != EMBER_BROADCAST_ENDPOINT) + if (endpoint != chip::kInvalidEndpointId) { ep = emberAfIndexFromEndpoint(endpoint); if (ep == kEmberInvalidEndpointIndex) @@ -1298,7 +1298,7 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, Optional clusterI } } } - if (endpoint != EMBER_BROADCAST_ENDPOINT) + if (endpoint != chip::kInvalidEndpointId) { break; } diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index e68735cde8f172..7a1ab307dc1202 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -30,8 +30,6 @@ #include -using chip::Protocols::InteractionModel::Status; - // If we have fixed number of endpoints, then max is the same. #ifdef FIXED_ENDPOINT_COUNT #define MAX_ENDPOINT_COUNT (FIXED_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) @@ -73,8 +71,9 @@ void emAfCallInits(void); // Initial configuration void emberAfEndpointConfigure(void); -Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata, - uint8_t * buffer, uint16_t readLength, bool write); +chip::Protocols::InteractionModel::Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, + const EmberAfAttributeMetadata ** metadata, uint8_t * buffer, + uint16_t readLength, bool write); // Check if a cluster is implemented or not. If yes, the cluster is returned. // @@ -122,7 +121,11 @@ const EmberAfCluster * emberAfFindClusterIncludingDisabledEndpoints(chip::Endpoi // cast it. EmberAfGenericClusterFunction emberAfFindClusterFunction(const EmberAfCluster * cluster, EmberAfClusterMask functionMask); -// Loads attribute defaults and any non-volatile attributes stored +/** + * @brief Loads attribute defaults and any non-volatile attributes stored + * + * @param endpoint EnpointId. Use chip::kInvalidEndpointId to initialize all endpoints + */ void emberAfInitializeAttributes(chip::EndpointId endpoint); // After the RAM value has changed, code should call this function. If this @@ -134,8 +137,9 @@ void emAfSaveAttributeToStorageIfNeeded(uint8_t * data, chip::EndpointId endpoin void emAfClusterAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); // Calls the attribute changed callback for a specific cluster. -Status emAfClusterPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, - EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); +chip::Protocols::InteractionModel::Status +emAfClusterPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, + uint16_t size, uint8_t * value); // Note the difference in for server filtering. // This method will return the cluster count for BOTH client and server diff --git a/src/app/util/attribute-table.h b/src/app/util/attribute-table.h index 0969e8c18c9b87..7b86298209326f 100644 --- a/src/app/util/attribute-table.h +++ b/src/app/util/attribute-table.h @@ -21,16 +21,15 @@ #include -using chip::Protocols::InteractionModel::Status; - /** * Write an attribute for a request arriving from external sources. * * This will check attribute writeability and that * the provided data type matches the expected data type. */ -Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, - uint8_t * dataPtr, EmberAfAttributeType dataType); +chip::Protocols::InteractionModel::Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, + chip::AttributeId attributeID, uint8_t * dataPtr, + EmberAfAttributeType dataType); /** * @brief write an attribute, performing all the checks. @@ -62,5 +61,6 @@ Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId clu * the attribute * - Status::Success: if the attribute was found and successfully written */ -Status emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * data, - EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType); +chip::Protocols::InteractionModel::Status emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, + chip::AttributeId attributeID, uint8_t * data, + EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType); diff --git a/src/app/util/binding-table.cpp b/src/app/util/binding-table.cpp index 87655bdf956c38..b08d41d7f074b4 100644 --- a/src/app/util/binding-table.cpp +++ b/src/app/util/binding-table.cpp @@ -33,12 +33,12 @@ BindingTable::BindingTable() CHIP_ERROR BindingTable::Add(const EmberBindingTableEntry & entry) { - if (entry.type == EMBER_UNUSED_BINDING) + if (entry.type == MATTER_UNUSED_BINDING) { return CHIP_ERROR_INVALID_ARGUMENT; } uint8_t newIndex = GetNextAvaiableIndex(); - if (newIndex >= EMBER_BINDING_TABLE_SIZE) + if (newIndex >= MATTER_BINDING_TABLE_SIZE) { return CHIP_ERROR_NO_MEMORY; } @@ -62,7 +62,7 @@ CHIP_ERROR BindingTable::Add(const EmberBindingTableEntry & entry) if (error != CHIP_NO_ERROR) { // Roll back - mBindingTable[newIndex].type = EMBER_UNUSED_BINDING; + mBindingTable[newIndex].type = MATTER_UNUSED_BINDING; return error; } @@ -101,7 +101,7 @@ CHIP_ERROR BindingTable::SaveEntryToStorage(uint8_t index, uint8_t nextIndex) { ReturnErrorOnFailure(writer.Put(TLV::ContextTag(kTagCluster), entry.clusterId.Value())); } - if (entry.type == EMBER_UNICAST_BINDING) + if (entry.type == MATTER_UNICAST_BINDING) { ReturnErrorOnFailure(writer.Put(TLV::ContextTag(kTagRemoteEndpoint), entry.remote)); ReturnErrorOnFailure(writer.Put(TLV::ContextTag(kTagNodeId), entry.nodeId)); @@ -211,14 +211,14 @@ CHIP_ERROR BindingTable::LoadEntryFromStorage(uint8_t index, uint8_t & nextIndex } if (reader.GetTag() == TLV::ContextTag(kTagRemoteEndpoint)) { - entry.type = EMBER_UNICAST_BINDING; + entry.type = MATTER_UNICAST_BINDING; ReturnErrorOnFailure(reader.Get(entry.remote)); ReturnErrorOnFailure(reader.Next(TLV::ContextTag(kTagNodeId))); ReturnErrorOnFailure(reader.Get(entry.nodeId)); } else { - entry.type = EMBER_MULTICAST_BINDING; + entry.type = MATTER_MULTICAST_BINDING; ReturnErrorCodeIf(reader.GetTag() != TLV::ContextTag(kTagGroupId), CHIP_ERROR_INVALID_TLV_TAG); ReturnErrorOnFailure(reader.Get(entry.groupId)); } @@ -265,7 +265,7 @@ CHIP_ERROR BindingTable::RemoveAt(Iterator & iter) { ChipLogError(AppServer, "Failed to remove binding table entry %u from storage", iter.mIndex); } - mBindingTable[iter.mIndex].type = EMBER_UNUSED_BINDING; + mBindingTable[iter.mIndex].type = MATTER_UNUSED_BINDING; mNextIndex[iter.mIndex] = kNextNullIndex; mSize--; } @@ -292,14 +292,14 @@ BindingTable::Iterator BindingTable::end() uint8_t BindingTable::GetNextAvaiableIndex() { - for (uint8_t i = 0; i < EMBER_BINDING_TABLE_SIZE; i++) + for (uint8_t i = 0; i < MATTER_BINDING_TABLE_SIZE; i++) { - if (mBindingTable[i].type == EMBER_UNUSED_BINDING) + if (mBindingTable[i].type == MATTER_UNUSED_BINDING) { return i; } } - return EMBER_BINDING_TABLE_SIZE; + return MATTER_BINDING_TABLE_SIZE; } BindingTable::Iterator BindingTable::Iterator::operator++() diff --git a/src/app/util/binding-table.h b/src/app/util/binding-table.h index 9e39313091cd35..4b8cc733410a9d 100644 --- a/src/app/util/binding-table.h +++ b/src/app/util/binding-table.h @@ -110,8 +110,8 @@ class BindingTable CHIP_ERROR LoadEntryFromStorage(uint8_t index, uint8_t & nextIndex); - EmberBindingTableEntry mBindingTable[EMBER_BINDING_TABLE_SIZE]; - uint8_t mNextIndex[EMBER_BINDING_TABLE_SIZE]; + EmberBindingTableEntry mBindingTable[MATTER_BINDING_TABLE_SIZE]; + uint8_t mNextIndex[MATTER_BINDING_TABLE_SIZE]; uint8_t mHead = kNextNullIndex; uint8_t mTail = kNextNullIndex; diff --git a/src/app/util/config.h b/src/app/util/config.h index 288935eee4beae..658626e384c464 100644 --- a/src/app/util/config.h +++ b/src/app/util/config.h @@ -29,6 +29,6 @@ // User options for plugin Binding Table Library // TODO: Make this a CHIP_CONFIG value. -#ifndef EMBER_BINDING_TABLE_SIZE -#define EMBER_BINDING_TABLE_SIZE 10 -#endif // EMBER_BINDING_TABLE_SIZE +#ifndef MATTER_BINDING_TABLE_SIZE +#define MATTER_BINDING_TABLE_SIZE 10 +#endif // MATTER_BINDING_TABLE_SIZE diff --git a/src/app/util/generic-callback-stubs.cpp b/src/app/util/generic-callback-stubs.cpp index 21d40858c4d13c..723c9f2a60df5b 100644 --- a/src/app/util/generic-callback-stubs.cpp +++ b/src/app/util/generic-callback-stubs.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace chip; @@ -34,18 +35,18 @@ bool __attribute__((weak)) emberAfAttributeWriteAccessCallback(EndpointId endpoi return true; } -Status __attribute__((weak)) +chip::Protocols::InteractionModel::Status __attribute__((weak)) emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) { - return Status::Failure; + return chip::Protocols::InteractionModel::Status::Failure; } -Status __attribute__((weak)) +chip::Protocols::InteractionModel::Status __attribute__((weak)) emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { - return Status::Failure; + return chip::Protocols::InteractionModel::Status::Failure; } chip::Protocols::InteractionModel::Status __attribute__((weak)) diff --git a/src/app/util/generic-callbacks.h b/src/app/util/generic-callbacks.h index 51917e6f86012b..8c2c966bcf507e 100644 --- a/src/app/util/generic-callbacks.h +++ b/src/app/util/generic-callbacks.h @@ -21,15 +21,9 @@ #include #include -#include -#include #include -#include -#include #include -using chip::Protocols::InteractionModel::Status; - /** @brief Cluster Init * * This function is called when a specific cluster is initialized. It gives the @@ -78,15 +72,15 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste * emberAfMainTickCallback. If the application was successfully able to * read the attribute and write it into the passed buffer, it should return a - * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally + * value of InteractionModel::Status::Success. Ensure that the size of the externally * managed attribute value is smaller than what the buffer can hold. In the case * of a buffer overflow throw an appropriate error such as - * EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED. Any other return value indicates the + * InteractionModel::Status::ResourceExhausted. Any other return value indicates the * application was not able to read the attribute. */ -Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength); +chip::Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); /** @brief External Attribute Write * @@ -124,19 +118,21 @@ Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::Clu * Framework and updated occasionally by the application code from within the * emberAfMainTickCallback. If the application was successfully able to - * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any + * write the attribute, it returns a value of InteractionModel::Status::Success. Any * other return value indicates the application was not able to write the * attribute. */ -Status emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); +chip::Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, + chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); /** @brief Pre Attribute Change * * This function is called by the application framework before it changes an * attribute value. The value passed into this callback is the value to which * the attribute is to be set by the framework. The application should return - * chip::Protocols::InteractionModel::Status::Success to permit the change or + * Protocols::InteractionModel::Status::Success to permit the change or * any other code to reject it. */ chip::Protocols::InteractionModel::Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, diff --git a/src/app/util/im-client-callbacks.h b/src/app/util/im-client-callbacks.h index 489224a2685730..3c4bdd6839a328 100644 --- a/src/app/util/im-client-callbacks.h +++ b/src/app/util/im-client-callbacks.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/src/app/util/mock/include/zap-generated/gen_config.h b/src/app/util/mock/include/zap-generated/gen_config.h index 8488bc9c8700ca..17f2de013f9597 100644 --- a/src/app/util/mock/include/zap-generated/gen_config.h +++ b/src/app/util/mock/include/zap-generated/gen_config.h @@ -17,5 +17,5 @@ #pragma once -#define EMBER_BINDING_TABLE_SIZE 20 +#define MATTER_BINDING_TABLE_SIZE 20 #define SCENES_MANAGEMENT_TABLE_SIZE 24 diff --git a/src/app/util/types_stub.h b/src/app/util/types_stub.h index e6ebd93f06f384..ac26684f850cd7 100644 --- a/src/app/util/types_stub.h +++ b/src/app/util/types_stub.h @@ -36,13 +36,13 @@ enum #endif { /** A binding that is currently not in use. */ - EMBER_UNUSED_BINDING = 0, + MATTER_UNUSED_BINDING = 0, /** A unicast binding whose 64-bit identifier is the destination EUI64. */ - EMBER_UNICAST_BINDING = 1, + MATTER_UNICAST_BINDING = 1, /** A multicast binding whose 64-bit identifier is the group address. This * binding can be used to send messages to the group and to receive * messages sent to the group. */ - EMBER_MULTICAST_BINDING = 3, + MATTER_MULTICAST_BINDING = 3, }; /** @@ -77,7 +77,7 @@ struct EmberBindingTableEntry chip::EndpointId remoteEndpoint, chip::Optional cluster) { EmberBindingTableEntry entry = { - .type = EMBER_UNICAST_BINDING, + .type = MATTER_UNICAST_BINDING, .fabricIndex = fabric, .local = localEndpoint, .clusterId = cluster, @@ -91,7 +91,7 @@ struct EmberBindingTableEntry chip::Optional cluster) { EmberBindingTableEntry entry = { - .type = EMBER_MULTICAST_BINDING, + .type = MATTER_MULTICAST_BINDING, .fabricIndex = fabric, .local = localEndpoint, .clusterId = cluster, @@ -102,7 +102,7 @@ struct EmberBindingTableEntry } /** The type of binding. */ - EmberBindingType type = EMBER_UNUSED_BINDING; + EmberBindingType type = MATTER_UNUSED_BINDING; chip::FabricIndex fabricIndex; /** The endpoint on the local node. */ @@ -135,12 +135,12 @@ struct EmberBindingTableEntry return false; } - if (type == EMBER_MULTICAST_BINDING && groupId != other.groupId) + if (type == MATTER_MULTICAST_BINDING && groupId != other.groupId) { return false; } - if (type == EMBER_UNICAST_BINDING && (nodeId != other.nodeId || remote != other.remote)) + if (type == MATTER_UNICAST_BINDING && (nodeId != other.nodeId || remote != other.remote)) { return false; } @@ -172,65 +172,6 @@ typedef struct */ #define UNUSED_VAR(x) (void) (x) -/** - * @brief The broadcast endpoint, as defined in the ZigBee spec. - */ -#define EMBER_BROADCAST_ENDPOINT (chip::kInvalidEndpointId) - -/** - * @brief Useful to reference a single bit of a byte. - */ -#define EMBER_BIT(nr) (1UL << (nr)) // Unsigned avoids compiler warnings re EMBER_BIT(15) - -/** - * @brief Returns the low byte of the 16-bit value \c n as an \c uint8_t. - */ -#define EMBER_LOW_BYTE(n) ((uint8_t) ((n) &0xFF)) - -/** - * @brief Returns the high byte of the 16-bit value \c n as an \c uint8_t. - */ -#define EMBER_HIGH_BYTE(n) ((uint8_t) (EMBER_LOW_BYTE((n) >> 8))) -/** - * @brief Returns the low byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_0(n) ((uint8_t) ((n) &0xFF)) - -/** - * @brief Returns the second byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_1(n) EMBER_BYTE_0((n) >> 8) - -/** - * @brief Returns the third byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_2(n) EMBER_BYTE_0((n) >> 16) - -/** - * @brief Returns the high byte of the 32-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_3(n) EMBER_BYTE_0((n) >> 24) - -/** - * @brief Returns the fifth byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_4(n) EMBER_BYTE_0((n) >> 32) - -/** - * @brief Returns the sixth byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_5(n) EMBER_BYTE_0((n) >> 40) - -/** - * @brief Returns the seventh byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_6(n) EMBER_BYTE_0((n) >> 48) - -/** - * @brief Returns the high byte of the 64-bit value \c n as an \c uint8_t. - */ -#define EMBER_BYTE_7(n) EMBER_BYTE_0((n) >> 56) - /** * @brief Returns the value of the bitmask \c bits within * the register or byte \c reg. diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index cdaac8f494a8c7..267da8921574d8 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include // TODO: figure out a clear path for compile-time codegen @@ -107,7 +108,7 @@ EmberAfDifferenceType emberAfGetDifference(uint8_t * pData, EmberAfDifferenceTyp // **************************************** void emberAfInit() { - emberAfInitializeAttributes(EMBER_BROADCAST_ENDPOINT); + emberAfInitializeAttributes(kInvalidEndpointId); MATTER_PLUGINS_INIT @@ -230,8 +231,7 @@ void emberAfCopyLongString(uint8_t * dest, const uint8_t * src, size_t size) length = static_cast(size); } memmove(dest + 2, src + 2, length); - dest[0] = EMBER_LOW_BYTE(length); - dest[1] = EMBER_HIGH_BYTE(length); + Encoding::LittleEndian::Put16(dest, length); } } diff --git a/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml index c4fb56ecef7077..6e241c7b5c3cd0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml @@ -16,7 +16,7 @@ limitations under the License. --> - + Media Content App Observer 0x0510 diff --git a/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml index 1c1ba4502eda7a..d8077e9e9276cc 100644 --- a/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml @@ -16,7 +16,7 @@ limitations under the License. --> - + Media Content Control 0x050F diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml index 7a6764bb95a39d..32893bd82a68e9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml @@ -13,7 +13,7 @@ limitations under the License. --> - + Energy Preference Energy Management 0x009B diff --git a/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml index 9514659cda3cf5..be3443519e5a98 100644 --- a/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml @@ -26,7 +26,7 @@ limitations under the License. - + Appliances Laundry Dryer Controls 0x004A @@ -41,4 +41,4 @@ limitations under the License. SupportedDrynessLevels SelectedDrynessLevel - + diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 66fcb0d9b48821..037c660d1d6f8c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -2401,13 +2401,10 @@ limitations under the License. 0x0103 0x050C - - + - - diff --git a/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml index 28b3eb975594a0..2da346cd49a6f7 100644 --- a/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml @@ -69,7 +69,7 @@ limitations under the License. - + Messages General This cluster provides an interface for passing messages to be presented by a device. diff --git a/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml index fb27062b26cfbe..9eef1e03c6c023 100644 --- a/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml @@ -23,7 +23,7 @@ limitations under the License. - + Measurement & Sensing Power Topology 0x009C diff --git a/src/ble/BLEEndPoint.cpp b/src/ble/BLEEndPoint.cpp index 8d68c68ec0b0d8..63708af678efbd 100644 --- a/src/ble/BLEEndPoint.cpp +++ b/src/ble/BLEEndPoint.cpp @@ -1040,6 +1040,7 @@ CHIP_ERROR BLEEndPoint::DriveSending() else { // Nothing to send! + mBle->mApplicationDelegate->CheckNonConcurrentBleClosing(); } } diff --git a/src/ble/BleApplicationDelegate.h b/src/ble/BleApplicationDelegate.h index 542e46b64c4888..2584aeb6b908fd 100644 --- a/src/ble/BleApplicationDelegate.h +++ b/src/ble/BleApplicationDelegate.h @@ -42,6 +42,10 @@ class DLL_EXPORT BleApplicationDelegate // The application can use this callback to e.g. close the underlying BLE connection if it is no longer needed, // decrement the connection's refcount if it has one, or perform any other sort of cleanup as desired. virtual void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT connObj) = 0; + + // Called to determine whether the BLE connection should be closed when in Non-concurrent mode if sending + // ConnectNetworkResponse. The BTP will be in kState_Complete when all fragments have been sent. + virtual void CheckNonConcurrentBleClosing() {} }; } /* namespace Ble */ diff --git a/src/ble/BleLayer.cpp b/src/ble/BleLayer.cpp index 9109924ccd3754..eae49a0bfa8dd1 100644 --- a/src/ble/BleLayer.cpp +++ b/src/ble/BleLayer.cpp @@ -300,6 +300,11 @@ CHIP_ERROR BleLayer::Init(BlePlatformDelegate * platformDelegate, BleApplication return Init(platformDelegate, nullptr, appDelegate, systemLayer); } +void BleLayer::IndicateBleClosing() +{ + mState = kState_Disconnecting; +} + void BleLayer::Shutdown() { mState = kState_NotInitialized; diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h index 5ded6c82cc2b46..f175334173ba7f 100644 --- a/src/ble/BleLayer.h +++ b/src/ble/BleLayer.h @@ -226,7 +226,8 @@ class DLL_EXPORT BleLayer enum { kState_NotInitialized = 0, - kState_Initialized = 1 + kState_Initialized = 1, + kState_Disconnecting = 2 } mState; ///< [READ-ONLY] Current state // This app state is not used by ble transport etc, it will be used by external ble implementation like Android @@ -243,6 +244,7 @@ class DLL_EXPORT BleLayer chip::System::Layer * systemLayer); CHIP_ERROR Init(BlePlatformDelegate * platformDelegate, BleConnectionDelegate * connDelegate, BleApplicationDelegate * appDelegate, chip::System::Layer * systemLayer); + void IndicateBleClosing(); void Shutdown(); CHIP_ERROR CancelBleIncompleteConnection(); diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 7cc2c86432f5f9..57c75cd0d813ae 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1636,27 +1636,6 @@ void OnBasicFailure(void * context, CHIP_ERROR error) commissioner->CommissioningStageComplete(error); } -static void NonConcurrentTimeout(void * context, CHIP_ERROR error) -{ - if (error == CHIP_ERROR_TIMEOUT) - { - ChipLogProgress(Controller, "Non-concurrent mode: Expected NetworkResponse Timeout, do nothing"); - } - else - { - ChipLogProgress(Controller, "Non-concurrent mode: Received failure response %" CHIP_ERROR_FORMAT, error.Format()); - } -} - -static void NonConcurrentNetworkResponse(void * context, - const NetworkCommissioning::Commands::ConnectNetworkResponse::DecodableType & data) -{ - // In Non Concurrent mode the commissioning network should have been shut down and not sent the - // ConnectNetworkResponse. In case it does send it this handles the message - ChipLogError(Controller, "Non-concurrent Mode : Received Unexpected ConnectNetwork response, ignoring. Status=%u", - to_underlying(data.networkingStatus)); -} - void DeviceCommissioner::CleanupCommissioning(DeviceProxy * proxy, NodeId nodeId, const CompletionStatus & completionStatus) { commissioningCompletionStatus = completionStatus; @@ -3061,28 +3040,9 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio request.breadcrumb.Emplace(breadcrumb); CHIP_ERROR err = CHIP_NO_ERROR; - GeneralCommissioning::Attributes::SupportsConcurrentConnection::TypeInfo::Type supportsConcurrentConnection; - supportsConcurrentConnection = params.GetSupportsConcurrentConnection().Value(); ChipLogProgress(Controller, "SendCommand kWiFiNetworkEnable, supportsConcurrentConnection=%d", - supportsConcurrentConnection); - if (supportsConcurrentConnection) - { - err = SendCommand(proxy, request, OnConnectNetworkResponse, OnBasicFailure, endpoint, timeout); - } - else - { - // Concurrent Connections not allowed. Send the ConnectNetwork command but do not wait for the - // ConnectNetworkResponse on the Commissioning network as it will not be present. Log the expected timeout - // and run what would have been in the onConnectNetworkResponse callback. - err = SendCommand(proxy, request, NonConcurrentNetworkResponse, NonConcurrentTimeout, endpoint, NullOptional); - if (err == CHIP_NO_ERROR) - { - // As there will be no ConnectNetworkResponse, it is an implicit kSuccess so a default report is fine - CommissioningDelegate::CommissioningReport report; - CommissioningStageComplete(CHIP_NO_ERROR, report); - return; - } - } + params.GetSupportsConcurrentConnection().Value()); + err = SendCommand(proxy, request, OnConnectNetworkResponse, OnBasicFailure, endpoint, timeout); if (err != CHIP_NO_ERROR) { diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index 8268b07b7f3dcc..ebc728ca206875 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -226,7 +226,7 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) ReturnErrorOnFailure(stateParams.exchangeMgr->Init(stateParams.sessionMgr)); ReturnErrorOnFailure(stateParams.messageCounterManager->Init(stateParams.exchangeMgr)); ReturnErrorOnFailure(stateParams.unsolicitedStatusHandler->Init(stateParams.exchangeMgr)); - ReturnErrorOnFailure(stateParams.bdxTransferServer->ListenForSendInit(stateParams.systemLayer, stateParams.exchangeMgr)); + ReturnErrorOnFailure(stateParams.bdxTransferServer->Init(stateParams.systemLayer, stateParams.exchangeMgr)); InitDataModelHandler(); diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 6d8856f42909cc..fd254210df74c3 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2923,7 +2923,7 @@ provisional cluster OvenMode = 73 { /** This cluster supports remotely monitoring and controling the different typs of functionality available to a drying device, such as a laundry dryer. */ -cluster LaundryDryerControls = 74 { +provisional cluster LaundryDryerControls = 74 { revision 1; enum DrynessLevelEnum : enum8 { @@ -4496,7 +4496,7 @@ provisional cluster DemandResponseLoadControl = 150 { } /** This cluster provides an interface for passing messages to be presented by a device. */ -cluster Messages = 151 { +provisional cluster Messages = 151 { revision 3; enum FutureMessagePreferenceEnum : enum8 { @@ -4977,7 +4977,7 @@ provisional cluster EnergyEvse = 153 { } /** This cluster provides an interface to specify preferences for how devices should consume energy. */ -cluster EnergyPreference = 155 { +provisional cluster EnergyPreference = 155 { revision 1; enum EnergyPriorityEnum : enum8 { @@ -5011,7 +5011,7 @@ cluster EnergyPreference = 155 { } /** The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints. */ -cluster PowerTopology = 156 { +provisional cluster PowerTopology = 156 { revision 1; bitmap Feature : bitmap32 { @@ -8571,7 +8571,7 @@ cluster AccountLogin = 1294 { } /** This cluster is used for managing the content control (including "parental control") settings on a media device such as a TV, or Set-top Box. */ -cluster ContentControl = 1295 { +provisional cluster ContentControl = 1295 { revision 1; // NOTE: Default/not specifically set bitmap Feature : bitmap32 { @@ -8654,7 +8654,7 @@ cluster ContentControl = 1295 { } /** This cluster provides an interface for sending targeted commands to an Observer of a Content App on a Video Player device such as a Streaming Media Player, Smart TV or Smart Screen. The cluster server for Content App Observer is implemented by an endpoint that communicates with a Content App, such as a Casting Video Client. The cluster client for Content App Observer is implemented by a Content App endpoint. A Content App is informed of the NodeId of an Observer when a binding is set on the Content App. The Content App can then send the ContentAppMessage to the Observer (server cluster), and the Observer responds with a ContentAppMessageResponse. */ -cluster ContentAppObserver = 1296 { +provisional cluster ContentAppObserver = 1296 { revision 1; // NOTE: Default/not specifically set enum StatusEnum : enum8 { diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index 88bbf9844c9407..9e3e3e966c20d3 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -55,22 +55,6 @@ CHIP_ERROR CreateChipAttributePath(JNIEnv * env, const app::ConcreteDataAttribut return CHIP_NO_ERROR; } -CHIP_ERROR ReportCallback::CreateChipEventPath(JNIEnv * env, const app::ConcreteEventPath & aPath, jobject & outObj) -{ - jclass eventPathCls = nullptr; - ReturnErrorOnFailure( - JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/ChipEventPath", eventPathCls)); - - jmethodID eventPathCtor = - env->GetStaticMethodID(eventPathCls, "newInstance", "(IJJ)Lchip/devicecontroller/model/ChipEventPath;"); - VerifyOrReturnError(eventPathCtor != nullptr, CHIP_JNI_ERROR_METHOD_NOT_FOUND); - - outObj = env->CallStaticObjectMethod(eventPathCls, eventPathCtor, static_cast(aPath.mEndpointId), - static_cast(aPath.mClusterId), static_cast(aPath.mEventId)); - VerifyOrReturnError(outObj != nullptr, CHIP_JNI_ERROR_NULL_OBJECT); - return CHIP_NO_ERROR; -} - GetConnectedDeviceCallback::GetConnectedDeviceCallback(jobject wrapperCallback, jobject javaCallback) : mOnSuccess(OnDeviceConnectedFn, this), mOnFailure(OnDeviceConnectionFailureFn, this) { @@ -270,6 +254,30 @@ CHIP_ERROR ConvertReportTlvToJson(const uint32_t id, TLV::TLVReader & data, std: return TlvToJson(readerForJson, json); } +static CHIP_ERROR CreateStatus(JNIEnv * env, const app::StatusIB & aStatus, jobject & outObj) +{ + jclass statusCls = nullptr; + ReturnErrorOnFailure(JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/model/Status", statusCls)); + jmethodID statusCtor = nullptr; + if (aStatus.mClusterStatus.HasValue()) + { + statusCtor = env->GetStaticMethodID(statusCls, "newInstance", "(II)Lchip/devicecontroller/model/Status;"); + VerifyOrReturnError(!env->ExceptionCheck(), CHIP_JNI_ERROR_EXCEPTION_THROWN); + VerifyOrReturnError(statusCtor != nullptr, CHIP_JNI_ERROR_METHOD_NOT_FOUND); + outObj = env->CallStaticObjectMethod(statusCls, statusCtor, static_cast(aStatus.mStatus), + static_cast(aStatus.mClusterStatus.Value())); + } + else + { + statusCtor = env->GetStaticMethodID(statusCls, "newInstance", "(I)Lchip/devicecontroller/model/Status;"); + VerifyOrReturnError(!env->ExceptionCheck(), CHIP_JNI_ERROR_EXCEPTION_THROWN); + VerifyOrReturnError(statusCtor != nullptr, CHIP_JNI_ERROR_METHOD_NOT_FOUND); + outObj = env->CallStaticObjectMethod(statusCls, statusCtor, static_cast(aStatus.mStatus)); + } + VerifyOrReturnError(outObj != nullptr, CHIP_JNI_ERROR_METHOD_NOT_FOUND); + return CHIP_NO_ERROR; +} + void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const app::StatusIB & aStatus) { @@ -277,14 +285,28 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); JniLocalReferenceScope scope(env); - - jobject attributePathObj = nullptr; - err = CreateChipAttributePath(env, aPath, attributePathObj); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create Java ChipAttributePath: %s", ErrorStr(err))); - VerifyOrReturn(!aPath.IsListItemOperation(), ChipLogError(Controller, "Expect non-list item operation"); aPath.LogPath()); - VerifyOrReturn(aStatus.IsSuccess(), ChipLogError(Controller, "Receive bad status %s", ErrorStr(aStatus.ToChipError())); - aPath.LogPath()); + + jobject nodeState = mNodeStateObj.ObjectRef(); + if (aStatus.IsFailure()) + { + ChipLogError(Controller, "Receive bad status %s", ErrorStr(aStatus.ToChipError())); + jobject statusObj = nullptr; + err = CreateStatus(env, aStatus, statusObj); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Controller, "Fail to create status with error %" CHIP_ERROR_FORMAT, err.Format())); + // Add Attribute Status to NodeState + jmethodID addAttributeStatusMethod = nullptr; + err = JniReferences::GetInstance().FindMethod(env, nodeState, "addAttributeStatus", + "(IJJLchip/devicecontroller/model/Status;)V", &addAttributeStatusMethod); + VerifyOrReturn( + err == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not find addAttributeStatus method with error %" CHIP_ERROR_FORMAT, err.Format())); + env->CallVoidMethod(nodeState, addAttributeStatusMethod, static_cast(aPath.mEndpointId), + static_cast(aPath.mClusterId), static_cast(aPath.mAttributeId), statusObj); + VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); + return; + } VerifyOrReturn(apData != nullptr, ChipLogError(Controller, "Receive empty apData"); aPath.LogPath()); TLV::TLVReader readerForJavaTLV; @@ -345,7 +367,6 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat VerifyOrReturn(attributeStateObj != nullptr, ChipLogError(Controller, "Could not create AttributeState object"); aPath.LogPath()); - jobject nodeState = mNodeStateObj.ObjectRef(); // Add AttributeState to NodeState jmethodID addAttributeMethod; err = JniReferences::GetInstance().FindMethod(env, nodeState, "addAttribute", @@ -401,10 +422,28 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); VerifyOrReturn(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread")); - jobject eventPathObj = nullptr; - err = CreateChipEventPath(env, aEventHeader.mPath, eventPathObj); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to create Java ChipEventPath: %s", ErrorStr(err))); + jobject nodeState = mNodeStateObj.ObjectRef(); + if (apStatus != nullptr && apStatus->IsFailure()) + { + ChipLogError(Controller, "Receive bad status %s", ErrorStr(apStatus->ToChipError())); + jobject statusObj = nullptr; + err = CreateStatus(env, *apStatus, statusObj); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(Controller, "Fail to create status with error %" CHIP_ERROR_FORMAT, err.Format())); + // Add Event Status to NodeState + jmethodID addEventStatusMethod; + err = JniReferences::GetInstance().FindMethod(env, nodeState, "addEventStatus", + "(IJJLchip/devicecontroller/model/Status;)V", &addEventStatusMethod); + VerifyOrReturn( + err == CHIP_NO_ERROR, + ChipLogError(Controller, "Could not find addEventStatus method with error %" CHIP_ERROR_FORMAT, err.Format())); + env->CallVoidMethod(nodeState, addEventStatusMethod, static_cast(aEventHeader.mPath.mEndpointId), + static_cast(aEventHeader.mPath.mClusterId), static_cast(aEventHeader.mPath.mEventId), + statusObj); + VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); + return; + } VerifyOrReturn(apData != nullptr, ChipLogError(Controller, "Receive empty apData"); aEventHeader.LogPath()); TLV::TLVReader readerForJavaTLV; @@ -484,7 +523,7 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV // Add EventState to NodeState jmethodID addEventMethod; - jobject nodeState = mNodeStateObj.ObjectRef(); + err = JniReferences::GetInstance().FindMethod(env, nodeState, "addEvent", "(IJJLchip/devicecontroller/model/EventState;)V", &addEventMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find addEvent method with error %s", ErrorStr(err)); diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 0f68fcebb6ed6e..0e5beda7115ae6 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -482,6 +482,7 @@ android_library("java") { "src/chip/devicecontroller/model/EventState.java", "src/chip/devicecontroller/model/InvokeElement.java", "src/chip/devicecontroller/model/NodeState.java", + "src/chip/devicecontroller/model/Status.java", ] if (matter_enable_tlv_decoder_api) { diff --git a/src/controller/java/src/chip/devicecontroller/model/ClusterState.java b/src/controller/java/src/chip/devicecontroller/model/ClusterState.java index 4c575f1a41df66..6ebe40e99fe0a2 100644 --- a/src/controller/java/src/chip/devicecontroller/model/ClusterState.java +++ b/src/controller/java/src/chip/devicecontroller/model/ClusterState.java @@ -32,12 +32,19 @@ public final class ClusterState { private static final String TAG = "ClusterState"; private Map attributes; private Map> events; + private Map attributeStatuses; + private Map> eventStatuses; private Optional dataVersion; - public ClusterState( - Map attributes, Map> events) { + protected ClusterState( + Map attributes, + Map> events, + Map attributeStatuses, + Map> eventStatuses) { this.attributes = attributes; this.events = events; + this.attributeStatuses = attributeStatuses; + this.eventStatuses = eventStatuses; this.dataVersion = Optional.empty(); } @@ -45,10 +52,18 @@ public Map getAttributeStates() { return attributes; } + public Map getAttributeStatuses() { + return attributeStatuses; + } + public Map> getEventStates() { return events; } + public Map> getEventStatuses() { + return eventStatuses; + } + public void setDataVersion(long version) { dataVersion = Optional.of(version); } @@ -130,6 +145,25 @@ public String toString() { builder.append("\n"); }); }); + attributeStatuses.forEach( + (attributeId, status) -> { + builder.append("Attribute Status "); + builder.append(attributeId); + builder.append(": "); + builder.append(status.toString()); + builder.append("\n"); + }); + eventStatuses.forEach( + (eventId, status) -> { + status.forEach( + (eventState) -> { + builder.append("Event Status"); + builder.append(eventId); + builder.append(": "); + builder.append(status.toString()); + builder.append("\n"); + }); + }); return builder.toString(); } } diff --git a/src/controller/java/src/chip/devicecontroller/model/NodeState.java b/src/controller/java/src/chip/devicecontroller/model/NodeState.java index decd9782f5369a..f77097b5452f62 100644 --- a/src/controller/java/src/chip/devicecontroller/model/NodeState.java +++ b/src/controller/java/src/chip/devicecontroller/model/NodeState.java @@ -55,10 +55,15 @@ private void addAttribute( ClusterState clusterState = endpointState.getClusterState(clusterId); if (clusterState == null) { - clusterState = new ClusterState(new HashMap<>(), new HashMap<>()); + clusterState = + new ClusterState(new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>()); endpointState.getClusterStates().put(clusterId, clusterState); } + if (clusterState.getAttributeStatuses().containsKey(attributeId)) { + clusterState.getAttributeStatuses().remove(attributeId); + } + // This will overwrite previous attributes. clusterState.getAttributeStates().put(attributeId, attributeStateToAdd); } @@ -72,16 +77,70 @@ private void addEvent(int endpointId, long clusterId, long eventId, EventState e ClusterState clusterState = endpointState.getClusterState(clusterId); if (clusterState == null) { - clusterState = new ClusterState(new HashMap<>(), new HashMap<>()); + clusterState = + new ClusterState(new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>()); endpointState.getClusterStates().put(clusterId, clusterState); } if (!clusterState.getEventStates().containsKey(eventId)) { clusterState.getEventStates().put(eventId, new ArrayList()); } + + if (clusterState.getEventStatuses().containsKey(eventId)) { + clusterState.getEventStatuses().remove(eventId); + } + clusterState.getEventStates().get(eventId).add(eventStateToAdd); } + // Called from native code only, which ignores access modifiers. + private void addAttributeStatus( + int endpointId, long clusterId, long attributeId, Status statusToAdd) { + EndpointState endpointState = getEndpointState(endpointId); + if (endpointState == null) { + endpointState = new EndpointState(new HashMap<>()); + getEndpointStates().put(endpointId, endpointState); + } + + ClusterState clusterState = endpointState.getClusterState(clusterId); + if (clusterState == null) { + clusterState = + new ClusterState(new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>()); + endpointState.getClusterStates().put(clusterId, clusterState); + } + + if (clusterState.getAttributeStates().containsKey(attributeId)) { + clusterState.getAttributeStates().remove(attributeId); + } + + clusterState.getAttributeStatuses().put(attributeId, statusToAdd); + } + + private void addEventStatus(int endpointId, long clusterId, long eventId, Status statusToAdd) { + EndpointState endpointState = getEndpointState(endpointId); + if (endpointState == null) { + endpointState = new EndpointState(new HashMap<>()); + getEndpointStates().put(endpointId, endpointState); + } + + ClusterState clusterState = endpointState.getClusterState(clusterId); + if (clusterState == null) { + clusterState = + new ClusterState(new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>()); + endpointState.getClusterStates().put(clusterId, clusterState); + } + + if (!clusterState.getEventStatuses().containsKey(eventId)) { + clusterState.getEventStatuses().put(eventId, new ArrayList()); + } + + if (clusterState.getEventStates().containsKey(eventId)) { + clusterState.getEventStates().remove(eventId); + } + + clusterState.getEventStatuses().get(eventId).add(statusToAdd); + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); diff --git a/src/controller/java/src/chip/devicecontroller/model/Status.java b/src/controller/java/src/chip/devicecontroller/model/Status.java new file mode 100644 index 00000000000000..7391f9a312f3f7 --- /dev/null +++ b/src/controller/java/src/chip/devicecontroller/model/Status.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 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. + * + */ + +package chip.devicecontroller.model; + +import java.util.Locale; +import java.util.Optional; + +public final class Status { + private Integer status; + private Optional clusterStatus; + + private Status(int status, Optional clusterStatus) { + this.status = status; + this.clusterStatus = clusterStatus; + } + + // Getters + public Integer getStatus() { + return status; + } + + public Optional getClusterStatus() { + return clusterStatus; + } + + public String toString() { + return String.format( + Locale.ENGLISH, + "status %s, clusterStatus %s", + String.valueOf(status), + clusterStatus.isPresent() ? String.valueOf(clusterStatus.get()) : "None"); + } + + public static Status newInstance(int status, int clusterStatus) { + return new Status(status, Optional.of(clusterStatus)); + } + + public static Status newInstance(int status) { + return new Status(status, Optional.empty()); + } +} diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 140ef1e08d5694..5fc2212098fea8 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -81,6 +81,7 @@ shared_library("ChipDeviceCtrl") { "chip/internal/ChipThreadWork.cpp", "chip/internal/ChipThreadWork.h", "chip/internal/CommissionerImpl.cpp", + "chip/logging/LoggingFilter.cpp", "chip/logging/LoggingRedirect.cpp", "chip/native/ChipMainLoopWork.h", "chip/native/PyChipError.cpp", diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 2576a360307611..b4f2edb2955005 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -71,7 +71,6 @@ #include #include #include -#include #include #include #include @@ -200,9 +199,6 @@ PyChipError pychip_ScriptDevicePairingDelegate_SetOpenWindowCompleteCallback( // BLE PyChipError pychip_DeviceCommissioner_CloseBleConnection(chip::Controller::DeviceCommissioner * devCtrl); -uint8_t pychip_DeviceController_GetLogFilter(); -void pychip_DeviceController_SetLogFilter(uint8_t category); - const char * pychip_Stack_ErrorToString(ChipError::StorageType err); const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode); void pychip_Stack_SetLogFunct(LogMessageFunct logFunct); @@ -353,22 +349,6 @@ const char * pychip_DeviceController_StatusReportToString(uint32_t profileId, ui return nullptr; } -uint8_t pychip_DeviceController_GetLogFilter() -{ -#if _CHIP_USE_LOGGING - return chip::Logging::GetLogFilter(); -#else - return chip::Logging::kLogCategory_None; -#endif -} - -void pychip_DeviceController_SetLogFilter(uint8_t category) -{ -#if _CHIP_USE_LOGGING - chip::Logging::SetLogFilter(category); -#endif -} - PyChipError pychip_DeviceController_ConnectBLE(chip::Controller::DeviceCommissioner * devCtrl, uint16_t discriminator, uint32_t setupPINCode, chip::NodeId nodeid) { diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 2297dfff3049ab..2400d543f6d09e 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -1480,23 +1480,6 @@ def ZCLAttributeList(self): return self._Cluster.ListClusterAttributes() - def SetLogFilter(self, category): - self.CheckIsActive() - - if category < 0 or category > pow(2, 8): - raise ValueError("category must be an unsigned 8-bit integer") - - self._ChipStack.Call( - lambda: self._dmLib.pychip_DeviceController_SetLogFilter(category) - ) - - def GetLogFilter(self): - self.CheckIsActive() - - self._ChipStack.Call( - lambda: self._dmLib.pychip_DeviceController_GetLogFilter() - ) - def SetBlockingCB(self, blockingCB): self.CheckIsActive() diff --git a/src/controller/python/chip/logging/LoggingFilter.cpp b/src/controller/python/chip/logging/LoggingFilter.cpp new file mode 100644 index 00000000000000..52271dc3aeca71 --- /dev/null +++ b/src/controller/python/chip/logging/LoggingFilter.cpp @@ -0,0 +1,37 @@ +/* + * + * Copyright (c) 2024 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 + +extern "C" { + +uint8_t pychip_logging_GetLogFilter() +{ +#if _CHIP_USE_LOGGING + return chip::Logging::GetLogFilter(); +#else + return chip::Logging::kLogCategory_None; +#endif +} + +void pychip_logging_SetLogFilter(uint8_t category) +{ +#if _CHIP_USE_LOGGING + chip::Logging::SetLogFilter(category); +#endif +} +} diff --git a/src/controller/python/chip/logging/__init__.py b/src/controller/python/chip/logging/__init__.py index 980c33ac92482d..047d3f4f8e97f5 100644 --- a/src/controller/python/chip/logging/__init__.py +++ b/src/controller/python/chip/logging/__init__.py @@ -32,7 +32,7 @@ def _RedirectToPythonLogging(category, module, message): module = module.decode('utf-8') message = message.decode('utf-8') - logger = logging.getLogger('chip.%s' % module) + logger = logging.getLogger('chip.native.%s' % module) if category == ERROR_CATEGORY_ERROR: logger.error("%s", message) @@ -51,3 +51,16 @@ def RedirectToPythonLogging(): handle = _GetLoggingLibraryHandle() handle.pychip_logging_set_callback(_RedirectToPythonLogging) + + +def SetLogFilter(category): + if category < 0 or category > pow(2, 8): + raise ValueError("category must be an unsigned 8-bit integer") + + handle = _GetLoggingLibraryHandle() + handle.pychip_logging_SetLogFilter(category) + + +def GetLogFilter(): + handle = _GetLoggingLibraryHandle() + return handle.pychip_logging_GetLogFilter() diff --git a/src/controller/python/chip/logging/library_handle.py b/src/controller/python/chip/logging/library_handle.py index ae34f502fd1093..f74a810b4641da 100644 --- a/src/controller/python/chip/logging/library_handle.py +++ b/src/controller/python/chip/logging/library_handle.py @@ -27,7 +27,9 @@ def _GetLoggingLibraryHandle() -> ctypes.CDLL: native methods. """ - handle = chip.native.GetLibraryHandle() + # Getting a handle without requiring init, as logging methods + # do not require chip stack startup + handle = chip.native.GetLibraryHandle(chip.native.HandleFlags(0)) # Uses one of the type decorators as an indicator for everything being # initialized. diff --git a/src/controller/python/test/test_scripts/mobile-device-test.py b/src/controller/python/test/test_scripts/mobile-device-test.py index 87e0a9acb6569b..9ceaa35d24c291 100755 --- a/src/controller/python/test/test_scripts/mobile-device-test.py +++ b/src/controller/python/test/test_scripts/mobile-device-test.py @@ -251,8 +251,12 @@ def do_tests(controller_nodeid, device_nodeid, address, timeout, discriminator, multiple=True, default=[], help="Trace location") +@click.option('--app-pid', + type=int, + default=0, + help="The PID of the app against which the test is going to run") def run(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin, enable_test, disable_test, log_level, - log_format, print_test_list, paa_trust_store_path, trace_to): + log_format, print_test_list, paa_trust_store_path, trace_to, app_pid): coloredlogs.install(level=log_level, fmt=log_format, logger=logger) if print_test_list: diff --git a/src/credentials/FabricTable.h b/src/credentials/FabricTable.h index 688a6d6a612bc7..c61b6176fecb1e 100644 --- a/src/credentials/FabricTable.h +++ b/src/credentials/FabricTable.h @@ -116,15 +116,15 @@ class DLL_EXPORT FabricInfo private: struct InitParams { - NodeId nodeId = kUndefinedNodeId; - FabricId fabricId = kUndefinedFabricId; - FabricIndex fabricIndex = kUndefinedFabricIndex; - CompressedFabricId compressedFabricId = kUndefinedCompressedFabricId; - Crypto::P256PublicKey rootPublicKey; - VendorId vendorId = VendorId::NotSpecified; /**< Vendor ID for commissioner of fabric */ + CompressedFabricId compressedFabricId = kUndefinedCompressedFabricId; + NodeId nodeId = kUndefinedNodeId; + FabricIndex fabricIndex = kUndefinedFabricIndex; Crypto::P256Keypair * operationalKeypair = nullptr; - bool hasExternallyOwnedKeypair = false; - bool advertiseIdentity = false; + FabricId fabricId = kUndefinedFabricId; + Crypto::P256PublicKey rootPublicKey; + VendorId vendorId = VendorId::NotSpecified; /**< Vendor ID for commissioner of fabric */ + bool hasExternallyOwnedKeypair = false; + bool advertiseIdentity = false; CHIP_ERROR AreValid() const { diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRDevice.h index 9d3b0768ff4061..96526a2ecacf67 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRDevice.h @@ -338,8 +338,9 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * If the timeout is set to 0, the request will not expire and completion will not be called until * the log is fully retrieved or an error occurs. * @param queue The queue on which completion will be called. - * @param completion The completion that will be called to return the URL of the requested log if successful. Otherwise - * returns an error. + * @param completion The completion handler that is called after attempting to retrieve the requested log. + * - In case of success, the completion handler is called with a non-nil URL and a nil error. + * - If there is an error, a non-nil error is used and the url can be non-nil too if some logs have already been downloaded. */ - (void)downloadLogOfType:(MTRDiagnosticLogType)type timeout:(NSTimeInterval)timeout diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index a7aa7645185a7c..f2ba2d2173e977 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -284,6 +284,8 @@ - (void)invalidate os_unfair_lock_lock(&self->_lock); + _state = MTRDeviceStateUnknown; + _weakDelegate = nil; // Make sure we don't try to resubscribe if we have a pending resubscribe @@ -343,13 +345,13 @@ - (void)_changeState:(MTRDeviceState)state _state = state; if (lastState != state) { if (state != MTRDeviceStateReachable) { - MTR_LOG_INFO("%@ State change %lu => %lu, set estimated start time to nil", self, static_cast(lastState), + MTR_LOG_INFO("%@ reachability state change %lu => %lu, set estimated start time to nil", self, static_cast(lastState), static_cast(state)); _estimatedStartTime = nil; _estimatedStartTimeFromGeneralDiagnosticsUpTime = nil; } else { MTR_LOG_INFO( - "%@ State change %lu => %lu", self, static_cast(lastState), static_cast(state)); + "%@ reachability state change %lu => %lu", self, static_cast(lastState), static_cast(state)); } id delegate = _weakDelegate.strongObject; if (delegate) { @@ -357,6 +359,9 @@ - (void)_changeState:(MTRDeviceState)state [delegate device:self stateChanged:state]; }); } + } else { + MTR_LOG_INFO( + "%@ Not reporting reachability state change, since no change in state %lu => %lu", self, static_cast(lastState), static_cast(state)); } } @@ -592,14 +597,14 @@ - (void)_handleEventReport:(NSArray *> *)eventRepor // If event time is of MTREventTimeTypeSystemUpTime type, then update estimated start time as needed NSNumber * eventTimeTypeNumber = eventDict[MTREventTimeTypeKey]; if (!eventTimeTypeNumber) { - MTR_LOG_ERROR("Event %@ missing event time type", eventDict); + MTR_LOG_ERROR("%@ Event %@ missing event time type", self, eventDict); continue; } MTREventTimeType eventTimeType = (MTREventTimeType) eventTimeTypeNumber.unsignedIntegerValue; if (eventTimeType == MTREventTimeTypeSystemUpTime) { NSNumber * eventTimeValueNumber = eventDict[MTREventSystemUpTimeKey]; if (!eventTimeValueNumber) { - MTR_LOG_ERROR("Event %@ missing event time value", eventDict); + MTR_LOG_ERROR("%@ Event %@ missing event time value", self, eventDict); continue; } NSTimeInterval eventTimeValue = eventTimeValueNumber.doubleValue; @@ -792,7 +797,7 @@ - (void)_setupSubscription CHIP_ERROR err = readClient->SendAutoResubscribeRequest(std::move(readParams)); if (err != CHIP_NO_ERROR) { - NSError * error = [MTRError errorForCHIPErrorCode:err]; + NSError * error = [MTRError errorForCHIPErrorCode:err logContext:self]; MTR_LOG_ERROR("%@ SendAutoResubscribeRequest error %@", self, error); dispatch_async(self.queue, ^{ [self _handleSubscriptionError:error]; @@ -982,6 +987,8 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) // Create work item, set ready handler to perform task, then enqueue the work MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; uint64_t workItemID = workItem.uniqueID; // capture only the ID, not the work item + NSNumber * nodeID = [self nodeID]; + [workItem setBatchingID:MTRDeviceWorkItemBatchingReadID data:readRequests handler:^(id opaqueDataCurrent, id opaqueDataNext) { mtr_hide(self); // don't capture self accidentally NSMutableArray * readRequestsCurrent = opaqueDataCurrent; @@ -991,14 +998,14 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) while (readRequestsNext.count) { // Can only read up to 9 paths at a time, per spec if (readRequestsCurrent.count >= 9) { - MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, item is full", workItemID); + MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, item is full [%@:%@:%@:%@]", workItemID, nodeID, endpointID, clusterID, attributeID); return outcome; } // if params don't match then they cannot be merged if (![readRequestsNext[0][MTRDeviceReadRequestFieldParamsIndex] isEqual:readRequestsCurrent[0][MTRDeviceReadRequestFieldParamsIndex]]) { - MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, parameter mismatch", workItemID); + MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, parameter mismatch [%@:%@:%@:%@]", workItemID, nodeID, endpointID, clusterID, attributeID); return outcome; } @@ -1006,8 +1013,8 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) auto readItem = readRequestsNext.firstObject; [readRequestsNext removeObjectAtIndex:0]; [readRequestsCurrent addObject:readItem]; - MTR_LOG_INFO("Batching read attribute work item [%llu]: added %@ (now %tu requests total)", - workItemID, readItem, readRequestsCurrent.count); + MTR_LOG_INFO("Batching read attribute work item [%llu]: added %@ (now %tu requests total) [%@:%@:%@:%@]", + workItemID, readItem, readRequestsCurrent.count, nodeID, endpointID, clusterID, attributeID); outcome = MTRBatchedPartially; } NSCAssert(readRequestsNext.count == 0, @"should have batched everything or returned early"); @@ -1017,7 +1024,7 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) mtr_hide(self); // don't capture self accidentally for (NSArray * readItem in readRequests) { if ([readItem isEqual:opaqueItemData]) { - MTR_LOG_DEFAULT("Read attribute work item [%llu] report duplicate %@", workItemID, readItem); + MTR_LOG_DEFAULT("Read attribute work item [%llu] report duplicate %@ [%@:%@:%@:%@]", workItemID, readItem, nodeID, endpointID, clusterID, attributeID); *isDuplicate = YES; *stop = YES; return; @@ -1053,23 +1060,23 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) if (values) { // Since the format is the same data-value dictionary, this looks like an // attribute report - MTR_LOG_INFO("Read attribute work item [%llu] result: %@", workItemID, values); + MTR_LOG_INFO("Read attribute work item [%llu] result: %@ [%@:%@:%@:%@]", workItemID, values, nodeID, endpointID, clusterID, attributeID); [self _handleAttributeReport:values]; } // TODO: better retry logic if (error && (retryCount < 2)) { - MTR_LOG_ERROR("Read attribute work item [%llu] failed (will retry): %@", workItemID, error); + MTR_LOG_ERROR("Read attribute work item [%llu] failed (will retry): %@ [%@:%@:%@:%@]", workItemID, error, nodeID, endpointID, clusterID, attributeID); completion(MTRAsyncWorkNeedsRetry); } else { if (error) { - MTR_LOG_DEFAULT("Read attribute work item [%llu] failed (giving up): %@", workItemID, error); + MTR_LOG_DEFAULT("Read attribute work item [%llu] failed (giving up): %@ [%@:%@:%@:%@]", workItemID, error, nodeID, endpointID, clusterID, attributeID); } completion(MTRAsyncWorkComplete); } }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ %@ %@", endpointID, clusterID, attributeID]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ %@ %@ %@", self.nodeID, endpointID, clusterID, attributeID]; } return attributeValueToReturn; @@ -1137,7 +1144,7 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID completion(MTRAsyncWorkComplete); }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ %@ %@", endpointID, clusterID, attributeID]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ %@ %@ %@", self.nodeID, endpointID, clusterID, attributeID]; } - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID @@ -1739,7 +1746,7 @@ - (void)setExpectedValues:(NSArray *> *)values NSDate * expirationTime = [NSDate dateWithTimeIntervalSinceNow:expectedValueInterval.doubleValue / 1000]; MTR_LOG_INFO( - "Setting expected values %@ with expiration time %f seconds from now", values, [expirationTime timeIntervalSinceNow]); + "%@ Setting expected values %@ with expiration time %f seconds from now", self, values, [expirationTime timeIntervalSinceNow]); os_unfair_lock_lock(&self->_lock); diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index f0c6e89a3af30c..64d70ce647cdb7 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -1313,12 +1313,17 @@ - (void)downloadLogFromNodeWithID:(NSNumber *)nodeID queue:(dispatch_queue_t)queue completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion { - [_factory downloadLogFromNodeWithID:nodeID - controller:self - type:type - timeout:timeout - queue:queue - completion:completion]; + [self asyncDispatchToMatterQueue:^() { + [self->_factory downloadLogFromNodeWithID:nodeID + controller:self + type:type + timeout:timeout + queue:queue + completion:completion]; + } + errorHandler:^(NSError * error) { + completion(nil, error); + }]; } - (NSArray *)accessGrantsForClusterPath:(MTRClusterPath *)clusterPath diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 457abeaed55a5f..0430558e8a4b32 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -1220,24 +1220,20 @@ - (void)downloadLogFromNodeWithID:(NSNumber *)nodeID queue:(dispatch_queue_t)queue completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion { - dispatch_sync(_chipWorkQueue, ^{ - if (![self isRunning]) { - return; - } + assertChipStackLockedByCurrentThread(); - if (_diagnosticLogsDownloader == nil) { - _diagnosticLogsDownloader = [[MTRDiagnosticLogsDownloader alloc] init]; - auto systemState = _controllerFactory->GetSystemState(); - systemState->BDXTransferServer()->SetDelegate([_diagnosticLogsDownloader getBridge]); - } + if (_diagnosticLogsDownloader == nil) { + _diagnosticLogsDownloader = [[MTRDiagnosticLogsDownloader alloc] init]; + auto systemState = _controllerFactory->GetSystemState(); + systemState->BDXTransferServer()->SetDelegate([_diagnosticLogsDownloader getBridge]); + } - [_diagnosticLogsDownloader downloadLogFromNodeWithID:nodeID - controller:controller - type:type - timeout:timeout - queue:queue - completion:completion]; - }); + [_diagnosticLogsDownloader downloadLogFromNodeWithID:nodeID + controller:controller + type:type + timeout:timeout + queue:queue + completion:completion]; } - (void)operationalInstanceAdded:(chip::PeerId &)operationalID diff --git a/src/darwin/Framework/CHIP/MTRDiagnosticLogsDownloader.mm b/src/darwin/Framework/CHIP/MTRDiagnosticLogsDownloader.mm index 4814b37d7a82f4..46226d69357058 100644 --- a/src/darwin/Framework/CHIP/MTRDiagnosticLogsDownloader.mm +++ b/src/darwin/Framework/CHIP/MTRDiagnosticLogsDownloader.mm @@ -59,7 +59,7 @@ - (instancetype)initWithType:(MTRDiagnosticLogType)type - (void)writeToFile:(NSData *)data error:(out NSError **)error; -- (BOOL)compare:(NSString *)fileDesignator +- (BOOL)matches:(NSString *)fileDesignator fabricIndex:(NSNumber *)fabricIndex nodeID:(NSNumber *)nodeID; @@ -139,8 +139,7 @@ - (void)handleBDXTransferSessionEndForFileDesignator:(NSString *)fileDesignator private: static void OnTransferTimeout(chip::System::Layer * layer, void * context); - MTRDiagnosticLogsDownloader * mDelegate; - AbortHandler mAbortHandler; + MTRDiagnosticLogsDownloader * __weak mDelegate; }; @implementation Download @@ -162,7 +161,7 @@ - (instancetype)initWithType:(MTRDiagnosticLogType)type Download * strongSelf = weakSelf; if (strongSelf) { // If a fileHandle exists, it means that the BDX session has been initiated and a file has - // been created to host the data of the session. So even if there is an error it may be some + // been created to host the data of the session. So even if there is an error there may be some // data in the logs that the caller may find useful. For this reason, fileURL is passed in even // when there is an error but fileHandle is not nil. completion(strongSelf->_fileHandle ? fileURL : nil, bdxError); @@ -192,15 +191,12 @@ - (void)checkInteractionModelResponse:(MTRDiagnosticLogsClusterRetrieveLogsRespo VerifyOrReturn(![status isEqual:@(MTRDiagnosticLogsStatusBusy)], [self failure:[MTRError errorForCHIPErrorCode:CHIP_ERROR_BUSY]]); VerifyOrReturn(![status isEqual:@(MTRDiagnosticLogsStatusDenied)], [self failure:[MTRError errorForCHIPErrorCode:CHIP_ERROR_ACCESS_DENIED]]); - // If there is not logs for the given type, forward it to the caller with a nil url and stop here. - VerifyOrReturn(![status isEqual:@(MTRDiagnosticLogsStatusNoLogs)], [self success]); - - // If the whole log content fits into the response LogContent field, forward it to the caller + // If the whole log content fits into the response LogContent field or if there is no log, forward it to the caller // and stop here. - if ([status isEqual:@(MTRDiagnosticLogsStatusExhausted)]) { + if ([status isEqual:@(MTRDiagnosticLogsStatusExhausted)] || [status isEqual:@(MTRDiagnosticLogsStatusNoLogs)]) { NSError * writeError = nil; [self writeToFile:response.logContent error:&writeError]; - VerifyOrReturn(nil == writeError, [self failure:[MTRError errorForCHIPErrorCode:CHIP_ERROR_INTERNAL]]); + VerifyOrReturn(nil == writeError, [self failure:writeError]); [self success]; return; @@ -238,7 +234,7 @@ - (void)deleteFile [[NSFileManager defaultManager] removeItemAtPath:[_fileURL path] error:&error]; if (nil != error) { // There is an error but there is really not much we can do at that point besides logging it. - MTR_LOG_ERROR("Error: %@", error); + MTR_LOG_ERROR("Error trying to delete the log file: %@. Error: %@", _fileURL, error); } } @@ -249,11 +245,11 @@ - (void)writeToFile:(NSData *)data error:(out NSError **)error [_fileHandle writeData:data error:error]; } -- (BOOL)compare:(NSString *)fileDesignator +- (BOOL)matches:(NSString *)fileDesignator fabricIndex:(NSNumber *)fabricIndex nodeID:(NSNumber *)nodeID { - return [_fileDesignator isEqualToString:fileDesignator] && _fabricIndex == fabricIndex && _nodeID == nodeID; + return [_fileDesignator isEqualToString:fileDesignator] && [_fabricIndex isEqualToNumber:fabricIndex] && [_nodeID isEqualToNumber:nodeID]; } - (void)failure:(NSError * _Nullable)error @@ -329,7 +325,7 @@ - (void)dealloc - (Download * _Nullable)get:(NSString *)fileDesignator fabricIndex:(NSNumber *)fabricIndex nodeID:(NSNumber *)nodeID { for (Download * download in _downloads) { - if ([download compare:fileDesignator fabricIndex:fabricIndex nodeID:nodeID]) { + if ([download matches:fileDesignator fabricIndex:fabricIndex nodeID:nodeID]) { return download; } } @@ -344,6 +340,8 @@ - (Download * _Nullable)add:(MTRDiagnosticLogType)type completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion done:(void (^)(Download * finishedDownload))done { + assertChipStackLockedByCurrentThread(); + auto download = [[Download alloc] initWithType:type fabricIndex:fabricIndex nodeID:nodeID queue:queue completion:completion done:done]; VerifyOrReturnValue(nil != download, nil); @@ -353,6 +351,8 @@ - (Download * _Nullable)add:(MTRDiagnosticLogType)type - (void)remove:(Download *)download { + assertChipStackLockedByCurrentThread(); + [_downloads removeObject:download]; } @end @@ -525,9 +525,7 @@ - (void)handleBDXTransferSessionEndForFileDesignator:(NSString *)fileDesignator } }; - // Ideally we would like to handle aborts a bit differently since this only works - // because our BDX stack supports one transfer at a time. - mAbortHandler = ^(NSError * error) { + auto abortHandler = ^(NSError * error) { assertChipStackLockedByCurrentThread(); auto err = [MTRError errorToCHIPErrorCode:error]; transfer->Reject(err); @@ -537,7 +535,7 @@ - (void)handleBDXTransferSessionEndForFileDesignator:(NSString *)fileDesignator fabricIndex:fabricIndex nodeID:nodeId completion:completionHandler - abortHandler:mAbortHandler]; + abortHandler:abortHandler]; return CHIP_NO_ERROR; } @@ -588,8 +586,6 @@ - (void)handleBDXTransferSessionEndForFileDesignator:(NSString *)fileDesignator } }; - mAbortHandler = nil; - [mDelegate handleBDXTransferSessionDataForFileDesignator:fileDesignator fabricIndex:fabricIndex nodeID:nodeId diff --git a/src/darwin/Framework/CHIP/MTRError.h b/src/darwin/Framework/CHIP/MTRError.h index a2bea3e5a49e40..8eaefbd50df643 100644 --- a/src/darwin/Framework/CHIP/MTRError.h +++ b/src/darwin/Framework/CHIP/MTRError.h @@ -104,31 +104,33 @@ typedef NS_ERROR_ENUM(MTRErrorDomain, MTRErrorCode){ typedef NS_ERROR_ENUM(MTRInteractionErrorDomain, MTRInteractionErrorCode){ // These values come from the general status code table in the Matter // Interaction Model specification. - MTRInteractionErrorCodeFailure = 0x01, - MTRInteractionErrorCodeInvalidSubscription = 0x7d, - MTRInteractionErrorCodeUnsupportedAccess = 0x7e, - MTRInteractionErrorCodeUnsupportedEndpoint = 0x7f, - MTRInteractionErrorCodeInvalidAction = 0x80, - MTRInteractionErrorCodeUnsupportedCommand = 0x81, - MTRInteractionErrorCodeInvalidCommand = 0x85, - MTRInteractionErrorCodeUnsupportedAttribute = 0x86, - MTRInteractionErrorCodeConstraintError = 0x87, - MTRInteractionErrorCodeUnsupportedWrite = 0x88, - MTRInteractionErrorCodeResourceExhausted = 0x89, - MTRInteractionErrorCodeNotFound = 0x8b, - MTRInteractionErrorCodeUnreportableAttribute = 0x8c, - MTRInteractionErrorCodeInvalidDataType = 0x8d, - MTRInteractionErrorCodeUnsupportedRead = 0x8f, - MTRInteractionErrorCodeDataVersionMismatch = 0x92, - MTRInteractionErrorCodeTimeout = 0x94, - MTRInteractionErrorCodeBusy = 0x9c, - MTRInteractionErrorCodeUnsupportedCluster = 0xc3, - MTRInteractionErrorCodeNoUpstreamSubscription = 0xc5, - MTRInteractionErrorCodeNeedsTimedInteraction = 0xc6, - MTRInteractionErrorCodeUnsupportedEvent = 0xc7, - MTRInteractionErrorCodePathsExhausted = 0xc8, - MTRInteractionErrorCodeTimedRequestMismatch = 0xc9, - MTRInteractionErrorCodeFailsafeRequired = 0xca, + MTRInteractionErrorCodeFailure = 0x01, + MTRInteractionErrorCodeInvalidSubscription = 0x7d, + MTRInteractionErrorCodeUnsupportedAccess = 0x7e, + MTRInteractionErrorCodeUnsupportedEndpoint = 0x7f, + MTRInteractionErrorCodeInvalidAction = 0x80, + MTRInteractionErrorCodeUnsupportedCommand = 0x81, + MTRInteractionErrorCodeInvalidCommand = 0x85, + MTRInteractionErrorCodeUnsupportedAttribute = 0x86, + MTRInteractionErrorCodeConstraintError = 0x87, + MTRInteractionErrorCodeUnsupportedWrite = 0x88, + MTRInteractionErrorCodeResourceExhausted = 0x89, + MTRInteractionErrorCodeNotFound = 0x8b, + MTRInteractionErrorCodeUnreportableAttribute = 0x8c, + MTRInteractionErrorCodeInvalidDataType = 0x8d, + MTRInteractionErrorCodeUnsupportedRead = 0x8f, + MTRInteractionErrorCodeDataVersionMismatch = 0x92, + MTRInteractionErrorCodeTimeout = 0x94, + MTRInteractionErrorCodeBusy = 0x9c, + MTRInteractionErrorCodeUnsupportedCluster = 0xc3, + MTRInteractionErrorCodeNoUpstreamSubscription = 0xc5, + MTRInteractionErrorCodeNeedsTimedInteraction = 0xc6, + MTRInteractionErrorCodeUnsupportedEvent = 0xc7, + MTRInteractionErrorCodePathsExhausted = 0xc8, + MTRInteractionErrorCodeTimedRequestMismatch = 0xc9, + MTRInteractionErrorCodeFailsafeRequired = 0xca, + MTRInteractionErrorInvalidInState MTR_NEWLY_AVAILABLE = 0xcb, + MTRInteractionErrorNoCommandResponse MTR_NEWLY_AVAILABLE = 0xcc, }; // clang-format on diff --git a/src/darwin/Framework/CHIP/MTRError.mm b/src/darwin/Framework/CHIP/MTRError.mm index 4050615f2c3adf..0cb40006ac3293 100644 --- a/src/darwin/Framework/CHIP/MTRError.mm +++ b/src/darwin/Framework/CHIP/MTRError.mm @@ -21,7 +21,6 @@ #import "MTRError_Internal.h" #import -#import #import #import @@ -45,12 +44,17 @@ - (instancetype)initWithError:(CHIP_ERROR)error; @implementation MTRError + (NSError *)errorForCHIPErrorCode:(CHIP_ERROR)errorCode +{ + return [MTRError errorForCHIPErrorCode:errorCode logContext:nil]; +} + ++ (NSError *)errorForCHIPErrorCode:(CHIP_ERROR)errorCode logContext:(id)contextToLog { if (errorCode == CHIP_NO_ERROR) { return nil; } - ChipLogError(Controller, "Creating NSError from %" CHIP_ERROR_FORMAT, errorCode.Format()); + ChipLogError(Controller, "Creating NSError from %" CHIP_ERROR_FORMAT " (context: %@)", errorCode.Format(), contextToLog); if (errorCode.IsIMStatus()) { chip::app::StatusIB status(errorCode); diff --git a/src/darwin/Framework/CHIP/MTRError_Internal.h b/src/darwin/Framework/CHIP/MTRError_Internal.h index 9997118ae95191..24916082835a6e 100644 --- a/src/darwin/Framework/CHIP/MTRError_Internal.h +++ b/src/darwin/Framework/CHIP/MTRError_Internal.h @@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MTRError : NSObject + (NSError * _Nullable)errorForCHIPErrorCode:(CHIP_ERROR)errorCode; ++ (NSError * _Nullable)errorForCHIPErrorCode:(CHIP_ERROR)errorCode logContext:(id _Nullable)contextToLog; + (NSError * _Nullable)errorForIMStatus:(const chip::app::StatusIB &)status; + (NSError * _Nullable)errorForIMStatusCode:(chip::Protocols::InteractionModel::Status)status; + (CHIP_ERROR)errorToCHIPErrorCode:(NSError * _Nullable)error; diff --git a/src/darwin/Framework/CHIP/MTRSetupPayload.mm b/src/darwin/Framework/CHIP/MTRSetupPayload.mm index d7b08c7c0a44a4..42bd7babdf3bc8 100644 --- a/src/darwin/Framework/CHIP/MTRSetupPayload.mm +++ b/src/darwin/Framework/CHIP/MTRSetupPayload.mm @@ -235,7 +235,7 @@ + (MTRSetupPayload * _Nullable)setupPayloadWithOnboardingPayload:(NSString *)onb if (!validPayload) { if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT logContext:onboardingPayload]; } return nil; } @@ -336,7 +336,7 @@ - (NSString * _Nullable)qrCodeString:(NSError * __autoreleasing *)error if (self.commissioningFlow == MTRCommissioningFlowInvalid) { // No idea how to map this to the standard codes. if (error != nil) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE logContext:@"invalid flow"]; } return nil; } @@ -344,7 +344,7 @@ - (NSString * _Nullable)qrCodeString:(NSError * __autoreleasing *)error if (self.hasShortDiscriminator) { // Can't create a QR code with a short discriminator. if (error != nil) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE logContext:@"cannot create a QR code with a short descrimintor"]; } return nil; } @@ -352,7 +352,7 @@ - (NSString * _Nullable)qrCodeString:(NSError * __autoreleasing *)error if (self.discoveryCapabilities == MTRDiscoveryCapabilitiesUnknown) { // Can't create a QR code if we don't know the discovery capabilities. if (error != nil) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE logContext:@"cannot create a QR code with unknown discovery capabilities"]; } return nil; } diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm index a1f1f47a7dc26e..ce847748cdfdc7 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm @@ -19,7 +19,7 @@ #include #include #include -#include + #include #include #include @@ -39,14 +39,14 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) // clusters dont use it. } -EmberAfStatus emAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, +Protocols::InteractionModel::Status emAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, EmberAfAttributeType dataType) { assertChipStackLockedByCurrentThread(); // All of our attributes are handled via AttributeAccessInterface, so this // should be unreached. - return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; + return Protocols::InteractionModel::Status::UnsupportedAttribute; } namespace chip { diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 24b9efcec73ff2..91191285701e33 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -8608,6 +8608,10 @@ # for now just start doing that for new additions to it. - TestDifferentVendorMeiRequest - TestDifferentVendorMeiResponse + GeneralDiagnostics: + # Targeting Spring 2024 Matter release + - PayloadTestRequest + - PayloadTestResponse structs: Thermostat: # Targeting Spring 2024 Matter release @@ -8651,6 +8655,9 @@ - PresetTypeFeaturesBitmap - ScheduleTypeFeaturesBitmap - TemperatureSetpointHoldPolicyBitmap + GeneralDiagnostics: + # Targeting Spring 2024 Matter release + - Feature bitmap values: DoorLock: Feature: diff --git a/src/darwin/Framework/CHIPTests/MTRBackwardsCompatTests.m b/src/darwin/Framework/CHIPTests/MTRBackwardsCompatTests.m index aada405c97a424..840c29f0c2a805 100644 --- a/src/darwin/Framework/CHIPTests/MTRBackwardsCompatTests.m +++ b/src/darwin/Framework/CHIPTests/MTRBackwardsCompatTests.m @@ -28,6 +28,8 @@ // system dependencies #import +// Fixture: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1 + static const uint16_t kPairingTimeoutInSeconds = 10; static const uint16_t kCASESetupTimeoutInSeconds = 30; static const uint16_t kTimeoutInSeconds = 3; @@ -71,7 +73,7 @@ - (void)onPairingComplete:(NSError *)error XCTAssertEqual(error.code, 0); NSError * commissionError = nil; - [sController commissionDevice:kDeviceId commissioningParams:[[MTRCommissioningParameters alloc] init] error:&commissionError]; + XCTAssertTrue([sController commissionDevice:kDeviceId commissioningParams:[[MTRCommissioningParameters alloc] init] error:&commissionError]); XCTAssertNil(commissionError); // Keep waiting for onCommissioningComplete @@ -89,45 +91,13 @@ - (void)onCommissioningComplete:(NSError *)error @interface MTRBackwardsCompatTests : XCTestCase @end -static BOOL sStackInitRan = NO; -static BOOL sNeedsStackShutdown = YES; - @implementation MTRBackwardsCompatTests -+ (void)tearDown ++ (void)setUp { - // Global teardown, runs once - if (sNeedsStackShutdown) { - // We don't need to worry about ResetCommissionee. If we get here, - // we're running only one of our test methods (using - // -only-testing:MatterTests/MTROTAProviderTests/testMethodName), since - // we did not run test999_TearDown. - [self shutdownStack]; - } -} - -- (void)setUp -{ - // Per-test setup, runs before each test. [super setUp]; - [self setContinueAfterFailure:NO]; - if (sStackInitRan == NO) { - [self initStack]; - } -} - -- (void)tearDown -{ - // Per-test teardown, runs after each test. - [super tearDown]; -} - -- (void)initStack -{ - sStackInitRan = YES; - - XCTestExpectation * expectation = [self expectationWithDescription:@"Pairing Complete"]; + XCTestExpectation * expectation = [[XCTestExpectation alloc] initWithDescription:@"Pairing Complete"]; __auto_type * factory = [MTRControllerFactory sharedInstance]; XCTAssertNotNil(factory); @@ -135,18 +105,13 @@ - (void)initStack __auto_type * storage = [[MTRTestStorage alloc] init]; __auto_type * factoryParams = [[MTRControllerFactoryParams alloc] initWithStorage:storage]; factoryParams.port = @(kLocalPort); + XCTAssertTrue([factory startup:factoryParams]); - BOOL ok = [factory startup:factoryParams]; - XCTAssertTrue(ok); - - __auto_type * testKeys = [[MTRTestKeys alloc] init]; - XCTAssertNotNil(testKeys); - - sTestKeys = testKeys; + XCTAssertNotNil(sTestKeys = [[MTRTestKeys alloc] init]); // Needs to match what startControllerOnExistingFabric calls elsewhere in // this file do. - __auto_type * params = [[MTRDeviceControllerStartupParams alloc] initWithSigningKeypair:testKeys fabricId:1 ipk:testKeys.ipk]; + __auto_type * params = [[MTRDeviceControllerStartupParams alloc] initWithSigningKeypair:sTestKeys fabricId:1 ipk:sTestKeys.ipk]; params.vendorId = @(kTestVendorId); MTRDeviceController * controller = [factory startControllerOnNewFabric:params]; @@ -164,12 +129,12 @@ - (void)initStack XCTAssertNotNil(payload); XCTAssertNil(error); - [controller setupCommissioningSessionWithPayload:payload newNodeID:@(kDeviceId) error:&error]; + XCTAssertTrue([controller setupCommissioningSessionWithPayload:payload newNodeID:@(kDeviceId) error:&error]); XCTAssertNil(error); - [self waitForExpectationsWithTimeout:kPairingTimeoutInSeconds handler:nil]; + XCTAssertEqual([XCTWaiter waitForExpectations:@[ expectation ] timeout:kPairingTimeoutInSeconds], XCTWaiterResultCompleted); - __block XCTestExpectation * connectionExpectation = [self expectationWithDescription:@"CASE established"]; + __block XCTestExpectation * connectionExpectation = [[XCTestExpectation alloc] initWithDescription:@"CASE established"]; [controller getBaseDevice:kDeviceId queue:dispatch_get_main_queue() completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) { @@ -178,27 +143,24 @@ - (void)initStack sConnectedDevice = device; connectionExpectation = nil; }]; - [self waitForExpectationsWithTimeout:kCASESetupTimeoutInSeconds handler:nil]; + XCTAssertEqual([XCTWaiter waitForExpectations:@[ connectionExpectation ] timeout:kCASESetupTimeoutInSeconds], XCTWaiterResultCompleted); } -+ (void)shutdownStack ++ (void)tearDown { - sNeedsStackShutdown = NO; - - MTRDeviceController * controller = sController; - XCTAssertNotNil(controller); - - [controller shutdown]; - XCTAssertFalse([controller isRunning]); + ResetCommissionee(GetConnectedDevice(), dispatch_get_main_queue(), nil, kTimeoutInSeconds); + [sController shutdown]; + XCTAssertFalse([sController isRunning]); [[MTRControllerFactory sharedInstance] shutdown]; + + [super tearDown]; } -- (void)test000_SetUp +- (void)setUp { - // Nothing to do here; our setUp method handled this already. This test - // just exists to make the setup not look like it's happening inside other - // tests. + [super setUp]; + [self setContinueAfterFailure:NO]; } #define CHECK_RETURN_TYPE(sig, type) \ @@ -1210,10 +1172,4 @@ - (void)test048_MTRModeSelectClusterSemanticTagStruct CHECK_PROPERTY(obj, value, setValue, NSNumber *); } -- (void)test999_TearDown -{ - ResetCommissionee(GetConnectedDevice(), dispatch_get_main_queue(), self, kTimeoutInSeconds); - [[self class] shutdownStack]; -} - @end diff --git a/src/darwin/Framework/CHIPTests/MTRCommissionableBrowserTests.m b/src/darwin/Framework/CHIPTests/MTRCommissionableBrowserTests.m index 2acd1c2d379d83..047ce4f8588816 100644 --- a/src/darwin/Framework/CHIPTests/MTRCommissionableBrowserTests.m +++ b/src/darwin/Framework/CHIPTests/MTRCommissionableBrowserTests.m @@ -23,6 +23,11 @@ #import "MTRTestKeys.h" #import "MTRTestStorage.h" +// Fixture 1: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1 +// Fixture 2: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1 \ + --dac_provider credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json \ + --product-id 32768 --discriminator 3839 + static const uint16_t kLocalPort = 5541; static const uint16_t kTestVendorId = 0xFFF1u; static const uint16_t kTestProductId1 = 0x8000u; @@ -113,39 +118,11 @@ - (void)controller:(MTRDeviceController *)controller didRemoveCommissionableDevi @interface MTRCommissionableBrowserTests : XCTestCase @end -static BOOL sStackInitRan = NO; -static BOOL sNeedsStackShutdown = YES; - @implementation MTRCommissionableBrowserTests -+ (void)tearDown -{ - // Global teardown, runs once - if (sNeedsStackShutdown) { - [self shutdownStack]; - } -} - -- (void)setUp ++ (void)setUp { - // Per-test setup, runs before each test. [super setUp]; - [self setContinueAfterFailure:NO]; - - if (sStackInitRan == NO) { - [self initStack]; - } -} - -- (void)tearDown -{ - // Per-test teardown, runs after each test. - [super tearDown]; -} - -- (void)initStack -{ - sStackInitRan = YES; __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; XCTAssertNotNil(factory); @@ -169,17 +146,22 @@ - (void)initStack sController = controller; } -+ (void)shutdownStack ++ (void)tearDown { - sNeedsStackShutdown = NO; - MTRDeviceController * controller = sController; XCTAssertNotNil(controller); - [controller shutdown]; XCTAssertFalse([controller isRunning]); [[MTRDeviceControllerFactory sharedInstance] stopControllerFactory]; + + [super tearDown]; +} + +- (void)setUp +{ + [super setUp]; + [self setContinueAfterFailure:NO]; } - (void)test001_StartBrowseAndStopBrowse @@ -248,9 +230,4 @@ - (void)test005_StartBrowseGetCommissionableOverMdns XCTAssertTrue([sController stopBrowseForCommissionables]); } -- (void)test999_TearDown -{ - [[self class] shutdownStack]; -} - @end diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 9f14cdf9d3c9c9..66bca12cc47bfd 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -36,6 +36,8 @@ // system dependencies #import +// Fixture: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1 + static const uint16_t kPairingTimeoutInSeconds = 10; static const uint16_t kTimeoutInSeconds = 3; static const uint64_t kDeviceId = 0x12344321; @@ -125,46 +127,11 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr @interface MTRDeviceTests : XCTestCase @end -static BOOL sStackInitRan = NO; -static BOOL sNeedsStackShutdown = YES; - @implementation MTRDeviceTests -+ (void)tearDown -{ - // Global teardown, runs once - if (sNeedsStackShutdown) { - // We don't need to worry about ResetCommissionee. If we get here, - // we're running only one of our test methods (using - // -only-testing:MatterTests/MTROTAProviderTests/testMethodName), since - // we did not run test999_TearDown. - [self shutdownStack]; - } -} - -- (void)setUp -{ - // Per-test setup, runs before each test. - [super setUp]; - [self setContinueAfterFailure:NO]; - - if (sStackInitRan == NO) { - [self initStack]; - [self waitForCommissionee]; - } -} - -- (void)tearDown ++ (void)setUp { - // Per-test teardown, runs after each test. - [super tearDown]; -} - -- (void)initStack -{ - sStackInitRan = YES; - - XCTestExpectation * expectation = [self expectationWithDescription:@"Pairing Complete"]; + XCTestExpectation * pairingExpectation = [[XCTestExpectation alloc] initWithDescription:@"Pairing Complete"]; __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; XCTAssertNotNil(factory); @@ -192,7 +159,7 @@ - (void)initStack sController = controller; MTRDeviceTestDeviceControllerDelegate * deviceControllerDelegate = - [[MTRDeviceTestDeviceControllerDelegate alloc] initWithExpectation:expectation]; + [[MTRDeviceTestDeviceControllerDelegate alloc] initWithExpectation:pairingExpectation]; dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.device_controller_delegate", DISPATCH_QUEUE_SERIAL); [controller setDeviceControllerDelegate:deviceControllerDelegate queue:callbackQueue]; @@ -202,38 +169,33 @@ - (void)initStack XCTAssertNotNil(payload); XCTAssertNil(error); - [controller setupCommissioningSessionWithPayload:payload newNodeID:@(kDeviceId) error:&error]; + XCTAssertTrue([controller setupCommissioningSessionWithPayload:payload newNodeID:@(kDeviceId) error:&error]); XCTAssertNil(error); + XCTAssertEqual([XCTWaiter waitForExpectations:@[ pairingExpectation ] timeout:kPairingTimeoutInSeconds], XCTWaiterResultCompleted); - [self waitForExpectationsWithTimeout:kPairingTimeoutInSeconds handler:nil]; + XCTestExpectation * expectation = [[XCTestExpectation alloc] initWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(expectation); + XCTAssertEqual([XCTWaiter waitForExpectations:@[ expectation ] timeout:kTimeoutInSeconds], XCTWaiterResultCompleted); } -+ (void)shutdownStack ++ (void)tearDown { - sNeedsStackShutdown = NO; + ResetCommissionee(GetConnectedDevice(), dispatch_get_main_queue(), nil, kTimeoutInSeconds); MTRDeviceController * controller = sController; XCTAssertNotNil(controller); - [controller shutdown]; XCTAssertFalse([controller isRunning]); [[MTRDeviceControllerFactory sharedInstance] stopControllerFactory]; -} - -- (void)waitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - WaitForCommissionee(expectation); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + [super tearDown]; } -- (void)test000_SetUp +- (void)setUp { - // Nothing to do here; our setUp method handled this already. This test - // just exists to make the setup not look like it's happening inside other - // tests. + [super setUp]; + [self setContinueAfterFailure:NO]; } - (void)test001_ReadAttribute @@ -2864,12 +2826,6 @@ - (void)test030_DeviceAndClusterProperties XCTAssertEqualObjects(cluster.endpointID, @(0)); } -- (void)test999_TearDown -{ - ResetCommissionee(GetConnectedDevice(), dispatch_get_main_queue(), self, kTimeoutInSeconds); - [[self class] shutdownStack]; -} - @end @interface MTRDeviceEncoderTests : XCTestCase diff --git a/src/darwin/Framework/CHIPTests/MTRPairingTests.m b/src/darwin/Framework/CHIPTests/MTRPairingTests.m index 94ce4e93131169..6757dea7ceb541 100644 --- a/src/darwin/Framework/CHIPTests/MTRPairingTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPairingTests.m @@ -26,6 +26,10 @@ // system dependencies #import +// Fixture: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1 \ + --dac_provider credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json \ + --product-id 32768 --discriminator 3839 + static const uint16_t kPairingTimeoutInSeconds = 10; static const uint16_t kTimeoutInSeconds = 3; static uint64_t sDeviceId = 0x12344321; @@ -118,106 +122,32 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr @end -// attestationDelegate and failSafeExtension can both be nil -static void DoPairingTest(XCTestCase * testcase, id attestationDelegate, NSNumber * failSafeExtension) -{ - // Don't reuse node ids, because that will confuse us. - ++sDeviceId; - XCTestExpectation * expectation = [testcase expectationWithDescription:@"Commissioning Complete"]; - __auto_type * controller = sController; - - __auto_type * controllerDelegate = [[MTRPairingTestControllerDelegate alloc] initWithExpectation:expectation - attestationDelegate:attestationDelegate - failSafeExtension:failSafeExtension]; - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.pairing", DISPATCH_QUEUE_SERIAL); - - [controller setDeviceControllerDelegate:controllerDelegate queue:callbackQueue]; - - NSError * error; - __auto_type * payload = [MTRSetupPayload setupPayloadWithOnboardingPayload:kOnboardingPayload error:&error]; - XCTAssertNotNil(payload); - XCTAssertNil(error); - - [controller setupCommissioningSessionWithPayload:payload newNodeID:@(sDeviceId) error:&error]; - XCTAssertNil(error); - - [testcase waitForExpectations:@[ expectation ] timeout:kPairingTimeoutInSeconds]; - - ResetCommissionee([MTRBaseDevice deviceWithNodeID:@(sDeviceId) controller:controller], dispatch_get_main_queue(), testcase, - kTimeoutInSeconds); -} - @interface MTRPairingTests : XCTestCase @end -static BOOL sStackInitRan = NO; -static BOOL sNeedsStackShutdown = YES; - @implementation MTRPairingTests -+ (void)tearDown -{ - // Global teardown, runs once - if (sNeedsStackShutdown) { - // We don't need to worry about ResetCommissionee. If we get here, - // we're running only one of our test methods (using - // -only-testing:MatterTests/MTROTAProviderTests/testMethodName), since - // we did not run test999_TearDown. - [self shutdownStack]; - } -} - -- (void)setUp -{ - // Per-test setup, runs before each test. - [super setUp]; - [self setContinueAfterFailure:NO]; - - if (sStackInitRan == NO) { - [self initStack]; - } -} - -- (void)tearDown -{ - // Per-test teardown, runs after each test. - [super tearDown]; -} - -- (void)initStack ++ (void)setUp { - sStackInitRan = YES; - __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; XCTAssertNotNil(factory); __auto_type * storage = [[MTRTestStorage alloc] init]; __auto_type * factoryParams = [[MTRDeviceControllerFactoryParams alloc] initWithStorage:storage]; factoryParams.port = @(kLocalPort); + XCTAssertTrue([factory startControllerFactory:factoryParams error:nil]); - BOOL ok = [factory startControllerFactory:factoryParams error:nil]; - XCTAssertTrue(ok); - - __auto_type * testKeys = [[MTRTestKeys alloc] init]; - XCTAssertNotNil(testKeys); - - sTestKeys = testKeys; + XCTAssertNotNil(sTestKeys = [[MTRTestKeys alloc] init]); // Needs to match what startControllerOnExistingFabric calls elsewhere in // this file do. - __auto_type * params = [[MTRDeviceControllerStartupParams alloc] initWithIPK:testKeys.ipk fabricID:@(1) nocSigner:testKeys]; + __auto_type * params = [[MTRDeviceControllerStartupParams alloc] initWithIPK:sTestKeys.ipk fabricID:@(1) nocSigner:sTestKeys]; params.vendorID = @(kTestVendorId); - - MTRDeviceController * controller = [factory createControllerOnNewFabric:params error:nil]; - XCTAssertNotNil(controller); - - sController = controller; + XCTAssertNotNil(sController = [factory createControllerOnNewFabric:params error:nil]); } -+ (void)shutdownStack ++ (void)tearDown { - sNeedsStackShutdown = NO; - MTRDeviceController * controller = sController; XCTAssertNotNil(controller); @@ -227,23 +157,51 @@ + (void)shutdownStack [[MTRDeviceControllerFactory sharedInstance] stopControllerFactory]; } -- (void)test000_SetUp +- (void)setUp { - // Nothing to do here; our setUp method handled this already. This test - // just exists to make the setup not look like it's happening inside other - // tests. + [super setUp]; + [self setContinueAfterFailure:NO]; +} + +// attestationDelegate and failSafeExtension can both be nil +- (void)doPairingTestWithAttestationDelegate:(id)attestationDelegate failSafeExtension:(NSNumber *)failSafeExtension +{ + // Don't reuse node ids, because that will confuse us. + ++sDeviceId; + XCTestExpectation * expectation = [self expectationWithDescription:@"Commissioning Complete"]; + + __auto_type * controllerDelegate = [[MTRPairingTestControllerDelegate alloc] initWithExpectation:expectation + attestationDelegate:attestationDelegate + failSafeExtension:failSafeExtension]; + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.pairing", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + + [sController setDeviceControllerDelegate:controllerDelegate queue:callbackQueue]; + + NSError * error; + __auto_type * payload = [MTRSetupPayload setupPayloadWithOnboardingPayload:kOnboardingPayload error:&error]; + XCTAssertNotNil(payload); + XCTAssertNil(error); + + XCTAssertTrue([sController setupCommissioningSessionWithPayload:payload newNodeID:@(sDeviceId) error:&error]); + XCTAssertNil(error); + + [self waitForExpectations:@[ expectation ] timeout:kPairingTimeoutInSeconds]; + + ResetCommissionee([MTRBaseDevice deviceWithNodeID:@(sDeviceId) controller:sController], dispatch_get_main_queue(), self, + kTimeoutInSeconds); } - (void)test001_PairWithoutAttestationDelegate { - DoPairingTest(self, nil, nil); + [self doPairingTestWithAttestationDelegate:nil failSafeExtension:nil]; } - (void)test002_PairWithAttestationDelegateNoFailsafeExtension { XCTestExpectation * expectation = [self expectationWithDescription:@"Attestation delegate called"]; - DoPairingTest(self, [[NoOpAttestationDelegate alloc] initWithExpectation:expectation], nil); + [self doPairingTestWithAttestationDelegate:[[NoOpAttestationDelegate alloc] initWithExpectation:expectation] + failSafeExtension:nil]; [self waitForExpectations:@[ expectation ] timeout:kTimeoutInSeconds]; } @@ -255,7 +213,8 @@ - (void)test003_PairWithAttestationDelegateFailsafeExtensionShort // Extend by a time that is going to be smaller than the 60s default we // already have set via CHIP_DEVICE_CONFIG_FAILSAFE_EXPIRY_LENGTH_SEC on the // server side, minus whatever time that has likely passed. - DoPairingTest(self, [[NoOpAttestationDelegate alloc] initWithExpectation:expectation], @(30)); + [self doPairingTestWithAttestationDelegate:[[NoOpAttestationDelegate alloc] initWithExpectation:expectation] + failSafeExtension:@(30)]; [self waitForExpectations:@[ expectation ] timeout:kTimeoutInSeconds]; } @@ -267,14 +226,10 @@ - (void)test004_PairWithAttestationDelegateFailsafeExtensionLong // Extend by a time that is going to be larger than the 60s default we // already have set via CHIP_DEVICE_CONFIG_FAILSAFE_EXPIRY_LENGTH_SEC on the // server side. - DoPairingTest(self, [[NoOpAttestationDelegate alloc] initWithExpectation:expectation], @(90)); + [self doPairingTestWithAttestationDelegate:[[NoOpAttestationDelegate alloc] initWithExpectation:expectation] + failSafeExtension:@(90)]; [self waitForExpectations:@[ expectation ] timeout:kTimeoutInSeconds]; } -- (void)test999_TearDown -{ - [[self class] shutdownStack]; -} - @end diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index eadfabae9cac57..604ed600fb02d6 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -204,10 +204,6 @@ @implementation MTRPerControllerStorageTests { dispatch_queue_t _storageQueue; } -+ (void)tearDown -{ -} - - (void)setUp { // Per-test setup, runs before each test. diff --git a/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift b/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift index 4a35a431347045..1276868a14c5fa 100644 --- a/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift +++ b/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift @@ -3,6 +3,8 @@ import XCTest // This should eventually grow into a Swift copy of MTRDeviceTests +// Fixture: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1 + struct DeviceConstants { static let testVendorID = 0xFFF1 static let onboardingPayload = "MT:-24J0AFN00KA0648G00" @@ -93,41 +95,10 @@ class MTRSwiftDeviceTestDelegate : NSObject, MTRDeviceDelegate { } class MTRSwiftDeviceTests : XCTestCase { - static var sStackInitRan : Bool = false - static var sNeedsStackShutdown : Bool = true - - static override func tearDown() { - // Global teardown, runs once - if (sNeedsStackShutdown) { - // We don't need to worry about ResetCommissionee. If we get here, - // we're running only one of our test methods (using - // -only-testing:MatterTests/MTRSwiftDeviceTests/testMethodName), since - // we did not run test999_TearDown. - shutdownStack() - } - } - - override func setUp() + static override func setUp() { - // Per-test setup, runs before each test. super.setUp() - self.continueAfterFailure = false - - if (!MTRSwiftDeviceTests.sStackInitRan) { - initStack() - } - } - - override func tearDown() - { - // Per-test teardown, runs after each test. - super.tearDown() - } - - func initStack() - { - MTRSwiftDeviceTests.sStackInitRan = true - + let factory = MTRDeviceControllerFactory.sharedInstance() let storage = MTRTestStorage() @@ -141,7 +112,6 @@ class MTRSwiftDeviceTests : XCTestCase { XCTAssertTrue(factory.isRunning) let testKeys = MTRTestKeys() - sTestKeys = testKeys // Needs to match what startControllerOnExistingFabric calls elsewhere in @@ -160,8 +130,8 @@ class MTRSwiftDeviceTests : XCTestCase { sController = controller - let expectation = expectation(description : "Commissioning Complete") - + let expectation = XCTestExpectation(description : "Commissioning Complete") + let controllerDelegate = MTRSwiftDeviceTestControllerDelegate(withExpectation: expectation) let serialQueue = DispatchQueue(label: "com.chip.device_controller_delegate") @@ -180,30 +150,29 @@ class MTRSwiftDeviceTests : XCTestCase { } catch { XCTFail("Could not start setting up PASE session: \(error)") return } - - wait(for: [expectation], timeout: DeviceConstants.pairingTimeoutInSeconds) + + XCTAssertEqual(XCTWaiter.wait(for: [expectation], timeout: DeviceConstants.pairingTimeoutInSeconds), XCTWaiter.Result.completed) } - static func shutdownStack() - { - sNeedsStackShutdown = false - + static override func tearDown() { + ResetCommissionee(sConnectedDevice, DispatchQueue.main, nil, UInt16(DeviceConstants.timeoutInSeconds)) + let controller = sController XCTAssertNotNil(controller) - controller!.shutdown() XCTAssertFalse(controller!.isRunning) MTRDeviceControllerFactory.sharedInstance().stop() + + super.tearDown() } - - func test000_SetUp() + + override func setUp() { - // Nothing to do here; our setUp method handled this already. This test - // just exists to make the setup not look like it's happening inside other - // tests. + super.setUp() + self.continueAfterFailure = false } - + func test017_TestMTRDeviceBasics() { let device = MTRDevice(nodeID: DeviceConstants.deviceID as NSNumber, controller:sController!) @@ -545,10 +514,4 @@ class MTRSwiftDeviceTests : XCTestCase { XCTAssertEqual(cluster.device, device) XCTAssertEqual(cluster.__endpointID, 0 as NSNumber) } - - func test999_TearDown() - { - ResetCommissionee(sConnectedDevice, DispatchQueue.main, self, UInt16(DeviceConstants.timeoutInSeconds)) - type(of: self).shutdownStack() - } } diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestResetCommissioneeHelper.m b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestResetCommissioneeHelper.m index 25ec161420bcfe..841a1ce656fa0b 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestResetCommissioneeHelper.m +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestResetCommissioneeHelper.m @@ -16,11 +16,11 @@ #import "MTRTestResetCommissioneeHelper.h" -void ResetCommissionee(MTRBaseDevice * device, dispatch_queue_t queue, XCTestCase * testcase, uint16_t commandTimeout) +void ResetCommissionee(MTRBaseDevice * device, dispatch_queue_t queue, XCTestCase * testcaseUnused, uint16_t commandTimeout) { // Put the device back in the state we found it: open commissioning window, no fabrics commissioned. // Get our current fabric index, for later deletion. - XCTestExpectation * readFabricIndexExpectation = [testcase expectationWithDescription:@"Fabric index read"]; + XCTestExpectation * readFabricIndexExpectation = [[XCTestExpectation alloc] initWithDescription:@"Fabric index read"]; __block NSNumber * fabricIndex; __auto_type * opCredsCluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -32,11 +32,10 @@ void ResetCommissionee(MTRBaseDevice * device, dispatch_queue_t queue, XCTestCas [readFabricIndexExpectation fulfill]; }]; - [testcase waitForExpectations:@[ readFabricIndexExpectation ] timeout:commandTimeout]; + XCTAssertEqual([XCTWaiter waitForExpectations:@[ readFabricIndexExpectation ] timeout:commandTimeout], XCTWaiterResultCompleted); // Open a commissioning window. - XCTestExpectation * openCommissioningWindowExpectation = [testcase expectationWithDescription:@"Commissioning window opened"]; - + XCTestExpectation * openCommissioningWindowExpectation = [[XCTestExpectation alloc] initWithDescription:@"Commissioning window opened"]; __auto_type * adminCommissioningCluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -49,10 +48,10 @@ void ResetCommissionee(MTRBaseDevice * device, dispatch_queue_t queue, XCTestCas [openCommissioningWindowExpectation fulfill]; }]; - [testcase waitForExpectations:@[ openCommissioningWindowExpectation ] timeout:commandTimeout]; + XCTAssertEqual([XCTWaiter waitForExpectations:@[ openCommissioningWindowExpectation ] timeout:commandTimeout], XCTWaiterResultCompleted); // Remove our fabric from the device. - XCTestExpectation * removeFabricExpectation = [testcase expectationWithDescription:@"Fabric removed"]; + XCTestExpectation * removeFabricExpectation = [[XCTestExpectation alloc] initWithDescription:@"Fabric removed"]; __auto_type * removeParams = [[MTROperationalCredentialsClusterRemoveFabricParams alloc] init]; removeParams.fabricIndex = fabricIndex; @@ -66,5 +65,5 @@ void ResetCommissionee(MTRBaseDevice * device, dispatch_queue_t queue, XCTestCas [removeFabricExpectation fulfill]; }]; - [testcase waitForExpectations:@[ removeFabricExpectation ] timeout:commandTimeout]; + XCTAssertEqual([XCTWaiter waitForExpectations:@[ removeFabricExpectation ] timeout:commandTimeout], XCTWaiterResultCompleted); } diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 22c071844795d5..5e227bc7a8d2b2 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -1648,7 +1648,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1140; + LastUpgradeCheck = 1500; ORGANIZATIONNAME = CHIP; TargetAttributes = { 037C3CA42991A44B00B7EEE2 = { diff --git a/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme b/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme index a55dee131a9593..e7243c557d1fa4 100644 --- a/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme +++ b/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme @@ -1,6 +1,6 @@ - - diff --git a/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework.xcscheme b/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework.xcscheme index 83717233f5a54a..c93293386d9c50 100644 --- a/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework.xcscheme +++ b/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework.xcscheme @@ -1,6 +1,6 @@ +#include #include #include diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 4e4808e88b3d39..38b76bca539c2a 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -33,7 +33,6 @@ #include #include -#include #include namespace chip { diff --git a/src/lib/core/CHIPKeyIds.cpp b/src/lib/core/CHIPKeyIds.cpp index 5c560aec893e79..06417dc61b5a9d 100644 --- a/src/lib/core/CHIPKeyIds.cpp +++ b/src/lib/core/CHIPKeyIds.cpp @@ -15,15 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include -/** - * @file - * This file implements CHIP key types helper functions. - * - */ -#include "CHIPKeyIds.h" - -#include #include namespace chip { diff --git a/src/lib/core/CHIPKeyIds.h b/src/lib/core/CHIPKeyIds.h index 3abbe90d674005..1aaf5cf519656c 100644 --- a/src/lib/core/CHIPKeyIds.h +++ b/src/lib/core/CHIPKeyIds.h @@ -22,10 +22,8 @@ * key flags, key ID fields, and helper API functions. * */ - #pragma once -#include #include namespace chip { diff --git a/src/lib/core/ErrorStr.cpp b/src/lib/core/ErrorStr.cpp index f661cc85ed63aa..5551ff60d413cd 100644 --- a/src/lib/core/ErrorStr.cpp +++ b/src/lib/core/ErrorStr.cpp @@ -15,24 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file implements functions to translate error codes used - * throughout the CHIP package into human-readable strings. - * - */ +#include #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif +#include +#include +#include + #include #include -#include -#include - namespace chip { /** diff --git a/src/lib/core/ErrorStr.h b/src/lib/core/ErrorStr.h index 70cca22c44a026..de3a0ad0afe93a 100644 --- a/src/lib/core/ErrorStr.h +++ b/src/lib/core/ErrorStr.h @@ -28,7 +28,6 @@ #include #include -#include namespace chip { diff --git a/src/lib/core/OTAImageHeader.cpp b/src/lib/core/OTAImageHeader.cpp index 674c08afb31429..68942d919a5ad4 100644 --- a/src/lib/core/OTAImageHeader.cpp +++ b/src/lib/core/OTAImageHeader.cpp @@ -14,12 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include -#include "OTAImageHeader.h" - -#include +#include +#include +#include +#include +#include #include #include +#include +#include + +#include namespace chip { diff --git a/src/lib/core/OTAImageHeader.h b/src/lib/core/OTAImageHeader.h index f9fa8868530fd8..36a3375ee9313e 100644 --- a/src/lib/core/OTAImageHeader.h +++ b/src/lib/core/OTAImageHeader.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include diff --git a/src/lib/core/TLVCircularBuffer.cpp b/src/lib/core/TLVCircularBuffer.cpp index c88892fe22bfd5..76a392f90f1644 100644 --- a/src/lib/core/TLVCircularBuffer.cpp +++ b/src/lib/core/TLVCircularBuffer.cpp @@ -26,16 +26,17 @@ * to continually add top-level TLV elements by evicting * pre-existing elements. */ +#include #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif -#include - -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/src/lib/core/TLVCircularBuffer.h b/src/lib/core/TLVCircularBuffer.h index 80897b3267913e..4d1507a4df973f 100644 --- a/src/lib/core/TLVCircularBuffer.h +++ b/src/lib/core/TLVCircularBuffer.h @@ -30,12 +30,12 @@ #pragma once #include -#include -#include -#include - +#include +#include +#include #include +#include #include namespace chip { diff --git a/src/lib/core/TLVDebug.cpp b/src/lib/core/TLVDebug.cpp index 74e6d5ce5377f1..4d922f6285ebd1 100644 --- a/src/lib/core/TLVDebug.cpp +++ b/src/lib/core/TLVDebug.cpp @@ -15,27 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file implements interfaces for debugging and logging - * CHIP TLV. - * - */ +#include #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif -#include #include -#include -#include -#include +#include +#include +#include +#include #include #include -#include namespace chip { diff --git a/src/lib/core/TLVDebug.h b/src/lib/core/TLVDebug.h index 5c18236880c01d..6a83b6b0ad09f1 100644 --- a/src/lib/core/TLVDebug.h +++ b/src/lib/core/TLVDebug.h @@ -15,24 +15,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file defines types and interfaces for debugging and - * logging CHIP TLV. - * - */ - #pragma once #include -#include #include -#include +#include +#include +#include namespace chip { - namespace TLV { /** diff --git a/src/lib/core/TLVReader.cpp b/src/lib/core/TLVReader.cpp index 9ef55edfe3a91f..abef9af1636ca5 100644 --- a/src/lib/core/TLVReader.cpp +++ b/src/lib/core/TLVReader.cpp @@ -15,24 +15,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include -/** - * @file - * This file implements a parser for the CHIP TLV (Tag-Length-Value) encoding format. - * - */ +#include +#include -#include - -#include +#include #include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include +#include +#include + +#if CHIP_CONFIG_TLV_VALIDATE_CHAR_STRING_ON_READ #include +#endif namespace chip { namespace TLV { diff --git a/src/lib/core/TLVReader.h b/src/lib/core/TLVReader.h index 744402a8b059cd..bfb6b47f14d3f4 100644 --- a/src/lib/core/TLVReader.h +++ b/src/lib/core/TLVReader.h @@ -24,14 +24,25 @@ * shares many properties with the commonly used JSON serialization format while being considerably * more compact over the wire. */ - #pragma once +#include +#include +#include +#include + +#include #include #include - -#include "TLVCommon.h" -#include "TLVWriter.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include /** * @namespace chip::TLV diff --git a/src/lib/core/TLVTags.cpp b/src/lib/core/TLVTags.cpp index bc44d52af12490..7a7701a965080e 100644 --- a/src/lib/core/TLVTags.cpp +++ b/src/lib/core/TLVTags.cpp @@ -15,7 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "TLVTags.h" +#include + +#include + +#include +#include namespace chip { namespace TLV { diff --git a/src/lib/core/TLVTags.h b/src/lib/core/TLVTags.h index b82be9179466af..950afab2f78f54 100644 --- a/src/lib/core/TLVTags.h +++ b/src/lib/core/TLVTags.h @@ -15,18 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file contains definitions for working with CHIP TLV tags. - * - */ - #pragma once -#include #include #include + +#include #include namespace chip { diff --git a/src/lib/core/TLVUpdater.cpp b/src/lib/core/TLVUpdater.cpp index 7df01cbad7b4a6..f960cfede7220d 100644 --- a/src/lib/core/TLVUpdater.cpp +++ b/src/lib/core/TLVUpdater.cpp @@ -15,18 +15,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file implements an updating encoder for the CHIP TLV - * (Tag-Length-Value) encoding format. - * - */ - -#include -#include -#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include namespace chip { namespace TLV { diff --git a/src/lib/core/TLVUpdater.h b/src/lib/core/TLVUpdater.h index f07d2bf24c92cb..1dfebbefcbb8a1 100644 --- a/src/lib/core/TLVUpdater.h +++ b/src/lib/core/TLVUpdater.h @@ -15,22 +15,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file contains definitions for working with data encoded in CHIP TLV format. - * - * CHIP TLV (Tag-Length-Value) is a generalized encoding method for simple structured data. It - * shares many properties with the commonly used JSON serialization format while being considerably - * more compact over the wire. - */ - #pragma once -#include "TLVCommon.h" +#include -#include "TLVReader.h" -#include "TLVWriter.h" +#include +#include +#include +#include +#include +#include +#include /** * @namespace chip::TLV diff --git a/src/lib/core/TLVUtilities.cpp b/src/lib/core/TLVUtilities.cpp index 6faf40b02be0ac..a0fcae8d78111b 100644 --- a/src/lib/core/TLVUtilities.cpp +++ b/src/lib/core/TLVUtilities.cpp @@ -23,8 +23,12 @@ * */ -#include #include + +#include +#include +#include +#include #include namespace chip { diff --git a/src/lib/core/TLVUtilities.h b/src/lib/core/TLVUtilities.h index 8813b9f8b558d2..9c4c406542d093 100644 --- a/src/lib/core/TLVUtilities.h +++ b/src/lib/core/TLVUtilities.h @@ -15,21 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#pragma once -/** - * @file - * This file specifies types and utility interfaces for managing and - * working with CHIP TLV. - * - */ +#include -#pragma once +#include +#include #include -#include - -#include -#include namespace chip { diff --git a/src/lib/core/TLVWriter.cpp b/src/lib/core/TLVWriter.cpp index 825b8c7b671406..2e946d0403267a 100644 --- a/src/lib/core/TLVWriter.cpp +++ b/src/lib/core/TLVWriter.cpp @@ -15,29 +15,34 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file implements an encoder for the CHIP TLV (Tag-Length-Value) encoding format. - * - */ +#include #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include +#include #include - -#include -#include -#include +#include // Doxygen is confused by the __attribute__ annotation #ifndef DOXYGEN diff --git a/src/lib/core/TLVWriter.h b/src/lib/core/TLVWriter.h index 39e23a8e3e5ab3..3c8600e303b552 100644 --- a/src/lib/core/TLVWriter.h +++ b/src/lib/core/TLVWriter.h @@ -27,12 +27,24 @@ #pragma once -#include - -#include "TLVCommon.h" +#include +#include +#include +#include -#include "TLVBackingStore.h" -#include "TLVReader.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /** * @namespace chip::TLV diff --git a/src/lib/dnssd/Advertiser.h b/src/lib/dnssd/Advertiser.h index 0a98a90fa89a7e..ddd8df259b1364 100644 --- a/src/lib/dnssd/Advertiser.h +++ b/src/lib/dnssd/Advertiser.h @@ -48,6 +48,13 @@ enum class CommissioningMode kEnabledEnhanced // Enhanced Commissioning Mode, CM=2 in DNS-SD key/value pairs }; +enum class ICDModeAdvertise : uint8_t +{ + kNone, // The device does not support the LIT feature-set. No ICD= key is advertised in DNS-SD. + kSIT, // The ICD supports the LIT feature-set, but is currently operating as a SIT. ICD=0 in DNS-SD key/value pairs. + kLIT, // The ICD is currently operating as a LIT. ICD=1 in DNS-SD key/value pairs. +}; + template class BaseAdvertisingParams { @@ -94,6 +101,8 @@ class BaseAdvertisingParams return *reinterpret_cast(this); } const Optional & GetLocalMRPConfig() const { return mLocalMRPConfig; } + + // NOTE: The SetTcpSupported API is deprecated and not compliant with 1.3. T flag should not be set. Derived & SetTcpSupported(Optional tcpSupported) { mTcpSupported = tcpSupported; @@ -101,12 +110,12 @@ class BaseAdvertisingParams } Optional GetTcpSupported() const { return mTcpSupported; } - Derived & SetICDOperatingAsLIT(Optional operatesAsLIT) + Derived & SetICDModeToAdvertise(ICDModeAdvertise operatingMode) { - mICDOperatesAsLIT = operatesAsLIT; + mICDModeAdvertise = operatingMode; return *reinterpret_cast(this); } - Optional GetICDOperatingAsLIT() const { return mICDOperatesAsLIT; } + ICDModeAdvertise GetICDModeToAdvertise() const { return mICDModeAdvertise; } private: uint16_t mPort = CHIP_PORT; @@ -116,7 +125,7 @@ class BaseAdvertisingParams size_t mMacLength = 0; Optional mLocalMRPConfig; Optional mTcpSupported; - Optional mICDOperatesAsLIT; + ICDModeAdvertise mICDModeAdvertise = ICDModeAdvertise::kNone; }; /// Defines parameters required for advertising a CHIP node diff --git a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp index b3b1f8ea8876a6..4c80723738bcaa 100644 --- a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp @@ -232,13 +232,9 @@ class AdvertiserMinMdns : public ServiceAdvertiser, { auto mrp = optionalMrp.Value(); -#if CHIP_CONFIG_ENABLE_ICD_SERVER - // An ICD operating as a LIT should not advertise its slow polling interval. - // When the ICD doesn't support the LIT feature, it doesn't set nor advertise the GetICDOperatingAsLIT entry. - // Therefore when GetICDOperatingAsLIT has no value or a value of 0, we advertise the slow polling interval - // otherwise we don't include the SII key in the advertisement. - if (!params.GetICDOperatingAsLIT().ValueOr(false)) -#endif + // An ICD operating as a LIT shall not advertise its slow polling interval. + // Don't include the SII key in the advertisement when operating as so. + if (params.GetICDModeToAdvertise() != ICDModeAdvertise::kLIT) { if (mrp.mIdleRetransTimeout > kMaxRetryInterval) { @@ -290,11 +286,11 @@ class AdvertiserMinMdns : public ServiceAdvertiser, CHIP_ERROR_INVALID_STRING_LENGTH); txtFields[numTxtFields++] = storage.tcpSupportedBuf; } - if (params.GetICDOperatingAsLIT().HasValue()) + if (params.GetICDModeToAdvertise() != ICDModeAdvertise::kNone) { size_t writtenCharactersNumber = static_cast(snprintf(storage.operatingICDAsLITBuf, sizeof(storage.operatingICDAsLITBuf), "ICD=%d", - params.GetICDOperatingAsLIT().Value())); + (params.GetICDModeToAdvertise() == ICDModeAdvertise::kLIT))); VerifyOrReturnError((writtenCharactersNumber > 0) && (writtenCharactersNumber < sizeof(storage.operatingICDAsLITBuf)), CHIP_ERROR_INVALID_STRING_LENGTH); txtFields[numTxtFields++] = storage.operatingICDAsLITBuf; diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index 8b1bbbfb7b82e5..abbc4647ff3805 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -213,19 +213,20 @@ CHIP_ERROR CopyTxtRecord(TxtFieldKey key, char * buffer, size_t bufferLen, const case TxtFieldKey::kSessionIdleInterval: #if CHIP_CONFIG_ENABLE_ICD_SERVER // A ICD operating as a LIT should not advertise its slow polling interval - if (params.GetICDOperatingAsLIT().HasValue() && params.GetICDOperatingAsLIT().Value()) - { - // Returning UNINITIALIZED ensures that the SII string isn't added by the AddTxtRecord - // without erroring out the action. - return CHIP_ERROR_UNINITIALIZED; - } + // Returning UNINITIALIZED ensures that the SII string isn't added by the AddTxtRecord + // without erroring out the action. + VerifyOrReturnError(params.GetICDModeToAdvertise() != ICDModeAdvertise::kLIT, CHIP_ERROR_UNINITIALIZED); FALLTHROUGH; #endif case TxtFieldKey::kSessionActiveInterval: case TxtFieldKey::kSessionActiveThreshold: return CopyTextRecordValue(buffer, bufferLen, params.GetLocalMRPConfig(), key); case TxtFieldKey::kLongIdleTimeICD: - return CopyTextRecordValue(buffer, bufferLen, params.GetICDOperatingAsLIT()); + // The ICD key is only added to the advertissment when the device supports the ICD LIT feature-set. + // Return UNINITIALIZED when the operating mode is kNone to ensure that the ICD string isn't added + // by the AddTxtRecord without erroring out the action. + VerifyOrReturnError(params.GetICDModeToAdvertise() != ICDModeAdvertise::kNone, CHIP_ERROR_UNINITIALIZED); + return CopyTextRecordValue(buffer, bufferLen, (params.GetICDModeToAdvertise() == ICDModeAdvertise::kLIT)); default: return CHIP_ERROR_INVALID_ARGUMENT; } diff --git a/src/lib/dnssd/TxtFields.h b/src/lib/dnssd/TxtFields.h index c3b8a0d668682c..5546493624119d 100644 --- a/src/lib/dnssd/TxtFields.h +++ b/src/lib/dnssd/TxtFields.h @@ -79,28 +79,28 @@ enum class TxtFieldKey : uint8_t namespace Internal { struct TxtFieldInfo { - TxtFieldKey key; size_t valMaxSize; - char keyStr[4]; + TxtFieldKey key; TxtKeyUse use; + char keyStr[4]; }; constexpr const TxtFieldInfo txtFieldInfo[static_cast(TxtFieldKey::kCount)] = { - { TxtFieldKey::kUnknown, 0, "", TxtKeyUse::kNone }, - { TxtFieldKey::kLongDiscriminator, kKeyLongDiscriminatorMaxLength, "D", TxtKeyUse::kCommission }, - { TxtFieldKey::kVendorProduct, kKeyVendorProductMaxLength, "VP", TxtKeyUse::kCommission }, - { TxtFieldKey::kCommissioningMode, kKeyCommissioningModeMaxLength, "CM", TxtKeyUse::kCommission }, - { TxtFieldKey::kDeviceType, kKeyDeviceTypeMaxLength, "DT", TxtKeyUse::kCommission }, - { TxtFieldKey::kDeviceName, kKeyDeviceNameMaxLength, "DN", TxtKeyUse::kCommission }, - { TxtFieldKey::kRotatingDeviceId, kKeyRotatingDeviceIdMaxLength, "RI", TxtKeyUse::kCommission }, - { TxtFieldKey::kPairingInstruction, kKeyPairingInstructionMaxLength, "PI", TxtKeyUse::kCommission }, - { TxtFieldKey::kPairingHint, kKeyPairingHintMaxLength, "PH", TxtKeyUse::kCommission }, - { TxtFieldKey::kCommissionerPasscode, kKeyCommissionerPasscodeMaxLength, "CP", TxtKeyUse::kCommission }, - { TxtFieldKey::kSessionIdleInterval, kKeySessionIdleIntervalMaxLength, "SII", TxtKeyUse::kCommon }, - { TxtFieldKey::kSessionActiveInterval, kKeySessionActiveIntervalMaxLength, "SAI", TxtKeyUse::kCommon }, - { TxtFieldKey::kSessionActiveThreshold, kKeySessionActiveThresholdMaxLength, "SAT", TxtKeyUse::kCommon }, - { TxtFieldKey::kTcpSupported, kKeyTcpSupportedMaxLength, "T", TxtKeyUse::kCommon }, - { TxtFieldKey::kLongIdleTimeICD, kKeyLongIdleTimeICDMaxLength, "ICD", TxtKeyUse::kCommon }, + { 0, TxtFieldKey::kUnknown, TxtKeyUse::kNone, "" }, + { kKeyLongDiscriminatorMaxLength, TxtFieldKey::kLongDiscriminator, TxtKeyUse::kCommission, "D" }, + { kKeyVendorProductMaxLength, TxtFieldKey::kVendorProduct, TxtKeyUse::kCommission, "VP" }, + { kKeyCommissioningModeMaxLength, TxtFieldKey::kCommissioningMode, TxtKeyUse::kCommission, "CM" }, + { kKeyDeviceTypeMaxLength, TxtFieldKey::kDeviceType, TxtKeyUse::kCommission, "DT" }, + { kKeyDeviceNameMaxLength, TxtFieldKey::kDeviceName, TxtKeyUse::kCommission, "DN" }, + { kKeyRotatingDeviceIdMaxLength, TxtFieldKey::kRotatingDeviceId, TxtKeyUse::kCommission, "RI" }, + { kKeyPairingInstructionMaxLength, TxtFieldKey::kPairingInstruction, TxtKeyUse::kCommission, "PI" }, + { kKeyPairingHintMaxLength, TxtFieldKey::kPairingHint, TxtKeyUse::kCommission, "PH" }, + { kKeyCommissionerPasscodeMaxLength, TxtFieldKey::kCommissionerPasscode, TxtKeyUse::kCommission, "CP" }, + { kKeySessionIdleIntervalMaxLength, TxtFieldKey::kSessionIdleInterval, TxtKeyUse::kCommon, "SII" }, + { kKeySessionActiveIntervalMaxLength, TxtFieldKey::kSessionActiveInterval, TxtKeyUse::kCommon, "SAI" }, + { kKeySessionActiveThresholdMaxLength, TxtFieldKey::kSessionActiveThreshold, TxtKeyUse::kCommon, "SAT" }, + { kKeyTcpSupportedMaxLength, TxtFieldKey::kTcpSupported, TxtKeyUse::kCommon, "T" }, + { kKeyLongIdleTimeICDMaxLength, TxtFieldKey::kLongIdleTimeICD, TxtKeyUse::kCommon, "ICD" }, }; #ifdef CHIP_CONFIG_TEST diff --git a/src/lib/dnssd/Types.h b/src/lib/dnssd/Types.h index 5d78c7631223cf..a835ebf5647a97 100644 --- a/src/lib/dnssd/Types.h +++ b/src/lib/dnssd/Types.h @@ -112,7 +112,7 @@ struct CommonResolutionData bool IsDeviceTreatedAsSleepy(const ReliableMessageProtocolConfig * defaultMRPConfig) const { - // If either sleepy interval (Idle - SII, Active - SAI) has a value and that value is greater + // If either session interval (Idle - SII, Active - SAI) has a value and that value is greater // than the value passed to this function, then the peer device will be treated as if it is // a Sleepy End Device (SED) return (mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || @@ -207,18 +207,18 @@ inline constexpr size_t kMaxPairingInstructionLen = 128; /// Data that is specific to commisionable/commissioning node discovery struct CommissionNodeData { - char instanceName[Commission::kInstanceNameMaxLength + 1] = {}; + size_t rotatingIdLen = 0; + uint32_t deviceType = 0; uint16_t longDiscriminator = 0; uint16_t vendorId = 0; uint16_t productId = 0; + uint16_t pairingHint = 0; uint8_t commissioningMode = 0; - uint32_t deviceType = 0; - char deviceName[kMaxDeviceNameLen + 1] = {}; + uint8_t commissionerPasscode = 0; uint8_t rotatingId[kMaxRotatingIdLen] = {}; - size_t rotatingIdLen = 0; - uint16_t pairingHint = 0; + char instanceName[Commission::kInstanceNameMaxLength + 1] = {}; + char deviceName[kMaxDeviceNameLen + 1] = {}; char pairingInstruction[kMaxPairingInstructionLen + 1] = {}; - uint8_t commissionerPasscode = 0; CommissionNodeData() {} diff --git a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp index 8f3e39c026eb6d..547d4eecf3bc54 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp @@ -80,7 +80,6 @@ OperationalAdvertisingParameters operationalParams1 = .SetMac(ByteSpan(kMac)) .SetPort(CHIP_PORT) .EnableIpV4(true) - .SetTcpSupported(chip::Optional(false)) .SetLocalMRPConfig(chip::Optional::Value( 32_ms32, 30_ms32)); // Match SII, SAI. SAT not provided so it uses default 4000ms OperationalAdvertisingParameters operationalParams2 = @@ -93,7 +92,7 @@ OperationalAdvertisingParameters operationalParams5 = OperationalAdvertisingParameters().SetPeerId(kPeerId5).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); OperationalAdvertisingParameters operationalParams6 = OperationalAdvertisingParameters().SetPeerId(kPeerId6).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); -const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "SAT=4000", "T=0" }; +const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "SAT=4000" }; PtrResourceRecord ptrOperationalService = PtrResourceRecord(kDnsSdQueryName, kMatterOperationalQueryName); PtrResourceRecord ptrOperational1 = PtrResourceRecord(kMatterOperationalQueryName, kInstanceName1); SrvResourceRecord srvOperational1 = SrvResourceRecord(kInstanceName1, kHostnameName, CHIP_PORT); @@ -181,14 +180,12 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced = .SetPairingInstruction(chip::Optional("Pair me")) .SetProductId(chip::Optional(897)) .SetRotatingDeviceId(chip::Optional("id_that_spins")) - .SetTcpSupported(chip::Optional(true)) - .SetICDOperatingAsLIT(chip::Optional(false)) + .SetICDModeToAdvertise(ICDModeAdvertise::kSIT) // 3600005 is more than the max so should be adjusted down .SetLocalMRPConfig(Optional::Value(3600000_ms32, 3600005_ms32, 65535_ms16)); QNamePart txtCommissionableNodeParamsLargeEnhancedParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000", "DN=testy-test", "RI=id_that_spins", "PI=Pair me", "PH=3", - "SAI=3600000", "SII=3600000", "SAT=65535", "T=1", - "ICD=0" }; + "SAI=3600000", "SII=3600000", "SAT=65535", "ICD=0" }; FullQName txtCommissionableNodeParamsLargeEnhancedName = FullQName(txtCommissionableNodeParamsLargeEnhancedParts); TxtResourceRecord txtCommissionableNodeParamsLargeEnhanced = TxtResourceRecord(instanceName, txtCommissionableNodeParamsLargeEnhancedName); @@ -207,13 +204,12 @@ CommissionAdvertisingParameters commissionableNodeParamsEnhancedAsICDLIT = .SetPairingHint(chip::Optional(3)) .SetPairingInstruction(chip::Optional("Pair me")) .SetProductId(chip::Optional(897)) - .SetTcpSupported(chip::Optional(true)) - .SetICDOperatingAsLIT(chip::Optional(true)) + .SetICDModeToAdvertise(ICDModeAdvertise::kLIT) .SetLocalMRPConfig(Optional::Value(3600000_ms32, 3600000_ms32, 65535_ms16)); // With ICD Operation as LIT, SII key will not be added to the advertisement QNamePart txtCommissionableNodeParamsEnhancedAsICDLITParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000", "DN=testy-test", "PI=Pair me", "PH=3", "SAI=3600000", - "SAT=65535", "T=1", "ICD=1" }; + "SAT=65535", "ICD=1" }; FullQName txtCommissionableNodeParamsEnhancedAsICDLITName = FullQName(txtCommissionableNodeParamsEnhancedAsICDLITParts); TxtResourceRecord txtCommissionableNodeParamsEnhancedAsICDLIT = TxtResourceRecord(instanceName, txtCommissionableNodeParamsEnhancedAsICDLITName); diff --git a/src/lib/dnssd/platform/tests/TestPlatform.cpp b/src/lib/dnssd/platform/tests/TestPlatform.cpp index 93141ca403dc6a..91a79f1efdc64a 100644 --- a/src/lib/dnssd/platform/tests/TestPlatform.cpp +++ b/src/lib/dnssd/platform/tests/TestPlatform.cpp @@ -53,8 +53,7 @@ OperationalAdvertisingParameters operationalParams2 = .SetPort(CHIP_PORT) .EnableIpV4(true) .SetLocalMRPConfig(Optional::Value(32_ms32, 30_ms32, 10_ms16)) // SII and SAI to match below - .SetTcpSupported(Optional(true)) - .SetICDOperatingAsLIT(Optional(false)); + .SetICDModeToAdvertise(ICDModeAdvertise::kSIT); test::ExpectedCall operationalCall2 = test::ExpectedCall() .SetProtocol(DnssdServiceProtocol::kDnssdProtocolTcp) .SetServiceName("_matter") @@ -64,7 +63,6 @@ test::ExpectedCall operationalCall2 = test::ExpectedCall() .AddTxt("SII", "32") .AddTxt("SAI", "30") .AddTxt("SAT", "10") - .AddTxt("T", "1") .AddTxt("ICD", "0"); CommissionAdvertisingParameters commissionableNodeParamsSmall = @@ -97,8 +95,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeBasic = .SetPairingInstruction(Optional("Pair me")) .SetProductId(Optional(897)) .SetRotatingDeviceId(Optional("id_that_spins")) - .SetTcpSupported(Optional(true)) - .SetICDOperatingAsLIT(Optional(false)) + .SetICDModeToAdvertise(ICDModeAdvertise::kSIT) // 3600005 is over the max, so this should be adjusted by the platform .SetLocalMRPConfig(Optional::Value(3600000_ms32, 3600005_ms32, 65535_ms16)); @@ -114,7 +111,6 @@ test::ExpectedCall commissionableLargeBasic = test::ExpectedCall() .AddTxt("RI", "id_that_spins") .AddTxt("PI", "Pair me") .AddTxt("PH", "3") - .AddTxt("T", "1") .AddTxt("ICD", "0") .AddTxt("SII", "3600000") .AddTxt("SAI", "3600000") diff --git a/src/lib/dnssd/tests/TestIncrementalResolve.cpp b/src/lib/dnssd/tests/TestIncrementalResolve.cpp index 2791631a32e8a0..1cc3b714d28ae3 100644 --- a/src/lib/dnssd/tests/TestIncrementalResolve.cpp +++ b/src/lib/dnssd/tests/TestIncrementalResolve.cpp @@ -294,7 +294,7 @@ void TestParseOperational(nlTestSuite * inSuite, void * inContext) { const char * entries[] = { "foo=bar", // unused data - "SII=23" // sleepy idle interval + "SII=23" // session idle interval }; CallOnRecord(inSuite, resolver, TxtResourceRecord(kTestOperationalName.Full(), entries)); @@ -369,7 +369,7 @@ void TestParseCommissionable(nlTestSuite * inSuite, void * inContext) { const char * entries[] = { "some", "foo=bar", "x=y=z", "a=", // unused data - "SII=123" // Sleepy idle interval + "SII=123" // session idle interval }; CallOnRecord(inSuite, resolver, TxtResourceRecord(kTestHostName.Full(), entries)); @@ -381,7 +381,7 @@ void TestParseCommissionable(nlTestSuite * inSuite, void * inContext) { const char * entries[] = { "foo=bar", // unused data - "SAI=321", // sleepy active interval + "SAI=321", // session active interval "D=22345", // Long discriminator "VP=321+654", // VendorProduct "DN=mytest" // Device name diff --git a/src/lib/shell/streamer_nxp.cpp b/src/lib/shell/streamer_nxp.cpp index b499b40c0f72e8..aed4796902942a 100644 --- a/src/lib/shell/streamer_nxp.cpp +++ b/src/lib/shell/streamer_nxp.cpp @@ -25,7 +25,6 @@ /* Includes */ /* -------------------------------------------------------------------------- */ -#include #include #include @@ -65,6 +64,25 @@ #endif #endif +// pw RPC uses UART DMA by default +#ifdef PW_RPC_ENABLED +#define CONSUMER_TASK_HANDLE RpcTaskHandle +#ifndef STREAMER_UART_USE_DMA +#define STREAMER_UART_USE_DMA 1 +#endif +#else +#define CONSUMER_TASK_HANDLE AppMatterCliTaskHandle +#ifndef STREAMER_UART_USE_DMA +#define STREAMER_UART_USE_DMA 0 +#endif +#endif // PW_RPC_ENABLED + +#if STREAMER_UART_USE_DMA +typedef serial_port_uart_dma_config_t streamer_serial_port_uart_config_t; +#else +typedef serial_port_uart_config_t streamer_serial_port_uart_config_t; +#endif + /* -------------------------------------------------------------------------- */ /* Private prototypes */ /* -------------------------------------------------------------------------- */ @@ -82,23 +100,33 @@ static SERIAL_MANAGER_READ_HANDLE_DEFINE(streamerSerialReadHandle); static volatile int txCount = 0; static bool readDone = true; -static serial_port_uart_config_t uartConfig = { .clockRate = BOARD_APP_UART_CLK_FREQ, - .baudRate = BOARD_DEBUG_UART_BAUDRATE, - .parityMode = kSerialManager_UartParityDisabled, - .stopBitCount = kSerialManager_UartOneStopBit, - .enableRx = 1, - .enableTx = 1, - .enableRxRTS = 0, - .enableTxCTS = 0, - .instance = BOARD_APP_UART_INSTANCE }; +static streamer_serial_port_uart_config_t uartConfig = { .clockRate = BOARD_APP_UART_CLK_FREQ, + .baudRate = BOARD_DEBUG_UART_BAUDRATE, + .parityMode = kSerialManager_UartParityDisabled, + .stopBitCount = kSerialManager_UartOneStopBit, + .enableRx = 1, + .enableTx = 1, + .enableRxRTS = 0, + .enableTxCTS = 0, + .instance = BOARD_APP_UART_INSTANCE, +#if STREAMER_UART_USE_DMA + .dma_instance = 0, + .rx_channel = 1, + .tx_channel = 0 +#endif +}; static uint8_t s_ringBuffer[STREAMER_UART_SERIAL_MANAGER_RING_BUFFER_SIZE]; static const serial_manager_config_t s_serialManagerConfig = { .ringBuffer = &s_ringBuffer[0], .ringBufferSize = STREAMER_UART_SERIAL_MANAGER_RING_BUFFER_SIZE, - .type = BOARD_DEBUG_UART_TYPE, - .blockType = kSerialManager_NonBlocking, - .portConfig = (serial_port_uart_config_t *) &uartConfig, +#if STREAMER_UART_USE_DMA + .type = kSerialPort_UartDma, +#else + .type = BOARD_DEBUG_UART_TYPE, +#endif + .blockType = kSerialManager_NonBlocking, + .portConfig = (serial_port_uart_config_t *) &uartConfig, }; /* -------------------------------------------------------------------------- */ @@ -107,7 +135,6 @@ static const serial_manager_config_t s_serialManagerConfig = { namespace chip { namespace Shell { -namespace { int streamer_nxp_init(streamer_t * streamer) { @@ -119,7 +146,12 @@ int streamer_nxp_init(streamer_t * streamer) BOARD_CLIAttachClk(); #endif - uartConfig.clockRate = BOARD_APP_UART_CLK_FREQ; +#if STREAMER_UART_USE_DMA + dma_channel_mux_configure_t dma_channel_mux; + dma_channel_mux.dma_dmamux_configure.dma_tx_channel_mux = kDmaRequestLPUART1Tx; + dma_channel_mux.dma_dmamux_configure.dma_rx_channel_mux = kDmaRequestLPUART1Rx; + uartConfig.dma_channel_mux_configure = &dma_channel_mux; +#endif /* * Make sure to disable interrupts while initializating the serial manager interface @@ -192,8 +224,8 @@ ssize_t streamer_nxp_write(streamer_t * streamer, const char * buffer, size_t le intMask = DisableGlobalIRQ(); txCount++; - status = - SerialManager_WriteNonBlocking((serial_write_handle_t) streamerSerialWriteHandle, (uint8_t *) buffer, (uint32_t) length); + status = SerialManager_WriteNonBlocking((serial_write_handle_t) streamerSerialWriteHandle, + (uint8_t *) (const_cast(buffer)), (uint32_t) length); EnableGlobalIRQ(intMask); if (status == kStatus_SerialManager_Success) { @@ -214,7 +246,6 @@ static streamer_t streamer_nxp = { .read_cb = streamer_nxp_read, .write_cb = streamer_nxp_write, }; -} // namespace streamer_t * streamer_get(void) { @@ -227,13 +258,14 @@ streamer_t * streamer_get(void) /* -------------------------------------------------------------------------- */ /* Private functions */ /* -------------------------------------------------------------------------- */ -extern TaskHandle_t AppMatterCliTaskHandle; +extern TaskHandle_t CONSUMER_TASK_HANDLE; + static void Uart_RxCallBack(void * pData, serial_manager_callback_message_t * message, serial_manager_status_t status) { - if (AppMatterCliTaskHandle != NULL) + if (CONSUMER_TASK_HANDLE != NULL) { /* notify the main loop that a RX buffer is available */ - xTaskNotifyGive(AppMatterCliTaskHandle); + xTaskNotifyGive(CONSUMER_TASK_HANDLE); } } diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index e1e87aeb2b2192..2342b26ae66d70 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -171,6 +171,10 @@ source_set("type-traits") { sources = [ "TypeTraits.h" ] } +source_set("static-support") { + sources = [ "static_support_smart_ptr.h" ] +} + static_library("support") { output_name = "libSupportLayer" diff --git a/src/lib/support/CHIPFaultInjection.cpp b/src/lib/support/CHIPFaultInjection.cpp index fc50021a6fe1e9..15cb5a40ec5b4d 100644 --- a/src/lib/support/CHIPFaultInjection.cpp +++ b/src/lib/support/CHIPFaultInjection.cpp @@ -35,9 +35,21 @@ static int32_t sFault_FuzzExchangeHeader_Arguments[1]; static class nl::FaultInjection::Manager sChipFaultInMgr; static const nl::FaultInjection::Name sManagerName = "chip"; static const nl::FaultInjection::Name sFaultNames[] = { - "AllocExchangeContext", "DropIncomingUDPMsg", "DropOutgoingUDPMsg", "AllocBinding", "SendAlarm", - "HandleAlarm", "FuzzExchangeHeaderTx", "RMPDoubleTx", "RMPSendError", "BDXBadBlockCounter", - "BDXAllocTransfer", "CASEKeyConfirm", "SecMgrBusy", + "AllocExchangeContext", + "DropIncomingUDPMsg", + "DropOutgoingUDPMsg", + "AllocBinding", + "SendAlarm", + "HandleAlarm", + "FuzzExchangeHeaderTx", + "RMPDoubleTx", + "RMPSendError", + "BDXBadBlockCounter", + "BDXAllocTransfer", + "SecMgrBusy", + "IMInvoke_SeparateResponses", + "IMInvoke_SeparateResponsesInvertResponseOrder", + "IMInvoke_SkipSecondResponse", #if CONFIG_NETWORK_LAYER_BLE "CHIPOBLESend", #endif // CONFIG_NETWORK_LAYER_BLE diff --git a/src/lib/support/CHIPFaultInjection.h b/src/lib/support/CHIPFaultInjection.h index 9fe78aed8c9ac9..44e582ba01d64d 100644 --- a/src/lib/support/CHIPFaultInjection.h +++ b/src/lib/support/CHIPFaultInjection.h @@ -26,6 +26,11 @@ #include #if CHIP_WITH_NLFAULTINJECTION +#ifdef NDEBUG +// TODO(#30453): After fixing the issue where CHIP_WITH_NLFAULTINJECTION is seemingly enabled on release builds, +// uncomment the line below. +// static_assert(false, "CHIP_WITH_NLFAULTINJECTION should NOT be enabled on release build"); +#endif #include @@ -57,12 +62,25 @@ typedef enum kFault_BDXBadBlockCounter, /**< Corrupt the BDX Block Counter in the BDX BlockSend or BlockEOF message about to be sent */ kFault_BDXAllocTransfer, /**< Fail the allocation of a BDXTransfer object */ kFault_SecMgrBusy, /**< Trigger a WEAVE_ERROR_SECURITY_MANAGER_BUSY when starting an authentication session */ + kFault_IMInvoke_SeparateResponses, /**< Validate incoming InvokeRequestMessage contains exactly 2 valid commands and respond + with 2 InvokeResponseMessages */ + kFault_IMInvoke_SeparateResponsesInvertResponseOrder, /**< Validate incoming InvokeRequestMessage contains exactly 2 valid + commands and respond with 2 InvokeResponseMessages where the response order is inverted + compared to the request order */ + kFault_IMInvoke_SkipSecondResponse, /**< Validate incoming InvokeRequestMessage contains exactly 2 valid commands and respond + with 1 InvokeResponseMessage, dropping the response to the second request */ #if CONFIG_NETWORK_LAYER_BLE kFault_CHIPOBLESend, /**< Inject a GATT error when sending the first fragment of a chip message over BLE */ #endif // CONFIG_NETWORK_LAYER_BLE kFault_NumItems, } Id; +static_assert(kFault_IMInvoke_SeparateResponses == 12, "Test plan specification and automation code relies on this value being 12"); +static_assert(kFault_IMInvoke_SeparateResponsesInvertResponseOrder == 13, + "Test plan specification and automation code relies on this value being 13"); +static_assert(kFault_IMInvoke_SkipSecondResponse == 14, + "Test plan specification and automation code relies on this value being 14"); + DLL_EXPORT nl::FaultInjection::Manager & GetManager(); /** diff --git a/src/lib/support/Pool.h b/src/lib/support/Pool.h index c2486f0c0e20b3..a3959fd1e868f9 100644 --- a/src/lib/support/Pool.h +++ b/src/lib/support/Pool.h @@ -104,18 +104,6 @@ class StaticAllocatorBitmap : public internal::StaticAllocatorBase std::atomic * mUsage; }; -template -class PoolCommon -{ -public: - template - void ResetObject(T * element, Args &&... args) - { - element->~T(); - new (element) T(std::forward(args)...); - } -}; - template class LambdaProxy { @@ -211,7 +199,7 @@ struct HeapObjectList : HeapObjectListNode * @tparam N a positive integer max number of elements the pool provides. */ template -class BitMapObjectPool : public internal::StaticAllocatorBitmap, public internal::PoolCommon +class BitMapObjectPool : public internal::StaticAllocatorBitmap { public: BitMapObjectPool() : StaticAllocatorBitmap(mData.mMemory, mUsage, N, sizeof(T)) {} @@ -314,7 +302,7 @@ class HeapObjectPoolExitHandling * @tparam T type to be allocated. */ template -class HeapObjectPool : public internal::Statistics, public internal::PoolCommon, public HeapObjectPoolExitHandling +class HeapObjectPool : public internal::Statistics, public HeapObjectPoolExitHandling { public: HeapObjectPool() {} diff --git a/src/lib/support/PoolWrapper.h b/src/lib/support/PoolWrapper.h index 78b6d838245633..fd9972429d9661 100644 --- a/src/lib/support/PoolWrapper.h +++ b/src/lib/support/PoolWrapper.h @@ -33,10 +33,9 @@ class PoolInterface virtual ~PoolInterface() {} - virtual U * CreateObject(ConstructorArguments... args) = 0; - virtual void ReleaseObject(U * element) = 0; - virtual void ReleaseAll() = 0; - virtual void ResetObject(U * element, ConstructorArguments... args) = 0; + virtual U * CreateObject(ConstructorArguments... args) = 0; + virtual void ReleaseObject(U * element) = 0; + virtual void ReleaseAll() = 0; template Loop ForEachActiveObject(Function && function) @@ -82,11 +81,6 @@ class PoolProxy> : public PoolIn void ReleaseAll() override { Impl().ReleaseAll(); } - void ResetObject(U * element, ConstructorArguments... args) override - { - return Impl().ResetObject(static_cast(element), std::move(args)...); - } - protected: Loop ForEachActiveObjectInner(void * context, typename PoolInterface::Lambda lambda) override { diff --git a/src/lib/support/static_support_smart_ptr.h b/src/lib/support/static_support_smart_ptr.h new file mode 100644 index 00000000000000..896073a9b15801 --- /dev/null +++ b/src/lib/support/static_support_smart_ptr.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2024 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. + */ +#pragma once + +#include + +namespace chip { + +/// A template that is able to provide the global instance +/// for some application-specific class +/// +/// It works specifically together with CheckedGlobalInstanceReference +template +struct GlobalInstanceProvider +{ + static T * InstancePointer(); +}; + +/// A class that looks like a smart pointer (overrides operator->) +/// +/// However internally it only checks that the provided value is a given +/// Global instance. +/// +/// The global instance should be provided via GlobalInstanceProvider, for +/// example +/// +/// namespace chip { +/// template<> +/// Foo *GlobalInstanceProvider::InstancePointer() { +/// return Foo::Instance(); +/// } +/// } // namespace chip +/// +/// The CheckedGlobalInstanceReference will have minimal size (1 byte because +/// comparing instance pointers has to work) and does not require alignment, +/// as opposed to sizeof(void*) usage for SimpleInstanceReferences +/// +template +class CheckedGlobalInstanceReference +{ +public: + CheckedGlobalInstanceReference(T * e) { VerifyOrDie(e == GlobalInstanceProvider::InstancePointer()); } + CheckedGlobalInstanceReference & operator=(T * value) + { + VerifyOrDie(value == GlobalInstanceProvider::InstancePointer()); + return *this; + } + + inline T * operator->() { return GlobalInstanceProvider::InstancePointer(); } + inline const T * operator->() const { return GlobalInstanceProvider::InstancePointer(); } +}; + +/// A class that acts as a wrapper to a pointer and provides +/// operator-> overrides. +/// +/// It provides the same interface as CheckedGlobalInstanceReference +/// however it does NOT use a global value. +/// +/// The intended usage of these pair of classes is to compile-time decide +/// if global variables are to be used or if fully dynamic pointers are +/// allowed. +/// +/// Example: +/// #if USE_GLOBALS +/// template +/// using PointerContainer = chip::CheckedGlobalInstanceReference; +/// #else +/// template +/// using PointerContainer = chip::SimpleInstanceReference; +/// #endif +template +class SimpleInstanceReference +{ +public: + SimpleInstanceReference(T * e) : mValue(e) {} + SimpleInstanceReference & operator=(T * value) + { + mValue = value; + return *this; + } + + T * operator->() { return mValue; } + const T * operator->() const { return mValue; } + +private: + T * mValue; +}; + +} // namespace chip diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index d0b91feeba7061..deac3e2cbb1342 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -49,6 +49,7 @@ chip_test_suite_using_nltest("tests") { "TestSerializableIntegerSet.cpp", "TestSpan.cpp", "TestStateMachine.cpp", + "TestStaticSupportSmartPtr.cpp", "TestStringBuilder.cpp", "TestStringSplitter.cpp", "TestTestPersistentStorageDelegate.cpp", @@ -79,6 +80,7 @@ chip_test_suite_using_nltest("tests") { public_deps = [ "${chip_root}/src/credentials", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support:static-support", "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/lib/support/jsontlv", diff --git a/src/lib/support/tests/TestStaticSupportSmartPtr.cpp b/src/lib/support/tests/TestStaticSupportSmartPtr.cpp new file mode 100644 index 00000000000000..809c2e4887969c --- /dev/null +++ b/src/lib/support/tests/TestStaticSupportSmartPtr.cpp @@ -0,0 +1,127 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +#include +#include + +#include + +#include + +using namespace chip; +namespace { + +struct TestClass +{ + const char * str; + int num; + + TestClass(const char * s, int n) : str(s), num(n) {} +}; + +TestClass gTestClass("abc", 123); +} // namespace + +namespace chip { + +template <> +TestClass * GlobalInstanceProvider::InstancePointer() +{ + return &gTestClass; +} + +} // namespace chip + +namespace { + +void TestCheckedGlobalInstanceReference(nlTestSuite * inSuite, void * inContext) +{ + CheckedGlobalInstanceReference ref(&gTestClass); + + // We expect that sizes of global references is minimal + NL_TEST_ASSERT(inSuite, sizeof(ref) == 1); + + NL_TEST_ASSERT(inSuite, ref->num == 123); + NL_TEST_ASSERT(inSuite, strcmp(ref->str, "abc") == 0); + + { + ScopedChange change1(gTestClass.num, 100); + ScopedChange change2(ref->str, "xyz"); + + NL_TEST_ASSERT(inSuite, ref->num == 100); + NL_TEST_ASSERT(inSuite, strcmp(gTestClass.str, "xyz") == 0); + } + + CheckedGlobalInstanceReference ref2(&gTestClass); + + NL_TEST_ASSERT(inSuite, ref->num == ref2->num); + NL_TEST_ASSERT(inSuite, strcmp(ref->str, ref2->str) == 0); + + { + ScopedChange change1(gTestClass.num, 321); + ScopedChange change2(ref->str, "test"); + + NL_TEST_ASSERT(inSuite, ref->num == ref2->num); + NL_TEST_ASSERT(inSuite, strcmp(ref->str, ref2->str) == 0); + + NL_TEST_ASSERT(inSuite, ref2->num == 321); + NL_TEST_ASSERT(inSuite, strcmp(ref2->str, "test") == 0); + } +} + +void TestSimpleInstanceReference(nlTestSuite * inSuite, void * inContext) +{ + TestClass a("abc", 123); + TestClass b("xyz", 100); + + SimpleInstanceReference ref_a(&a); + SimpleInstanceReference ref_b(&b); + + // overhead of simple references should be a simple pointer + NL_TEST_ASSERT(inSuite, sizeof(ref_a) <= sizeof(void *)); + + NL_TEST_ASSERT(inSuite, ref_a->num == 123); + NL_TEST_ASSERT(inSuite, ref_b->num == 100); + + ref_a->num = 99; + b.num = 30; + + NL_TEST_ASSERT(inSuite, a.num == 99); + NL_TEST_ASSERT(inSuite, ref_b->num == 30); +} + +#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) +const nlTest sTests[] = { + NL_TEST_DEF_FN(TestCheckedGlobalInstanceReference), + NL_TEST_DEF_FN(TestSimpleInstanceReference), + NL_TEST_SENTINEL(), +}; + +} // namespace + +int TestStaticSupportSmartPtr() +{ + nlTestSuite theSuite = { "CHIP Static support smart pointers", &sTests[0], nullptr, nullptr }; + + // Run test suite against one context. + nlTestRunner(&theSuite, nullptr); + return nlTestRunnerStats(&theSuite); +} + +CHIP_REGISTER_TEST_SUITE(TestStaticSupportSmartPtr) diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn index 755b3049174f7c..c51383a944dc80 100644 --- a/src/lwip/BUILD.gn +++ b/src/lwip/BUILD.gn @@ -30,12 +30,12 @@ if (lwip_platform == "") { assert(lwip_platform == "external" || lwip_platform == "standalone" || lwip_platform == "cc13xx_26xx" || lwip_platform == "cc32xx" || lwip_platform == "nxp" || lwip_platform == "silabs" || - lwip_platform == "k32w0" || lwip_platform == "k32w1" || - lwip_platform == "qpg" || lwip_platform == "mbed" || - lwip_platform == "psoc6" || lwip_platform == "cyw30739" || - lwip_platform == "bl602" || lwip_platform == "mw320" || - lwip_platform == "bl702" || lwip_platform == "bl702l" || - lwip_platform == "mt793x" || lwip_platform == "asr", + lwip_platform == "k32w0" || lwip_platform == "qpg" || + lwip_platform == "mbed" || lwip_platform == "psoc6" || + lwip_platform == "cyw30739" || lwip_platform == "bl602" || + lwip_platform == "mw320" || lwip_platform == "bl702" || + lwip_platform == "bl702l" || lwip_platform == "mt793x" || + lwip_platform == "asr", "Unsupported lwIP platform: ${lwip_platform}") if (lwip_platform != "external") { @@ -56,8 +56,6 @@ if (lwip_platform == "cc13xx_26xx") { import("${qpg_sdk_build_root}/qpg_sdk.gni") } else if (lwip_platform == "k32w0") { import("//build_overrides/k32w0_sdk.gni") -} else if (lwip_platform == "k32w1") { - import("//build_overrides/k32w1_sdk.gni") } else if (lwip_platform == "psoc6") { import("//build_overrides/psoc6.gni") } else if (lwip_platform == "cyw30739") { @@ -235,8 +233,6 @@ if (current_os == "zephyr" || current_os == "mbed") { public_deps += [ "${chip_root}/src/lib/support" ] } else if (lwip_platform == "k32w0") { public_deps += [ "${k32w0_sdk_build_root}:k32w0_sdk" ] - } else if (lwip_platform == "k32w1") { - public_deps += [ "${k32w1_sdk_build_root}:k32w1_sdk" ] } else if (lwip_platform == "cyw30739") { public_deps += [ "${cyw30739_sdk_build_root}:cyw30739_sdk" ] } else if (lwip_platform == "bl702") { diff --git a/src/messaging/ReliableMessageProtocolConfig.cpp b/src/messaging/ReliableMessageProtocolConfig.cpp index 86c95b1ff07346..d1a4deece9c0f8 100644 --- a/src/messaging/ReliableMessageProtocolConfig.cpp +++ b/src/messaging/ReliableMessageProtocolConfig.cpp @@ -60,8 +60,8 @@ void ClearLocalMRPConfigOverride() ReliableMessageProtocolConfig GetDefaultMRPConfig() { - // Default MRP intervals are defined in spec <2.11.3. Parameters and Constants> - static constexpr const System::Clock::Milliseconds32 idleRetransTimeout = 300_ms32; + // Default MRP intervals are defined in spec <4.12.8. Parameters and Constants> + static constexpr const System::Clock::Milliseconds32 idleRetransTimeout = 500_ms32; static constexpr const System::Clock::Milliseconds32 activeRetransTimeout = 300_ms32; static constexpr const System::Clock::Milliseconds16 activeThresholdTime = 4000_ms16; return ReliableMessageProtocolConfig(idleRetransTimeout, activeRetransTimeout, activeThresholdTime); diff --git a/src/messaging/ReliableMessageProtocolConfig.h b/src/messaging/ReliableMessageProtocolConfig.h index a49740ad4d5227..87864d1a67e922 100644 --- a/src/messaging/ReliableMessageProtocolConfig.h +++ b/src/messaging/ReliableMessageProtocolConfig.h @@ -45,7 +45,7 @@ namespace chip { * timeout when it sends a message to the present node and the present node is * perceived by the peer as active. * - * This value is announced to the peer using SAI (Sleepy Active Interval) key + * This value is announced to the peer using SAI (Session Active Interval) key * in the advertised DNS Service Discovery TXT records. Additionally, it is * exchanged in the initial phase of the PASE/CASE session establishment. * @@ -84,7 +84,7 @@ namespace chip { #if CHIP_ENABLE_OPENTHREAD && !CHIP_DEVICE_LAYER_TARGET_LINUX #define CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL (800_ms32) #else -#define CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL (300_ms32) +#define CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL (500_ms32) #endif #endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL && !CHIP_DEVICE_LAYER_TARGET_LINUX diff --git a/src/messaging/tests/MessagingContext.h b/src/messaging/tests/MessagingContext.h index a6a6d34fa1c36c..31143a727326be 100644 --- a/src/messaging/tests/MessagingContext.h +++ b/src/messaging/tests/MessagingContext.h @@ -78,7 +78,7 @@ class MessagingContext : public PlatformMemoryUser enum MRPMode { kDefault = 1, // This adopts the default MRP values for idle/active as per the spec. - // i.e IDLE = 4s, ACTIVE = 300ms + // i.e IDLE = 500ms, ACTIVE = 300ms kResponsive = 2, // This adopts values that are better suited for loopback tests that // don't actually go over a network interface, and are tuned much lower diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index c6b1aae23ee40f..3c1f56da771786 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -214,9 +214,6 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { } else if (chip_device_platform == "k32w0") { device_layer_target_define = "K32W" defines += [ "CHIP_DEVICE_LAYER_TARGET=nxp/k32w/k32w0" ] - } else if (chip_device_platform == "k32w1") { - device_layer_target_define = "K32W" - defines += [ "CHIP_DEVICE_LAYER_TARGET=nxp/k32w/k32w1" ] } else if (chip_device_platform == "nxp") { import("//build_overrides/nxp_sdk.gni") import("${nxp_sdk_build_root}/nxp_sdk.gni") @@ -537,8 +534,6 @@ if (chip_device_platform != "none") { _platform_target = "ESP32" } else if (chip_device_platform == "k32w0") { _platform_target = "nxp/k32w/k32w0" - } else if (chip_device_platform == "k32w1") { - _platform_target = "nxp/k32w/k32w1" } else if (chip_device_platform == "linux") { _platform_target = "Linux" } else if (chip_device_platform == "nrfconnect") { @@ -546,7 +541,7 @@ if (chip_device_platform != "none") { } else if (chip_device_platform == "qpg") { _platform_target = "qpg" } else if (chip_device_platform == "nxp") { - _platform_target = "nxp" + _platform_target = "nxp/${nxp_platform}:nxp_platform" } else if (chip_device_platform == "nxp_zephyr") { _platform_target = "nxp/zephyr:nxp_zephyr" } else if (chip_device_platform == "telink") { diff --git a/src/platform/DeviceControlServer.cpp b/src/platform/DeviceControlServer.cpp index 76008965498028..ec348669aec213 100644 --- a/src/platform/DeviceControlServer.cpp +++ b/src/platform/DeviceControlServer.cpp @@ -87,5 +87,12 @@ CHIP_ERROR DeviceControlServer::PostWiFiDeviceAvailableNetworkEvent() return PlatformMgr().PostEvent(&event); } +CHIP_ERROR DeviceControlServer::PostOperationalNetworkStartedEvent() +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kOperationalNetworkStarted; + return PlatformMgr().PostEvent(&event); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index a98a52de9721e1..d5129a983f092d 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -43,6 +43,10 @@ #include "bluez/BluezEndpoint.h" +#if !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION +#include +#endif + using namespace ::nl; using namespace ::chip::Ble; @@ -650,8 +654,23 @@ void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(Ble, "Got notification regarding chip connection closure"); #if CHIP_DEVICE_CONFIG_ENABLE_WPA && !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - // In Non-Concurrent mode start the Wi-Fi, as BLE has been stopped - DeviceLayer::ConnectivityMgrImpl().StartNonConcurrentWiFiManagement(); + if (mState == kState_NotInitialized) + { + // Close BLE GATT connections to disconnect BlueZ + CloseConnection(conId); + // In Non-Concurrent mode start the Wi-Fi, as BLE has been stopped + DeviceLayer::ConnectivityMgrImpl().StartNonConcurrentWiFiManagement(); + } +#endif // CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION +} + +void BLEManagerImpl::CheckNonConcurrentBleClosing() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_WPA && !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + if (mState == kState_Disconnecting) + { + DeviceLayer::DeviceControlServer::DeviceControlSvr().PostCloseAllBLEConnectionsToOperationalNetworkEvent(); + } #endif } @@ -790,22 +809,25 @@ void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * void BLEManagerImpl::OnDeviceScanned(BluezDevice1 & device, const chip::Ble::ChipBLEDeviceIdentificationInfo & info) { - ChipLogProgress(Ble, "New device scanned: %s", bluez_device1_get_address(&device)); + const char * address = bluez_device1_get_address(&device); + ChipLogProgress(Ble, "New device scanned: %s", address); if (mBLEScanConfig.mBleScanState == BleScanState::kScanForDiscriminator) { - if (!mBLEScanConfig.mDiscriminator.MatchesLongDiscriminator(info.GetDeviceDiscriminator())) - { - return; - } + auto isMatch = mBLEScanConfig.mDiscriminator.MatchesLongDiscriminator(info.GetDeviceDiscriminator()); + VerifyOrReturn( + isMatch, + ChipLogError(Ble, "Skip connection: Device discriminator does not match: %u != %u", info.GetDeviceDiscriminator(), + mBLEScanConfig.mDiscriminator.IsShortDiscriminator() ? mBLEScanConfig.mDiscriminator.GetShortValue() + : mBLEScanConfig.mDiscriminator.GetLongValue())); ChipLogProgress(Ble, "Device discriminator match. Attempting to connect."); } else if (mBLEScanConfig.mBleScanState == BleScanState::kScanForAddress) { - if (strcmp(bluez_device1_get_address(&device), mBLEScanConfig.mAddress.c_str()) != 0) - { - return; - } + auto isMatch = strcmp(address, mBLEScanConfig.mAddress.c_str()) == 0; + VerifyOrReturn(isMatch, + ChipLogError(Ble, "Skip connection: Device address does not match: %s != %s", address, + mBLEScanConfig.mAddress.c_str())); ChipLogProgress(Ble, "Device address match. Attempting to connect."); } else @@ -826,7 +848,10 @@ void BLEManagerImpl::OnDeviceScanned(BluezDevice1 & device, const chip::Ble::Chi DeviceLayer::SystemLayer().StartTimer(kConnectTimeout, HandleConnectTimeout, &mEndpoint); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - mEndpoint.ConnectDevice(device); + CHIP_ERROR err = mEndpoint.ConnectDevice(device); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Ble, "Device connection failed: %" CHIP_ERROR_FORMAT, err.Format())); + + ChipLogProgress(Ble, "New device connected: %s", address); } void BLEManagerImpl::OnScanComplete() diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h index 1441f2e6573573..61d2dff02757c7 100644 --- a/src/platform/Linux/BLEManagerImpl.h +++ b/src/platform/Linux/BLEManagerImpl.h @@ -133,6 +133,7 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BleApplicationDelegate. void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) override; + void CheckNonConcurrentBleClosing() override; // ===== Members that implement virtual methods on BleConnectionDelegate. diff --git a/src/platform/Linux/CHIPPlatformConfig.h b/src/platform/Linux/CHIPPlatformConfig.h index 788fe9b80c75d9..9e2832307f27b2 100644 --- a/src/platform/Linux/CHIPPlatformConfig.h +++ b/src/platform/Linux/CHIPPlatformConfig.h @@ -57,7 +57,7 @@ using CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE = const char *; #endif // CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS #ifndef CHIP_LOG_FILTERING -#define CHIP_LOG_FILTERING 0 +#define CHIP_LOG_FILTERING 1 #endif // CHIP_LOG_FILTERING #ifndef CHIP_CONFIG_BDX_MAX_NUM_TRANSFERS diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index a2566d20f35560..d03cefef4f0ef7 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -774,7 +774,7 @@ void ConnectivityManagerImpl::StartNonConcurrentWiFiManagement() { if (IsWiFiManagementStarted()) { - DeviceControlServer::DeviceControlSvr().PostWiFiDeviceAvailableNetworkEvent(); + DeviceControlServer::DeviceControlSvr().PostOperationalNetworkStartedEvent(); ChipLogProgress(DeviceLayer, "Non-concurrent mode Wi-Fi Management Started."); return; } diff --git a/src/platform/Linux/bluez/BluezEndpoint.cpp b/src/platform/Linux/bluez/BluezEndpoint.cpp index 51a418bfee384b..3baca7d127f20a 100644 --- a/src/platform/Linux/bluez/BluezEndpoint.cpp +++ b/src/platform/Linux/bluez/BluezEndpoint.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -694,8 +695,6 @@ void BluezEndpoint::Shutdown() g_object_unref(self->mpObjMgr); if (self->mpAdapter != nullptr) g_object_unref(self->mpAdapter); - if (self->mpDevice != nullptr) - g_object_unref(self->mpDevice); if (self->mpRoot != nullptr) g_object_unref(self->mpRoot); if (self->mpService != nullptr) @@ -720,61 +719,42 @@ void BluezEndpoint::Shutdown() // ConnectDevice callbacks -void BluezEndpoint::ConnectDeviceDone(GObject * aObject, GAsyncResult * aResult, gpointer apParams) +CHIP_ERROR BluezEndpoint::ConnectDeviceImpl(BluezDevice1 & aDevice) { - BluezDevice1 * device = BLUEZ_DEVICE1(aObject); - ConnectParams * params = static_cast(apParams); - GAutoPtr error; - - if (!bluez_device1_call_connect_finish(device, aResult, &MakeUniquePointerReceiver(error).Get())) + // Due to radio interferences or Wi-Fi coexistence, sometimes the BLE connection may not be + // established (e.g. Connection Indication Packet is missed by BLE peripheral). In such case, + // BlueZ returns "Software caused connection abort error", and we should make a connection retry. + // It's important to make sure that the connection is correctly ceased, by calling `Disconnect()` + // D-Bus method, or else `Connect()` returns immediately without any effect. + for (uint16_t i = 0; i < kMaxConnectRetries; i++) { - ChipLogError(DeviceLayer, "FAIL: ConnectDevice : %s (%d)", error->message, error->code); - - // Due to radio interferences or Wi-Fi coexistence, sometimes the BLE connection may not be - // established (e.g. Connection Indication Packet is missed by BLE peripheral). In such case, - // BlueZ returns "Software caused connection abort error", and we should make a connection retry. - // It's important to make sure that the connection is correctly ceased, by calling `Disconnect()` - // D-Bus method, or else `Connect()` returns immediately without any effect. - if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_DBUS_ERROR) && params->mNumRetries++ < kMaxConnectRetries) + GAutoPtr error; + if (bluez_device1_call_connect_sync(&aDevice, mConnectCancellable.get(), &MakeUniquePointerReceiver(error).Get())) { - // Clear the error before usage in subsequent call. - g_clear_error(&MakeUniquePointerReceiver(error).Get()); + ChipLogDetail(DeviceLayer, "ConnectDevice complete"); + return CHIP_NO_ERROR; + } - bluez_device1_call_disconnect_sync(device, nullptr, &MakeUniquePointerReceiver(error).Get()); - bluez_device1_call_connect(device, params->mEndpoint.mConnectCancellable.get(), ConnectDeviceDone, params); - return; + ChipLogError(DeviceLayer, "FAIL: ConnectDevice: %s (%d)", error->message, error->code); + if (!g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) + { + break; } - BLEManagerImpl::HandleConnectFailed(CHIP_ERROR_INTERNAL); - } - else - { - ChipLogDetail(DeviceLayer, "ConnectDevice complete"); + ChipLogProgress(DeviceLayer, "ConnectDevice retry: %u out of %u", i + 1, kMaxConnectRetries); + bluez_device1_call_disconnect_sync(&aDevice, nullptr, nullptr); } - chip::Platform::Delete(params); -} - -CHIP_ERROR BluezEndpoint::ConnectDeviceImpl(ConnectParams * apParams) -{ - bluez_device1_call_connect(apParams->mpDevice, apParams->mEndpoint.mConnectCancellable.get(), ConnectDeviceDone, apParams); - return CHIP_NO_ERROR; + BLEManagerImpl::HandleConnectFailed(CHIP_ERROR_INTERNAL); + return CHIP_ERROR_INTERNAL; } CHIP_ERROR BluezEndpoint::ConnectDevice(BluezDevice1 & aDevice) { - auto params = chip::Platform::New(*this, &aDevice); - VerifyOrReturnError(params != nullptr, CHIP_ERROR_NO_MEMORY); - + auto params = std::make_pair(this, &aDevice); mConnectCancellable.reset(g_cancellable_new()); - if (PlatformMgrImpl().GLibMatterContextInvokeSync(ConnectDeviceImpl, params) != CHIP_NO_ERROR) - { - ChipLogError(Ble, "Failed to schedule ConnectDeviceImpl() on CHIPoBluez thread"); - chip::Platform::Delete(params); - return CHIP_ERROR_INCORRECT_STATE; - } - - return CHIP_NO_ERROR; + return PlatformMgrImpl().GLibMatterContextInvokeSync( + +[](typeof(params) * aParams) { return aParams->first->ConnectDeviceImpl(*aParams->second); }, ¶ms); } void BluezEndpoint::CancelConnect() diff --git a/src/platform/Linux/bluez/BluezEndpoint.h b/src/platform/Linux/bluez/BluezEndpoint.h index 772b503efd300a..115731d665d4ba 100644 --- a/src/platform/Linux/bluez/BluezEndpoint.h +++ b/src/platform/Linux/bluez/BluezEndpoint.h @@ -83,16 +83,6 @@ class BluezEndpoint void CancelConnect(); private: - struct ConnectParams - { - ConnectParams(const BluezEndpoint & aEndpoint, BluezDevice1 * apDevice) : mEndpoint(aEndpoint), mpDevice(apDevice) {} - ~ConnectParams() = default; - - const BluezEndpoint & mEndpoint; - BluezDevice1 * mpDevice; - uint16_t mNumRetries = 0; - }; - CHIP_ERROR StartupEndpointBindings(); void SetupAdapter(); @@ -122,8 +112,7 @@ class BluezEndpoint void RegisterGattApplicationDone(GObject * aObject, GAsyncResult * aResult); CHIP_ERROR RegisterGattApplicationImpl(); - static void ConnectDeviceDone(GObject * aObject, GAsyncResult * aResult, gpointer apParams); - static CHIP_ERROR ConnectDeviceImpl(ConnectParams * apParams); + CHIP_ERROR ConnectDeviceImpl(BluezDevice1 & aDevice); bool mIsCentral = false; bool mIsInitialized = false; @@ -139,7 +128,6 @@ class BluezEndpoint // Objects (interfaces) subscribed to by this service GDBusObjectManager * mpObjMgr = nullptr; BluezAdapter1 * mpAdapter = nullptr; - BluezDevice1 * mpDevice = nullptr; // Objects (interfaces) published by this service GDBusObjectManagerServer * mpRoot = nullptr; diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index a759b4ecb72e75..0a1a9468d00b06 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -542,10 +542,7 @@ void BLEManagerImpl::OnChipDeviceScanned(void * device, const Ble::ChipBLEDevice /* Initiate Connect */ auto params = std::make_pair(this, deviceInfo->remote_address); PlatformMgrImpl().GLibMatterContextInvokeSync( - +[](typeof(params) * aParams) { - return reinterpret_cast(aParams->first)->ConnectChipThing(aParams->second); - }, - ¶ms); + +[](typeof(params) * aParams) { return aParams->first->ConnectChipThing(aParams->second); }, ¶ms); } void BLEManagerImpl::OnScanComplete() diff --git a/src/platform/device.gni b/src/platform/device.gni index aa81c50e4a5fcc..933b730186ec85 100644 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -16,7 +16,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/ble/ble.gni") declare_args() { - # Device platform layer: cc13x2_26x2, cc13x4_26x4, cc32xx, darwin, efr32, esp32, external, freertos, linux, nrfconnect, k32w0, k32w1, qpg, tizen, cyw30739, bl602, mw320, zephyr, beken, openiotsdk, none. + # Device platform layer: cc13x2_26x2, cc13x4_26x4, cc32xx, darwin, efr32, esp32, external, freertos, linux, nrfconnect, k32w0, nxp, qpg, tizen, cyw30739, bl602, mw320, zephyr, beken, openiotsdk, none. chip_device_platform = "auto" chip_platform_target = "" @@ -51,9 +51,8 @@ declare_args() { chip_device_platform == "linux" || chip_device_platform == "qpg" || chip_device_platform == "cc13x2_26x2" || chip_device_platform == "cc13x4_26x4" || - chip_device_platform == "k32w0" || chip_device_platform == "k32w1" || - chip_device_platform == "tizen" || chip_device_platform == "stm32" || - chip_device_platform == "webos" + chip_device_platform == "k32w0" || chip_device_platform == "tizen" || + chip_device_platform == "stm32" || chip_device_platform == "webos" } declare_args() { @@ -152,8 +151,6 @@ if (chip_device_platform == "cc13x2_26x2") { _chip_device_layer = "qpg" } else if (chip_device_platform == "k32w0") { _chip_device_layer = "nxp/k32w/k32w0" -} else if (chip_device_platform == "k32w1") { - _chip_device_layer = "nxp/k32w/k32w1" } else if (chip_device_platform == "nxp") { import("//build_overrides/nxp_sdk.gni") import("${nxp_sdk_build_root}/nxp_sdk.gni") @@ -255,7 +252,7 @@ assert( chip_device_platform == "external" || chip_device_platform == "linux" || chip_device_platform == "tizen" || chip_device_platform == "nrfconnect" || chip_device_platform == "nxp" || - chip_device_platform == "k32w0" || chip_device_platform == "k32w1" || + chip_device_platform == "k32w0" || chip_device_platform == "nxp_zephyr" || chip_device_platform == "qpg" || chip_device_platform == "telink" || chip_device_platform == "mbed" || chip_device_platform == "psoc6" || chip_device_platform == "android" || diff --git a/src/platform/nrfconnect/CHIPPlatformConfig.h b/src/platform/nrfconnect/CHIPPlatformConfig.h index 6c724a185d460c..90af43c0a10c6b 100644 --- a/src/platform/nrfconnect/CHIPPlatformConfig.h +++ b/src/platform/nrfconnect/CHIPPlatformConfig.h @@ -114,15 +114,15 @@ #endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_IDLE_MODE_DURATION #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp index d6aa5f2e939251..40f9bc5c7d7abf 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp @@ -949,7 +949,7 @@ void BLEManagerCommon::HandleConnectionCloseEvent(blekw_msg_t * msg) mDeviceConnected = false; ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionError; + event.Type = DeviceEventType::kCHIPoBLEConnectionClosed; event.CHIPoBLEConnectionError.ConId = deviceId; event.CHIPoBLEConnectionError.Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED; diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.h b/src/platform/nxp/k32w/common/BLEManagerCommon.h index 32ccdd762cdea4..628d9b5324aa46 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.h +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.h @@ -233,6 +233,7 @@ class BLEManagerCommon : public BLEManager, protected BleLayer, private BlePlatf public: virtual CHIP_ERROR InitHostController(BLECallbackDelegate::GapGenericCallback cb_fp) = 0; virtual BLEManagerCommon * GetImplInstance() = 0; + virtual CHIP_ERROR ResetController() { return CHIP_NO_ERROR; } void DoBleProcessing(void); BLECallbackDelegate callbackDelegate; diff --git a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp index 946c0c37f83d87..591d082ea992f7 100644 --- a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp +++ b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp @@ -308,7 +308,7 @@ CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage() CHIP_ERROR OTAImageProcessorImpl::SetBlock(ByteSpan & block) { - if (block.empty()) + if (!IsSpanUsable(block)) { return CHIP_NO_ERROR; } diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.h b/src/platform/nxp/k32w/common/OTATlvProcessor.h index 13a2df115d90d9..65d1d68830f2b8 100644 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.h +++ b/src/platform/nxp/k32w/common/OTATlvProcessor.h @@ -43,10 +43,10 @@ namespace chip { #define CHIP_OTA_PROCESSOR_START_IMAGE CHIP_ERROR_TLV_PROCESSOR(0x0E) // Descriptor constants -inline constexpr size_t kVersionStringSize = 64; -inline constexpr size_t kBuildDateSize = 64; +constexpr size_t kVersionStringSize = 64; +constexpr size_t kBuildDateSize = 64; -inline constexpr uint16_t requestedOtaMaxBlockSize = 1024; +constexpr uint16_t requestedOtaMaxBlockSize = 1024; /** * Used alongside RegisterDescriptorCallback to register diff --git a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h index 0c849ccc4989aa..a584e0c79afbbb 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h @@ -47,6 +47,8 @@ #define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH 32 #endif +#define CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER + // ========== Platform-specific Configuration ========= // These are configuration options that are unique to the K32W platform. diff --git a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp index 95a69b717c4af0..88d5c00400193c 100644 --- a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp @@ -30,6 +30,8 @@ OSA_EVENT_HANDLE_DEFINE(gHost_TaskEvent); #include +extern "C" bleResult_t Hci_Reset(void); + namespace chip { namespace DeviceLayer { namespace Internal { @@ -45,6 +47,8 @@ CHIP_ERROR BLEManagerImpl::InitHostController(BLECallbackDelegate::GapGenericCal { CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrExit(PLATFORM_InitTimerManager() >= 0, err = CHIP_ERROR_INCORRECT_STATE); + PLATFORM_InitBle(); (void) RNG_Init(); @@ -73,6 +77,21 @@ CHIP_ERROR BLEManagerImpl::InitHostController(BLECallbackDelegate::GapGenericCal return err; } +CHIP_ERROR BLEManagerImpl::ResetController() +{ + bleResult_t res = Hci_Reset(); + if (res != gBleSuccess_c) + { + ChipLogProgress(DeviceLayer, "Failed to reset controller %d", res); + return CHIP_ERROR_INTERNAL; + } + + /* Wait for function to complete */ + PLATFORM_Delay(HCI_RESET_WAIT_TIME_US); + + return CHIP_NO_ERROR; +} + void BLEManagerImpl::Host_Task(osaTaskParam_t argument) { Host_TaskHandler((void *) NULL); diff --git a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h b/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h index bef927c8275350..59bda33db0051f 100644 --- a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h +++ b/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h @@ -23,6 +23,7 @@ #include "RNG_Interface.h" #include "fwk_messaging.h" #include "fwk_os_abs.h" +#include "fwk_platform.h" #include "fwk_platform_ble.h" #include "hci_transport.h" @@ -36,6 +37,10 @@ #define HOST_TASK_PRIORITY (4U) #define HOST_TASK_STACK_SIZE (gHost_TaskStackSize_c / sizeof(StackType_t)) +#ifndef HCI_RESET_WAIT_TIME_US +#define HCI_RESET_WAIT_TIME_US 30000 +#endif + namespace chip { namespace DeviceLayer { namespace Internal { @@ -51,6 +56,7 @@ class BLEManagerImpl final : public BLEManagerCommon CHIP_ERROR InitHostController(BLECallbackDelegate::GapGenericCallback cb_fp) override; BLEManagerCommon * GetImplInstance() override; + CHIP_ERROR ResetController() override; private: static BLEManagerImpl sInstance; diff --git a/src/platform/nxp/k32w/k32w1/BUILD.gn b/src/platform/nxp/k32w/k32w1/BUILD.gn index 8ad11928178bb7..bb3e74dc034527 100644 --- a/src/platform/nxp/k32w/k32w1/BUILD.gn +++ b/src/platform/nxp/k32w/k32w1/BUILD.gn @@ -13,12 +13,13 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/platform/device.gni") -import("${k32w1_sdk_build_root}/k32w1_sdk.gni") +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") -assert(chip_device_platform == "k32w1") +assert(chip_device_platform == "nxp") +assert(nxp_platform == "k32w/k32w1") if (chip_enable_openthread) { import("//build_overrides/openthread.gni") @@ -28,7 +29,7 @@ if (chip_crypto == "platform") { import("//build_overrides/mbedtls.gni") } -static_library("k32w1") { +static_library("nxp_platform") { sources = [ "../../../SingletonConfigurationManager.cpp", "../common/BLEManagerCommon.cpp", @@ -58,7 +59,15 @@ static_library("k32w1") { "ram_storage.h", ] - public = [ "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h" ] + public = [ + "${chip_root}/src/credentials/DeviceAttestationCredsProvider.h", + "${chip_root}/src/credentials/examples/DeviceAttestationCredsExample.h", + "${chip_root}/src/credentials/examples/ExampleDACs.h", + "${chip_root}/src/credentials/examples/ExamplePAI.h", + "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h", + "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h", + "${chip_root}/src/platform/nxp/k32w/k32w1/SMU2Manager.h", + ] public_deps = [ "${chip_root}/src/platform:platform_base" ] @@ -87,10 +96,25 @@ static_library("k32w1") { "K32W1PersistentStorageOpKeystore.h", ] + if (chip_with_factory_data == 1) { + sources += [ + "../common/FactoryDataProvider.cpp", + "FactoryDataProviderImpl.cpp", + ] + public += [ + "${chip_root}/src/credentials/CHIPCert.h", + "${chip_root}/src/credentials/CertificationDeclaration.h", + ] + + if (chip_convert_dac_private_key == 1) { + defines = [ "CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY=1" ] + } + } + public_deps += [ "${mbedtls_root}:mbedtls" ] } - deps = [ "${chip_root}/src/platform/logging:headers" ] + deps = [] if (chip_enable_openthread) { sources += [ @@ -107,7 +131,17 @@ static_library("k32w1") { ] deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] } + + if (use_smu2_dynamic) { + sources += [ + "SMU2Manager.cpp", + "SMU2Manager.h", + ] + } } - public_deps += [ "${chip_root}/src/crypto" ] + public_deps += [ + "${chip_root}/src/crypto", + "${chip_root}/src/platform/logging:headers", + ] } diff --git a/src/platform/nxp/k32w/k32w1/CHIPCryptoPalK32W1.cpp b/src/platform/nxp/k32w/k32w1/CHIPCryptoPalK32W1.cpp index f10198b9b955c3..5eab6bb0c8c706 100644 --- a/src/platform/nxp/k32w/k32w1/CHIPCryptoPalK32W1.cpp +++ b/src/platform/nxp/k32w/k32w1/CHIPCryptoPalK32W1.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -55,8 +54,10 @@ #include -#include "SecLib_ecp256.h" #include "sss_crypto.h" +extern "C" { +#include "SecLib.h" +} namespace chip { namespace Crypto { @@ -82,10 +83,10 @@ typedef struct bool mInitialized; bool mDRBGSeeded; mbedtls_ctr_drbg_context mDRBGCtxt; - mbedtls_entropy_context mEntropy; -} EntropyContext; + entropy_source fn_source; +} DRBGContext; -static EntropyContext gsEntropyContext; +static DRBGContext gsDrbgContext; static void _log_mbedTLS_error(int error_code) { @@ -141,19 +142,32 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c { VerifyOrExit(aad != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); } - - // Size of key is expressed in bits, hence the multiplication by 8. - result = mbedtls_ccm_setkey(&context, MBEDTLS_CIPHER_ID_AES, key.As(), - sizeof(Symmetric128BitsKeyByteArray) * 8); - VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - - // Encrypt - result = mbedtls_ccm_encrypt_and_tag(&context, plaintext_length, Uint8::to_const_uchar(nonce), nonce_length, - Uint8::to_const_uchar(aad), aad_length, Uint8::to_const_uchar(plaintext), - Uint8::to_uchar(ciphertext), Uint8::to_uchar(tag), tag_length); - _log_mbedTLS_error(result); - VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - +#if defined(USE_HW_AES) + if (!aad_length) + { +#endif + // Size of key is expressed in bits, hence the multiplication by 8. + result = mbedtls_ccm_setkey(&context, MBEDTLS_CIPHER_ID_AES, key.As(), + sizeof(Symmetric128BitsKeyByteArray) * 8); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + // Encrypt + result = mbedtls_ccm_encrypt_and_tag(&context, plaintext_length, Uint8::to_const_uchar(nonce), nonce_length, + Uint8::to_const_uchar(aad), aad_length, Uint8::to_const_uchar(plaintext), + Uint8::to_uchar(ciphertext), Uint8::to_uchar(tag), tag_length); + _log_mbedTLS_error(result); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); +#if defined(USE_HW_AES) + } + else + { + // Encrypt + result = AES_128_CCM(Uint8::to_const_uchar(plaintext), plaintext_length, Uint8::to_const_uchar(aad), aad_length, + Uint8::to_const_uchar(nonce), nonce_length, key.As(), ciphertext, tag, + tag_length, gSecLib_CCM_Encrypt_c); + VerifyOrExit(result == kStatus_Success, error = CHIP_ERROR_INTERNAL); + } +#endif exit: mbedtls_ccm_free(&context); return error; @@ -179,19 +193,32 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_len, co { VerifyOrExit(aad != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); } - - // Size of key is expressed in bits, hence the multiplication by 8. - result = mbedtls_ccm_setkey(&context, MBEDTLS_CIPHER_ID_AES, key.As(), - sizeof(Symmetric128BitsKeyByteArray) * 8); - VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - - // Decrypt - result = mbedtls_ccm_auth_decrypt(&context, ciphertext_len, Uint8::to_const_uchar(nonce), nonce_length, - Uint8::to_const_uchar(aad), aad_len, Uint8::to_const_uchar(ciphertext), - Uint8::to_uchar(plaintext), Uint8::to_const_uchar(tag), tag_length); - _log_mbedTLS_error(result); - VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - +#if defined(USE_HW_AES) + if (!aad_len) + { +#endif + // Size of key is expressed in bits, hence the multiplication by 8. + result = mbedtls_ccm_setkey(&context, MBEDTLS_CIPHER_ID_AES, key.As(), + sizeof(Symmetric128BitsKeyByteArray) * 8); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); + + // Decrypt + result = mbedtls_ccm_auth_decrypt(&context, ciphertext_len, Uint8::to_const_uchar(nonce), nonce_length, + Uint8::to_const_uchar(aad), aad_len, Uint8::to_const_uchar(ciphertext), + Uint8::to_uchar(plaintext), Uint8::to_const_uchar(tag), tag_length); + _log_mbedTLS_error(result); + VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); +#if defined(USE_HW_AES) + } + else + { + // Decrypt + result = AES_128_CCM(Uint8::to_const_uchar(ciphertext), ciphertext_len, Uint8::to_const_uchar(aad), aad_len, + Uint8::to_const_uchar(nonce), nonce_length, key.As(), plaintext, + (uint8_t *) tag, tag_length, gSecLib_CCM_Decrypt_c); + VerifyOrExit(result == kStatus_Success, error = CHIP_ERROR_INTERNAL); + } +#endif exit: mbedtls_ccm_free(&context); return error; @@ -203,6 +230,9 @@ CHIP_ERROR Hash_SHA256(const uint8_t * data, const size_t data_length, uint8_t * VerifyOrReturnError(data != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(out_buffer != nullptr, CHIP_ERROR_INVALID_ARGUMENT); +#if defined(USE_HW_SHA256) + SHA256_Hash(Uint8::to_const_uchar(data), data_length, Uint8::to_uchar(out_buffer)); +#else #if (MBEDTLS_VERSION_NUMBER >= 0x03000000) const int result = mbedtls_sha256(Uint8::to_const_uchar(data), data_length, Uint8::to_uchar(out_buffer), 0); #else @@ -210,6 +240,7 @@ CHIP_ERROR Hash_SHA256(const uint8_t * data, const size_t data_length, uint8_t * #endif VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL); +#endif return CHIP_NO_ERROR; } @@ -230,6 +261,36 @@ CHIP_ERROR Hash_SHA1(const uint8_t * data, const size_t data_length, uint8_t * o return CHIP_NO_ERROR; } +#if defined(USE_HW_SHA256) +/* + * These structures are used to save the intermediate + * non-hashed data on heap (in a linked list) + * and compute the hash on demand. + * This solution bypases the sha256 context save/restore + * S200 limitation. + * */ +typedef struct sha256_node +{ + uint8_t * data; + uint16_t size; + sha256_node * next; +} sha256_node; + +typedef struct S200_context +{ + void * sss_context; + sha256_node * head; + sha256_node * tail; +} S200_context; + +static_assert(kMAX_Hash_SHA256_Context_Size >= sizeof(S200_context), + "kMAX_Hash_SHA256_Context_Size is too small for the size of underlying mbedtls_sha256_context"); + +static inline S200_context * to_inner_hash_sha256_context(HashSHA256OpaqueContext * context) +{ + return SafePointerCast(context); +} +#else static_assert(kMAX_Hash_SHA256_Context_Size >= sizeof(mbedtls_sha256_context), "kMAX_Hash_SHA256_Context_Size is too small for the size of underlying mbedtls_sha256_context"); @@ -237,52 +298,120 @@ static inline mbedtls_sha256_context * to_inner_hash_sha256_context(HashSHA256Op { return SafePointerCast(context); } +#endif Hash_SHA256_stream::Hash_SHA256_stream(void) { +#if defined(USE_HW_SHA256) + S200_context * context = to_inner_hash_sha256_context(&mContext); + + context->sss_context = nullptr; + context->head = nullptr; + context->tail = nullptr; +#else mbedtls_sha256_context * context = to_inner_hash_sha256_context(&mContext); mbedtls_sha256_init(context); +#endif } Hash_SHA256_stream::~Hash_SHA256_stream(void) { +#if defined(USE_HW_SHA256) + S200_context * context = to_inner_hash_sha256_context(&mContext); + + context->sss_context = nullptr; + context->head = nullptr; + context->tail = nullptr; +#else mbedtls_sha256_context * context = to_inner_hash_sha256_context(&mContext); mbedtls_sha256_free(context); +#endif Clear(); } CHIP_ERROR Hash_SHA256_stream::Begin(void) { +#if defined(USE_HW_SHA256) + S200_context * context = to_inner_hash_sha256_context(&mContext); + context->sss_context = SHA256_AllocCtx(); + + SHA256_Init(context->sss_context); +#else mbedtls_sha256_context * const context = to_inner_hash_sha256_context(&mContext); #if (MBEDTLS_VERSION_NUMBER >= 0x03000000) - const int result = mbedtls_sha256_starts(context, 0); + const int result = mbedtls_sha256_starts(context, 0); #else const int result = mbedtls_sha256_starts_ret(context, 0); #endif VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL); +#endif return CHIP_NO_ERROR; } CHIP_ERROR Hash_SHA256_stream::AddData(const ByteSpan data) { +#if defined(USE_HW_SHA256) + S200_context * context = to_inner_hash_sha256_context(&mContext); + sha256_node * node = nullptr; + + VerifyOrReturnError(context->sss_context != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + SHA256_HashUpdate(context->sss_context, Uint8::to_const_uchar(data.data()), data.size()); + + node = (sha256_node *) malloc(sizeof(sha256_node)); + node->size = data.size(); + node->data = (uint8_t *) malloc(data.size()); + node->next = nullptr; + memcpy(node->data, Uint8::to_const_uchar(data.data()), node->size); + + if (context->head == nullptr) + { + context->head = node; + context->tail = node; + } + else + { + context->tail->next = node; + } +#else mbedtls_sha256_context * const context = to_inner_hash_sha256_context(&mContext); #if (MBEDTLS_VERSION_NUMBER >= 0x03000000) - const int result = mbedtls_sha256_update(context, Uint8::to_const_uchar(data.data()), data.size()); + const int result = mbedtls_sha256_update(context, Uint8::to_const_uchar(data.data()), data.size()); #else const int result = mbedtls_sha256_update_ret(context, Uint8::to_const_uchar(data.data()), data.size()); #endif VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL); +#endif return CHIP_NO_ERROR; } CHIP_ERROR Hash_SHA256_stream::GetDigest(MutableByteSpan & out_buffer) { + CHIP_ERROR result = CHIP_NO_ERROR; + +#if defined(USE_HW_SHA256) + S200_context * context = to_inner_hash_sha256_context(&mContext); + sha256_node * node = context->head; + void * ctx = SHA256_AllocCtx(); + + SHA256_Init(ctx); + + while (node) + { + SHA256_HashUpdate(ctx, node->data, node->size); + node = node->next; + } + + SHA256_HashFinish(ctx, Uint8::to_uchar(out_buffer.data())); + + SHA256_FreeCtx(ctx); +#else mbedtls_sha256_context * context = to_inner_hash_sha256_context(&mContext); // Back-up context as we are about to finalize the hash to extract digest. @@ -291,28 +420,46 @@ CHIP_ERROR Hash_SHA256_stream::GetDigest(MutableByteSpan & out_buffer) mbedtls_sha256_clone(&previous_ctx, context); // Pad + compute digest, then finalize context. It is restored next line to continue. - CHIP_ERROR result = Finish(out_buffer); + result = Finish(out_buffer); // Restore context prior to finalization. mbedtls_sha256_clone(context, &previous_ctx); mbedtls_sha256_free(&previous_ctx); +#endif return result; } CHIP_ERROR Hash_SHA256_stream::Finish(MutableByteSpan & out_buffer) { +#if defined(USE_HW_SHA256) + S200_context * context = to_inner_hash_sha256_context(&mContext); + + sha256_node * node = nullptr; + + SHA256_HashFinish(context->sss_context, Uint8::to_uchar(out_buffer.data())); + SHA256_FreeCtx(context->sss_context); + + while (context->head) + { + node = context->head; + context->head = context->head->next; + free(node->data); + free(node); + } +#else VerifyOrReturnError(out_buffer.size() >= kSHA256_Hash_Length, CHIP_ERROR_BUFFER_TOO_SMALL); mbedtls_sha256_context * const context = to_inner_hash_sha256_context(&mContext); #if (MBEDTLS_VERSION_NUMBER >= 0x03000000) - const int result = mbedtls_sha256_finish(context, Uint8::to_uchar(out_buffer.data())); + const int result = mbedtls_sha256_finish(context, Uint8::to_uchar(out_buffer.data())); #else const int result = mbedtls_sha256_finish_ret(context, Uint8::to_uchar(out_buffer.data())); #endif VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL); - out_buffer = out_buffer.SubSpan(0, kSHA256_Hash_Length); + out_buffer = out_buffer.SubSpan(0, kSHA256_Hash_Length); +#endif return CHIP_NO_ERROR; } @@ -360,6 +507,10 @@ CHIP_ERROR HMAC_sha::HMAC_SHA256(const uint8_t * key, size_t key_length, const u VerifyOrReturnError(out_length >= kSHA256_Hash_Length, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(out_buffer != nullptr, CHIP_ERROR_INVALID_ARGUMENT); +#if defined(USE_HW_SHA256) + ::HMAC_SHA256(Uint8::to_const_uchar(key), (uint32_t) key_length, Uint8::to_const_uchar(message), (uint32_t) message_length, + out_buffer); +#else const mbedtls_md_info_t * const md = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256); VerifyOrReturnError(md != nullptr, CHIP_ERROR_INTERNAL); @@ -368,6 +519,7 @@ CHIP_ERROR HMAC_sha::HMAC_SHA256(const uint8_t * key, size_t key_length, const u _log_mbedTLS_error(result); VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL); +#endif return CHIP_NO_ERROR; } @@ -423,50 +575,47 @@ CHIP_ERROR PBKDF2_sha256::pbkdf2_sha256(const uint8_t * password, size_t plen, c return error; } -static EntropyContext * get_entropy_context() +static int strong_entropy_func(void * data, uint8_t * output, size_t len) { - if (!gsEntropyContext.mInitialized) - { - mbedtls_entropy_init(&gsEntropyContext.mEntropy); - mbedtls_ctr_drbg_init(&gsEntropyContext.mDRBGCtxt); + int result = -1; + size_t olen; - gsEntropyContext.mInitialized = true; + if (gsDrbgContext.fn_source) + { + result = gsDrbgContext.fn_source(data, output, len, &olen); } - - return &gsEntropyContext; + return result; } static mbedtls_ctr_drbg_context * get_drbg_context() { - EntropyContext * const context = get_entropy_context(); + if (!gsDrbgContext.mInitialized) + { + mbedtls_ctr_drbg_init(&gsDrbgContext.mDRBGCtxt); - mbedtls_ctr_drbg_context * const drbgCtxt = &context->mDRBGCtxt; + gsDrbgContext.mInitialized = true; + } - if (!context->mDRBGSeeded) + if (!gsDrbgContext.mDRBGSeeded) { - const int status = mbedtls_ctr_drbg_seed(drbgCtxt, mbedtls_entropy_func, &context->mEntropy, nullptr, 0); + const int status = mbedtls_ctr_drbg_seed(&gsDrbgContext.mDRBGCtxt, strong_entropy_func, nullptr, nullptr, 0); if (status != 0) { _log_mbedTLS_error(status); return nullptr; } - context->mDRBGSeeded = true; + gsDrbgContext.mDRBGSeeded = true; } - return drbgCtxt; + return &gsDrbgContext.mDRBGCtxt; } CHIP_ERROR add_entropy_source(entropy_source fn_source, void * p_source, size_t threshold) { VerifyOrReturnError(fn_source != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + gsDrbgContext.fn_source = fn_source; - EntropyContext * const entropy_ctxt = get_entropy_context(); - VerifyOrReturnError(entropy_ctxt != nullptr, CHIP_ERROR_INTERNAL); - - const int result = - mbedtls_entropy_add_source(&entropy_ctxt->mEntropy, fn_source, p_source, threshold, MBEDTLS_ENTROPY_SOURCE_STRONG); - VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL); return CHIP_NO_ERROR; } @@ -774,6 +923,7 @@ CHIP_ERROR P256Keypair::Deserialize(P256SerializedKeypair & input) exit: return error; } + void P256Keypair::Clear() { if (mInitialized) diff --git a/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h index 60a1498cff9444..52dec0809f618d 100644 --- a/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h @@ -44,6 +44,18 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 // #define CHIP_DEVICE_CONFIG_PERSISTED_STORAGE_GLOBAL_EIDC_KEY 2 +/** + * @def CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH + * + * Set unique id to maximum length if not defined to ensure the actual unique + * id is retrieved instead of the default one (if factory data read fails). + */ +#ifndef CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH +#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH 32 +#endif + +#define CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER + // ========== Platform-specific Configuration ========= // These are configuration options that are unique to the K32W platform. @@ -114,4 +126,16 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT 1 #endif +#if CHIP_DEVICE_CONFIG_ENABLE_SED + +#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(NXP_OT_IDLE_INTERVAL) +#endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL + +#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(NXP_OT_ACTIVE_INTERVAL) +#endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL + +#endif + #define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 1 diff --git a/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h b/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h index b8ae07689e14bb..cacc28dd4a60d6 100644 --- a/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h +++ b/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h @@ -76,3 +76,27 @@ #ifndef WDM_PUBLISHER_MAX_NOTIFIES_IN_FLIGHT #define WDM_PUBLISHER_MAX_NOTIFIES_IN_FLIGHT 2 #endif // WDM_PUBLISHER_MAX_NOTIFIES_IN_FLIGHT + +#if NXP_ICD_ENABLED + +#ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_INTERVAL +#endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC + +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_INTERVAL +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS + +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS +#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS NXP_ACTIVE_MODE_THRESHOLD +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS + +#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC +#define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC +#endif // CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC + +#ifndef CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED +#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 1 +#endif + +#endif diff --git a/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp index 43aa7fa591b8f0..68a1a4196ed39c 100644 --- a/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp @@ -30,6 +30,9 @@ #include #include #include +#if defined(USE_SMU2_DYNAMIC) +#include +#endif // #include #include "fsl_cmc.h" @@ -270,7 +273,10 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) ThreadStackMgr().ErasePersistentInfo(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD +#if defined(USE_SMU2_DYNAMIC) + SMU2::Deactivate(); +#endif +#endif // Restart the system. ChipLogProgress(DeviceLayer, "System restarting"); diff --git a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp b/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp index 2b7dd8856c617b..212d0b5ea39fa6 100644 --- a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp @@ -31,12 +31,11 @@ #include #endif -extern "C" void xPortResetHeapMinimumEverFreeHeapSize(void); - #include - #include +#include "fsl_component_mem_manager.h" + using namespace ::chip::app::Clusters::GeneralDiagnostics; namespace chip { @@ -50,31 +49,31 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeapFree) { - size_t freeHeapSize; + auto freeHeapSize = static_cast(MEM_GetFreeHeapSize()); + currentHeapFree = static_cast(freeHeapSize); - freeHeapSize = xPortGetFreeHeapSize(); - currentHeapFree = static_cast(freeHeapSize); return CHIP_NO_ERROR; } CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeapUsed) { - size_t freeHeapSize; - size_t usedHeapSize; + auto freeHeapSize = static_cast(MEM_GetFreeHeapSize()); + currentHeapUsed = static_cast(MinimalHeapSize_c - freeHeapSize); - freeHeapSize = xPortGetFreeHeapSize(); - usedHeapSize = MinimalHeapSize_c - freeHeapSize; - - currentHeapUsed = static_cast(usedHeapSize); return CHIP_NO_ERROR; } CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) { - size_t highWatermarkHeapSize; + currentHeapHighWatermark = static_cast(MinimalHeapSize_c - MEM_GetFreeHeapSizeLowWaterMark()); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DiagnosticDataProviderImpl::ResetWatermarks() +{ + MEM_ResetFreeHeapSizeLowWaterMark(); - highWatermarkHeapSize = MinimalHeapSize_c - xPortGetMinimumEverFreeHeapSize(); - currentHeapHighWatermark = static_cast(highWatermarkHeapSize); return CHIP_NO_ERROR; } diff --git a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.h b/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.h index 78cca26b3683ee..33ccbe53efebaa 100644 --- a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.h +++ b/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.h @@ -43,6 +43,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetCurrentHeapFree(uint64_t & currentHeapFree) override; CHIP_ERROR GetCurrentHeapUsed(uint64_t & currentHeapUsed) override; CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override; + CHIP_ERROR ResetWatermarks() override; CHIP_ERROR GetThreadMetrics(ThreadMetrics ** threadMetricsOut) override; void ReleaseThreadMetrics(ThreadMetrics * threadMetrics) override; diff --git a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp b/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp new file mode 100644 index 00000000000000..10ae6d0dd4ab05 --- /dev/null +++ b/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp @@ -0,0 +1,304 @@ +/* + * + * 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. + */ + +#include + +#if CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY +#include "fsl_adapter_flash.h" +#endif + +namespace chip { +namespace DeviceLayer { + +// SSS adds 24 bytes of metadata when creating the blob +static constexpr size_t kSssBlobMetadataLength = 24; +static constexpr size_t kPrivateKeyBlobLength = Crypto::kP256_PrivateKey_Length + kSssBlobMetadataLength; + +FactoryDataProviderImpl::~FactoryDataProviderImpl() +{ + SSS_KEY_OBJ_FREE(&mContext); +} + +CHIP_ERROR FactoryDataProviderImpl::Init() +{ + CHIP_ERROR error = CHIP_NO_ERROR; + uint32_t sum = 0; + +#if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST + SSS_RunApiTest(); +#endif + + if (sum > kFactoryDataSize) + { + ChipLogError(DeviceLayer, "Max size of factory data: %lu is bigger than reserved factory data size: %lu", sum, + kFactoryDataSize); + } + + error = Validate(); + if (error != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Factory data init failed with: %s", ErrorStr(error)); + } + + ReturnErrorOnFailure(SSS_InitContext()); +#if CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY + ReturnErrorOnFailure(SSS_ConvertDacKey()); + ReturnErrorOnFailure(Validate()); +#endif + ReturnErrorOnFailure(SSS_ImportPrivateKeyBlob()); + + return error; +} + +CHIP_ERROR FactoryDataProviderImpl::SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) +{ + Crypto::P256ECDSASignature signature; + + VerifyOrReturnError(IsSpanUsable(outSignBuffer), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(IsSpanUsable(messageToSign), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(outSignBuffer.size() >= signature.Capacity(), CHIP_ERROR_BUFFER_TOO_SMALL); + VerifyOrReturnError(messageToSign.data() != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(messageToSign.size() > 0, CHIP_ERROR_INVALID_ARGUMENT); + + uint8_t digest[Crypto::kSHA256_Hash_Length]; + memset(&digest[0], 0, sizeof(digest)); + + ReturnErrorOnFailure(Crypto::Hash_SHA256(messageToSign.data(), messageToSign.size(), digest)); + ReturnErrorOnFailure(SSS_Sign(digest, signature)); + + return CopySpanToMutableSpan(ByteSpan{ signature.ConstBytes(), signature.Length() }, outSignBuffer); +} + +CHIP_ERROR FactoryDataProviderImpl::SSS_InitContext() +{ + auto res = sss_sscp_key_object_init(&mContext, &g_keyStore); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); + res = sss_sscp_key_object_allocate_handle(&mContext, 0x0u, kSSS_KeyPart_Private, kSSS_CipherType_EC_NIST_P, + Crypto::kP256_PrivateKey_Length, SSS_KEYPROP_OPERATION_ASYM); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::SSS_ImportPrivateKeyBlob() +{ + uint8_t blob[kPrivateKeyBlobLength] = { 0 }; + uint16_t blobSize = 0; + ReturnErrorOnFailure(SearchForId(FactoryDataId::kDacPrivateKeyId, blob, kPrivateKeyBlobLength, blobSize)); + + auto res = sss_sscp_key_store_import_key(&g_keyStore, &mContext, blob, kPrivateKeyBlobLength, kPrivateKeyBlobLength * 8, + kSSS_blobType_ELKE_blob); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::SSS_Sign(uint8_t * digest, Crypto::P256ECDSASignature & signature) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + size_t signatureSize = Crypto::kP256_ECDSA_Signature_Length_Raw; + sss_status_t res = kStatus_SSS_Fail; + sss_sscp_asymmetric_t asyc; + + res = sss_sscp_asymmetric_context_init(&asyc, &g_sssSession, &mContext, kAlgorithm_SSS_ECDSA_SHA256, kMode_SSS_Sign); + VerifyOrExit(res == kStatus_SSS_Success, error = CHIP_ERROR_INTERNAL); + res = sss_sscp_asymmetric_sign_digest(&asyc, digest, Crypto::kP256_PrivateKey_Length, signature.Bytes(), &signatureSize); + VerifyOrExit(res == kStatus_SSS_Success, error = CHIP_ERROR_INTERNAL); + signature.SetLength(signatureSize); + +exit: + sss_sscp_asymmetric_context_free(&asyc); + return error; +} + +#if CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY +CHIP_ERROR FactoryDataProviderImpl::SSS_ConvertDacKey() +{ + size_t blobSize = kPrivateKeyBlobLength; + size_t newSize = sizeof(FactoryDataProvider::Header) + mHeader.size + kSssBlobMetadataLength; + uint8_t blob[kPrivateKeyBlobLength] = { 0 }; + uint8_t * data = static_cast(chip::Platform::MemoryAlloc(newSize)); + uint32_t offset = 0; + + VerifyOrReturnError(data != nullptr, CHIP_ERROR_INTERNAL); + + ReturnErrorOnFailure(SSS_ExportBlob(blob, &blobSize, offset)); + ChipLogError(DeviceLayer, "SSS: extracted blob from DAC private key"); + + hal_flash_status_t status = HAL_FlashRead(kFactoryDataStart, newSize - kSssBlobMetadataLength, data); + VerifyOrReturnError(status == kStatus_HAL_Flash_Success, CHIP_ERROR_INTERNAL); + ChipLogError(DeviceLayer, "SSS: cached factory data in RAM"); + + ReturnErrorOnFailure(ReplaceWithBlob(data, blob, blobSize, offset)); + ChipLogError(DeviceLayer, "SSS: replaced DAC private key with secured blob"); + + status = HAL_FlashEraseSector(kFactoryDataStart, kFactoryDataSize); + VerifyOrReturnError(status == kStatus_HAL_Flash_Success, CHIP_ERROR_INTERNAL); + status = HAL_FlashProgramUnaligned(kFactoryDataStart, newSize, data); + VerifyOrReturnError(status == kStatus_HAL_Flash_Success, CHIP_ERROR_INTERNAL); + ChipLogError(DeviceLayer, "SSS: updated factory data"); + + memset(data, 0, newSize); + chip::Platform::MemoryFree(data); + ChipLogError(DeviceLayer, "SSS: sanitized RAM cache"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::SSS_ExportBlob(uint8_t * data, size_t * dataLen, uint32_t & offset) +{ + uint8_t keyBuf[Crypto::kP256_PrivateKey_Length]; + MutableByteSpan dacPrivateKeySpan(keyBuf); + uint16_t keySize = 0; + + ReturnErrorOnFailure( + SearchForId(FactoryDataId::kDacPrivateKeyId, dacPrivateKeySpan.data(), dacPrivateKeySpan.size(), keySize, &offset)); + dacPrivateKeySpan.reduce_size(keySize); + + auto res = SSS_KEY_STORE_SET_KEY(&mContext, dacPrivateKeySpan.data(), Crypto::kP256_PrivateKey_Length, keySize * 8, + kSSS_KeyPart_Private); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); + + res = sss_sscp_key_store_export_key(&g_keyStore, &mContext, data, dataLen, kSSS_blobType_ELKE_blob); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::ReplaceWithBlob(uint8_t * data, uint8_t * blob, size_t blobLen, uint32_t offset) +{ + size_t newSize = mHeader.size + kSssBlobMetadataLength; + FactoryDataProvider::Header * header = reinterpret_cast(data); + uint8_t * payload = data + sizeof(FactoryDataProvider::Header); + size_t subsequentDataOffset = offset + kValueOffset + Crypto::kP256_PrivateKey_Length; + + memmove(payload + subsequentDataOffset + kSssBlobMetadataLength, payload + subsequentDataOffset, + mHeader.size - subsequentDataOffset); + header->size = newSize; + memcpy(payload + offset + kLengthOffset, (uint16_t *) &blobLen, sizeof(uint16_t)); + memcpy(payload + offset + kValueOffset, blob, blobLen); + + uint8_t hash[Crypto::kSHA256_Hash_Length] = { 0 }; + ReturnErrorOnFailure(Crypto::Hash_SHA256(payload, header->size, hash)); + memcpy(header->hash, hash, sizeof(header->hash)); + + return CHIP_NO_ERROR; +} +#endif // CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY + +#if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST + +#define _assert(condition) \ + if (!condition) \ + { \ + ChipLogError(DeviceLayer, "Condition failed" #condition); \ + while (1) \ + ; \ + } + +void FactoryDataProviderImpl::SSS_RunApiTest() +{ + uint8_t privateKey[Crypto::kP256_PrivateKey_Length] = { 0x18, 0xfe, 0x9a, 0xd9, 0x30, 0xdd, 0x2f, 0x62, 0xbe, 0x99, 0x43, + 0x93, 0xe8, 0xbe, 0x47, 0x28, 0x7f, 0xda, 0x5a, 0x71, 0x86, 0x1b, + 0x0e, 0x3f, 0x91, 0x27, 0x52, 0xd0, 0xba, 0xa7, 0x40, 0x02 }; + + auto error = SSS_InitContext(); + _assert((error == CHIP_NO_ERROR)); + + // Simulate factory data in RAM: create the header + dummy data + DAC private key entry + dummy data + uint8_t type = FactoryDataProvider::FactoryDataId::kDacPrivateKeyId; + uint8_t dummyType = FactoryDataProvider::FactoryDataId::kProductLabel; + uint16_t length = Crypto::kP256_PrivateKey_Length; + uint16_t dummyLength = 3; + uint32_t numberOfDummies = 10; + uint32_t dummySize = numberOfDummies * (sizeof(dummyType) + sizeof(dummyLength) + dummyLength); + uint32_t size = + sizeof(FactoryDataProvider::Header) + dummySize + sizeof(type) + sizeof(length) + kPrivateKeyBlobLength + dummySize; + uint8_t dummyData[3] = { 0xab }; + uint8_t hash[Crypto::kSHA256_Hash_Length] = { 0 }; + mHeader.hashId = FactoryDataProvider::kHashId; + mHeader.size = size - sizeof(FactoryDataProvider::Header); + mHeader.hash[0] = 0xde; + mHeader.hash[1] = 0xad; + mHeader.hash[2] = 0xbe; + mHeader.hash[3] = 0xef; + + uint8_t * factoryData = static_cast(chip::Platform::MemoryAlloc(size)); + _assert((factoryData != nullptr)); + + uint8_t * entry = factoryData + sizeof(mHeader); + for (auto i = 0; i < numberOfDummies; i++) + { + memcpy(entry, (void *) &dummyType, sizeof(dummyType)); + entry += sizeof(type); + memcpy(entry, (void *) &dummyLength, sizeof(dummyLength)); + entry += sizeof(length); + memcpy(entry, dummyData, dummyLength); + entry += dummyLength; + } + memcpy(entry, (void *) &type, sizeof(type)); + entry += sizeof(type); + memcpy(entry, (void *) &length, sizeof(length)); + entry += sizeof(length); + memcpy(entry, privateKey, Crypto::kP256_PrivateKey_Length); + entry += Crypto::kP256_PrivateKey_Length; + for (auto i = 0; i < numberOfDummies; i++) + { + memcpy(entry, (void *) &dummyType, sizeof(dummyType)); + entry += sizeof(type); + memcpy(entry, (void *) &dummyLength, sizeof(dummyLength)); + entry += sizeof(length); + memcpy(entry, dummyData, dummyLength); + entry += dummyLength; + } + + FactoryDataProvider::kFactoryDataPayloadStart = (uint32_t) factoryData + sizeof(FactoryDataProvider::Header); + + uint8_t keyBuf[Crypto::kP256_PrivateKey_Length]; + MutableByteSpan dacPrivateKeySpan(keyBuf); + uint16_t keySize = 0; + error = SearchForId(FactoryDataId::kCertDeclarationId, dacPrivateKeySpan.data(), dacPrivateKeySpan.size(), keySize); + _assert((error == CHIP_ERROR_NOT_FOUND)); + error = SearchForId(FactoryDataId::kDacPrivateKeyId, dacPrivateKeySpan.data(), dacPrivateKeySpan.size(), keySize); + _assert((error == CHIP_NO_ERROR)); + _assert((memcmp(dacPrivateKeySpan.data(), privateKey, Crypto::kP256_PrivateKey_Length) == 0)); + + size_t blobSize = kPrivateKeyBlobLength; + size_t newSize = sizeof(FactoryDataProvider::Header) + mHeader.size + kSssBlobMetadataLength; + uint8_t blob[kPrivateKeyBlobLength] = { 0 }; + + uint32_t offset = 0; + error = SSS_ExportBlob(blob, &blobSize, offset); + _assert((error == CHIP_NO_ERROR)); + error = ReplaceWithBlob(factoryData, blob, blobSize, offset); + _assert((error == CHIP_NO_ERROR)); + FactoryDataProvider::Header * header = reinterpret_cast(factoryData); + _assert((header->size == (mHeader.size + kSssBlobMetadataLength))); + _assert((header->hash[0] != 0xde)); + _assert((header->hash[1] != 0xad)); + _assert((header->hash[2] != 0xbe)); + _assert((header->hash[3] != 0xef)); + + memset(factoryData, 0, size); + chip::Platform::MemoryFree(factoryData); + FactoryDataProvider::kFactoryDataPayloadStart = FactoryDataProvider::kFactoryDataStart + sizeof(FactoryDataProvider::Header); + SSS_KEY_OBJ_FREE(&mContext); +} +#endif // CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST + +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.h b/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.h new file mode 100644 index 00000000000000..67bef1959ea503 --- /dev/null +++ b/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.h @@ -0,0 +1,109 @@ +/* + * + * 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. + */ +#pragma once + +#include +#include + +#include "sss_crypto.h" + +/* This flag should be defined when the factory data contains + * the DAC private key in plain text. It usually occurs in + * manufacturing. + * + * The init phase will use S200 to export an encrypted blob, + * then overwrite the private key section from internal flash. + * + * Should be used one time only for securing the private key. + * The manufacturer will then flash the real image, which shall + * not define this flag. + */ +#ifndef CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY +#define CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY 0 +#endif + +/* This flag should be defined to run SSS_RunApiTest tests. + */ +#ifndef CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST +#define CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST 0 +#endif + +namespace chip { +namespace DeviceLayer { + +/** + * This class extends the default FactoryDataProvider functionality + * by leveraging the secure subsystem for signing messages. + */ + +class FactoryDataProviderImpl : public FactoryDataProvider +{ +public: + ~FactoryDataProviderImpl(); + + CHIP_ERROR Init() override; + CHIP_ERROR SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) override; + +private: + CHIP_ERROR SSS_InitContext(); + CHIP_ERROR SSS_ImportPrivateKeyBlob(); + CHIP_ERROR SSS_Sign(uint8_t * digest, Crypto::P256ECDSASignature & signature); +#if CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY + /*! + * \brief Convert DAC private key to an SSS encrypted blob and update factory data + * + * @note This API should be called in manufacturing process context to replace + * DAC private key with an SSS encrypted blob. The conversion will be a + * one-time-only operation. + * @retval #CHIP_NO_ERROR if factory data was updated successfully. + */ + CHIP_ERROR SSS_ConvertDacKey(); + + /*! + * \brief Export an SSS encrypted blob from the DAC private key found in factory data + * + * @param data Pointer to an allocated buffer + * @param dataLen Pointer to a variable that will store the blob length + * @param offset Offset of private key from the start of factory data payload address (after header) + * + * @retval #CHIP_NO_ERROR if conversion to blob was successful. + */ + CHIP_ERROR SSS_ExportBlob(uint8_t * data, size_t * dataLen, uint32_t & offset); + + /*! + * \brief Replace DAC private key with the specified SSS encrypted blob + * + * @note A new hash has to be computed and written in the factory data header. + * @param data Pointer to a RAM buffer that duplicates the current factory data + * @param blob Pointer to blob data + * @param blobLen Blob length + * @param offset Offset of private key from the start of factory data payload address (after header) + * Extracted with SSS_ConvertToBlob. + * + * @retval #CHIP_NO_ERROR if conversion to blob was successful. + */ + CHIP_ERROR ReplaceWithBlob(uint8_t * data, uint8_t * blob, size_t blobLen, uint32_t offset); +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST + void SSS_RunApiTest(); +#endif + + sss_sscp_object_t mContext; +}; + +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/k32w/k32w1/K32W1Config.cpp b/src/platform/nxp/k32w/k32w1/K32W1Config.cpp index ee41809dcca7b9..489d6363d8f4e9 100644 --- a/src/platform/nxp/k32w/k32w1/K32W1Config.cpp +++ b/src/platform/nxp/k32w/k32w1/K32W1Config.cpp @@ -55,7 +55,7 @@ namespace Internal { #define CHIP_PLAT_NVM_STATIC_ALLOC 1 #endif -#define CHIP_CONFIG_RAM_BUFFER_SIZE 10240 +#define CHIP_CONFIG_RAM_BUFFER_SIZE 14336 #ifndef NVM_ID_CHIP_CONFIG_DATA #define NVM_ID_CHIP_CONFIG_DATA 0xf104 @@ -378,6 +378,7 @@ CHIP_ERROR K32WConfig::FactoryResetConfig(void) CHIP_ERROR err = CHIP_NO_ERROR; FactoryResetConfigInternal(kMinConfigKey_ChipConfig, kMaxConfigKey_ChipConfig); + FactoryResetConfigInternal(kMinConfigKey_ChipCounter, kMaxConfigKey_ChipCounter); FactoryResetConfigInternal(kMinConfigKey_KVSKey, kMaxConfigKey_KVSKey); FactoryResetConfigInternal(kMinConfigKey_KVSValue, kMaxConfigKey_KVSValue); diff --git a/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.cpp b/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.cpp index 43560f549ff951..a3a4a480430979 100644 --- a/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.cpp +++ b/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.cpp @@ -37,47 +37,21 @@ namespace chip { using namespace chip::Crypto; -CHIP_ERROR P256KeypairSSS::Initialize(Crypto::ECPKeyTarget key_target) +static inline sss_sscp_object_t * to_keypair(P256KeypairContext * context) { - CHIP_ERROR error = CHIP_NO_ERROR; - size_t keyBitsLen = kP256_PrivateKey_Length * 8; - size_t keySize = SSS_ECP_KEY_SZ(kP256_PrivateKey_Length); - - Clear(); - - VerifyOrReturnError(sss_sscp_key_object_init(&mKeyObj, &g_keyStore) == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); - - VerifyOrReturnError(sss_sscp_key_object_allocate_handle( - &mKeyObj, 0x0u, kSSS_KeyPart_Pair, kSSS_CipherType_EC_NIST_P, 3 * kP256_PrivateKey_Length, - SSS_KEYPROP_OPERATION_KDF | SSS_KEYPROP_OPERATION_ASYM) == kStatus_SSS_Success, - error = CHIP_ERROR_INTERNAL); - - VerifyOrExit(SSS_ECP_GENERATE_KEY(&mKeyObj, keyBitsLen) == kStatus_SSS_Success, error = CHIP_ERROR_INTERNAL); - - // The first byte of the public key is the uncompressed marker - Uint8::to_uchar(mPublicKey)[0] = 0x04; - - // Extract public key, write from the second byte - VerifyOrExit(SSS_KEY_STORE_GET_PUBKEY(&mKeyObj, Uint8::to_uchar(mPublicKey) + 1, &keySize, &keyBitsLen) == kStatus_SSS_Success, - CHIP_ERROR_INTERNAL); - - mInitialized = true; - -exit: - if (mInitialized != true) - (void) SSS_KEY_OBJ_FREE(&mKeyObj); - - return error; + return SafePointerCast(context); } CHIP_ERROR P256KeypairSSS::ExportBlob(P256SerializedKeypairSSS & output) const { VerifyOrReturnError(mInitialized, CHIP_ERROR_UNINITIALIZED); + sss_sscp_object_t * keypair = to_keypair(&mKeypair); + size_t keyBlobLen = output.Capacity(); - VerifyOrReturnError(sss_sscp_key_store_export_key(&g_keyStore, &mKeyObj, output.Bytes(), &keyBlobLen, - kSSS_blobType_ELKE_blob) == kStatus_SSS_Success, - CHIP_ERROR_INTERNAL); + auto res = sss_sscp_key_store_export_key(&g_keyStore, keypair, output.Bytes(), &keyBlobLen, kSSS_blobType_ELKE_blob); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); + output.SetLength(keyBlobLen); return CHIP_NO_ERROR; @@ -85,77 +59,27 @@ CHIP_ERROR P256KeypairSSS::ExportBlob(P256SerializedKeypairSSS & output) const CHIP_ERROR P256KeypairSSS::ImportBlob(P256SerializedKeypairSSS & input) { - CHIP_ERROR error = CHIP_NO_ERROR; + sss_sscp_object_t * keypair = to_keypair(&mKeypair); if (false == mInitialized) { - VerifyOrExit((sss_sscp_key_object_init(&mKeyObj, &g_keyStore) == kStatus_SSS_Success), error = CHIP_ERROR_INTERNAL); + auto res = sss_sscp_key_object_init(keypair, &g_keyStore); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); /* Allocate key handle */ - VerifyOrExit( - (sss_sscp_key_object_allocate_handle(&mKeyObj, 0x0u, kSSS_KeyPart_Pair, kSSS_CipherType_EC_NIST_P, - 3 * kP256_PrivateKey_Length, SSS_KEYPROP_OPERATION_ASYM) == kStatus_SSS_Success), - error = CHIP_ERROR_INTERNAL); + res = sss_sscp_key_object_allocate_handle(keypair, 0x0u, kSSS_KeyPart_Pair, kSSS_CipherType_EC_NIST_P, + 3 * kP256_PrivateKey_Length, SSS_KEYPROP_OPERATION_ASYM); + VerifyOrReturnError(res == kStatus_SSS_Success, CHIP_ERROR_INTERNAL); } - VerifyOrExit((sss_sscp_key_store_import_key(&g_keyStore, &mKeyObj, input.Bytes(), input.Length(), kP256_PrivateKey_Length * 8, + VerifyOrExit((sss_sscp_key_store_import_key(&g_keyStore, keypair, input.Bytes(), input.Length(), kP256_PrivateKey_Length * 8, kSSS_blobType_ELKE_blob) == kStatus_SSS_Success), - error = CHIP_ERROR_INTERNAL); + CHIP_ERROR_INTERNAL); mInitialized = true; exit: - return error; -} - -CHIP_ERROR P256KeypairSSS::ECDSA_sign_msg(const uint8_t * msg, const size_t msg_length, P256ECDSASignature & out_signature) const -{ - CHIP_ERROR error = CHIP_NO_ERROR; - sss_sscp_asymmetric_t asyc; - size_t signatureSize = kP256_ECDSA_Signature_Length_Raw; - - VerifyOrReturnError(mInitialized, CHIP_ERROR_UNINITIALIZED); - VerifyOrReturnError((msg != nullptr) && (msg_length > 0), CHIP_ERROR_INVALID_ARGUMENT); - - uint8_t digest[kSHA256_Hash_Length]; - memset(&digest[0], 0, sizeof(digest)); - ReturnErrorOnFailure(Hash_SHA256(msg, msg_length, &digest[0])); - - VerifyOrExit((sss_sscp_asymmetric_context_init(&asyc, &g_sssSession, &mKeyObj, kAlgorithm_SSS_ECDSA_SHA256, kMode_SSS_Sign) == - kStatus_SSS_Success), - error = CHIP_ERROR_INTERNAL); - VerifyOrExit((sss_sscp_asymmetric_sign_digest(&asyc, digest, kP256_FE_Length, out_signature.Bytes(), &signatureSize) == - kStatus_SSS_Success), - error = CHIP_ERROR_INTERNAL); - VerifyOrExit(out_signature.SetLength(kP256_ECDSA_Signature_Length_Raw) == CHIP_NO_ERROR, error = CHIP_ERROR_INTERNAL); - -exit: - (void) sss_sscp_asymmetric_context_free(&asyc); - return error; -} - -CHIP_ERROR P256KeypairSSS::NewCertificateSigningRequest(uint8_t * out_csr, size_t & csr_length) const -{ - VerifyOrReturnError(mInitialized, CHIP_ERROR_UNINITIALIZED); - - MutableByteSpan csr(out_csr, csr_length); - CHIP_ERROR err = GenerateCertificateSigningRequest(this, csr); - csr_length = (CHIP_NO_ERROR == err) ? csr.size() : 0; - return err; -} - -void P256KeypairSSS::Clear() -{ - if (mInitialized) - { - (void) SSS_KEY_OBJ_FREE(&mKeyObj); - mInitialized = false; - } -} - -P256KeypairSSS::~P256KeypairSSS() -{ - Clear(); + return CHIP_NO_ERROR; } bool K32W1PersistentStorageOpKeystore::HasOpKeypairForFabric(FabricIndex fabricIndex) const diff --git a/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.h b/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.h index 6402c235527ff0..c0aeabccd2e724 100644 --- a/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.h +++ b/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.h @@ -41,47 +41,17 @@ typedef Crypto::SensitiveDataBuffer P256SerializedKeypai class P256KeypairSSS : public Crypto::P256Keypair { public: - P256KeypairSSS() {} - ~P256KeypairSSS() override; - /** - * @brief Initialize the keypair. + * @brief Export an encrypted blob. * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ - CHIP_ERROR Initialize(Crypto::ECPKeyTarget key_target) override; - CHIP_ERROR ExportBlob(P256SerializedKeypairSSS & output) const; - CHIP_ERROR ImportBlob(P256SerializedKeypairSSS & input); - - /** - * @brief Generate a new Certificate Signing Request (CSR). - * @param csr Newly generated CSR in DER format - * @param csr_length The caller provides the length of input buffer (csr). The function returns the actual length of generated - *CSR. - * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise - **/ - CHIP_ERROR NewCertificateSigningRequest(uint8_t * csr, size_t & csr_length) const override; - /** - * @brief A function to sign a msg using ECDSA - * @param msg Message that needs to be signed - * @param msg_length Length of message - * @param out_signature Buffer that will hold the output signature. The signature consists of: 2 EC elements (r and s), - * in raw point form (see SEC1). + * @brief Import an encrypted blob. * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ - CHIP_ERROR ECDSA_sign_msg(const uint8_t * msg, size_t msg_length, Crypto::P256ECDSASignature & out_signature) const override; - - const Crypto::P256PublicKey & Pubkey() const override { return mPublicKey; } - - /** Release resources associated with this key pair */ - void Clear(); - -private: - Crypto::P256PublicKey mPublicKey; - mutable sss_sscp_object_t mKeyObj; - bool mInitialized = false; + CHIP_ERROR ImportBlob(P256SerializedKeypairSSS & input); }; /** diff --git a/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp index 00f6a9314398bc..6af22df6781d3b 100644 --- a/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp @@ -36,7 +36,7 @@ namespace DeviceLayer { namespace PersistedStorage { /* TODO: adjust these values */ -constexpr size_t kMaxNumberOfKeys = 150; +constexpr size_t kMaxNumberOfKeys = 200; constexpr size_t kMaxKeyValueBytes = 255; KeyValueStoreManagerImpl KeyValueStoreManagerImpl::sInstance; diff --git a/src/platform/nxp/k32w/k32w1/Logging.cpp b/src/platform/nxp/k32w/k32w1/Logging.cpp index 62b5d114379f3a..5c68f4f11dab7a 100644 --- a/src/platform/nxp/k32w/k32w1/Logging.cpp +++ b/src/platform/nxp/k32w/k32w1/Logging.cpp @@ -12,6 +12,10 @@ #include "fsl_debug_console.h" #include +#ifdef PW_RPC_ENABLED +#include +#endif + #define K32W_LOG_MODULE_NAME chip #define EOL_CHARS "\r\n" /* End of Line Characters */ #define EOL_CHARS_LEN 2 /* Length of EOL */ @@ -109,7 +113,9 @@ void ENFORCE_FORMAT(1, 0) GenericLog(const char * format, va_list arg, const cha if (!isLogInitialized) { isLogInitialized = true; +#ifndef PW_RPC_ENABLED otPlatUartEnable(); +#endif } /* Prefix is composed of [Time Reference][Debug String][Module Name String] */ @@ -121,7 +127,11 @@ void ENFORCE_FORMAT(1, 0) GenericLog(const char * format, va_list arg, const cha VerifyOrDie(writtenLen > 0); memcpy(formattedMsg + prefixLen + writtenLen, EOL_CHARS, EOL_CHARS_LEN); +#ifndef PW_RPC_ENABLED otPlatUartSendBlocking((const uint8_t *) formattedMsg, strlen(formattedMsg)); +#else + PigweedLogger::PutString((const char *) formattedMsg, strlen(formattedMsg)); +#endif // Let the application know that a log message has been emitted. chip::DeviceLayer::OnLogOutput(); diff --git a/src/platform/nxp/k32w/k32w1/LowPowerHooks.cpp b/src/platform/nxp/k32w/k32w1/LowPowerHooks.cpp index 752344e5e42cae..bc849b476e57af 100644 --- a/src/platform/nxp/k32w/k32w1/LowPowerHooks.cpp +++ b/src/platform/nxp/k32w/k32w1/LowPowerHooks.cpp @@ -34,12 +34,12 @@ using namespace ::chip::DeviceLayer; extern "C" void App_AllowDeviceToSleep() { - PWR_AllowDeviceToSleep(); + ; } extern "C" void App_DisallowDeviceToSleep() { - PWR_DisallowDeviceToSleep(); + ; } #endif diff --git a/src/platform/nxp/k32w/k32w1/OTAHooks.cpp b/src/platform/nxp/k32w/k32w1/OTAHooks.cpp index b672ed8322177d..c045a111618e49 100644 --- a/src/platform/nxp/k32w/k32w1/OTAHooks.cpp +++ b/src/platform/nxp/k32w/k32w1/OTAHooks.cpp @@ -39,7 +39,7 @@ extern "C" void HAL_ResetMCU(void); #define ResetMCU HAL_ResetMCU -#if USE_SMU2_AS_SYSTEM_MEMORY +#if USE_SMU2_STATIC // The attribute specifier should not be changed. static chip::OTAFirmwareProcessor gApplicationProcessor __attribute__((section(".smu2"))); #else diff --git a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp index 53e68779bcecd2..40d747fc8a21d5 100644 --- a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp @@ -29,7 +29,8 @@ #include #include #include -#include +#include +#include #if CHIP_SYSTEM_CONFIG_USE_LWIP #include @@ -39,6 +40,8 @@ #include "fwk_platform.h" #include +extern "C" void HAL_ResetMCU(void); + extern uint8_t __data_end__[], m_data0_end[]; memAreaCfg_t data0Heap = { .start_address = (void *) __data_end__, .end_address = (void *) m_data0_end }; @@ -68,6 +71,15 @@ CHIP_ERROR PlatformManagerImpl::InitBoardFwk(void) return CHIP_NO_ERROR; } +void PlatformManagerImpl::CleanReset() +{ + StopEventLoopTask(); + Shutdown(); +#if CHIP_PLAT_NVM_SUPPORT + NvCompletePendingOperations(); +#endif + HAL_ResetMCU(); +} static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen) { diff --git a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h b/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h index 70ece1cdf11f3c..6798cb911ee377 100644 --- a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h +++ b/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h @@ -50,6 +50,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener System::Clock::Timestamp GetStartTime() { return mStartTime; } CHIP_ERROR InitBoardFwk(void); + void CleanReset(); private: // ===== Methods that implement the PlatformManager abstract interface. diff --git a/src/platform/nxp/k32w/k32w1/SMU2Manager.cpp b/src/platform/nxp/k32w/k32w1/SMU2Manager.cpp new file mode 100644 index 00000000000000..f4e0216bb8955a --- /dev/null +++ b/src/platform/nxp/k32w/k32w1/SMU2Manager.cpp @@ -0,0 +1,165 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023 NXP + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides the SMU2 namespace for K32W1 platform using the NXP SDK. + * This namespace implements all the necessary function to allocate + * OpenThread buffers from SMU2 region. + */ + +#include "SMU2Manager.h" +#include + +using namespace chip::DeviceLayer; +using namespace chip::DeviceLayer::Internal; + +namespace chip::SMU2 { +namespace { + +static const uint32_t AREA_START = (0x489C5380U); +static const uint32_t AREA_END = (0x489C87FFU); +static const uint32_t AREA_SIZE = (AREA_END - AREA_START); + +uint8_t mAreaId = 0; + +PersistentStorageDelegate * mStorage = nullptr; + +memAreaCfg_t mAreaDescriptor; +bool mDeviceCommissioned = false; +bool mUseAllocator = false; + +StorageKeyName GetSMU2AllocatorKey() +{ + return StorageKeyName::FromConst("nxp/ot-smu2"); +} + +void ResetBLEController() +{ + VerifyOrDie(BLEMgrImpl().ResetController() == CHIP_NO_ERROR); +} + +void RegisterArea(void) +{ + mem_status_t st = kStatus_MemSuccess; + + memset((void *) AREA_START, 0x00, AREA_SIZE); + + mAreaDescriptor.start_address = (void *) AREA_START; + mAreaDescriptor.end_address = (void *) AREA_END; + + st = MEM_RegisterExtendedArea(&mAreaDescriptor, &mAreaId, AREA_FLAGS_POOL_NOT_SHARED); + VerifyOrDie(st == kStatus_MemSuccess); +} + +void UnregisterArea(void) +{ + mem_status_t st = kStatus_MemSuccess; + + st = MEM_UnRegisterExtendedArea(mAreaId); + VerifyOrDie(st == kStatus_MemSuccess); + mAreaId = 0; + + memset((void *) AREA_START, 0x00, AREA_SIZE); +} + +void EventHandler(const ChipDeviceEvent * event, intptr_t) +{ + switch (event->Type) + { + case DeviceEventType::kCommissioningComplete: { + mDeviceCommissioned = true; + break; + } + + case DeviceEventType::kCHIPoBLEConnectionClosed: { + if (mDeviceCommissioned) + { + mUseAllocator = true; + mStorage->SyncSetKeyValue(GetSMU2AllocatorKey().KeyName(), (void *) &mUseAllocator, (uint16_t) sizeof(mUseAllocator)); + ResetBLEController(); + RegisterArea(); + } + break; + } + } +} + +} // anonymous namespace + +CHIP_ERROR Init(PersistentStorageDelegate * storage) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + uint16_t size = (uint16_t) sizeof(mUseAllocator); + mStorage = storage; + + VerifyOrReturnError(storage != nullptr, CHIP_ERROR_INCORRECT_STATE); + + PlatformMgr().AddEventHandler(EventHandler, reinterpret_cast(nullptr)); + + err = mStorage->SyncGetKeyValue(GetSMU2AllocatorKey().KeyName(), (void *) &mUseAllocator, size); + + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + mUseAllocator = false; + err = mStorage->SyncSetKeyValue(GetSMU2AllocatorKey().KeyName(), (void *) &mUseAllocator, size); + } + ReturnErrorOnFailure(err); + + if (mUseAllocator) + { + RegisterArea(); + } + + return err; +} + +CHIP_ERROR Deactivate(void) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mUseAllocator) + { + mUseAllocator = false; + err = mStorage->SyncDeleteKeyValue(GetSMU2AllocatorKey().KeyName()); + ReturnErrorOnFailure(err); + + UnregisterArea(); + ResetBLEController(); + } + + return CHIP_NO_ERROR; +} + +void * Allocate(size_t size) +{ + size_t smu2Size = 0; + if (mAreaId) + { + smu2Size = MEM_GetFreeHeapSizeByAreaId(mAreaId); + if (size > smu2Size) + { + mAreaId = 0; + } + } + + return MEM_BufferAllocWithId(size, mAreaId); +} + +} // namespace chip::SMU2 diff --git a/src/platform/nxp/k32w/k32w1/SMU2Manager.h b/src/platform/nxp/k32w/k32w1/SMU2Manager.h new file mode 100644 index 00000000000000..7044d452727476 --- /dev/null +++ b/src/platform/nxp/k32w/k32w1/SMU2Manager.h @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023 NXP + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides the SMU2 namespace for K32W1 platform using the NXP SDK. + * This namespace implements all the necessary function to allocate + * OpenThread buffers from SMU2 region. + */ + +#pragma once + +#include "fsl_component_mem_manager.h" +#include +#include + +namespace chip::SMU2 { + +CHIP_ERROR Init(PersistentStorageDelegate * storage); +CHIP_ERROR Deactivate(void); +void * Allocate(size_t size); + +} // namespace chip::SMU2 diff --git a/src/platform/nxp/k32w/k32w1/SystemTimeSupport.cpp b/src/platform/nxp/k32w/k32w1/SystemTimeSupport.cpp index a61c5d648bc039..7ef2a2ae0fff17 100644 --- a/src/platform/nxp/k32w/k32w1/SystemTimeSupport.cpp +++ b/src/platform/nxp/k32w/k32w1/SystemTimeSupport.cpp @@ -25,7 +25,7 @@ /* this file behaves like a config.h, comes first */ #include -extern "C" uint32_t otPlatAlarmMicroGetNow(void); +#include namespace chip { namespace System { @@ -43,7 +43,7 @@ uint64_t sBootTimeUS = 0; Microseconds64 ClockImpl::GetMonotonicMicroseconds64(void) { - return Clock::Microseconds64(otPlatAlarmMicroGetNow()); + return Clock::Microseconds64(otPlatTimeGet()); } Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) @@ -53,12 +53,12 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) uint64_t GetClock_Monotonic(void) { - return otPlatAlarmMicroGetNow(); + return otPlatTimeGet(); } uint64_t GetClock_MonotonicMS(void) { - return (otPlatAlarmMicroGetNow() / 1000); + return (otPlatTimeGet() / 1000); } uint64_t GetClock_MonotonicHiRes(void) diff --git a/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp index 7bf96771fb78d7..89c63694fed168 100644 --- a/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp @@ -34,6 +34,9 @@ #include #include +#if defined(USE_SMU2_DYNAMIC) +#include +#endif #include namespace chip { @@ -83,6 +86,7 @@ bool ThreadStackManagerImpl::IsInitialized() } // namespace DeviceLayer } // namespace chip +using namespace ::chip; using namespace ::chip::DeviceLayer; /** @@ -113,7 +117,11 @@ extern "C" void * pvPortCallocRtos(size_t num, size_t size) extern "C" void * otPlatCAlloc(size_t aNum, size_t aSize) { +#if defined(USE_SMU2_DYNAMIC) + return SMU2::Allocate(aNum * aSize); +#else return CHIPPlatformMemoryCalloc(aNum, aSize); +#endif } extern "C" void otPlatFree(void * aPtr) diff --git a/src/platform/nxp/k32w/k32w1/args.gni b/src/platform/nxp/k32w/k32w1/args.gni index 4170e95ea6f632..2de35770927a63 100644 --- a/src/platform/nxp/k32w/k32w1/args.gni +++ b/src/platform/nxp/k32w/k32w1/args.gni @@ -13,18 +13,36 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") import("//build_overrides/openthread.gni") declare_args() { chip_with_ot_cli = 0 chip_with_low_power = 0 + chip_convert_dac_private_key = 0 sdk_release = 1 } -chip_device_platform = "k32w1" +nxp_platform = "k32w/k32w1" +nxp_sdk_name = "k32w1_sdk" +nxp_device_layer = "nxp/${nxp_platform}" +nxp_use_lwip = false +nxp_use_mbedtls_port = false -lwip_platform = "k32w1" +# ARM architecture flags will be set based on NXP board. +arm_platform_config = "${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_arm.gni" + +chip_device_platform = "nxp" + +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_inet_project_config_include = "" +chip_system_project_config_include = "" +chip_ble_project_config_include = "" +chip_project_config_include_dirs = + [ "${chip_root}/examples/platform/${nxp_platform}/app/project_include" ] + +chip_enable_openthread = true chip_inet_config_enable_ipv4 = false @@ -39,7 +57,7 @@ chip_mdns = "platform" chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -mbedtls_target = "${chip_root}/third_party/nxp/k32w1_sdk:mbedtls" +mbedtls_target = "${nxp_sdk_build_root}/${nxp_sdk_name}:mbedtls" openthread_external_mbedtls = mbedtls_target openthread_project_core_config_file = "OpenThreadConfig.h" diff --git a/src/platform/nxp/zephyr/CHIPDevicePlatformConfig.h b/src/platform/nxp/zephyr/CHIPDevicePlatformConfig.h index f8c72dd043902f..7a80a39a3f77b2 100644 --- a/src/platform/nxp/zephyr/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/zephyr/CHIPDevicePlatformConfig.h @@ -27,65 +27,22 @@ // ==================== Platform Adaptations ==================== -#ifndef CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER -#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER CONFIG_CHIP_DEVICE_SERIAL_NUMBER -#endif - -#ifndef CHIP_DEVICE_CONFIG_TEST_MANUFACTURING_DATE -#define CHIP_DEVICE_CONFIG_TEST_MANUFACTURING_DATE CONFIG_CHIP_DEVICE_MANUFACTURING_DATE -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION CONFIG_CHIP_DEVICE_HARDWARE_VERSION -#endif - -#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE -#endif - -#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR CONFIG_CHIP_DEVICE_DISCRIMINATOR -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING -#endif - -#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT -#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT CONFIG_CHIP_DEVICE_SPAKE2_IT -#endif - -#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_SALT -#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_SALT CONFIG_CHIP_DEVICE_SPAKE2_SALT -#endif - -#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_VERIFIER -#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_VERIFIER CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID CONFIG_CHIP_DEVICE_VENDOR_ID -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID CONFIG_CHIP_DEVICE_PRODUCT_ID -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME CONFIG_CHIP_DEVICE_VENDOR_NAME -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID CONFIG_CHIP_DEVICE_PRODUCT_ID #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME CONFIG_CHIP_DEVICE_PRODUCT_NAME -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION CONFIG_CHIP_DEVICE_HARDWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING #define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION CONFIG_CHIP_DEVICE_SOFTWARE_VERSION -#endif - -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING #define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING -#endif +#define CHIP_DEVICE_CONFIG_TEST_MANUFACTURING_DATE CONFIG_CHIP_DEVICE_MANUFACTURING_DATE +#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER CONFIG_CHIP_DEVICE_SERIAL_NUMBER +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE CONFIG_CHIP_DEVICE_TYPE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR CONFIG_CHIP_DEVICE_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT CONFIG_CHIP_DEVICE_SPAKE2_IT +#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_SALT CONFIG_CHIP_DEVICE_SPAKE2_SALT +#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_VERIFIER CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER #ifdef CONFIG_NET_L2_OPENTHREAD #define CHIP_DEVICE_CONFIG_ENABLE_THREAD CONFIG_NET_L2_OPENTHREAD @@ -93,8 +50,8 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 0 #endif -#ifdef CONFIG_WIFI_NXP -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI CONFIG_WIFI_NXP +#ifdef CONFIG_CHIP_WIFI +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI CONFIG_CHIP_WIFI #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 #else @@ -155,6 +112,8 @@ #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 8192 #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE +#define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 64 + #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_TELEMETRY 0 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY 0 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_TELEMETRY_FULL 0 @@ -197,10 +156,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 #endif // CONFIG_CHIP_COMMISSIONABLE_DEVICE_TYPE -#ifdef CONFIG_CHIP_DEVICE_TYPE -#define CHIP_DEVICE_CONFIG_DEVICE_TYPE CONFIG_CHIP_DEVICE_TYPE -#endif // CONFIG_CHIP_DEVICE_TYPE - #ifdef CONFIG_CHIP_EXTENDED_DISCOVERY #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 #endif // CONFIG_CHIP_EXTENDED_DISCOVERY diff --git a/src/platform/nxp/zephyr/CHIPPlatformConfig.h b/src/platform/nxp/zephyr/CHIPPlatformConfig.h index cd9873051e5fed..d5ed1717bd64d4 100644 --- a/src/platform/nxp/zephyr/CHIPPlatformConfig.h +++ b/src/platform/nxp/zephyr/CHIPPlatformConfig.h @@ -114,15 +114,15 @@ #endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_IDLE_MODE_DURATION #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/platform/nxp/zephyr/SystemPlatformConfig.h b/src/platform/nxp/zephyr/SystemPlatformConfig.h index 24f8c4d229e235..1757071f42a751 100644 --- a/src/platform/nxp/zephyr/SystemPlatformConfig.h +++ b/src/platform/nxp/zephyr/SystemPlatformConfig.h @@ -25,3 +25,5 @@ #pragma once #include + +#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0 diff --git a/src/platform/nxp/zephyr/wifi/NxpWifiDriver.cpp b/src/platform/nxp/zephyr/wifi/NxpWifiDriver.cpp index 06a0b48f1e8c77..f3969a583221e6 100644 --- a/src/platform/nxp/zephyr/wifi/NxpWifiDriver.cpp +++ b/src/platform/nxp/zephyr/wifi/NxpWifiDriver.cpp @@ -147,10 +147,6 @@ CHIP_ERROR NxpWifiDriver::CommitConfiguration() CHIP_ERROR NxpWifiDriver::RevertConfiguration() { - // Abort Connection Recovery if it is in progress during reverting configuration. - // This is needed to stop recovery process after failsafe timer expiring. - WiFiManager::Instance().AbortConnectionRecovery(); - LoadFromStorage(); if (WiFiManager::StationStatus::CONNECTING <= WiFiManager::Instance().GetStationStatus()) diff --git a/src/platform/nxp/zephyr/wifi/WiFiManager.cpp b/src/platform/nxp/zephyr/wifi/WiFiManager.cpp index 946546288761b4..8b6fdf64bbe8d9 100644 --- a/src/platform/nxp/zephyr/wifi/WiFiManager.cpp +++ b/src/platform/nxp/zephyr/wifi/WiFiManager.cpp @@ -142,8 +142,8 @@ const Map WiFiManager::sEventHandlerMap({ { NET_EVENT_WIFI_SCAN_RESULT, WiFiManager::ScanResultHandler }, { NET_EVENT_WIFI_SCAN_DONE, WiFiManager::ScanDoneHandler }, { NET_EVENT_WIFI_CONNECT_RESULT, WiFiManager::ConnectHandler }, - { NET_EVENT_WIFI_DISCONNECT_RESULT, WiFiManager::NetworkDrivenDisconnectHandler }, - { NET_EVENT_WIFI_DISCONNECT_COMPLETE, WiFiManager::ApplicationDrivenDisconnectHandler } }); + { NET_EVENT_WIFI_DISCONNECT_RESULT, WiFiManager::DisconnectHandler }, + { NET_EVENT_WIFI_DISCONNECT_COMPLETE, WiFiManager::DisconnectHandler } }); void WiFiManager::WifiMgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface) { @@ -206,9 +206,6 @@ CHIP_ERROR WiFiManager::Scan(const ByteSpan & ssid, ScanResultCallback resultCal mCachedWiFiState = mWiFiState; mWiFiState = WIFI_STATE_SCANNING; mSsidFound = false; - mRecoveryArmed = true; - // TODO Workaround for recovery mechanism to wait before the next scan request until the WiFi supplicant is not busy. - static bool workaroundDone; /* If the ssid is not null, it means the scan must target a specific SSID, and only include this one in the scan * result. To do so, we save the requested ssid and we will filter the scan results accordingly in the scan done @@ -220,28 +217,9 @@ CHIP_ERROR WiFiManager::Scan(const ByteSpan & ssid, ScanResultCallback resultCal mNetworkToScan.ssidLen = ssid.size(); } - int ret = net_mgmt(NET_REQUEST_WIFI_SCAN, iface, NULL, 0); - - if (ret) + if (0 != net_mgmt(NET_REQUEST_WIFI_SCAN, iface, NULL, 0)) { - ChipLogError(DeviceLayer, "Scan request failed %d", ret); - if (ret == -EBUSY && !workaroundDone) - { - // TODO Wi-Fi driver returned an error during recovery. - // As a workaround schedule the recovery timer one more time in WifiSupplicantWorkaroundTime time. - // This allows the device to run the Scan method without - // rebooting when the "Device or resource busy" error occurs. - DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(kWifiSupplicantWorkaroundTime), Recover, nullptr); - workaroundDone = true; - return CHIP_NO_ERROR; - } - else - { - // TODO The workaround has not worked, so reboot the device - ChipLogError(DeviceLayer, "WiFi driver does not respond, resetting the device..."); - workaroundDone = false; - PlatformMgr().Shutdown(); - } + ChipLogError(DeviceLayer, "Scan request failed"); return CHIP_ERROR_INTERNAL; } @@ -437,21 +415,14 @@ void WiFiManager::ScanDoneHandler(Platform::UniquePtr data) // Internal scan is supposed to be followed by a connection request if the SSID has been found if (Instance().mInternalScan) { - if (Instance().mRecoveryArmed) + if (!Instance().mSsidFound) { - if (!Instance().mSsidFound) - { - ChipLogProgress(DeviceLayer, "No requested SSID found"); - auto currentTimeout = Instance().CalculateNextRecoveryTime(); - ChipLogProgress(DeviceLayer, "Starting connection recover: re-scanning... (next attempt in %d ms)", - currentTimeout.count()); - DeviceLayer::SystemLayer().StartTimer(currentTimeout, Recover, nullptr); - return; - } - else - { - Instance().AbortConnectionRecovery(); - } + ChipLogProgress(DeviceLayer, "No requested SSID found"); + auto currentTimeout = Instance().CalculateNextRecoveryTime(); + ChipLogProgress(DeviceLayer, "Starting connection recover: re-scanning... (next attempt in %d ms)", + currentTimeout.count()); + DeviceLayer::SystemLayer().StartTimer(currentTimeout, Recover, nullptr); + return; } Instance().mWiFiState = WIFI_STATE_ASSOCIATING; @@ -542,8 +513,6 @@ void WiFiManager::ConnectHandler(Platform::UniquePtr data) ChipLogError(DeviceLayer, "Cannot post event [error: %s]", ErrorStr(error)); } } - // Ensure fresh recovery for future connection requests. - Instance().ResetRecoveryTime(); // cleanup the provisioning data as it is configured per each connect request Instance().ClearStationProvisioningData(); }); @@ -555,16 +524,8 @@ void WiFiManager::ConnectHandler(Platform::UniquePtr data) } } -void WiFiManager::NetworkDrivenDisconnectHandler(Platform::UniquePtr) +void WiFiManager::DisconnectHandler(Platform::UniquePtr) { - // Workaround: schedule the application level connection recovery in kSupplicantReconnectionTimeoutMs to give WPA supplicant - // some time to restore it. - if (!Instance().mRecoveryArmed) - { - Instance().mRecoveryArmed = true; - DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(kSupplicantReconnectionTimeoutMs), Recover, nullptr); - } - SystemLayer().ScheduleLambda([] { ChipLogProgress(DeviceLayer, "WiFi station disconnected"); Instance().mWiFiState = WIFI_STATE_DISCONNECTED; @@ -572,24 +533,6 @@ void WiFiManager::NetworkDrivenDisconnectHandler(Platform::UniquePtr) }); } -void WiFiManager::ApplicationDrivenDisconnectHandler(Platform::UniquePtr) -{ - if (!Instance().mRecoveryArmed) - { - return; - } - - if (!Instance().mApplicationDisconnectRequested) - { - Instance().AbortConnectionRecovery(); - } - else - { - Instance().mApplicationDisconnectRequested = false; - SystemLayer().ScheduleLambda([] { Recover(nullptr, nullptr); }); - } -} - WiFiManager::StationStatus WiFiManager::GetStationStatus() const { return WiFiManager::sStatusMap[mWiFiState]; @@ -603,23 +546,6 @@ void WiFiManager::PostConnectivityStatusChange(ConnectivityChange changeType) PlatformMgr().PostEventOrDie(&networkEvent); } -System::Clock::Milliseconds32 WiFiManager::CalculateNextRecoveryTime() -{ - if (mConnectionRecoveryTimeMs > kConnectionRecoveryMaxIntervalMs) - { - // Find the new random jitter value in range [-jitter, +jitter]. - int32_t jitter = chip::Crypto::GetRandU32() % (2 * jitter + 1) - jitter; - mConnectionRecoveryTimeMs = kConnectionRecoveryMaxIntervalMs + jitter; - return System::Clock::Milliseconds32(mConnectionRecoveryTimeMs); - } - else - { - uint32_t currentRecoveryTimeout = mConnectionRecoveryTimeMs; - mConnectionRecoveryTimeMs = mConnectionRecoveryTimeMs * 2; - return System::Clock::Milliseconds32(currentRecoveryTimeout); - } -} - void WiFiManager::Recover(System::Layer *, void *) { // Prevent scheduling recovery if we are already connected to the network. @@ -649,7 +575,23 @@ void WiFiManager::AbortConnectionRecovery() { DeviceLayer::SystemLayer().CancelTimer(Recover, nullptr); Instance().ResetRecoveryTime(); - Instance().mRecoveryArmed = false; +} + +System::Clock::Milliseconds32 WiFiManager::CalculateNextRecoveryTime() +{ + if (mConnectionRecoveryTimeMs > kConnectionRecoveryMaxIntervalMs) + { + // Find the new random jitter value in range [-jitter, +jitter]. + int32_t jitter = chip::Crypto::GetRandU32() % (2 * jitter + 1) - jitter; + mConnectionRecoveryTimeMs = kConnectionRecoveryMaxIntervalMs + jitter; + return System::Clock::Milliseconds32(mConnectionRecoveryTimeMs); + } + else + { + uint32_t currentRecoveryTimeout = mConnectionRecoveryTimeMs; + mConnectionRecoveryTimeMs = mConnectionRecoveryTimeMs * 2; + return System::Clock::Milliseconds32(currentRecoveryTimeout); + } } CHIP_ERROR WiFiManager::SetLowPowerMode(bool onoff) diff --git a/src/platform/nxp/zephyr/wifi/WiFiManager.h b/src/platform/nxp/zephyr/wifi/WiFiManager.h index 29f2ef299af1aa..d48536fb3d0da3 100644 --- a/src/platform/nxp/zephyr/wifi/WiFiManager.h +++ b/src/platform/nxp/zephyr/wifi/WiFiManager.h @@ -173,10 +173,6 @@ class WiFiManager static constexpr uint32_t kConnectionRecoveryMaxIntervalMs = CONFIG_CHIP_WIFI_CONNECTION_RECOVERY_MAXIMUM_INTERVAL; static constexpr uint32_t kConnectionRecoveryJitterMs = CONFIG_CHIP_WIFI_CONNECTION_RECOVERY_JITTER; static constexpr uint32_t kConnectionRecoveryMaxRetries = CONFIG_CHIP_WIFI_CONNECTION_RECOVERY_MAX_RETRIES_NUMBER; - static constexpr uint32_t kSupplicantReconnectionTimeoutMs = 60000; - - static_assert(kConnectionRecoveryMinIntervalMs < kConnectionRecoveryMaxIntervalMs); - static_assert(kConnectionRecoveryJitterMs <= kConnectionRecoveryMaxIntervalMs); CHIP_ERROR Init(); CHIP_ERROR Scan(const ByteSpan & ssid, ScanResultCallback resultCallback, ScanDoneCallback doneCallback, @@ -200,16 +196,14 @@ class WiFiManager }; constexpr static uint32_t kWifiManagementEvents = NET_EVENT_WIFI_SCAN_RESULT | NET_EVENT_WIFI_SCAN_DONE | - NET_EVENT_WIFI_CONNECT_RESULT | NET_EVENT_WIFI_DISCONNECT_RESULT | NET_EVENT_WIFI_DISCONNECT_COMPLETE | - NET_EVENT_WIFI_IFACE_STATUS; + NET_EVENT_WIFI_CONNECT_RESULT | NET_EVENT_WIFI_DISCONNECT_RESULT | NET_EVENT_WIFI_IFACE_STATUS; // Event handling static void WifiMgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mgmtEvent, net_if * iface); static void ScanResultHandler(Platform::UniquePtr data); static void ScanDoneHandler(Platform::UniquePtr data); static void ConnectHandler(Platform::UniquePtr data); - static void NetworkDrivenDisconnectHandler(Platform::UniquePtr data); - static void ApplicationDrivenDisconnectHandler(Platform::UniquePtr data); + static void DisconnectHandler(Platform::UniquePtr data); static void PostConnectivityStatusChange(ConnectivityChange changeType); static void SendRouterSolicitation(System::Layer * layer, void * param); @@ -240,10 +234,7 @@ class WiFiManager bool mSsidFound{ false }; uint32_t mConnectionRecoveryCounter{ 0 }; uint32_t mConnectionRecoveryTimeMs{ kConnectionRecoveryMinIntervalMs }; - bool mRecoveryArmed{ false }; bool mApplicationDisconnectRequested{ false }; - // TODO Workaround for recovery mechanism to wait before the next scan request until the WiFi supplicant is not busy. - static constexpr uint32_t kWifiSupplicantWorkaroundTime = 8000; static const Map sStatusMap; static const Map sEventHandlerMap; diff --git a/src/platform/silabs/CHIPPlatformConfig.h b/src/platform/silabs/CHIPPlatformConfig.h index 5fc9abfa995a3b..93faf6b791b697 100644 --- a/src/platform/silabs/CHIPPlatformConfig.h +++ b/src/platform/silabs/CHIPPlatformConfig.h @@ -95,11 +95,11 @@ #ifdef SL_ICD_ENABLED #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC SL_IDLE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC SL_IDLE_MODE_DURATION_S #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS SL_ACTIVE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS SL_ACTIVE_MODE_DURATION_MS #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/platform/telink/CHIPPlatformConfig.h b/src/platform/telink/CHIPPlatformConfig.h index 9e0dc3dd36e8f7..1bb4ab7b07203d 100644 --- a/src/platform/telink/CHIPPlatformConfig.h +++ b/src/platform/telink/CHIPPlatformConfig.h @@ -133,15 +133,15 @@ #endif #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_IDLE_MODE_DURATION #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/protocols/bdx/BUILD.gn b/src/protocols/bdx/BUILD.gn index 17f18826ebe474..a95fd02202f626 100644 --- a/src/protocols/bdx/BUILD.gn +++ b/src/protocols/bdx/BUILD.gn @@ -20,6 +20,9 @@ static_library("bdx") { sources = [ "BdxMessages.cpp", "BdxMessages.h", + "BdxTransferDiagnosticLog.cpp", + "BdxTransferDiagnosticLog.h", + "BdxTransferDiagnosticLogPool.h", "BdxTransferProxy.h", "BdxTransferProxyDiagnosticLog.cpp", "BdxTransferProxyDiagnosticLog.h", diff --git a/src/protocols/bdx/BdxTransferDiagnosticLog.cpp b/src/protocols/bdx/BdxTransferDiagnosticLog.cpp new file mode 100644 index 00000000000000..8b349fed31e8f5 --- /dev/null +++ b/src/protocols/bdx/BdxTransferDiagnosticLog.cpp @@ -0,0 +1,198 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "BdxTransferDiagnosticLog.h" + +namespace chip { +namespace bdx { + +namespace { +// Max block size for the BDX transfer. +constexpr uint32_t kMaxBdxBlockSize = 1024; + +// Timeout for the BDX transfer session.. +constexpr System::Clock::Timeout kBdxTimeout = System::Clock::Seconds16(5 * 60); +constexpr TransferRole kBdxRole = TransferRole::kReceiver; +} // namespace + +void BdxTransferDiagnosticLog::HandleTransferSessionOutput(TransferSession::OutputEvent & event) +{ + assertChipStackLockedByCurrentThread(); + + ChipLogDetail(BDX, "Got an event %s", event.ToString(event.EventType)); + + switch (event.EventType) + { + case TransferSession::OutputEventType::kInitReceived: + AbortTransferOnFailure(OnTransferSessionBegin(event)); + break; + case TransferSession::OutputEventType::kStatusReceived: + ChipLogError(BDX, "Got StatusReport %x", static_cast(event.statusData.statusCode)); + LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_INTERNAL)); + break; + case TransferSession::OutputEventType::kInternalError: + LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_INTERNAL)); + break; + case TransferSession::OutputEventType::kTransferTimeout: + LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_TIMEOUT)); + break; + case TransferSession::OutputEventType::kBlockReceived: + AbortTransferOnFailure(OnBlockReceived(event)); + break; + case TransferSession::OutputEventType::kMsgToSend: + LogErrorOnFailure(OnMessageToSend(event)); + + if (event.msgTypeData.HasMessageType(MessageType::BlockAckEOF)) + { + LogErrorOnFailure(OnTransferSessionEnd(CHIP_NO_ERROR)); + } + break; + case TransferSession::OutputEventType::kAckEOFReceived: + case TransferSession::OutputEventType::kNone: + case TransferSession::OutputEventType::kQueryWithSkipReceived: + case TransferSession::OutputEventType::kQueryReceived: + case TransferSession::OutputEventType::kAckReceived: + case TransferSession::OutputEventType::kAcceptReceived: + // Nothing to do. + break; + default: + // Should never happen. + chipDie(); + break; + } +} + +CHIP_ERROR BdxTransferDiagnosticLog::OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, + System::PacketBufferHandle && payload) +{ + assertChipStackLockedByCurrentThread(); + + VerifyOrReturnError(ec != nullptr, CHIP_ERROR_INCORRECT_STATE); + + // If we receive a SendInit message, then we prepare for transfer + if (payloadHeader.HasMessageType(MessageType::SendInit)) + { + FabricIndex fabricIndex = ec->GetSessionHandle()->GetFabricIndex(); + NodeId peerNodeId = ec->GetSessionHandle()->GetPeer().GetNodeId(); + VerifyOrReturnError(fabricIndex != kUndefinedFabricIndex, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(peerNodeId != kUndefinedNodeId, CHIP_ERROR_INVALID_ARGUMENT); + + mTransferProxy.SetFabricIndex(fabricIndex); + mTransferProxy.SetPeerNodeId(peerNodeId); + auto flags(TransferControlFlags::kSenderDrive); + ReturnLogErrorOnFailure(Responder::PrepareForTransfer(mSystemLayer, kBdxRole, flags, kMaxBdxBlockSize, kBdxTimeout)); + } + + return TransferFacilitator::OnMessageReceived(ec, payloadHeader, std::move(payload)); +} + +CHIP_ERROR BdxTransferDiagnosticLog::OnMessageToSend(TransferSession::OutputEvent & event) +{ + assertChipStackLockedByCurrentThread(); + + VerifyOrReturnError(mExchangeCtx != nullptr, CHIP_ERROR_INCORRECT_STATE); + + auto & msgTypeData = event.msgTypeData; + bool isStatusReport = msgTypeData.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport); + + // All messages sent from the Sender expect a response, except for a StatusReport which would indicate an error and + // the end of the transfer. + Messaging::SendFlags sendFlags; + VerifyOrDo(isStatusReport, sendFlags.Set(Messaging::SendMessageFlags::kExpectResponse)); + + // If there's an error sending the message, close the exchange by calling Reset. + auto err = mExchangeCtx->SendMessage(msgTypeData.ProtocolId, msgTypeData.MessageType, std::move(event.MsgData), sendFlags); + VerifyOrDo(CHIP_NO_ERROR == err, OnTransferSessionEnd(err)); + + return err; +} + +CHIP_ERROR BdxTransferDiagnosticLog::OnTransferSessionBegin(TransferSession::OutputEvent & event) +{ + assertChipStackLockedByCurrentThread(); + VerifyOrReturnError(nullptr != mDelegate, CHIP_ERROR_INCORRECT_STATE); + + ReturnErrorOnFailure(mTransferProxy.Init(&mTransfer)); + return mDelegate->OnTransferBegin(&mTransferProxy); +} + +CHIP_ERROR BdxTransferDiagnosticLog::OnTransferSessionEnd(CHIP_ERROR error) +{ + assertChipStackLockedByCurrentThread(); + VerifyOrReturnError(nullptr != mDelegate, CHIP_ERROR_INCORRECT_STATE); + + LogErrorOnFailure(mDelegate->OnTransferEnd(&mTransferProxy, error)); + Reset(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BdxTransferDiagnosticLog::OnBlockReceived(TransferSession::OutputEvent & event) +{ + assertChipStackLockedByCurrentThread(); + VerifyOrReturnError(nullptr != mDelegate, CHIP_ERROR_INCORRECT_STATE); + + ByteSpan blockData(event.blockdata.Data, event.blockdata.Length); + return mDelegate->OnTransferData(&mTransferProxy, blockData); +} + +void BdxTransferDiagnosticLog::AbortTransferOnFailure(CHIP_ERROR error) +{ + VerifyOrReturn(CHIP_NO_ERROR != error); + LogErrorOnFailure(error); + LogErrorOnFailure(mTransfer.AbortTransfer(GetBdxStatusCodeFromChipError(error))); +} + +void BdxTransferDiagnosticLog::Reset() +{ + assertChipStackLockedByCurrentThread(); + + Responder::ResetTransfer(); + + if (mExchangeCtx) + { + mIsExchangeClosing = true; + mExchangeCtx->Close(); + mIsExchangeClosing = false; + mExchangeCtx = nullptr; + } + + mTransferProxy.Reset(); +} + +void BdxTransferDiagnosticLog::OnExchangeClosing(Messaging::ExchangeContext * ec) +{ + // The exchange can be closing while TransferFacilitator is still accessing us, so + // the BdxTransferDiagnosticLog can not be released "right now". + mSystemLayer->ScheduleWork( + [](auto * systemLayer, auto * appState) -> void { + auto * _this = static_cast(appState); + _this->mPoolDelegate->Release(_this); + }, + this); + + // This block checks and handles the scenario where the exchange is closed externally (e.g., receiving a StatusReport). + // Continuing to use it could lead to a use-after-free error and such an error might occur when the poll timer triggers and + // OnTransferSessionEnd is called. + // We know it's not just us normally closing the exchange if mIsExchangeClosing is false. + VerifyOrReturn(!mIsExchangeClosing); + mExchangeCtx = nullptr; + LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_INTERNAL)); +} + +} // namespace bdx +} // namespace chip diff --git a/src/protocols/bdx/BdxTransferDiagnosticLog.h b/src/protocols/bdx/BdxTransferDiagnosticLog.h new file mode 100644 index 00000000000000..bc7a8773cd2dff --- /dev/null +++ b/src/protocols/bdx/BdxTransferDiagnosticLog.h @@ -0,0 +1,111 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include +#include +#include +#include + +namespace chip { +namespace bdx { + +class BdxTransferDiagnosticLog : public Responder +{ +public: + BdxTransferDiagnosticLog(BDXTransferServerDelegate * delegate, BdxTransferDiagnosticLogPoolDelegate * poolDelegate, + System::Layer * systemLayer) : + mSystemLayer(systemLayer), + mDelegate(delegate), mPoolDelegate(poolDelegate){}; + + ~BdxTransferDiagnosticLog() { Reset(); }; + + /** + * This method handles BDX messages and other TransferSession events. + * + * @param[in] event An OutputEvent that contains output from the TransferSession object. + */ + void HandleTransferSessionOutput(TransferSession::OutputEvent & event) override; + + void OnExchangeClosing(Messaging::ExchangeContext * ec) override; + +protected: + /** + * Called when a BDX message is received over the exchange context + * + * @param[in] ec The exchange context + * + * @param[in] payloadHeader The payload header of the message + * + * @param[in] payload The payload of the message + */ + CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, + System::PacketBufferHandle && payload) override; + +private: + /** + * Called to send a BDX MsgToSend message over the exchange + * + * + * @param[in] event The output event to be send + */ + CHIP_ERROR OnMessageToSend(TransferSession::OutputEvent & event); + + /** + * Called to begin the transfer session when an init message has been received + * + * @param[in] event The output event received + */ + CHIP_ERROR OnTransferSessionBegin(TransferSession::OutputEvent & event); + + /** + * Called to end the transfer session when a BlockAckEOF message has been sent over the exchange + * or an error has occurred during the BDX session + * + * @param[in] error The error type + */ + CHIP_ERROR OnTransferSessionEnd(CHIP_ERROR error); + + /** + * Called when a block has been received from the Sender. The block is processed + * and written to a file and a block ack is sent back to the sender. + * + * @param[in] event The output event received + */ + CHIP_ERROR OnBlockReceived(TransferSession::OutputEvent & event); + + /** + * This method is called to reset state. It resets the transfer and cleans up the + * exchange and the fabric index and peer node id. + */ + void Reset(); + + void AbortTransferOnFailure(CHIP_ERROR error); + + BDXTransferProxyDiagnosticLog mTransferProxy; + bool mIsExchangeClosing = false; + + System::Layer * mSystemLayer; + + BDXTransferServerDelegate * mDelegate; + BdxTransferDiagnosticLogPoolDelegate * mPoolDelegate; +}; + +} // namespace bdx +} // namespace chip diff --git a/src/protocols/bdx/BdxTransferDiagnosticLogPool.h b/src/protocols/bdx/BdxTransferDiagnosticLogPool.h new file mode 100644 index 00000000000000..a2d7d3f5d11105 --- /dev/null +++ b/src/protocols/bdx/BdxTransferDiagnosticLogPool.h @@ -0,0 +1,58 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include +#include +#include + +namespace chip { +namespace bdx { + +class BdxTransferDiagnosticLog; + +class BdxTransferDiagnosticLogPoolDelegate +{ +public: + virtual ~BdxTransferDiagnosticLogPoolDelegate() {} + + virtual BdxTransferDiagnosticLog * Allocate(BDXTransferServerDelegate * delegate, System::Layer * systemLayer) = 0; + + virtual void Release(BdxTransferDiagnosticLog * client) = 0; +}; + +template +class BdxTransferDiagnosticLogPool : public BdxTransferDiagnosticLogPoolDelegate +{ +public: + ~BdxTransferDiagnosticLogPool() override { mTransferPool.ReleaseAll(); } + + BdxTransferDiagnosticLog * Allocate(BDXTransferServerDelegate * delegate, System::Layer * systemLayer) override + { + return mTransferPool.CreateObject(delegate, this, systemLayer); + } + + void Release(BdxTransferDiagnosticLog * transfer) override { mTransferPool.ReleaseObject(transfer); } + +private: + ObjectPool mTransferPool; +}; + +} // namespace bdx +} // namespace chip diff --git a/src/protocols/bdx/BdxTransferServer.cpp b/src/protocols/bdx/BdxTransferServer.cpp index b276dba51ab521..709d21b1f3b835 100644 --- a/src/protocols/bdx/BdxTransferServer.cpp +++ b/src/protocols/bdx/BdxTransferServer.cpp @@ -21,16 +21,7 @@ namespace chip { namespace bdx { -namespace { -// Max block size for the BDX transfer. -constexpr uint32_t kMaxBdxBlockSize = 1024; - -// Timeout for the BDX transfer session.. -constexpr System::Clock::Timeout kBdxTimeout = System::Clock::Seconds16(5 * 60); -constexpr TransferRole kBdxRole = TransferRole::kReceiver; -} // namespace - -CHIP_ERROR BDXTransferServer::ListenForSendInit(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeMgr) +CHIP_ERROR BDXTransferServer::Init(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeMgr) { VerifyOrReturnError(nullptr != systemLayer, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(nullptr != exchangeMgr, CHIP_ERROR_INVALID_ARGUMENT); @@ -40,170 +31,31 @@ CHIP_ERROR BDXTransferServer::ListenForSendInit(System::Layer * systemLayer, Mes return mExchangeMgr->RegisterUnsolicitedMessageHandlerForType(MessageType::SendInit, this); } -void BDXTransferServer::Shutdown() -{ - VerifyOrReturn(nullptr != mSystemLayer); - VerifyOrReturn(nullptr != mExchangeMgr); - - LogErrorOnFailure(mExchangeMgr->UnregisterUnsolicitedMessageHandlerForType(MessageType::SendInit)); - - mSystemLayer = nullptr; - mExchangeMgr = nullptr; -} - -void BDXTransferServer::HandleTransferSessionOutput(TransferSession::OutputEvent & event) -{ - assertChipStackLockedByCurrentThread(); - - ChipLogDetail(BDX, "Got an event %s", event.ToString(event.EventType)); - - switch (event.EventType) - { - case TransferSession::OutputEventType::kInitReceived: - AbortTransferOnFailure(OnTransferSessionBegin(event)); - break; - case TransferSession::OutputEventType::kStatusReceived: - ChipLogError(BDX, "Got StatusReport %x", static_cast(event.statusData.statusCode)); - LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_INTERNAL)); - break; - case TransferSession::OutputEventType::kInternalError: - LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_INTERNAL)); - break; - case TransferSession::OutputEventType::kTransferTimeout: - LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_TIMEOUT)); - break; - case TransferSession::OutputEventType::kBlockReceived: - AbortTransferOnFailure(OnBlockReceived(event)); - break; - case TransferSession::OutputEventType::kMsgToSend: - LogErrorOnFailure(OnMessageToSend(event)); - - if (event.msgTypeData.HasMessageType(MessageType::BlockAckEOF)) - { - LogErrorOnFailure(OnTransferSessionEnd(CHIP_NO_ERROR)); - } - break; - case TransferSession::OutputEventType::kAckEOFReceived: - case TransferSession::OutputEventType::kNone: - case TransferSession::OutputEventType::kQueryWithSkipReceived: - case TransferSession::OutputEventType::kQueryReceived: - case TransferSession::OutputEventType::kAckReceived: - case TransferSession::OutputEventType::kAcceptReceived: - // Nothing to do. - break; - default: - // Should never happen. - chipDie(); - break; - } -} - -CHIP_ERROR BDXTransferServer::OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, - System::PacketBufferHandle && payload) -{ - assertChipStackLockedByCurrentThread(); - - VerifyOrReturnError(ec != nullptr, CHIP_ERROR_INCORRECT_STATE); - - // If we receive a SendInit message, then we prepare for transfer - if (payloadHeader.HasMessageType(MessageType::SendInit)) - { - FabricIndex fabricIndex = ec->GetSessionHandle()->GetFabricIndex(); - NodeId peerNodeId = ec->GetSessionHandle()->GetPeer().GetNodeId(); - VerifyOrReturnError(fabricIndex != kUndefinedFabricIndex, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(peerNodeId != kUndefinedNodeId, CHIP_ERROR_INVALID_ARGUMENT); - - mTransferProxy.SetFabricIndex(fabricIndex); - mTransferProxy.SetPeerNodeId(peerNodeId); - auto flags(TransferControlFlags::kSenderDrive); - ReturnLogErrorOnFailure(Responder::PrepareForTransfer(mSystemLayer, kBdxRole, flags, kMaxBdxBlockSize, kBdxTimeout)); - } - - return TransferFacilitator::OnMessageReceived(ec, payloadHeader, std::move(payload)); -} - -CHIP_ERROR BDXTransferServer::OnMessageToSend(TransferSession::OutputEvent & event) +CHIP_ERROR BDXTransferServer::OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader, + Messaging::ExchangeDelegate *& newDelegate) { - assertChipStackLockedByCurrentThread(); + auto * logTransfer = mPoolDelegate.Allocate(mDelegate, mSystemLayer); + VerifyOrReturnError(nullptr != logTransfer, CHIP_ERROR_NO_MEMORY); - VerifyOrReturnError(mExchangeCtx != nullptr, CHIP_ERROR_INCORRECT_STATE); - - auto & msgTypeData = event.msgTypeData; - bool isStatusReport = msgTypeData.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport); - - // All messages sent from the Sender expect a response, except for a StatusReport which would indicate an error and - // the end of the transfer. - Messaging::SendFlags sendFlags; - VerifyOrDo(isStatusReport, sendFlags.Set(Messaging::SendMessageFlags::kExpectResponse)); - - // If there's an error sending the message, close the exchange by calling Reset. - auto err = mExchangeCtx->SendMessage(msgTypeData.ProtocolId, msgTypeData.MessageType, std::move(event.MsgData), sendFlags); - VerifyOrDo(CHIP_NO_ERROR == err, Reset()); - - return err; -} - -CHIP_ERROR BDXTransferServer::OnTransferSessionBegin(TransferSession::OutputEvent & event) -{ - assertChipStackLockedByCurrentThread(); - VerifyOrReturnError(nullptr != mDelegate, CHIP_ERROR_INCORRECT_STATE); - - ReturnErrorOnFailure(mTransferProxy.Init(&mTransfer)); - return mDelegate->OnTransferBegin(&mTransferProxy); -} - -CHIP_ERROR BDXTransferServer::OnTransferSessionEnd(CHIP_ERROR error) -{ - assertChipStackLockedByCurrentThread(); - VerifyOrReturnError(nullptr != mDelegate, CHIP_ERROR_INCORRECT_STATE); - - LogErrorOnFailure(mDelegate->OnTransferEnd(&mTransferProxy, error)); - Reset(); + newDelegate = logTransfer; return CHIP_NO_ERROR; } -CHIP_ERROR BDXTransferServer::OnBlockReceived(TransferSession::OutputEvent & event) -{ - assertChipStackLockedByCurrentThread(); - VerifyOrReturnError(nullptr != mDelegate, CHIP_ERROR_INCORRECT_STATE); - - ByteSpan blockData(event.blockdata.Data, event.blockdata.Length); - return mDelegate->OnTransferData(&mTransferProxy, blockData); -} - -void BDXTransferServer::AbortTransferOnFailure(CHIP_ERROR error) +void BDXTransferServer::OnExchangeCreationFailed(Messaging::ExchangeDelegate * delegate) { - VerifyOrReturn(CHIP_NO_ERROR != error); - LogErrorOnFailure(error); - LogErrorOnFailure(mTransfer.AbortTransfer(GetBdxStatusCodeFromChipError(error))); + auto * logTransfer = static_cast(delegate); + mPoolDelegate.Release(logTransfer); } -void BDXTransferServer::Reset() +void BDXTransferServer::Shutdown() { - assertChipStackLockedByCurrentThread(); - - Responder::ResetTransfer(); - - if (mExchangeCtx) - { - mIsExchangeClosing = true; - mExchangeCtx->Close(); - mIsExchangeClosing = false; - mExchangeCtx = nullptr; - } + VerifyOrReturn(nullptr != mSystemLayer); + VerifyOrReturn(nullptr != mExchangeMgr); - mTransferProxy.Reset(); -} + LogErrorOnFailure(mExchangeMgr->UnregisterUnsolicitedMessageHandlerForType(MessageType::SendInit)); -void BDXTransferServer::OnExchangeClosing(Messaging::ExchangeContext * ec) -{ - // This block checks and handles the scenario where the exchange is closed externally (e.g., receiving a StatusReport). - // Continuing to use it could lead to a use-after-free error and such an error might occur when the poll timer triggers and - // OnTransferSessionEnd is called. - // We know it's not just us normally closing the exchange if mIsExchangeClosing is false. - VerifyOrReturn(!mIsExchangeClosing); - mExchangeCtx = nullptr; - LogErrorOnFailure(OnTransferSessionEnd(CHIP_ERROR_INTERNAL)); + mSystemLayer = nullptr; + mExchangeMgr = nullptr; } } // namespace bdx diff --git a/src/protocols/bdx/BdxTransferServer.h b/src/protocols/bdx/BdxTransferServer.h index 83da8b97ecb6a8..0fac0e88b672de 100644 --- a/src/protocols/bdx/BdxTransferServer.h +++ b/src/protocols/bdx/BdxTransferServer.h @@ -18,97 +18,41 @@ #pragma once -#include "BdxTransferServerDelegate.h" +#include +#include #include -#include -#include -#include +#include namespace chip { namespace bdx { -class BDXTransferServer : public Responder +class BdxTransferDiagnosticLog; + +class BDXTransferServer : public Messaging::UnsolicitedMessageHandler { public: BDXTransferServer(){}; ~BDXTransferServer() { Shutdown(); }; - CHIP_ERROR ListenForSendInit(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeMgr); + CHIP_ERROR Init(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeMgr); void Shutdown(); void SetDelegate(BDXTransferServerDelegate * delegate) { mDelegate = delegate; } - /** - * This method handles BDX messages and other TransferSession events. - * - * @param[in] event An OutputEvent that contains output from the TransferSession object. - */ - void HandleTransferSessionOutput(TransferSession::OutputEvent & event) override; - - void OnExchangeClosing(Messaging::ExchangeContext * ec) override; - protected: - /** - * Called when a BDX message is received over the exchange context - * - * @param[in] ec The exchange context - * - * @param[in] payloadHeader The payload header of the message - * - * @param[in] payload The payload of the message - */ - CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, - System::PacketBufferHandle && payload) override; + CHIP_ERROR OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader, + Messaging::ExchangeDelegate *& newDelegate) override; + void OnExchangeCreationFailed(Messaging::ExchangeDelegate * delegate) override; private: - /** - * Called to send a BDX MsgToSend message over the exchange - * - * - * @param[in] event The output event to be send - */ - CHIP_ERROR OnMessageToSend(TransferSession::OutputEvent & event); - - /** - * Called to begin the transfer session when an init message has been received - * - * @param[in] event The output event received - */ - CHIP_ERROR OnTransferSessionBegin(TransferSession::OutputEvent & event); - - /** - * Called to end the transfer session when a BlockAckEOF message has been sent over the exchange - * or an error has occurred during the BDX session - * - * @param[in] error The error type - */ - CHIP_ERROR OnTransferSessionEnd(CHIP_ERROR error); - - /** - * Called when a block has been received from the Sender. The block is processed - * and written to a file and a block ack is sent back to the sender. - * - * @param[in] event The output event received - */ - CHIP_ERROR OnBlockReceived(TransferSession::OutputEvent & event); - - /** - * This method is called to reset state. It resets the transfer and cleans up the - * exchange and the fabric index and peer node id. - */ - void Reset(); - - void AbortTransferOnFailure(CHIP_ERROR error); - System::Layer * mSystemLayer; Messaging::ExchangeManager * mExchangeMgr; - BDXTransferServerDelegate * mDelegate; - BDXTransferProxyDiagnosticLog mTransferProxy; - bool mIsExchangeClosing = false; + BDXTransferServerDelegate * mDelegate; + BdxTransferDiagnosticLogPool mPoolDelegate; }; } // namespace bdx diff --git a/src/protocols/interaction_model/StatusCode.h b/src/protocols/interaction_model/StatusCode.h index f5426834a39393..b004b4e04a9057 100644 --- a/src/protocols/interaction_model/StatusCode.h +++ b/src/protocols/interaction_model/StatusCode.h @@ -37,10 +37,7 @@ namespace chip { namespace Protocols { namespace InteractionModel { -// This table comes from the IM's "Status Code Table" section from the Interaction Model spec. -// TODO: This needs to go back to being an enum class. -// https://github.com/project-chip/connectedhomeip/issues/32025 -enum Status : uint8_t +enum class Status : uint8_t { #define CHIP_IM_STATUS_CODE(name, spec_name, value) name = value, #include @@ -105,7 +102,8 @@ class ClusterStatusCode template static ClusterStatusCode ClusterSpecificFailure(T cluster_specific_code) { - static_assert(std::numeric_limits::max() <= std::numeric_limits::max(), "Type used must fit in uint8_t"); + static_assert(std::numeric_limits>::max() <= std::numeric_limits::max(), + "Type used must fit in uint8_t"); return ClusterStatusCode(Status::Failure, chip::to_underlying(cluster_specific_code)); } @@ -121,7 +119,8 @@ class ClusterStatusCode template static ClusterStatusCode ClusterSpecificSuccess(T cluster_specific_code) { - static_assert(std::numeric_limits::max() <= std::numeric_limits::max(), "Type used must fit in uint8_t"); + static_assert(std::numeric_limits>::max() <= std::numeric_limits::max(), + "Type used must fit in uint8_t"); return ClusterStatusCode(Status::Success, chip::to_underlying(cluster_specific_code)); } diff --git a/src/protocols/secure_channel/RendezvousParameters.h b/src/protocols/secure_channel/RendezvousParameters.h index a82628a483b2e9..e5e366d3b3b704 100644 --- a/src/protocols/secure_channel/RendezvousParameters.h +++ b/src/protocols/secure_channel/RendezvousParameters.h @@ -32,8 +32,8 @@ namespace chip { // The largest supported value for Rendezvous discriminators const uint16_t kMaxRendezvousDiscriminatorValue = 0xFFF; -// The largest supported value for sleepy idle interval and sleepy active interval -inline constexpr uint32_t kMaxSleepyInterval = 3600000; +// The largest supported value for session idle interval and session active interval +inline constexpr uint32_t kMaxSessionIdleInterval = 3600000; class RendezvousParameters { diff --git a/src/python_testing/TC_BOOLCFG_3_1.py b/src/python_testing/TC_BOOLCFG_3_1.py index ceeeba33c6ee2d..fb45e60ab38f8d 100644 --- a/src/python_testing/TC_BOOLCFG_3_1.py +++ b/src/python_testing/TC_BOOLCFG_3_1.py @@ -36,7 +36,8 @@ def steps_TC_BOOLCFG_3_1(self) -> list[TestStep]: steps = [ TestStep(1, "Commissioning, already done", is_commissioning=True), TestStep("2a", "Read FeatureMap attribute"), - TestStep("2b", "Read AttributeList attribute"), + TestStep("2b", "Verify SENS feature is supported"), + TestStep("2c", "Read AttributeList attribute"), TestStep(3, "Read SupportedSensitivityLevels attribute"), TestStep(4, "Read DefaultSensitivityLevel attribute, if supported"), TestStep(5, "Read CurrentSensitivityLevel attribute"), @@ -65,19 +66,26 @@ async def test_TC_BOOLCFG_3_1(self): self.step("2a") feature_map = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap) + is_sens_level_feature_supported = feature_map & Clusters.BooleanStateConfiguration.Bitmaps.Feature.kSensitivityLevel self.step("2b") - attribute_list = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) + if not is_sens_level_feature_supported: + logging.info("SENS feature not supported, skipping test case") - is_sens_level_feature_supported = feature_map & Clusters.BooleanStateConfiguration.Bitmaps.Feature.kSensitivityLevel + # Skipping all remainig steps + for step in self.get_test_steps(self.current_test_info.name)[self.current_step_index:]: + self.step(step.test_plan_number) + logging.info("Test step skipped") - self.step(3) - if is_sens_level_feature_supported: - numberOfSupportedLevels = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.SupportedSensitivityLevels) + return else: logging.info("Test step skipped") - default_level = 0 + self.step("2c") + attribute_list = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) + + self.step(3) + numberOfSupportedLevels = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.SupportedSensitivityLevels) self.step(4) if attributes.DefaultSensitivityLevel.attribute_id in attribute_list: @@ -85,20 +93,14 @@ async def test_TC_BOOLCFG_3_1(self): else: logging.info("Test step skipped") - current_level = 0 - self.step(5) - if is_sens_level_feature_supported: - current_level = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentSensitivityLevel) - else: - logging.info("Test step skipped") + current_level = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentSensitivityLevel) self.step(6) - if is_sens_level_feature_supported: - for sens_level in range(numberOfSupportedLevels): - logging.info(f"Write sensitivity level ({sens_level}) to CurrentSensitivityLevel)") - result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(sens_level))]) - asserts.assert_equal(result[0].Status, Status.Success, "CurrentSensitivityLevel write failed") + for sens_level in range(numberOfSupportedLevels): + logging.info(f"Write sensitivity level ({sens_level}) to CurrentSensitivityLevel)") + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(sens_level))]) + asserts.assert_equal(result[0].Status, Status.Success, "CurrentSensitivityLevel write failed") self.step(7) if attributes.DefaultSensitivityLevel.attribute_id in attribute_list: @@ -114,21 +116,18 @@ async def test_TC_BOOLCFG_3_1(self): asserts.assert_equal(result[0].Status, Status.Success, "CurrentSensitivityLevel write failed") self.step(9) - if is_sens_level_feature_supported: - result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(numberOfSupportedLevels))]) - asserts.assert_equal(result[0].Status, Status.ConstraintError, - "CurrentSensitivityLevel did not return CONSTRAINT_ERROR") + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(numberOfSupportedLevels))]) + asserts.assert_equal(result[0].Status, Status.ConstraintError, + "CurrentSensitivityLevel did not return CONSTRAINT_ERROR") self.step(10) - if is_sens_level_feature_supported: - result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(255))]) - asserts.assert_equal(result[0].Status, Status.ConstraintError, - "CurrentSensitivityLevel did not return CONSTRAINT_ERROR") + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(255))]) + asserts.assert_equal(result[0].Status, Status.ConstraintError, + "CurrentSensitivityLevel did not return CONSTRAINT_ERROR") self.step(11) - if is_sens_level_feature_supported: - result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(current_level))]) - asserts.assert_equal(result[0].Status, Status.Success, "CurrentSensitivityLevel write failed") + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.CurrentSensitivityLevel(current_level))]) + asserts.assert_equal(result[0].Status, Status.Success, "CurrentSensitivityLevel write failed") if __name__ == "__main__": diff --git a/src/python_testing/TC_EPM_2_1.py b/src/python_testing/TC_EPM_2_1.py index fc4347e1ec0a0d..8be16208169de2 100644 --- a/src/python_testing/TC_EPM_2_1.py +++ b/src/python_testing/TC_EPM_2_1.py @@ -23,6 +23,9 @@ logger = logging.getLogger(__name__) +MIN_INT64_ALLOWED = -pow(2, 62) # -(2^62) +MAX_INT64_ALLOWED = pow(2, 62) # (2^62) + class TC_EPM_2_1(MatterBaseTest, EnergyReportingBaseTestHelper): @@ -133,52 +136,52 @@ async def test_TC_EPM_2_1(self): self.step("6") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.Voltage.attribute_id in supported_attributes): - voltage = await self.check_epm_attribute_in_range("Voltage", -2 ^ 62, 2 ^ 62, allow_null=True) + voltage = await self.check_epm_attribute_in_range("Voltage", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd Voltage: {voltage}") self.step("7") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ActiveCurrent.attribute_id in supported_attributes): - active_current = await self.check_epm_attribute_in_range("ActiveCurrent", -2 ^ 62, 2 ^ 62, allow_null=True) + active_current = await self.check_epm_attribute_in_range("ActiveCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd ActiveCurrent: {active_current}") self.step("8") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ReactiveCurrent.attribute_id in supported_attributes): - reactive_current = await self.check_epm_attribute_in_range("ReactiveCurrent", -2 ^ 62, 2 ^ 62, allow_null=True) + reactive_current = await self.check_epm_attribute_in_range("ReactiveCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd ReactiveCurrent: {reactive_current}") self.step("9") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ApparentCurrent.attribute_id in supported_attributes): - apparent_current = await self.check_epm_attribute_in_range("ApparentCurrent", 0, 2 ^ 62, allow_null=True) + apparent_current = await self.check_epm_attribute_in_range("ApparentCurrent", 0, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd ApparentCurrent: {apparent_current}") self.step("10") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ActivePower.attribute_id in supported_attributes): - active_power = await self.check_epm_attribute_in_range("ActivePower", -2 ^ 62, 2 ^ 62, allow_null=True) + active_power = await self.check_epm_attribute_in_range("ActivePower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd ActivePower: {active_power}") self.step("11") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ReactivePower.attribute_id in supported_attributes): - reactive_power = await self.check_epm_attribute_in_range("ReactivePower", -2 ^ 62, 2 ^ 62, allow_null=True) + reactive_power = await self.check_epm_attribute_in_range("ReactivePower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd ReactivePower: {reactive_power}") self.step("12") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ApparentPower.attribute_id in supported_attributes): - apparent_power = await self.check_epm_attribute_in_range("ApparentPower", -2 ^ 62, 2 ^ 62, allow_null=True) + apparent_power = await self.check_epm_attribute_in_range("ApparentPower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd ApparentPower: {apparent_power}") self.step("13") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.RMSVoltage.attribute_id in supported_attributes): - rms_voltage = await self.check_epm_attribute_in_range("RMSVoltage", -2 ^ 62, 2 ^ 62, allow_null=True) + rms_voltage = await self.check_epm_attribute_in_range("RMSVoltage", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd RMSVoltage: {rms_voltage}") self.step("14") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.RMSCurrent.attribute_id in supported_attributes): - rms_current = await self.check_epm_attribute_in_range("RMSCurrent", -2 ^ 62, 2 ^ 62, allow_null=True) + rms_current = await self.check_epm_attribute_in_range("RMSCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd RMSCurrent: {rms_current}") self.step("15") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.RMSPower.attribute_id in supported_attributes): - rms_power = await self.check_epm_attribute_in_range("RMSPower", -2 ^ 62, 2 ^ 62, allow_null=True) + rms_power = await self.check_epm_attribute_in_range("RMSPower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd RMSPower: {rms_power}") self.step("16") @@ -188,13 +191,23 @@ async def test_TC_EPM_2_1(self): self.step("17") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.HarmonicCurrents.attribute_id in supported_attributes): - harmonic_currents = await self.read_epm_attribute_expect_success("HarmonicCurrents", allow_null=True) + harmonic_currents = await self.read_epm_attribute_expect_success("HarmonicCurrents") logger.info(f"Rx'd HarmonicCurrents: {harmonic_currents}") + asserts.assert_is(type(harmonic_currents), list) + for index, entry in enumerate(harmonic_currents): + logging.info(f" [{index}] order:{entry.order} measurement:{entry.measurement}") + asserts.assert_greater_equal(entry.order, 1) + self.check_value_in_range("Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED) self.step("18") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.HarmonicPhases.attribute_id in supported_attributes): - harmonic_phases = await self.read_epm_attribute_expect_success("HarmonicPhases", allow_null=True) + harmonic_phases = await self.read_epm_attribute_expect_success("HarmonicPhases") logger.info(f"Rx'd HarmonicPhases: {harmonic_phases}") + asserts.assert_is(type(harmonic_phases), list) + for index, entry in enumerate(harmonic_phases): + logging.info(f" [{index}] order:{entry.order} measurement:{entry.measurement}") + asserts.assert_greater_equal(entry.order, 1) + self.check_value_in_range("Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED) self.step("19") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.PowerFactor.attribute_id in supported_attributes): @@ -203,7 +216,7 @@ async def test_TC_EPM_2_1(self): self.step("20") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.NeutralCurrent.attribute_id in supported_attributes): - neutral_current = await self.check_epm_attribute_in_range("NeutralCurrent", -2 ^ 62, 2 ^ 62, allow_null=True) + neutral_current = await self.check_epm_attribute_in_range("NeutralCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True) logger.info(f"Rx'd NeutralCurrent: {neutral_current}") diff --git a/src/python_testing/TC_IDM_1_4.py b/src/python_testing/TC_IDM_1_4.py index 86e49bb3523f42..507b5d74254abf 100644 --- a/src/python_testing/TC_IDM_1_4.py +++ b/src/python_testing/TC_IDM_1_4.py @@ -16,21 +16,16 @@ # import logging -from dataclasses import dataclass import chip.clusters as Clusters -from chip import ChipUtility from chip.exceptions import ChipStackError from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts - -@dataclass -class FakeInvalidBasicInformationCommand(Clusters.BasicInformation.Commands.MfgSpecificPing): - @ChipUtility.classproperty - def must_use_timed_invoke(cls) -> bool: - return False +# If DUT supports `MaxPathsPerInvoke > 1`, additional command line argument +# run with +# --hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY: class TC_IDM_1_4(MatterBaseTest): @@ -44,7 +39,9 @@ def steps_TC_IDM_1_4(self) -> list[TestStep]: TestStep(6, "Verify DUT responds to InvokeRequestMessage containing one valid paths, and one InvokeRequest to unsupported endpoint"), TestStep(7, "Verify DUT responds to InvokeRequestMessage containing two valid paths. One of which requires timed invoke, and TimedRequest in InvokeResponseMessage set to true, but never sending preceding Timed Invoke Action"), TestStep(8, "Verify DUT responds to InvokeRequestMessage containing two valid paths. One of which requires timed invoke, and TimedRequest in InvokeResponseMessage set to true"), - TestStep(9, "Verify DUT capable of responding to request with multiple InvokeResponseMessages")] + TestStep(9, "Verify DUT supports extended Data Model Testing feature in General Diagnostics Cluster"), + TestStep(10, "Verify DUT has TestEventTriggersEnabled attribute set to true in General Diagnostics Cluster"), + TestStep(11, "Verify DUT capable of responding to request with multiple InvokeResponseMessages")] return steps @async_test_body @@ -118,9 +115,14 @@ async def test_TC_IDM_1_4(self): if max_paths_per_invoke == 1: self.skip_all_remaining_steps(3) else: - await self.steps_3_to_9(False) + asserts.assert_true('PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY' in self.matter_test_config.global_test_params, + "PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY must be included on the command line in " + "the --hex-arg flag as PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:, " + "e.g. --hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f") + + await self.remaining_batch_commands_test_steps(False) - async def steps_3_to_9(self, dummy_value): + async def remaining_batch_commands_test_steps(self, dummy_value): dev_ctrl = self.default_controller dut_node_id = self.dut_node_id @@ -247,8 +249,66 @@ async def steps_3_to_9(self, dummy_value): except InteractionModelError: asserts.fail("DUT failed with non-path specific error when path specific error was expected") - # Skipping test until https://github.com/project-chip/connectedhomeip/issues/31434 resolved - self.skip_step(9) + self.step(9) + try: + feature_map = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=0, + attribute=Clusters.GeneralDiagnostics.Attributes.FeatureMap + ) + except InteractionModelError: + asserts.fail("DUT failed to respond reading FeatureMap attribute") + has_data_model_test_feature = (feature_map & Clusters.GeneralDiagnostics.Bitmaps.Feature.kDataModelTest) != 0 + asserts.assert_true(has_data_model_test_feature, "DataModelTest Feature is not supported by DUT") + + self.step(10) + try: + test_event_triggers_enabled = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=0, + attribute=Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled + ) + except InteractionModelError: + asserts.fail("DUT failed to respond reading TestEventTriggersEnabled attribute") + asserts.assert_true(test_event_triggers_enabled, "Test Event Triggers must be enabled on DUT") + + self.step(11) + enable_key = self.matter_test_config.global_test_params['PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY'] + endpoint = 0 + command = Clusters.GeneralDiagnostics.Commands.PayloadTestRequest( + enableKey=enable_key, + value=ord('A'), + count=800 + ) + invoke_request_1 = Clusters.Command.InvokeRequestInfo(endpoint, command) + + command = Clusters.OperationalCredentials.Commands.CertificateChainRequest( + Clusters.OperationalCredentials.Enums.CertificateChainTypeEnum.kDACCertificate) + invoke_request_2 = Clusters.Command.InvokeRequestInfo(endpoint, command) + + try: + test_only_result = await dev_ctrl.TestOnlySendBatchCommands(dut_node_id, [invoke_request_1, invoke_request_2]) + except InteractionModelError: + asserts.fail("DUT failed to respond to batch commands, where response is expected to be too large to fit in a single ResponseMessage") + + responses = test_only_result.Responses + # This check is validating the number of InvokeResponses we got + asserts.assert_equal(len(responses), 2, "Unexpected number of InvokeResponses sent back from DUT") + asserts.assert_true(type_matches( + responses[0], Clusters.GeneralDiagnostics.Commands.PayloadTestResponse), "Unexpected return type for first InvokeRequest") + asserts.assert_true(type_matches( + responses[1], Clusters.OperationalCredentials.Commands.CertificateChainResponse), "Unexpected return type for second InvokeRequest") + logging.info("DUT successfully responded to a InvokeRequest action with two valid commands") + + asserts.assert_equal(responses[0].payload, b'A' * 800, "Expect response to match for count == 800") + # If this assert below fails then some assumptions we were relying on are now no longer true. + # This check is validating the number of InvokeResponsesMessages we got. This is different then the earlier + # `len(responses)` check as you can have multiple InvokeResponses in a single message. But this test step + # is explicitly making sure that we recieved multiple ResponseMessages. + asserts.assert_greater_equal(test_only_result.ResponseMessageCount, 2, + "DUT was expected to send multiple InvokeResponseMessages") if __name__ == "__main__": diff --git a/src/python_testing/TC_OPSTATE_1_1.py b/src/python_testing/TC_OPSTATE_1_1.py new file mode 100644 index 00000000000000..67caefc85862b5 --- /dev/null +++ b/src/python_testing/TC_OPSTATE_1_1.py @@ -0,0 +1,53 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OPSTATE_1_1(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OPSTATE_1_1(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_1_1() + + def pics_TC_OPSTATE_1_1(self) -> list[str]: + return ["OPSTATE.S"] + + @async_test_body + async def test_TC_OPSTATE_1_1(self): + endpoint = self.matter_test_config.endpoint + cluster_revision = 2 + feature_map = 0 + + await self.TEST_TC_OPSTATE_BASE_1_1(endpoint=endpoint, + cluster_revision=cluster_revision, + feature_map=feature_map) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OPSTATE_2_1.py b/src/python_testing/TC_OPSTATE_2_1.py index 98dbe83dc09057..0827202af71c29 100644 --- a/src/python_testing/TC_OPSTATE_2_1.py +++ b/src/python_testing/TC_OPSTATE_2_1.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,173 +15,33 @@ # limitations under the License. # -import logging import chip.clusters as Clusters -from chip.clusters.Types import NullValue -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main -from mobly import asserts +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo -# This test requires several additional command line arguments -# run with -# --int-arg PIXIT_ENDPOINT: +class TC_OPSTATE_2_1(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) -class TC_OPSTATE_2_1(MatterBaseTest): + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) - async def read_mod_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.OperationalState - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + super().setup_base(test_info=test_info) - async def read_and_validate_opstate(self, step, expected_state): - self.print_step(step, "Read OperationalState attribute") - operational_state = await self.read_mod_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.OperationalState.Attributes.OperationalState) - logging.info("OperationalState: %s" % (operational_state)) - asserts.assert_equal(operational_state, expected_state, - "OperationalState(%s) should equal %s" % (operational_state, expected_state)) - - async def read_and_validate_operror(self, step, expected_error): - self.print_step(step, "Read OperationalError attribute") - operational_error = await self.read_mod_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.OperationalState.Attributes.OperationalError) - logging.info("OperationalError: %s" % (operational_error)) - asserts.assert_equal(operational_error.errorStateID, expected_error, - "errorStateID(%s) should equal %s" % (operational_error.errorStateID, expected_error)) + def steps_TC_OPSTATE_2_1(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_1() def pics_TC_OPSTATE_2_1(self) -> list[str]: return ["OPSTATE.S"] @async_test_body async def test_TC_OPSTATE_2_1(self): - - asserts.assert_true('PIXIT_ENDPOINT' in self.matter_test_config.global_test_params, - "PIXIT_ENDPOINT must be included on the command line in " - "the --int-arg flag as PIXIT_ENDPOINT:") - - self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] - - attributes = Clusters.OperationalState.Attributes - - self.print_step(1, "Commissioning, already done") - - if self.check_pics("OPSTATE.S.A0000"): - self.print_step(2, "Read PhaseList attribute") - phase_list = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.PhaseList) - - if phase_list == NullValue: - logging.info("PhaseList is null") - else: - logging.info("PhaseList: %s" % (phase_list)) - - phase_list_len = len(phase_list) - - asserts.assert_less_equal(phase_list_len, 32, - "PhaseList length(%d) must be less than 32!" % phase_list_len) - - if self.check_pics("OPSTATE.S.A0001"): - self.print_step(3, "Read CurrentPhase attribute") - current_phase = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentPhase) - logging.info("CurrentPhase: %s" % (current_phase)) - - if phase_list == NullValue: - asserts.assert_true(current_phase == NullValue, "CurrentPhase(%s) should be null" % current_phase) - else: - asserts.assert_true(0 <= current_phase and current_phase < phase_list_len, - "CurrentPhase(%s) must be between 0 and %s" % (current_phase, (phase_list_len - 1))) - - if self.check_pics("OPSTATE.S.A0002"): - self.print_step(4, "Read CountdownTime attribute") - countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.CountdownTime) - - logging.info("CountdownTime: %s" % (countdown_time)) - if countdown_time is not NullValue: - asserts.assert_true(0 <= countdown_time <= 259200, - "CountdownTime(%s) must be between 0 and 259200" % countdown_time) - - if self.check_pics("OPSTATE.S.A0003"): - self.print_step(5, "Read OperationalStateList attribute") - operational_state_list = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.OperationalStateList) - - logging.info("OperationalStateList: %s" % (operational_state_list)) - - defined_states = [state.value for state in Clusters.OperationalState.Enums.OperationalStateEnum - if state is not Clusters.OperationalState.Enums.OperationalStateEnum.kUnknownEnumValue] - - for state in operational_state_list: - in_range = (0x80 <= state.operationalStateID <= 0xBF) - asserts.assert_true(state.operationalStateID in defined_states or in_range, - "Found a OperationalStateList entry with invalid ID value!") - if in_range: - asserts.assert_true(state.operationalStateLabel is not None, - "The OperationalStateLabel should be populated") - if state.operationalStateID == Clusters.OperationalState.Enums.OperationalStateEnum.kError: - error_state_present = True - - asserts.assert_true(error_state_present, "The OperationalStateList does not have an ID entry of Error(0x03)") - - if self.check_pics("OPSTATE.S.A0004"): - self.print_step(6, "Read OperationalState attribute") - operational_state = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.OperationalState) - - logging.info("OperationalState: %s" % (operational_state)) - - in_range = (0x80 <= operational_state <= 0xBF) - asserts.assert_true(operational_state in defined_states or in_range, "OperationalState has an invalid ID value!") - - if self.check_pics("OPSTATE.S.M.ST_STOPPED"): - self.print_step("6a", "Manually put the device in the stopped state") - input("Press Enter when done.\n") - await self.read_and_validate_opstate(step="6b", expected_state=Clusters.OperationalState.Enums.OperationalStateEnum.kStopped) - if self.check_pics("OPSTATE.S.M.ST_RUNNING"): - self.print_step("6c", "Manually put the device in the running state") - input("Press Enter when done.\n") - await self.read_and_validate_opstate(step="6d", expected_state=Clusters.OperationalState.Enums.OperationalStateEnum.kRunning) - if self.check_pics("OPSTATE.S.M.ST_PAUSED"): - self.print_step("6e", "Manually put the device in the paused state") - input("Press Enter when done.\n") - await self.read_and_validate_opstate(step="6f", expected_state=Clusters.OperationalState.Enums.OperationalStateEnum.kPaused) - if self.check_pics("OPSTATE.S.M.ST_ERROR"): - self.print_step("6g", "Manually put the device in the error state") - input("Press Enter when done.\n") - await self.read_and_validate_opstate(step="6h", expected_state=Clusters.OperationalState.Enums.OperationalStateEnum.kError) - - if self.check_pics("OPSTATE.S.A0005"): - self.print_step(7, "Read OperationalError attribute") - operational_error = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.OperationalError) - - logging.info("OperationalError: %s" % (operational_error)) - - # Defined Errors - defined_errors = [error.value for error in Clusters.OperationalState.Enums.ErrorStateEnum - if error is not Clusters.OperationalState.Enums.ErrorStateEnum.kUnknownEnumValue] - - in_range = (0x80 <= operational_error.errorStateID <= 0xBF) - asserts.assert_true(operational_error.errorStateID in defined_errors - or in_range, "OperationalError has an invalid ID value!") - if in_range: - asserts.assert_true(operational_error.errorStateLabel is not None, "ErrorStateLabel should be populated") - - if self.check_pics("OPSTATE.S.M.ERR_NO_ERROR"): - self.print_step("7a", "Manually put the device in the no error state") - input("Press Enter when done.\n") - await self.read_and_validate_operror(step="7b", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kNoError) - if self.check_pics("OPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME"): - self.print_step("7c", "Manually put the device in the unable to start or resume error state") - input("Press Enter when done.\n") - await self.read_and_validate_operror(step="7d", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kUnableToStartOrResume) - if self.check_pics("OPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION"): - self.print_step("7e", "Manually put the device in the unable to complete operation error state") - input("Press Enter when done.\n") - await self.read_and_validate_operror(step="7f", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kUnableToCompleteOperation) - if self.check_pics("OPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE"): - self.print_step("7g", "Manually put the device in the command invalid error state") - input("Press Enter when done.\n") - await self.read_and_validate_operror(step="7h", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState) + endpoint = self.matter_test_config.endpoint + await self.TEST_TC_OPSTATE_BASE_2_1(endpoint) if __name__ == "__main__": diff --git a/src/python_testing/TC_OPSTATE_2_2.py b/src/python_testing/TC_OPSTATE_2_2.py new file mode 100644 index 00000000000000..59d36b56cfa66d --- /dev/null +++ b/src/python_testing/TC_OPSTATE_2_2.py @@ -0,0 +1,50 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OPSTATE_2_2(MatterBaseTest, TC_OPSTATE_BASE): + + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OPSTATE_2_2(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_2() + + def pics_TC_OPSTATE_2_2(self) -> list[str]: + return ["OPSTATE.S"] + + @async_test_body + async def test_TC_OPSTATE_2_2(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_2(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OPSTATE_2_3.py b/src/python_testing/TC_OPSTATE_2_3.py index 57189c60382f08..e05aef4f607263 100644 --- a/src/python_testing/TC_OPSTATE_2_3.py +++ b/src/python_testing/TC_OPSTATE_2_3.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,160 +15,34 @@ # limitations under the License. # -import logging -import time import chip.clusters as Clusters -from chip.clusters.Types import NullValue -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches -from mobly import asserts +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo -# This test requires several additional command line arguments -# run with -# --int-arg PIXIT_ENDPOINT: +class TC_OPSTATE_2_3(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) -class TC_OPSTATE_2_3(MatterBaseTest): + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) - async def read_mod_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.OperationalState - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + super().setup_base(test_info=test_info) - async def send_pause_cmd(self) -> Clusters.Objects.OperationalState.Commands.Pause: - ret = await self.send_single_cmd(cmd=Clusters.Objects.OperationalState.Commands.Pause(), endpoint=self.endpoint) - asserts.assert_true(type_matches(ret, Clusters.Objects.OperationalState.Commands.OperationalCommandResponse), - "Unexpected return type for Pause") - return ret - - async def send_resume_cmd(self) -> Clusters.Objects.OperationalState.Commands.Resume: - ret = await self.send_single_cmd(cmd=Clusters.Objects.OperationalState.Commands.Resume(), endpoint=self.endpoint) - asserts.assert_true(type_matches(ret, Clusters.Objects.OperationalState.Commands.OperationalCommandResponse), - "Unexpected return type for Resume") - return ret + def steps_TC_OPSTATE_2_3(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_3() def pics_TC_OPSTATE_2_3(self) -> list[str]: return ["OPSTATE.S"] @async_test_body async def test_TC_OPSTATE_2_3(self): + endpoint = self.matter_test_config.endpoint - asserts.assert_true('PIXIT_ENDPOINT' in self.matter_test_config.global_test_params, - "PIXIT_ENDPOINT must be included on the command line in " - "the --int-arg flag as PIXIT_ENDPOINT:") - - self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] - - asserts.assert_true(self.check_pics("OPSTATE.S.A0003"), "OPSTATE.S.A0003 must be supported") - asserts.assert_true(self.check_pics("OPSTATE.S.A0004"), "OPSTATE.S.A0004 must be supported") - asserts.assert_true(self.check_pics("OPSTATE.S.C00.Rsp"), "OPSTATE.S.C00.Rsp must be supported") - asserts.assert_true(self.check_pics("OPSTATE.S.C03.Rsp"), "OPSTATE.S.C03.Rsp must be supported") - # This command SHALL be supported by an implementation if any of the other commands are supported (6.5) - asserts.assert_true(self.check_pics("OPSTATE.S.C04.Rsp"), "OPSTATE.S.C04.Rsp must be supported") - - attributes = Clusters.OperationalState.Attributes - - self.print_step(1, "Commissioning, already done") - - self.print_step(2, "Manually put the device in a state where it can receive a Pause command") - input("Press Enter when done.\n") - - self.print_step(3, "Read OperationalStateList attribute") - op_state_list = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.OperationalStateList) - - logging.info("OperationalStateList: %s" % (op_state_list)) - - defined_states = [state.value for state in Clusters.OperationalState.Enums.OperationalStateEnum - if state is not Clusters.OperationalState.Enums.OperationalStateEnum.kUnknownEnumValue] - - state_ids = set([s.operationalStateID for s in op_state_list]) - - asserts.assert_true(all(id in state_ids for id in defined_states), "OperationalStateList is missing a required entry") - - self.print_step(4, "Send Pause command") - ret = await self.send_pause_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, Clusters.OperationalState.Enums.ErrorStateEnum.kNoError, - "errorStateID(%s) should be NoError(0x00)" % ret.commandResponseState.errorStateID) - - self.print_step(5, "Read OperationalState attribute") - operational_state = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.OperationalState) - logging.info("OperationalState: %s" % (operational_state)) - asserts.assert_equal(operational_state, Clusters.OperationalState.Enums.OperationalStateEnum.kPaused, - "OperationalState ID should be Paused(0x02)") - - if self.check_pics("OPSTATE.S.A0002"): - self.print_step(6, "Read CountdownTime attribute") - initial_countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.CountdownTime) - logging.info("CountdownTime: %s" % (initial_countdown_time)) - if initial_countdown_time is not NullValue: - in_range = (1 <= initial_countdown_time <= 259200) - asserts.assert_true(initial_countdown_time is NullValue or in_range, - "invalid CountdownTime(%s). Must be in between 1 and 259200, or null " % initial_countdown_time) - - self.print_step(7, "Waiting for 5 seconds") - time.sleep(5) - - self.print_step(8, "Read CountdownTime attribute") - countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CountdownTime) - logging.info("CountdownTime: %s" % (countdown_time)) - asserts.assert_true(countdown_time != 0 or countdown_time == NullValue, - "invalid CountdownTime(%s). Must be a non zero integer, or null" % countdown_time) - asserts.assert_equal(countdown_time, initial_countdown_time, "CountdownTime(%s) does not equal to the intial CountdownTime(%s)" - % (countdown_time, initial_countdown_time)) - - self.print_step(9, "Send Pause command") - ret = await self.send_pause_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, Clusters.OperationalState.Enums.ErrorStateEnum.kNoError, - "errorStateID(%s) should be NoError(0x00)" % ret.commandResponseState.errorStateID) - - self.print_step(10, "Send Resume command") - ret = await self.send_resume_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, Clusters.OperationalState.Enums.ErrorStateEnum.kNoError, - "errorStateID(%s) should be NoError(0x00)" % ret.commandResponseState.errorStateID) - - self.print_step(11, "Read OperationalState attribute") - operational_state = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, - attribute=attributes.OperationalState) - logging.info("OperationalState: %s" % (operational_state)) - asserts.assert_equal(operational_state, Clusters.OperationalState.Enums.OperationalStateEnum.kRunning, - "OperationalState(%s) should be Running(0x01)" % operational_state) - - self.print_step(12, "Send Resume command") - ret = await self.send_resume_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, Clusters.OperationalState.Enums.ErrorStateEnum.kNoError, - "errorStateID(%s) should be NoError(0x00)" % ret.commandResponseState.errorStateID) - - self.print_step(13, "Manually put the device in the Stopped(0x00) operational state") - input("Press Enter when done.\n") - - self.print_step(14, "Send Pause command") - ret = await self.send_pause_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, - Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState, - "errorStateID(%s) should be CommandInvalidInState(0x03)" % ret.commandResponseState.errorStateID) - - self.print_step(15, "Send Resume command") - ret = await self.send_resume_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, - Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState, - "errorStateID(%s) should be CommandInvalidInState(0x03)" % ret.commandResponseState.errorStateID) - - self.print_step(16, "Manually put the device in the Error(0x03) operational state") - input("Press Enter when done.\n") - - self.print_step(17, "Send Pause command") - ret = await self.send_pause_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, - Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState, - "errorStateID(%s) should be CommandInvalidInState(0x03)" % ret.commandResponseState.errorStateID) - - self.print_step(18, "Send Resume command") - ret = await self.send_resume_cmd() - asserts.assert_equal(ret.commandResponseState.errorStateID, - Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState, - "errorStateID(%s) should be CommandInvalidInState(0x03)" % ret.commandResponseState.errorStateID) + await self.TEST_TC_OPSTATE_BASE_2_3(endpoint=endpoint) if __name__ == "__main__": diff --git a/src/python_testing/TC_OPSTATE_2_4.py b/src/python_testing/TC_OPSTATE_2_4.py new file mode 100644 index 00000000000000..7ad8fbccd9cd42 --- /dev/null +++ b/src/python_testing/TC_OPSTATE_2_4.py @@ -0,0 +1,49 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OPSTATE_2_4(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OPSTATE_2_4(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_4() + + def pics_TC_OPSTATE_2_4(self) -> list[str]: + return ["OPSTATE.S"] + + @async_test_body + async def test_TC_OPSTATE_2_4(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_4(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OPSTATE_2_5.py b/src/python_testing/TC_OPSTATE_2_5.py new file mode 100644 index 00000000000000..ffaceaeb2863a0 --- /dev/null +++ b/src/python_testing/TC_OPSTATE_2_5.py @@ -0,0 +1,49 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OPSTATE_2_5(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OPSTATE_2_5(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_5() + + def pics_TC_OPSTATE_2_5(self) -> list[str]: + return ["OPSTATE.S"] + + @async_test_body + async def test_TC_OPSTATE_2_5(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_5(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_1_1.py b/src/python_testing/TC_OVENOPSTATE_1_1.py new file mode 100644 index 00000000000000..3e6b0a27fbab5d --- /dev/null +++ b/src/python_testing/TC_OVENOPSTATE_1_1.py @@ -0,0 +1,53 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OVENOPSTATE_1_1(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OVENOPSTATE", + cluster=Clusters.OvenCavityOperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OVENOPSTATE_1_1(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_1_1() + + def pics_TC_OVENOPSTATE_1_1(self) -> list[str]: + return ["OVENOPSTATE.S"] + + @async_test_body + async def test_TC_OVENOPSTATE_1_1(self): + endpoint = self.matter_test_config.endpoint + cluster_revision = 1 + feature_map = 0 + + await self.TEST_TC_OPSTATE_BASE_1_1(endpoint=endpoint, + cluster_revision=cluster_revision, + feature_map=feature_map) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_2_1.py b/src/python_testing/TC_OVENOPSTATE_2_1.py new file mode 100644 index 00000000000000..e6847f22e94f39 --- /dev/null +++ b/src/python_testing/TC_OVENOPSTATE_2_1.py @@ -0,0 +1,48 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OVENOPSTATE_2_1(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OVENOPSTATE", + cluster=Clusters.OvenCavityOperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OVENOPSTATE_2_1(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_1() + + def pics_TC_OVENOPSTATE_2_1(self) -> list[str]: + return ["OVENOPSTATE.S"] + + @async_test_body + async def test_TC_OVENOPSTATE_2_1(self): + endpoint = self.matter_test_config.endpoint + await self.TEST_TC_OPSTATE_BASE_2_1(endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_2_2.py b/src/python_testing/TC_OVENOPSTATE_2_2.py new file mode 100644 index 00000000000000..7789f5076a7d0a --- /dev/null +++ b/src/python_testing/TC_OVENOPSTATE_2_2.py @@ -0,0 +1,50 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OVENOPSTATE_2_2(MatterBaseTest, TC_OPSTATE_BASE): + + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OVENOPSTATE", + cluster=Clusters.OvenCavityOperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OVENOPSTATE_2_2(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_2() + + def pics_TC_OVENOPSTATE_2_2(self) -> list[str]: + return ["OVENOPSTATE.S"] + + @async_test_body + async def test_TC_OVENOPSTATE_2_2(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_2(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_2_3.py b/src/python_testing/TC_OVENOPSTATE_2_3.py new file mode 100644 index 00000000000000..25434978320b46 --- /dev/null +++ b/src/python_testing/TC_OVENOPSTATE_2_3.py @@ -0,0 +1,49 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OVENOPSTATE_2_3(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OVENOPSTATE", + cluster=Clusters.OvenCavityOperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OVENOPSTATE_2_3(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_3() + + def pics_TC_OVENOPSTATE_2_3(self) -> list[str]: + return ["OVENOPSTATE.S"] + + @async_test_body + async def test_TC_OVENOPSTATE_2_3(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_3(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_2_4.py b/src/python_testing/TC_OVENOPSTATE_2_4.py new file mode 100644 index 00000000000000..4bc2040638b820 --- /dev/null +++ b/src/python_testing/TC_OVENOPSTATE_2_4.py @@ -0,0 +1,49 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OVENOPSTATE_2_4(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OVENOPSTATE", + cluster=Clusters.OvenCavityOperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OVENOPSTATE_2_4(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_4() + + def pics_TC_OVENOPSTATE_2_4(self) -> list[str]: + return ["OVENOPSTATE.S"] + + @async_test_body + async def test_TC_OVENOPSTATE_2_4(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_4(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OVENOPSTATE_2_5.py b/src/python_testing/TC_OVENOPSTATE_2_5.py new file mode 100644 index 00000000000000..7754f0a624ffd3 --- /dev/null +++ b/src/python_testing/TC_OVENOPSTATE_2_5.py @@ -0,0 +1,49 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OVENOPSTATE_2_5(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OVENOPSTATE", + cluster=Clusters.OvenCavityOperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OVENOPSTATE_2_5(self) -> list[TestStep]: + return self.STEPS_TC_OPSTATE_BASE_2_5() + + def pics_TC_OVENOPSTATE_2_5(self) -> list[str]: + return ["OVENOPSTATE.S"] + + @async_test_body + async def test_TC_OVENOPSTATE_2_5(self): + endpoint = self.matter_test_config.endpoint + + await self.TEST_TC_OPSTATE_BASE_2_5(endpoint=endpoint) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OpstateCommon.py b/src/python_testing/TC_OpstateCommon.py new file mode 100644 index 00000000000000..9e32aac00ec846 --- /dev/null +++ b/src/python_testing/TC_OpstateCommon.py @@ -0,0 +1,1217 @@ +# +# Copyright (c) 2024 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 logging +import queue +import time +from dataclasses import dataclass +from typing import Any + +import chip.clusters as Clusters +import psutil +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction +from chip.clusters.Types import NullValue +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import EventChangeCallback, TestStep +from mobly import asserts + + +def get_pid(name): + pid = None + + for proc in psutil.process_iter(): + if name in proc.name(): + pid = proc.pid + break + + return pid + + +@dataclass +class TestInfo: + pics_code: str + cluster: Clusters + + +class EventSpecificChangeCallback: + def __init__(self, expected_event: ClusterObjects.ClusterEvent): + """This class creates a queue to store received event callbacks, that can be checked by the test script + expected_event: is the expected event + """ + self._q = queue.Queue() + self._expected_cluster_id = expected_event.cluster_id + self._expected_event = expected_event + + async def start(self, dev_ctrl, node_id: int, endpoint: int): + """This starts a subscription for events on the specified node_id and endpoint. The event is specified when the class instance is created.""" + self._subscription = await dev_ctrl.ReadEvent(node_id, + events=[(endpoint, self._expected_event, True)], reportInterval=(1, 5), + fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + self._subscription.SetEventUpdateCallback(self.__call__) + + def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): + """This is the subscription callback when an event is received. + It checks the if the event is the expected one and then posts it into the queue for later processing.""" + if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster_id and res.Header.EventId == self._expected_event.event_id: + logging.info( + f'Got subscription report for event {self._expected_event.event_id} on cluster {self._expected_cluster_id}: {res.Data}') + self._q.put(res) + + def wait_for_event_report(self, timeout: int = 10): + """This function allows a test script to block waiting for the specific event to arrive with a timeout. + It returns the event data so that the values can be checked.""" + try: + res = self._q.get(block=True, timeout=timeout) + except queue.Empty: + asserts.fail(f"Failed to receive a report for the event {self._expected_event}") + + asserts.assert_equal(res.Header.ClusterId, self._expected_cluster_id, "Expected cluster ID not found in event report") + asserts.assert_equal(res.Header.EventId, self._expected_event.event_id, "Expected event ID not found in event report") + return res.Data + + +class TC_OPSTATE_BASE(): + def setup_base(self, test_info=None, app_pipe="/tmp/chip_all_clusters_fifo_"): + + asserts.assert_true(test_info is not None, + "You shall define the test info!") + + self.test_info = test_info + self.app_pipe = app_pipe + + if self.test_info.cluster == Clusters.OperationalState: + self.device = "Generic" + elif self.test_info.cluster == Clusters.OvenCavityOperationalState: + self.device = "Oven" + else: + asserts.fail(f"This provided cluster ({self.test_info.cluster}) is not supported!") + + def init_test(self): + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + app_pid = get_pid("chip-all-clusters-app") + if app_pid is None: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") + self.app_pipe = self.app_pipe + str(app_pid) + + # Sends and out-of-band command to test-app + def write_to_app_pipe(self, command): + with open(self.app_pipe, "w") as app_pipe: + app_pipe.write(command + "\n") + + def send_raw_manual_or_pipe_command(self, command): + if self.is_ci: + self.write_to_app_pipe(command) + time.sleep(0.1) + else: + input("Press Enter when done.\n") + + def send_manual_or_pipe_command(self, device: str, name: str, operation: str, param: Any = None): + command = { + "Name": name, + "Device": device, + "Operation": operation, + } + + if param is not None: + command["Param"] = param + + self.send_raw_manual_or_pipe_command(json.dumps(command)) + + async def send_cmd(self, endpoint, cmd, timedRequestTimeoutMs=None): + logging.info(f"##### Command {cmd}") + + try: + return await self.send_single_cmd(cmd=cmd, + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.fail(f"Unexpected error returned: {e.status}") + + async def send_cmd_expect_response(self, endpoint, cmd, expected_response, timedRequestTimeoutMs=None): + ret = await self.send_cmd(endpoint=endpoint, + cmd=cmd, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(ret.commandResponseState.errorStateID, + expected_response, + f"Command response ({ret.commandResponseState}) mismatched from expectation for {cmd} on {endpoint}") + + async def read_expect_success(self, endpoint, attribute): + logging.info(f"##### Read {attribute}") + attr_value = await self.read_single_attribute_check_success(endpoint=endpoint, + cluster=self.test_info.cluster, + attribute=attribute) + logging.info(f"## {attribute}: {attr_value}") + + return attr_value + + async def read_and_expect_value(self, endpoint, attribute, expected_value): + attr_value = await self.read_expect_success( + endpoint=endpoint, + attribute=attribute) + + asserts.assert_equal(attr_value, expected_value, + f"Value mismatched from expectation for {attribute} on {endpoint}") + + async def read_and_expect_property_value(self, endpoint, attribute, attr_property, expected_value): + attr_value = await self.read_expect_success( + endpoint=endpoint, + attribute=attribute) + field_value = getattr(attr_value, attr_property) + + asserts.assert_equal(field_value, expected_value, + f"Property '{attr_property}' value mismatched from expectation for {attribute} on {endpoint}") + + async def read_and_expect_array_contains(self, endpoint, attribute, expected_contains): + attr_value = await self.read_expect_success( + endpoint=endpoint, + attribute=attribute) + attr_value.sort() + expected_contains.sort() + + logging.info("## Current value: [%s]" % attr_value) + logging.info("## Expected value: [%s]" % expected_contains) + + for item in expected_contains: + if item not in attr_value: + asserts.fail("Entry (%s), not found! The returned value SHALL include all the entries: [%s]!" % ( + item, expected_contains)) + + ############################ + # TEST CASE 1.1 + ############################ + def STEPS_TC_OPSTATE_BASE_1_1(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "TH reads from the DUT the ClusterRevision attribute"), + TestStep(3, "TH reads from the DUT the FeatureMap attribute"), + TestStep(4, "TH reads from the DUT the AttributeList attribute"), + TestStep(5, "TH reads from the DUT the EventList attribute"), + TestStep(6, "TH reads from the DUT the AcceptedCommandList attribute"), + TestStep(7, "TH reads from the DUT the GeneratedCommandList attribute") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_1_1(self, endpoint=1, cluster_revision=1, feature_map=0): + cluster = self.test_info.cluster + attributes = cluster.Attributes + events = cluster.Events + commands = cluster.Commands + + self.init_test() + + # STEP 1: Commission DUT to TH (can be skipped if done in a preceding test) + self.step(1) + + # STEP 2: TH reads from the DUT the ClusterRevision attribute + self.step(2) + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.ClusterRevision, + expected_value=cluster_revision) + + # STEP 3: TH reads from the DUT the FeatureMap attribute + self.step(3) + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.FeatureMap, + expected_value=feature_map) + + # STEP 4: TH reads from the DUT the AttributeList attribute + self.step(4) + expected_value = [ + attributes.PhaseList.attribute_id, + attributes.CurrentPhase.attribute_id, + attributes.OperationalStateList.attribute_id, + attributes.OperationalState.attribute_id, + attributes.OperationalError.attribute_id, + attributes.GeneratedCommandList.attribute_id, + attributes.AcceptedCommandList.attribute_id, + attributes.AttributeList.attribute_id, + attributes.FeatureMap.attribute_id, + attributes.ClusterRevision.attribute_id + ] + + if self.check_pics(f"{self.test_info.pics_code}.S.A0002"): + expected_value.append(attributes.CountdownTime.attribute_id) + + await self.read_and_expect_array_contains(endpoint=endpoint, + attribute=attributes.AttributeList, + expected_contains=expected_value) + + # STEP 5: TH reads from the DUT the EventList attribute + self.step(5) + if self.pics_guard(self.check_pics("PICS_EVENT_LIST_ENABLED")): + expected_value = [ + events.OperationalError.event_id, + ] + + if self.check_pics(f"{self.test_info.pics_code}.S.E01"): + expected_value.append(events.OperationCompletion.event_id) + + await self.read_and_expect_array_contains(endpoint=endpoint, + attribute=attributes.EventList, + expected_contains=expected_value) + + # STEP 6: TH reads from the DUT the AcceptedCommandList attribute + self.step(6) + expected_value = [] + + if (self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") or + self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp")): + expected_value.append(commands.Pause.command_id) + + if (self.check_pics(f"{self.test_info.pics_code}.S.C01.Rsp") or + self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp")): + expected_value.append(commands.Stop.command_id) + + if self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp"): + expected_value.append(commands.Start.command_id) + + if (self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp") or + self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp")): + expected_value.append(commands.Resume.command_id) + + await self.read_and_expect_array_contains(endpoint=endpoint, + attribute=attributes.AcceptedCommandList, + expected_contains=expected_value) + + # STEP 7: TH reads from the DUT the AcceptedCommandList attribute + self.step(7) + expected_value = [] + + if (self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") or + self.check_pics(f"{self.test_info.pics_code}.S.C01.Rsp") or + self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp") or + self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp")): + expected_value.append(commands.OperationalCommandResponse.command_id) + + await self.read_and_expect_array_contains(endpoint=endpoint, + attribute=attributes.GeneratedCommandList, + expected_contains=expected_value) + + ############################ + # TEST CASE 2.1 + ############################ + def STEPS_TC_OPSTATE_BASE_2_1(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "TH reads from the DUT the PhaseList attribute"), + TestStep(3, "TH reads from the DUT the CurrentPhase attribute"), + TestStep(4, "TH reads from the DUT the CountdownTime attribute"), + TestStep(5, "TH reads from the DUT the OperationalStateList attribute"), + TestStep(6, "TH reads from the DUT the OperationalState attribute"), + TestStep("6a", "Manually put the device in the Stopped(0x00) operational state"), + TestStep("6b", "TH reads from the DUT the OperationalState attribute"), + TestStep("6c", "Manually put the device in the Running(0x01) operational state"), + TestStep("6d", "TH reads from the DUT the OperationalState attribute"), + TestStep("6e", "Manually put the device in the Paused(0x02) operational state"), + TestStep("6f", "TH reads from the DUT the OperationalState attribute"), + TestStep("6g", "Manually put the device in the Error(0x03) operational state"), + TestStep("6h", "TH reads from the DUT the OperationalState attribute"), + TestStep(7, "TH reads from the DUT the OperationalError attribute"), + TestStep("7a", "Manually put the device in the NoError(0x00) error state"), + TestStep("7b", "TH reads from the DUT the OperationalError attribute"), + TestStep("7c", "Manually put the device in the UnableToStartOrResume(0x01) error state"), + TestStep("7d", "TH reads from the DUT the OperationalError attribute"), + TestStep("7e", "Manually put the device in the UnableToCompleteOperation(0x02) error state"), + TestStep("7f", "TH reads from the DUT the OperationalError attribute"), + TestStep("7g", "Manually put the device in the CommandInvalidInState(0x03) error state"), + TestStep("7h", "TH reads from the DUT the OperationalError attribute") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1): + cluster = self.test_info.cluster + attributes = cluster.Attributes + + self.init_test() + + # STEP 1: Commission DUT to TH (can be skipped if done in a preceding test) + self.step(1) + + # STEP 2: TH reads from the DUT the PhaseList attribute + self.step(2) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0000")): + phase_list = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.PhaseList) + if phase_list is not NullValue: + phase_list_len = len(phase_list) + asserts.assert_less_equal(phase_list_len, 32, + f"PhaseList length({phase_list_len}) must be less than 32!") + + # STEP 3: TH reads from the DUT the CurrentPhase attribute + self.step(3) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0001")): + current_phase = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CurrentPhase) + if (phase_list == NullValue) or (not phase_list): + asserts.assert_true(current_phase == NullValue, f"CurrentPhase({current_phase}) should be null") + else: + asserts.assert_true(0 <= current_phase and current_phase < phase_list_len, + f"CurrentPhase({current_phase}) must be between 0 and {(phase_list_len - 1)}") + + # STEP 4: TH reads from the DUT the CountdownTime attribute + self.step(4) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + countdown_time = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CountdownTime) + if countdown_time is not NullValue: + asserts.assert_true(0 <= countdown_time <= 259200, + f"CountdownTime({countdown_time}) must be between 0 and 259200") + + # STEP 5: TH reads from the DUT the OperationalStateList attribute + self.step(5) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0003")): + operational_state_list = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.OperationalStateList) + defined_states = [state.value for state in cluster.Enums.OperationalStateEnum + if state != cluster.Enums.OperationalStateEnum.kUnknownEnumValue] + + for state in operational_state_list: + in_range = (0x80 <= state.operationalStateID <= 0xBF) + asserts.assert_true(state.operationalStateID in defined_states or in_range, + "Found a OperationalStateList entry with invalid ID value!") + if in_range: + asserts.assert_true(state.operationalStateLabel is not None, + "The OperationalStateLabel should be populated") + + if state.operationalStateID == cluster.Enums.OperationalStateEnum.kError: + error_state_present = True + + asserts.assert_true(error_state_present, "The OperationalStateList does not have an ID entry of Error(0x03)") + + # STEP 6: TH reads from the DUT the OperationalState attribute + self.step(6) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + operational_state = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.OperationalState) + in_range = (0x80 <= operational_state <= 0xBF) + asserts.assert_true(operational_state in defined_states or in_range, + "OperationalState has an invalid ID value!") + + # STEP 6a: Manually put the device in the Stopped(0x00) operational state + self.step("6a") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_STOPPED")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Stop") + # STEP 6b: TH reads from the DUT the OperationalState attribute + self.step("6b") + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kStopped) + else: + self.skip_step("6b") + + # STEP 6c: Manually put the device in the Running(0x01) operational state + self.step("6c") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_RUNNING")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Start") + # STEP 6d: TH reads from the DUT the OperationalState attribute + self.step("6d") + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + else: + self.skip_step("6d") + + # STEP 6e: Manually put the device in the Paused(0x02) operational state + self.step("6e") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_PAUSED")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Pause") + # STEP 6f: TH reads from the DUT the OperationalState attribute + self.step("6f") + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kPaused) + else: + self.skip_step("6f") + + # STEP 6g: Manually put the device in the Error(0x03) operational state + self.step("6g") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_ERROR")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kUnableToStartOrResume) + # STEP 6h: TH reads from the DUT the OperationalState attribute + self.step("6h") + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kError) + else: + self.skip_step("6h") + + # STEP 7: TH reads from the DUT the OperationalError attribute + self.step(7) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0005")): + operational_error = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.OperationalError) + # Defined Errors + defined_errors = [error.value for error in cluster.Enums.ErrorStateEnum + if error != cluster.Enums.ErrorStateEnum.kUnknownEnumValue] + + in_range = (0x80 <= operational_error.errorStateID <= 0xBF) + asserts.assert_true(operational_error.errorStateID in defined_errors + or in_range, "OperationalError has an invalid ID value!") + if in_range: + asserts.assert_true(operational_error.errorStateLabel is not None, "ErrorStateLabel should be populated") + + # STEP 7a: Manually put the device in the NoError(0x00) error state + self.step("7a") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ERR_NO_ERROR")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kNoError) + # STEP 7b: TH reads from the DUT the OperationalError attribute + self.step("7b") + await self.read_and_expect_property_value(endpoint=endpoint, + attribute=attributes.OperationalError, + attr_property="errorStateID", + expected_value=cluster.Enums.ErrorStateEnum.kNoError) + else: + self.skip_step("7b") + + # STEP 7c: Manually put the device in the UnableToStartOrResume(0x01) error state + self.step("7c") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ERR_UNABLE_TO_START_OR_RESUME")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kUnableToStartOrResume) + # STEP 7d: TH reads from the DUT the OperationalError attribute + self.step("7d") + await self.read_and_expect_property_value(endpoint=endpoint, + attribute=attributes.OperationalError, + attr_property="errorStateID", + expected_value=cluster.Enums.ErrorStateEnum.kUnableToStartOrResume) + else: + self.skip_step("7d") + + # STEP 7e: Manually put the device in the UnableToCompleteOperation(0x02) error state + self.step("7e") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kUnableToCompleteOperation) + # STEP 7f: TH reads from the DUT the OperationalError attribute + self.step("7f") + await self.read_and_expect_property_value(endpoint=endpoint, + attribute=attributes.OperationalError, + attr_property="errorStateID", + expected_value=cluster.Enums.ErrorStateEnum.kUnableToCompleteOperation) + else: + self.skip_step("7f") + + # STEP 7g: Manually put the device in the CommandInvalidInState(0x03) error state + self.step("7g") + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ERR_COMMAND_INVALID_IN_STATE")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kCommandInvalidInState) + # STEP 7h: TH reads from the DUT the OperationalError attribute + self.step("7h") + await self.read_and_expect_property_value(endpoint=endpoint, + attribute=attributes.OperationalError, + attr_property="errorStateID", + expected_value=cluster.Enums.ErrorStateEnum.kCommandInvalidInState) + else: + self.skip_step("7h") + + ############################ + # TEST CASE 2.2 + ############################ + def STEPS_TC_OPSTATE_BASE_2_2(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Manually put the DUT into a state wherein it can receive a Start Command"), + TestStep(3, "TH reads from the DUT the OperationalStateList attribute"), + TestStep(4, "TH sends Start command to the DUT"), + TestStep(5, "TH reads from the DUT the OperationalState attribute"), + TestStep(6, "TH reads from the DUT the OperationalError attribute"), + TestStep(7, "TH reads from the DUT the CountdownTime attribute"), + TestStep(8, "TH reads from the DUT the PhaseList attribute"), + TestStep(9, "TH reads from the DUT the CurrentPhase attribute"), + TestStep(10, "TH waits for {PIXIT.WAITTIME.COUNTDOWN}"), + TestStep(11, "TH reads from the DUT the CountdownTime attribute"), + TestStep(12, "TH sends Start command to the DUT"), + TestStep(13, "TH sends Stop command to the DUT"), + TestStep(14, "TH reads from the DUT the OperationalState attribute"), + TestStep(15, "TH sends Stop command to the DUT"), + TestStep(16, "Manually put the DUT into a state wherein it cannot receive a Start Command"), + TestStep(17, "TH sends Start command to the DUT") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1): + cluster = self.test_info.cluster + attributes = cluster.Attributes + commands = cluster.Commands + + self.init_test() + + asserts.assert_true('PIXIT.WAITTIME.COUNTDOWN' in self.matter_test_config.global_test_params, + "PIXIT.WAITTIME.COUNTDOWN must be included on the command line in " + "the --int-arg flag as PIXIT.WAITTIME.COUNTDOWN:") + + wait_time = self.matter_test_config.global_test_params['PIXIT.WAITTIME.COUNTDOWN'] + + if wait_time == 0: + asserts.fail("PIXIT.WAITTIME.COUNTDOWN shall be higher than 0.") + + # STEP 1: Commission DUT to TH (can be skipped if done in a preceding test) + self.step(1) + + # STEP 2: Manually put the DUT into a state wherein it can receive a Start Command + self.step(2) + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kNoError) + + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Stop") + + # STEP 3: TH reads from the DUT the OperationalStateList attribute + self.step(3) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0003")): + operational_state_list = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.OperationalStateList) + + operational_state_list_ids = [op_state.operationalStateID for op_state in operational_state_list] + + defined_states = [state.value for state in cluster.Enums.OperationalStateEnum + if state != cluster.Enums.OperationalStateEnum.kUnknownEnumValue] + + for state in defined_states: + if state not in operational_state_list_ids: + asserts.fail(f"The list shall include structs with the following OperationalStateIds: {defined_states}") + + # STEP 4: TH sends Start command to the DUT + self.step(4) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Start(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 5: TH reads from the DUT the OperationalState attribute + self.step(5) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + + # STEP 6: TH reads from the DUT the OperationalError attribute + self.step(6) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0005")): + await self.read_and_expect_property_value(endpoint=endpoint, + attribute=attributes.OperationalError, + attr_property="errorStateID", + expected_value=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 7: TH reads from the DUT the CountdownTime attribute + self.step(7) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + initial_countdown_time = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CountdownTime) + if initial_countdown_time is not NullValue: + asserts.assert_true(0 <= initial_countdown_time <= 259200, + f"CountdownTime({initial_countdown_time}) must be between 0 and 259200") + + # STEP 8: TH reads from the DUT the PhaseList attribute + self.step(8) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0000")): + phase_list = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.PhaseList) + phase_list_len = 0 + if phase_list is not NullValue: + phase_list_len = len(phase_list) + asserts.assert_less_equal(phase_list_len, 32, + f"PhaseList length({phase_list_len}) must be less than 32!") + + # STEP 9: TH reads from the DUT the CurrentPhase attribute + self.step(9) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0001")): + current_phase = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CurrentPhase) + if (phase_list == NullValue) or (not phase_list): + asserts.assert_equal(current_phase, NullValue, f"CurrentPhase({current_phase}) should be null") + else: + asserts.assert_less_equal(0, current_phase, + f"CurrentPhase({current_phase}) must be greater or equal than 0") + asserts.assert_less(current_phase < phase_list_len, + f"CurrentPhase({current_phase}) must be less then {(phase_list_len - 1)}") + + # STEP 10: TH waits for {PIXIT.WAITTIME.COUNTDOWN} + self.step(10) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + time.sleep(wait_time) + + # STEP 11: TH reads from the DUT the CountdownTime attribute + self.step(11) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + countdown_time = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CountdownTime) + + if (countdown_time is not NullValue) and (initial_countdown_time is not NullValue): + asserts.assert_less_equal(countdown_time, (initial_countdown_time - wait_time), + f"The countdown time shall have decreased at least {wait_time:.1f} since start command") + + # STEP 12: TH sends Start command to the DUT + self.step(12) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Start(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 13: TH sends Stop command to the DUT + self.step(13) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C01.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Stop(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 14: TH reads from the DUT the OperationalState attribute + self.step(14) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kStopped) + + # STEP 15: TH sends Stop command to the DUT + self.step(15) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C01.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Stop(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 16: Manually put the DUT into a state wherein it cannot receive a Start Command + self.step(16) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ERR_UNABLE_TO_START_OR_RESUME")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kUnableToCompleteOperation) + + # STEP 17: TH sends Start command to the DUT + self.step(17) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ERR_UNABLE_TO_START_OR_RESUME") and + self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Start(), + expected_response=cluster.Enums.ErrorStateEnum.kUnableToStartOrResume) + + ############################ + # TEST CASE 2.3 + ############################ + def STEPS_TC_OPSTATE_BASE_2_3(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Manually put the DUT into a state wherein it can receive a Pause Command"), + TestStep(3, "TH reads from the DUT the OperationalStateList attribute"), + TestStep(4, "TH sends Pause command to the DUT"), + TestStep(5, "TH reads from the DUT the OperationalState attribute"), + TestStep(6, "TH reads from the DUT the CountdownTime attribute"), + TestStep(7, "TH waits for {PIXIT.WAITTIME.COUNTDOWN}"), + TestStep(8, "TH reads from the DUT the CountdownTime attribute"), + TestStep(9, "TH sends Pause command to the DUT"), + TestStep(10, "TH sends Resume command to the DUT"), + TestStep(11, "TH reads from the DUT the OperationalState attribute"), + TestStep(12, "TH sends Resume command to the DUT"), + TestStep(13, "Manually put the device in the Stopped(0x00) operational state"), + TestStep(14, "TH sends Pause command to the DUT"), + TestStep(15, "TH sends Resume command to the DUT"), + TestStep(16, "Manually put the device in the Error(0x03) operational state"), + TestStep(17, "TH sends Pause command to the DUT"), + TestStep(18, "TH sends Resume command to the DUT") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_2_3(self, endpoint=1): + cluster = self.test_info.cluster + attributes = cluster.Attributes + commands = cluster.Commands + + self.init_test() + + asserts.assert_true('PIXIT.WAITTIME.COUNTDOWN' in self.matter_test_config.global_test_params, + "PIXIT.WAITTIME.COUNTDOWN must be included on the command line in " + "the --int-arg flag as PIXIT.WAITTIME.COUNTDOWN:") + + wait_time = self.matter_test_config.global_test_params['PIXIT.WAITTIME.COUNTDOWN'] + + if wait_time == 0: + asserts.fail("PIXIT.WAITTIME.COUNTDOWN shall be higher than 0.") + + # STEP 1: Commission DUT to TH (can be skipped if done in a preceding test) + self.step(1) + + # STEP 2: Manually put the DUT into a state wherein it can receive a Pause Command + self.step(2) + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kNoError) + + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Start") + + # STEP 3: TH reads from the DUT the OperationalStateList attribute + self.step(3) + if self.pics_guard(self.check_pics((f"{self.test_info.pics_code}.S.A0003"))): + operational_state_list = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.OperationalStateList) + + operational_state_list_ids = [op_state.operationalStateID for op_state in operational_state_list] + + defined_states = [state.value for state in cluster.Enums.OperationalStateEnum + if state != cluster.Enums.OperationalStateEnum.kUnknownEnumValue] + + for state in defined_states: + if state not in operational_state_list_ids: + asserts.fail(f"The list shall include structs with the following OperationalStateIds: {defined_states}") + + # STEP 4: TH sends Pause command to the DUT + self.step(4) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Pause(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 5: TH reads from the DUT the OperationalState attribute + self.step(5) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kPaused) + + # STEP 6: TH reads from the DUT the CountdownTime attribute + self.step(6) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + initial_countdown_time = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CountdownTime) + if initial_countdown_time is not NullValue: + asserts.assert_true(0 <= initial_countdown_time <= 259200, + f"CountdownTime({initial_countdown_time}) must be between 0 and 259200") + + # STEP 7: TH waits for {PIXIT.WAITTIME.COUNTDOWN} + self.step(7) + time.sleep(wait_time) + + # STEP 8: TH reads from the DUT the CountdownTime attribute + self.step(8) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + countdown_time = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CountdownTime) + + if (countdown_time is not NullValue) and (initial_countdown_time is not NullValue): + asserts.assert_equal(countdown_time, initial_countdown_time, + "The countdown time shall be equal since pause command") + + # STEP 9: TH sends Pause command to the DUT + self.step(9) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Pause(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 10: TH sends Resume command to the DUT + self.step(10) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Resume(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 11: TH reads from the DUT the OperationalState attribute + self.step(11) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + + # STEP 12: TH sends Resume command to the DUT + self.step(12) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Resume(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 13: Manually put the device in the Stopped(0x00) operational state + self.step(13) + if self.pics_guard(self.check_pics((f"{self.test_info.pics_code}.S.M.ST_STOPPED"))): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Stop") + + # STEP 14: TH sends Pause command to the DUT + self.step(14) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Pause(), + expected_response=cluster.Enums.ErrorStateEnum.kCommandInvalidInState) + + # STEP 15: TH sends Resume command to the DUT + self.step(15) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Resume(), + expected_response=cluster.Enums.ErrorStateEnum.kCommandInvalidInState) + + # STEP 16: Manually put the device in the Error(0x03) operational state + self.step(16) + if self.pics_guard(self.check_pics((f"{self.test_info.pics_code}.S.M.ST_ERROR"))): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kUnableToStartOrResume) + + # STEP 17: TH sends Pause command to the DUT + self.step(17) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Pause(), + expected_response=cluster.Enums.ErrorStateEnum.kCommandInvalidInState) + + # STEP 18: TH sends Resume command to the DUT + self.step(18) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Resume(), + expected_response=cluster.Enums.ErrorStateEnum.kCommandInvalidInState) + + ############################ + # TEST CASE 2.4 + ############################ + def STEPS_TC_OPSTATE_BASE_2_4(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Set up a subscription to the OperationalError event"), + TestStep(3, "At the DUT take the vendor defined action to generate an OperationalError event"), + TestStep(4, "TH reads from the DUT the OperationalState attribute") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_2_4(self, endpoint=1): + cluster = self.test_info.cluster + attributes = cluster.Attributes + events = cluster.Events + + self.init_test() + + pixit_var_name = f'PIXIT.{self.test_info.pics_code}.ErrorEventGen' + print(pixit_var_name in self.matter_test_config.global_test_params) + asserts.assert_true(pixit_var_name in self.matter_test_config.global_test_params, + f"{pixit_var_name} must be included on the command line in the --int-arg flag as {pixit_var_name}:<0 or 1>") + + error_event_gen = self.matter_test_config.global_test_params[pixit_var_name] + + # STEP 1: Commission DUT to TH (can be skipped if done in a preceding test) + self.step(1) + + if self.pics_guard(error_event_gen): + # STEP 2: Set up a subscription to the OperationalError event + self.step(2) + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(cluster) + await events_callback.start(self.default_controller, + self.dut_node_id, + endpoint) + + # STEP 3: At the DUT take the vendor defined action to generate an OperationalError event + self.step(3) + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kUnableToStartOrResume) + event_data = events_callback.wait_for_event_report(events.OperationalError).errorState + + # Defined Errors + defined_errors = [error.value for error in cluster.Enums.ErrorStateEnum + if (error != cluster.Enums.ErrorStateEnum.kUnknownEnumValue or + error != cluster.Enums.ErrorStateEnum.kNoError)] + + in_range = (0x80 <= event_data.errorStateID <= 0xBF) + asserts.assert_true(event_data.errorStateID in defined_errors + or in_range, "Event has an invalid ID value!") + if in_range: + asserts.assert_true(event_data.errorStateLabel is not None, "ErrorStateLabel should be populated") + + # STEP 4: TH reads from the DUT the OperationalState attribute + self.step(4) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kError) + else: + self.skip_step(2) + self.skip_step(3) + self.skip_step(4) + + ############################ + # TEST CASE 2.5 + ############################ + def STEPS_TC_OPSTATE_BASE_2_5(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Set up a subscription to the OperationCompletion event"), + TestStep(3, "Manually put the DUT into a state wherein it can receive a Start Command"), + TestStep(4, "TH sends Start command to the DUT"), + TestStep(5, "TH reads from the DUT the CountdownTime attribute"), + TestStep(6, "TH reads from the DUT the OperationalState attribute"), + TestStep(7, "TH waits for initial-countdown-time"), + TestStep(8, "TH sends Stop command to the DUT"), + TestStep(9, "TH waits for OperationCompletion event"), + TestStep(10, "TH reads from the DUT the OperationalState attribute"), + TestStep(11, "Restart DUT"), + TestStep(12, "TH waits for {PIXIT.WAITTIME.REBOOT}"), + TestStep(13, "TH sends Start command to the DUT"), + TestStep(14, "TH reads from the DUT the OperationalState attribute"), + TestStep(15, "TH sends Pause command to the DUT"), + TestStep(16, "TH reads from the DUT the OperationalState attribute"), + TestStep(17, "TH waits for half of initial-countdown-time"), + TestStep(18, "TH sends Resume command to the DUT"), + TestStep(19, "TH reads from the DUT the OperationalState attribute"), + TestStep(20, "TH waits for initial-countdown-time"), + TestStep(21, "TH sends Stop command to the DUT"), + TestStep(22, "TH waits for OperationCompletion event") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_2_5(self, endpoint=1): + cluster = self.test_info.cluster + attributes = cluster.Attributes + commands = cluster.Commands + events = cluster.Events + + self.init_test() + + asserts.assert_true('PIXIT.WAITTIME.REBOOT' in self.matter_test_config.global_test_params, + "PIXIT.WAITTIME.REBOOT must be included on the command line in " + "the --int-arg flag as PIXIT.WAITTIME.REBOOT:") + + wait_time_reboot = self.matter_test_config.global_test_params['PIXIT.WAITTIME.REBOOT'] + + if wait_time_reboot == 0: + asserts.fail("PIXIT.WAITTIME.REBOOT shall be higher than 0.") + + # STEP 1: Commission DUT to TH (can be skipped if done in a preceding test) + self.step(1) + + # STEP 2: Set up a subscription to the OperationCompletion event + self.step(2) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.E01")): + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventSpecificChangeCallback(events.OperationCompletion) + await events_callback.start(self.default_controller, + self.dut_node_id, + endpoint) + + # STEP 3: Manually put the DUT into a state wherein it can receive a Start Command + self.step(3) + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="OnFault", + param=cluster.Enums.ErrorStateEnum.kNoError) + + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Stop") + + # STEP 4: TH sends Start command to the DUT + self.step(4) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Start(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 5: TH reads from the DUT the CountdownTime attribute + self.step(5) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0002")): + initial_countdown_time = await self.read_expect_success(endpoint=endpoint, + attribute=attributes.CountdownTime) + + if initial_countdown_time is not NullValue: + # STEP 6: TH reads from the DUT the OperationalState attribute + self.step(6) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + + # STEP 7: TH waits for initial-countdown-time + self.step(7) + time.sleep(initial_countdown_time) + + # STEP 8: TH sends Stop command to the DUT + self.step(8) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C01.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Stop(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 9: TH waits for OperationCompletion event + self.step(9) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.E01")): + event_data = events_callback.wait_for_event_report() + + asserts.assert_equal(event_data.completionErrorCode, cluster.Enums.ErrorStateEnum.kNoError, + f"Completion event error code mismatched from expectation on endpoint {endpoint}.") + + if event_data.totalOperationalTime is not NullValue: + asserts.assert_less_equal(initial_countdown_time, event_data.totalOperationalTime, + f"The total operation time shall be at least {initial_countdown_time:.1f}") + + asserts.assert_equal(0, event_data.pausedTime, + f"Paused time ({event_data.pausedTime}) shall be zero") + + # STEP 10: TH reads from the DUT the OperationalState attribute + self.step(10) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kStopped) + + # STEP 11: Restart DUT + self.step(11) + # In CI environment, the STOP coommand (step 8) already resets the variables. Only ask for + # reboot outside CI environment. + if not self.is_ci: + input("Press Enter when done.\n") + + # STEP 12: TH waits for {PIXIT.WAITTIME.REBOOT} + self.step(12) + time.sleep(wait_time_reboot) + + # STEP 13: TH sends Start command to the DUT + self.step(13) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C02.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Start(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 14: TH reads from the DUT the OperationalState attribute + self.step(14) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + + # STEP 15: TH sends Pause command to the DUT + self.step(15) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C00.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Pause(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 16: TH reads from the DUT the OperationalState attribute + self.step(16) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kPaused) + + # STEP 17: TH waits for half of initial-countdown-time + self.step(17) + time.sleep((initial_countdown_time / 2)) + + # STEP 18: TH sends Resume command to the DUT + self.step(18) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C03.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Resume(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 19: TH reads from the DUT the OperationalState attribute + self.step(19) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.A0004")): + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + + # STEP 20: TH waits for initial-countdown-time + self.step(20) + time.sleep(initial_countdown_time) + + # STEP 21: TH sends Stop command to the DUT + self.step(21) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.C01.Rsp") and + self.check_pics(f"{self.test_info.pics_code}.S.C04.Tx")): + await self.send_cmd_expect_response(endpoint=endpoint, + cmd=commands.Stop(), + expected_response=cluster.Enums.ErrorStateEnum.kNoError) + + # STEP 22: TH waits for OperationCompletion event + self.step(22) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.E01")): + event_data = events_callback.wait_for_event_report() + + asserts.assert_equal(event_data.completionErrorCode, cluster.Enums.ErrorStateEnum.kNoError, + f"Completion event error code mismatched from expectation on endpoint {endpoint}.") + + if event_data.totalOperationalTime is not NullValue: + expected_value = (1.5 * initial_countdown_time) + + asserts.assert_less_equal(expected_value, event_data.totalOperationalTime, + f"The total operation time shall be at least {expected_value:.1f}") + + expected_value = (0.5 * initial_countdown_time) + asserts.assert_less_equal(expected_value, event_data.pausedTime, + f"Paused time ({event_data.pausedTime}) shall be at least {expected_value:.1f}") + else: + self.skip_step(6) + self.skip_step(7) + self.skip_step(8) + self.skip_step(9) + self.skip_step(10) + self.skip_step(11) + self.skip_step(12) + self.skip_step(13) + self.skip_step(14) + self.skip_step(15) + self.skip_step(16) + self.skip_step(17) + self.skip_step(18) + self.skip_step(19) + self.skip_step(20) + self.skip_step(21) + self.skip_step(22) diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index ddcb134ed96d77..3314eaade876bb 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -24,59 +24,26 @@ # Takes an OpState or RvcOpState state enum and returns a string representation def state_enum_to_text(state_enum): - if state_enum == Clusters.OperationalState.Enums.OperationalStateEnum.kStopped: - return "Stopped(0x00)" - elif state_enum == Clusters.OperationalState.Enums.OperationalStateEnum.kRunning: - return "Running(0x01)" - elif state_enum == Clusters.OperationalState.Enums.OperationalStateEnum.kPaused: - return "Paused(0x02)" - elif state_enum == Clusters.OperationalState.Enums.OperationalStateEnum.kError: - return "Error(0x03)" - elif state_enum == Clusters.RvcOperationalState.Enums.OperationalStateEnum.kSeekingCharger: - return "SeekingCharger(0x40)" - elif state_enum == Clusters.RvcOperationalState.Enums.OperationalStateEnum.kCharging: - return "Charging(0x41)" - elif state_enum == Clusters.RvcOperationalState.Enums.OperationalStateEnum.kDocked: - return "Docked(0x42)" - else: - return "UnknownEnumValue" + try: + return f'{Clusters.RvcOperationalState.Enums.OperationalStateEnum(state_enum).name[1:]}(0x{state_enum:02x})' + except AttributeError: + return f'{Clusters.OperationalState.Enums.OperationalStateEnum(state_enum).name[1:]}(0x{state_enum:02x})' # Takes an OpState or RvcOpState error enum and returns a string representation def error_enum_to_text(error_enum): - if error_enum == Clusters.OperationalState.Enums.ErrorStateEnum.kNoError: - return "NoError(0x00)" - elif error_enum == Clusters.OperationalState.Enums.ErrorStateEnum.kUnableToStartOrResume: - return "UnableToStartOrResume(0x01)" - elif error_enum == Clusters.OperationalState.Enums.ErrorStateEnum.kUnableToCompleteOperation: - return "UnableToCompleteOperation(0x02)" - elif error_enum == Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState: - return "CommandInvalidInState(0x03)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kFailedToFindChargingDock: - return "FailedToFindChargingDock(0x40)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kStuck: - return "Stuck(0x41)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kDustBinMissing: - return "DustBinMissing(0x42)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kDustBinFull: - return "DustBinFull(0x43)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kWaterTankEmpty: - return "WaterTankEmpty(0x44)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kWaterTankMissing: - return "WaterTankMissing(0x45)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kWaterTankLidOpen: - return "WaterTankLidOpen(0x46)" - elif error_enum == Clusters.RvcOperationalState.Enums.ErrorStateEnum.kMopCleaningPadMissing: - return "MopCleaningPadMissing(0x47)" - - def pics_TC_RVCOPSTATE_2_4(self) -> list[str]: - return ["RVCOPSTATE.S"] + try: + return f'{Clusters.RvcOperationalState.Enums.ErrorStateEnum(error_enum).name[1:]}(0x{error_enum:02x})' + except AttributeError: + return f'{Clusters.OperationalState.Enums.ErrorStateEnum(error_enum).name[1:]}(0x{error_enum:02x})' class TC_RVCOPSTATE_2_4(MatterBaseTest): def __init__(self, *args): super().__init__(*args) self.endpoint = None + self.is_ci = False + self.app_pipe = "/tmp/chip_rvc_fifo_" async def read_mod_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.RvcOperationalState @@ -105,15 +72,29 @@ async def read_operational_state_with_check(self, step_number, expected_state): asserts.assert_equal(operational_state, expected_state, "OperationalState(%s) should be %s" % (operational_state, state_enum_to_text(expected_state))) - # Prints the instruction and waits for a user input to continue - def print_instruction(self, step_number, instruction): - self.print_step(step_number, instruction) - input("Press Enter when done.\n") + # Sends an RvcRunMode Change to mode command + async def send_run_change_to_mode_cmd(self, new_mode): + await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=new_mode), + endpoint=self.endpoint) + + # Sends an out-of-band command to the rvc-app + def write_to_app_pipe(self, command): + with open(self.app_pipe, "w") as app_pipe: + app_pipe.write(command + "\n") + + def pics_TC_RVCOPSTATE_2_4(self) -> list[str]: + return ["RVCOPSTATE.S"] @async_test_body async def test_TC_RVCOPSTATE_2_4(self): self.endpoint = self.matter_test_config.endpoint asserts.assert_false(self.endpoint is None, "--endpoint must be included on the command line in.") + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set.c") + self.app_pipe = self.app_pipe + str(app_pid) asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0004"), "RVCOPSTATE.S.A0004 must be supported") asserts.assert_true(self.check_pics("RVCOPSTATE.S.C04.Tx"), "RVCOPSTATE.S.C04.Tx must be supported") @@ -123,55 +104,62 @@ async def test_TC_RVCOPSTATE_2_4(self): rvc_op_states = Clusters.RvcOperationalState.Enums.OperationalStateEnum op_errors = Clusters.OperationalState.Enums.ErrorStateEnum - self.print_step(1, "Commissioning, already done") - - if self.check_pics("RVCOPSTATE.S.M.ST_STOPPED"): - self.print_instruction(2, "Manually put the device in the STOPPED operational state") - - await self.read_operational_state_with_check(3, op_states.kStopped) - - await self.send_go_home_cmd_with_check(4, op_errors.kNoError) - - await self.read_operational_state_with_check(5, rvc_op_states.kSeekingCharger) + # These are the mode values used by the RVC example app that is used in CI. + rvc_app_run_mode_idle = 0 + rvc_app_run_mode_cleaning = 1 - if self.check_pics("RVCOPSTATE.S.M.ST_RUNNING"): - self.print_instruction(6, "Manually put the device in the RUNNING operational state") - - await self.read_operational_state_with_check(7, op_states.kRunning) - - await self.send_go_home_cmd_with_check(8, op_errors.kNoError) - - await self.read_operational_state_with_check(9, rvc_op_states.kSeekingCharger) - - if self.check_pics("RVCOPSTATE.S.M.ST_PAUSED"): - self.print_instruction(10, "Manually put the device in the PAUSED operational state") - - await self.read_operational_state_with_check(11, op_states.kPaused) - - await self.send_go_home_cmd_with_check(12, op_errors.kNoError) + self.print_step(1, "Commissioning, already done") - await self.read_operational_state_with_check(13, rvc_op_states.kSeekingCharger) + # Ensure that the device is in the correct state + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') if self.check_pics("RVCOPSTATE.S.M.ST_ERROR"): - self.print_instruction(14, "Manually put the device in the ERROR operational state") + self.print_step(2, "Manually put the device in the ERROR operational state") + if self.is_ci: + self.write_to_app_pipe('{"Name": "ErrorEvent", "Error": "UnableToStartOrResume"}') + else: + input("Press Enter when done.\n") - await self.read_operational_state_with_check(15, op_states.kError) + await self.read_operational_state_with_check(3, op_states.kError) - await self.send_go_home_cmd_with_check(16, op_errors.kCommandInvalidInState) + await self.send_go_home_cmd_with_check(4, op_errors.kCommandInvalidInState) if self.check_pics("RVCOPSTATE.S.M.ST_CHARGING"): - self.print_instruction(17, "Manually put the device in the CHARGING operational state") + self.print_step(5, "Manually put the device in the CHARGING operational state") + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') + self.write_to_app_pipe('{"Name": "Docked"}') + self.write_to_app_pipe('{"Name": "Charging"}') + else: + input("Press Enter when done.\n") - await self.read_operational_state_with_check(18, rvc_op_states.kCharging) + await self.read_operational_state_with_check(6, rvc_op_states.kCharging) - await self.send_go_home_cmd_with_check(19, op_errors.kCommandInvalidInState) + await self.send_go_home_cmd_with_check(7, op_errors.kCommandInvalidInState) if self.check_pics("RVCOPSTATE.S.M.ST_DOCKED"): - self.print_instruction(20, "Manually put the device in the DOCKED operational state") + self.print_step(8, "Manually put the device in the DOCKED operational state") + if self.is_ci: + self.write_to_app_pipe('{"Name": "Charged"}') + else: + input("Press Enter when done.\n") + + await self.read_operational_state_with_check(9, rvc_op_states.kDocked) - await self.read_operational_state_with_check(21, rvc_op_states.kDocked) + await self.send_go_home_cmd_with_check(10, op_errors.kCommandInvalidInState) + + if self.check_pics("PICS_M_ST_SEEKING_CHARGER"): + self.print_step(8, "Manually put the device in the SEEKING CHARGER operational state") + if self.is_ci: + await self.send_run_change_to_mode_cmd(rvc_app_run_mode_cleaning) + await self.send_run_change_to_mode_cmd(rvc_app_run_mode_idle) + else: + input("Press Enter when done.\n") + + await self.read_operational_state_with_check(9, rvc_op_states.kSeekingCharger) - await self.send_go_home_cmd_with_check(22, op_errors.kCommandInvalidInState) + await self.send_go_home_cmd_with_check(10, op_errors.kNoError) if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index d7ee163b1eb37a..4868865c367d19 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -81,6 +81,12 @@ async def send_change_to_mode_with_check(self, new_mode, expected_error): "Expected a ChangeToMode response status of %s, got %s" % (error_enum_to_text(expected_error), error_enum_to_text(response.status))) + async def read_op_state_operational_state(self) -> Clusters.Objects.RvcOperationalState.Attributes.OperationalState: + ret = await self.read_mod_attribute_expect_success( + Clusters.RvcOperationalState, + Clusters.RvcOperationalState.Attributes.OperationalState) + return ret + # Sends and out-of-band command to the rvc-app def write_to_app_pipe(self, command): with open(self.app_pipe, "w") as app_pipe: @@ -181,12 +187,34 @@ async def test_TC_RVCRUNM_2_2(self): # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.idle_mode_dut) - self.print_step(8, "Send ChangeToMode MODE_B command") + self.print_step(8, "Read RVCOPSTATE's OperationalState attribute") + op_state = await self.read_op_state_operational_state() + + valid_op_states = [ + Clusters.OperationalState.Enums.OperationalStateEnum.kStopped, + Clusters.OperationalState.Enums.OperationalStateEnum.kPaused, + Clusters.RvcOperationalState.Enums.OperationalStateEnum.kCharging, + Clusters.RvcOperationalState.Enums.OperationalStateEnum.kDocked] + + if op_state not in valid_op_states: + self.print_step(9, "Manually put the device in one of Stopped(0x00), Paused(0x02), Charging(0x41) or Docked(0x42)") + if self.is_ci: + self.write_to_app_pipe('{"Name": "ChargerFound"}') + else: + input("Press Enter when done.\n") + + self.print_step(10, "Read RVCOPSTATE's OperationalState attribute") + op_state = await self.read_op_state_operational_state() + + asserts.assert_true(op_state in valid_op_states, + "Expected RVCOPSTATE's OperationalState attribute to be one of Stopped(0x00), Paused(0x02), Charging(0x41) or Docked(0x42)") + + self.print_step(11, "Send ChangeToMode MODE_B command") await self.send_change_to_mode_with_check(self.mode_b, 0) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.mode_b) - self.print_step(9, "Send ChangeToMode idle command") + self.print_step(12, "Send ChangeToMode idle command") await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.idle_mode_dut) diff --git a/src/python_testing/TC_VALCC_4_3.py b/src/python_testing/TC_VALCC_4_3.py index 5869328958f64a..d696464827c20f 100644 --- a/src/python_testing/TC_VALCC_4_3.py +++ b/src/python_testing/TC_VALCC_4_3.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,25 +30,19 @@ async def read_valcc_attribute_expect_success(self, endpoint, attribute): return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) def desc_TC_VALCC_4_3(self) -> str: - return "[TC-VALCC-4.3] AutoCloseTime functionality with DUT as Server" + return "[TC-VALCC-4.3] AutoCloseTime functionality with (no synchronized time) DUT as Server" def steps_TC_VALCC_4_3(self) -> list[TestStep]: steps = [ TestStep(1, "Commissioning, already done", is_commissioning=True), - TestStep(2, "Read FeatureMap attribute"), - TestStep(3, "Verify TimeSync feature is supported"), - TestStep(4, "Send Open command with duration set to 60"), - TestStep(5, "Read UTCTime attribute from TimeSync cluster"), - TestStep(6, "Read AutoCloseTime attribute"), - TestStep(7, "Send Close command"), - TestStep(8, "Read AutoCloseTime attribute"), - TestStep("9a", "Read DefaultOpenDuration attribute"), - TestStep("9b", "Write DefaultOpenDuration attribute"), - TestStep(10, "Send Open command"), - TestStep(11, "Read UTCTime attribute from TimeSync cluster"), - TestStep(12, "Read AutoCloseTime attribute"), - TestStep(13, "Send Close command"), - TestStep(14, "Read AutoCloseTime attribute"), + TestStep("2a", "Read FeatureMap attribute"), + TestStep("2b", "Verify TimeSync feature is supported"), + TestStep("3a", "Read UTCTime attribute from Time Synchronization cluster"), + TestStep("3b", "Verify UTCTime is null"), + TestStep(4, "Send Open command"), + TestStep(5, "Read AutoCloseTime attribute"), + TestStep(6, "Send Close command"), + TestStep(7, "Read AutoCloseTime attribute"), ] return steps @@ -66,12 +60,12 @@ async def test_TC_VALCC_4_3(self): self.step(1) attributes = Clusters.ValveConfigurationAndControl.Attributes - self.step(2) + self.step("2a") feature_map = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap) is_ts_feature_supported = feature_map & Clusters.ValveConfigurationAndControl.Bitmaps.Feature.kTimeSync - self.step(3) + self.step("2b") if not is_ts_feature_supported: logging.info("TimeSync feature not supported skipping test case") @@ -85,82 +79,43 @@ async def test_TC_VALCC_4_3(self): else: logging.info("Test step skipped") - self.step(4) - try: - await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Open(openDuration=60), endpoint=endpoint) - except InteractionModelError as e: - asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") - pass - - self.step(5) + self.step("3a") utcTime = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) - asserts.assert_true(utcTime is not NullValue, "OpenDuration is null") - - self.step(6) - auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) - - asserts.assert_true(auto_close_time_dut is not NullValue, "AutoCloseTime is null") - asserts.assert_greater_equal(auto_close_time_dut, (utcTime + 55000000), - "AutoCloseTime is not in the expected range") - asserts.assert_less_equal(auto_close_time_dut, (utcTime + 60000000), "AutoCloseTime is not in the expected range") - - self.step(7) - try: - await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Close(), endpoint=endpoint) - except InteractionModelError as e: - asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") - pass - - self.step(8) - auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) - - asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") - self.step("9a") - defaultOpenDuration = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.OpenDuration) + self.step("3b") + if utcTime is not NullValue: + logging.info("UTCTime is not null, skipping test case") - asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") + # Skipping all remainig steps + for step in self.get_test_steps(self.current_test_info.name)[self.current_step_index:]: + self.step(step.test_plan_number) + logging.info("Test step skipped") - self.step("9b") - if defaultOpenDuration is NullValue: - defaultOpenDuration = 60 + return - result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.DefaultOpenDuration(defaultOpenDuration))]) - asserts.assert_equal(result[0].Status, Status.Success, "DefaultOpenDuration write failed") else: logging.info("Test step skipped") - self.step(10) + self.step(4) try: await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Open(), endpoint=endpoint) except InteractionModelError as e: asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") pass - self.step(11) - utcTime = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) - - asserts.assert_true(utcTime is not NullValue, "OpenDuration is null") - - self.step(12) + self.step(5) auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) + asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") - asserts.assert_true(auto_close_time_dut is not NullValue, "AutoCloseTime is null") - asserts.assert_greater_equal(auto_close_time_dut, (utcTime + ((defaultOpenDuration - 5) * 1000000)), - "AutoCloseTime is not in the expected range") - asserts.assert_less_equal(auto_close_time_dut, (utcTime + (defaultOpenDuration * 1000000)), - "AutoCloseTime is not in the expected range") - - self.step(13) + self.step(6) try: await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Close(), endpoint=endpoint) except InteractionModelError as e: asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") pass - self.step(14) + self.step(7) auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) - asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") diff --git a/src/python_testing/TC_VALCC_4_4.py b/src/python_testing/TC_VALCC_4_4.py index 0d7d1184dbcda3..95aa1743187ee7 100644 --- a/src/python_testing/TC_VALCC_4_4.py +++ b/src/python_testing/TC_VALCC_4_4.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,12 +15,12 @@ # limitations under the License. # -import time +import logging import chip.clusters as Clusters from chip.clusters.Types import NullValue from chip.interaction_model import InteractionModelError, Status -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, utc_time_in_matter_epoch from mobly import asserts @@ -30,19 +30,27 @@ async def read_valcc_attribute_expect_success(self, endpoint, attribute): return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) def desc_TC_VALCC_4_4(self) -> str: - return "[TC-VALCC-4.4] Auto close functionality with DUT as Server" + return "[TC-VALCC-4.4] AutoCloseTime functionality with (synchronized time) DUT as Server" def steps_TC_VALCC_4_4(self) -> list[TestStep]: steps = [ TestStep(1, "Commissioning, already done", is_commissioning=True), - TestStep(2, "Send Open command with duration set to 5"), - TestStep(3, "Read OpenDuration attribute"), - TestStep(4, "Read RemainingDuration attribute"), - TestStep(5, "Read CurrentState attribute"), - TestStep(6, "Wait 6 seconds"), - TestStep(7, "Read OpenDuration attribute"), - TestStep(8, "Read RemainingDuration attribute"), - TestStep(9, "Read CurrentState attribute"), + TestStep("2a", "Read FeatureMap attribute"), + TestStep("2b", "Verify TimeSync feature is supported"), + TestStep("3a", "Read UTCTime attribute from Time Synchronization cluster"), + TestStep("3b", "Set UTCTime, if null"), + TestStep(4, "Send Open command with duration set to 60"), + TestStep(5, "Read UTCTime attribute from TimeSync cluster"), + TestStep(6, "Read AutoCloseTime attribute"), + TestStep(7, "Send Close command"), + TestStep(8, "Read AutoCloseTime attribute"), + TestStep("9a", "Read DefaultOpenDuration attribute"), + TestStep("9b", "Write DefaultOpenDuration attribute"), + TestStep(10, "Send Open command"), + TestStep(11, "Read UTCTime attribute from TimeSync cluster"), + TestStep(12, "Read AutoCloseTime attribute"), + TestStep(13, "Send Close command"), + TestStep(14, "Read AutoCloseTime attribute"), ] return steps @@ -60,53 +68,117 @@ async def test_TC_VALCC_4_4(self): self.step(1) attributes = Clusters.ValveConfigurationAndControl.Attributes - self.step(2) + self.step("2a") + feature_map = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap) + + is_ts_feature_supported = feature_map & Clusters.ValveConfigurationAndControl.Bitmaps.Feature.kTimeSync + + self.step("2b") + if not is_ts_feature_supported: + logging.info("TimeSync feature not supported skipping test case") + + # Skipping all remainig steps + for step in self.get_test_steps(self.current_test_info.name)[self.current_step_index:]: + self.step(step.test_plan_number) + logging.info("Test step skipped") + + return + + else: + logging.info("Test step skipped") + + self.step("3a") + utcTime = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) + + self.step("3b") + if utcTime is NullValue: + th_utc = utc_time_in_matter_epoch() + + try: + await self.send_single_cmd(cmd=Clusters.Objects.TimeSynchronization.Commands.SetUTCTime(UTCTime=th_utc, granularity=Clusters.Objects.TimeSynchronization.Enums.GranularityEnum.kMillisecondsGranularity), endpoint=0) + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") + pass + + else: + logging.info("Test step skipped") + + self.step(4) try: - await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Open(openDuration=5), endpoint=endpoint) + await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Open(openDuration=60), endpoint=endpoint) except InteractionModelError as e: asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") pass - self.step(3) - open_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.OpenDuration) - asserts.assert_true(open_duration_dut is not NullValue, "OpenDuration is null") - asserts.assert_equal(open_duration_dut, 5, "OpenDuration is not the expected value") + self.step(5) + utcTime = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) - self.step(4) - remaining_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.RemainingDuration) - asserts.assert_true(remaining_duration_dut is not NullValue, "RemainingDuration is null") - asserts.assert_greater_equal(remaining_duration_dut, 1, "RemainingDuration is not in the expected range") - asserts.assert_less_equal(remaining_duration_dut, 5, "RemainingDuration is not in the expected range") + self.step(6) + auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) - self.step(5) - current_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState) - asserts.assert_true(current_state_dut is not NullValue, "CurrentState is null") + asserts.assert_true(auto_close_time_dut is not NullValue, "AutoCloseTime is null") + asserts.assert_greater_equal(auto_close_time_dut, (utcTime + 55000000), + "AutoCloseTime is not in the expected range") + asserts.assert_less_equal(auto_close_time_dut, (utcTime + 60000000), "AutoCloseTime is not in the expected range") - while current_state_dut is Clusters.Objects.ValveConfigurationAndControl.Enums.ValveStateEnum.kTransitioning: - time.sleep(1) + self.step(7) + try: + await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Close(), endpoint=endpoint) + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") + pass - current_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState) - asserts.assert_true(current_state_dut is not NullValue, "CurrentState is null") + self.step(8) + auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) - asserts.assert_equal(current_state_dut, Clusters.Objects.ValveConfigurationAndControl.Enums.ValveStateEnum.kOpen, - "CurrentState is not the expected value") + asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") - self.step(6) - time.sleep(6) + self.step("9a") + defaultOpenDuration = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.OpenDuration) - self.step(7) - open_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.OpenDuration) - asserts.assert_true(open_duration_dut is NullValue, "OpenDuration is not null") + asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") - self.step(8) - remaining_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.RemainingDuration) - asserts.assert_true(remaining_duration_dut is NullValue, "RemainingDuration is not null") - - self.step(9) - current_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState) - asserts.assert_true(current_state_dut is not NullValue, "CurrentState is null") - asserts.assert_equal(current_state_dut, Clusters.Objects.ValveConfigurationAndControl.Enums.ValveStateEnum.kClosed, - "CurrentState is not the expected value") + self.step("9b") + if defaultOpenDuration is NullValue: + defaultOpenDuration = 60 + + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.DefaultOpenDuration(defaultOpenDuration))]) + asserts.assert_equal(result[0].Status, Status.Success, "DefaultOpenDuration write failed") + else: + logging.info("Test step skipped") + + self.step(10) + try: + await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Open(), endpoint=endpoint) + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") + pass + + self.step(11) + utcTime = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) + + asserts.assert_true(utcTime is not NullValue, "OpenDuration is null") + + self.step(12) + auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) + + asserts.assert_true(auto_close_time_dut is not NullValue, "AutoCloseTime is null") + asserts.assert_greater_equal(auto_close_time_dut, (utcTime + ((defaultOpenDuration - 5) * 1000000)), + "AutoCloseTime is not in the expected range") + asserts.assert_less_equal(auto_close_time_dut, (utcTime + (defaultOpenDuration * 1000000)), + "AutoCloseTime is not in the expected range") + + self.step(13) + try: + await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Close(), endpoint=endpoint) + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") + pass + + self.step(14) + auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) + + asserts.assert_true(auto_close_time_dut is NullValue, "AutoCloseTime is not null") if __name__ == "__main__": diff --git a/src/python_testing/TC_VALCC_4_5.py b/src/python_testing/TC_VALCC_4_5.py new file mode 100644 index 00000000000000..7dd21b89eead6e --- /dev/null +++ b/src/python_testing/TC_VALCC_4_5.py @@ -0,0 +1,113 @@ +# +# Copyright (c) 2024 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 time + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_VALCC_4_5(MatterBaseTest): + async def read_valcc_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.ValveConfigurationAndControl + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + def desc_TC_VALCC_4_5(self) -> str: + return "[TC-VALCC-4.5] Auto close functionality with DUT as Server" + + def steps_TC_VALCC_4_5(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Send Open command with duration set to 5"), + TestStep(3, "Read OpenDuration attribute"), + TestStep(4, "Read RemainingDuration attribute"), + TestStep(5, "Read CurrentState attribute"), + TestStep(6, "Wait 6 seconds"), + TestStep(7, "Read OpenDuration attribute"), + TestStep(8, "Read RemainingDuration attribute"), + TestStep(9, "Read CurrentState attribute"), + ] + return steps + + def pics_TC_VALCC_4_5(self) -> list[str]: + pics = [ + "VALCC.S", + ] + return pics + + @async_test_body + async def test_TC_VALCC_4_5(self): + + endpoint = self.user_params.get("endpoint", 1) + + self.step(1) + attributes = Clusters.ValveConfigurationAndControl.Attributes + + self.step(2) + try: + await self.send_single_cmd(cmd=Clusters.Objects.ValveConfigurationAndControl.Commands.Open(openDuration=5), endpoint=endpoint) + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Success, "Unexpected error returned") + pass + + self.step(3) + open_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.OpenDuration) + asserts.assert_true(open_duration_dut is not NullValue, "OpenDuration is null") + asserts.assert_equal(open_duration_dut, 5, "OpenDuration is not the expected value") + + self.step(4) + remaining_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.RemainingDuration) + asserts.assert_true(remaining_duration_dut is not NullValue, "RemainingDuration is null") + asserts.assert_greater_equal(remaining_duration_dut, 1, "RemainingDuration is not in the expected range") + asserts.assert_less_equal(remaining_duration_dut, 5, "RemainingDuration is not in the expected range") + + self.step(5) + current_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState) + asserts.assert_true(current_state_dut is not NullValue, "CurrentState is null") + + while current_state_dut is Clusters.Objects.ValveConfigurationAndControl.Enums.ValveStateEnum.kTransitioning: + time.sleep(1) + + current_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState) + asserts.assert_true(current_state_dut is not NullValue, "CurrentState is null") + + asserts.assert_equal(current_state_dut, Clusters.Objects.ValveConfigurationAndControl.Enums.ValveStateEnum.kOpen, + "CurrentState is not the expected value") + + self.step(6) + time.sleep(6) + + self.step(7) + open_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.OpenDuration) + asserts.assert_true(open_duration_dut is NullValue, "OpenDuration is not null") + + self.step(8) + remaining_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.RemainingDuration) + asserts.assert_true(remaining_duration_dut is NullValue, "RemainingDuration is not null") + + self.step(9) + current_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState) + asserts.assert_true(current_state_dut is not NullValue, "CurrentState is null") + asserts.assert_equal(current_state_dut, Clusters.Objects.ValveConfigurationAndControl.Enums.ValveStateEnum.kClosed, + "CurrentState is not the expected value") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TestSpecParsingSupport.py b/src/python_testing/TestSpecParsingSupport.py index ed790fb4bf4629..2ff80e55244648 100644 --- a/src/python_testing/TestSpecParsingSupport.py +++ b/src/python_testing/TestSpecParsingSupport.py @@ -19,9 +19,10 @@ import chip.clusters as Clusters from global_attribute_ids import GlobalAttributeIds -from matter_testing_support import MatterBaseTest, default_matter_test_main +from matter_testing_support import MatterBaseTest, ProblemNotice, default_matter_test_main from mobly import asserts -from spec_parsing_support import ClusterParser, XmlCluster +from spec_parsing_support import (ClusterParser, XmlCluster, add_cluster_data_from_xml, check_clusters_for_unknown_commands, + combine_derived_clusters_with_base) # TODO: improve the test coverage here # https://github.com/project-chip/connectedhomeip/issues/30958 @@ -77,6 +78,120 @@ def get_access_enum_from_string(access_str: str) -> Clusters.AccessControl.Enums asserts.fail("Unknown access string") +BASE_CLUSTER_XML_STR = ( + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '') + +DERIVED_CLUSTER_XML_STR = ( + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '' +) + +CLUSTER_WITH_UNKNOWN_COMMAND = ( + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '' +) + + class TestSpecParsingSupport(MatterBaseTest): def test_spec_parsing_access(self): strs = [None, 'view', 'operate', 'manage', 'admin'] @@ -106,6 +221,81 @@ def test_write_optional(self): asserts.assert_equal(xml_cluster.attributes[ATTRIBUTE_ID].write_optional, write_support == 'optional', "Unexpected write_optional value") + def test_derived_clusters(self): + clusters: dict[int, XmlCluster] = {} + pure_base_clusters: dict[str, XmlCluster] = {} + ids_by_name: dict[str, int] = {} + problems: list[ProblemNotice] = [] + base_cluster_xml = ElementTree.fromstring(BASE_CLUSTER_XML_STR) + derived_cluster_xml = ElementTree.fromstring(DERIVED_CLUSTER_XML_STR) + expected_global_attrs = [GlobalAttributeIds.FEATURE_MAP_ID, GlobalAttributeIds.ATTRIBUTE_LIST_ID, + GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID, GlobalAttributeIds.GENERATED_COMMAND_LIST_ID, GlobalAttributeIds.CLUSTER_REVISION_ID] + + add_cluster_data_from_xml(base_cluster_xml, clusters, pure_base_clusters, ids_by_name, problems) + add_cluster_data_from_xml(derived_cluster_xml, clusters, pure_base_clusters, ids_by_name, problems) + + asserts.assert_equal(len(clusters), 1, "Unexpected number of clusters") + asserts.assert_equal(len(pure_base_clusters), 1, "Unexpected number of pure base clusters") + asserts.assert_equal(len(ids_by_name), 1, "Unexpected number of IDs per name") + asserts.assert_equal(len(problems), 0, "Unexpected number of problems") + asserts.assert_equal(ids_by_name["Test Derived"], 0xFFFF, "Test derived name not added to IDs") + + asserts.assert_true(0xFFFF in clusters, "Derived ID not found in clusters") + asserts.assert_equal(set(clusters[0xFFFF].attributes.keys()), set( + [0, 2, 3] + expected_global_attrs), "Unexpected attribute list") + asserts.assert_equal(set(clusters[0xFFFF].accepted_commands.keys()), set([]), "Unexpected accepted commands") + asserts.assert_equal(set(clusters[0xFFFF].generated_commands.keys()), set([]), "Unexpected generated commands") + + asserts.assert_true("Test Base" in pure_base_clusters, "Base ID not found in derived clusters") + asserts.assert_equal(set(pure_base_clusters["Test Base"].attributes.keys()), set( + [0, 1, 2, 3] + expected_global_attrs), "Unexpected attribute list") + asserts.assert_equal(set(pure_base_clusters["Test Base"].accepted_commands.keys()), + set([0]), "Unexpected accepted commands") + asserts.assert_equal(set(pure_base_clusters["Test Base"].generated_commands.keys()), + set([1]), "Unexpected generated commands") + asserts.assert_equal(str(pure_base_clusters["Test Base"].accepted_commands[0].conformance), + "M", "Unexpected conformance on base accepted command") + asserts.assert_equal(str(pure_base_clusters["Test Base"].generated_commands[1].conformance), + "M", "Unexpected conformance on base generated command") + + asserts.assert_equal(len(pure_base_clusters["Test Base"].unknown_commands), + 0, "Unexpected number of unknown commands in base") + asserts.assert_equal(len(clusters[0xFFFF].unknown_commands), 2, "Unexpected number of unknown commands in derived cluster") + + combine_derived_clusters_with_base(clusters, pure_base_clusters, ids_by_name) + # Ensure the base-only attribute (1) was added to the derived cluster + asserts.assert_equal(set(clusters[0xFFFF].attributes.keys()), set( + [0, 1, 2, 3] + expected_global_attrs), "Unexpected attribute list") + # Ensure the conformance overrides from the derived cluster are on the attributes + asserts.assert_equal(str(clusters[0xFFFF].attributes[0].conformance), "M", "Unexpected conformance on attribute 0") + asserts.assert_equal(str(clusters[0xFFFF].attributes[1].conformance), "M", "Unexpected conformance on attribute 1") + asserts.assert_equal(str(clusters[0xFFFF].attributes[2].conformance), "X", "Unexpected conformance on attribute 2") + asserts.assert_equal(str(clusters[0xFFFF].attributes[3].conformance), "X", "Unexpected conformance on attribute 3") + + # Ensure both the accepted and generated command overrides work + asserts.assert_true(set(clusters[0xFFFF].accepted_commands.keys()), + set([0]), "Unexpected accepted command list after merge") + asserts.assert_true(set(clusters[0xFFFF].generated_commands.keys()), set([1]), + "Unexpected generated command list after merge") + asserts.assert_equal(str(clusters[0xFFFF].accepted_commands[0].conformance), + "X", "Unexpected conformance on accepted commands") + asserts.assert_equal(str(clusters[0xFFFF].generated_commands[1].conformance), + "X", "Unexpected conformance on generated commands") + asserts.assert_equal(len(clusters[0xFFFF].unknown_commands), 0, "Unexpected number of unknown commands after merge") + + def test_missing_command_direction(self): + clusters: dict[int, XmlCluster] = {} + pure_base_clusters: dict[str, XmlCluster] = {} + ids_by_name: dict[str, int] = {} + problems: list[ProblemNotice] = [] + cluster_xml = ElementTree.fromstring(CLUSTER_WITH_UNKNOWN_COMMAND) + + add_cluster_data_from_xml(cluster_xml, clusters, pure_base_clusters, ids_by_name, problems) + check_clusters_for_unknown_commands(clusters, problems) + asserts.assert_equal(len(problems), 1, "Unexpected number of problems found") + asserts.assert_equal(problems[0].location.cluster_id, 0xFFFE, "Unexpected problem location (cluster id)") + asserts.assert_equal(problems[0].location.command_id, 0, "Unexpected problem location (command id)") + 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 1515f0310d3302..5a5e9db1820845 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -1014,16 +1014,24 @@ def skip_step(self, step): self.step(step) self.mark_current_step_skipped() - def skip_all_remaining_steps(self, starting_step): + def skip_all_remaining_steps(self, starting_step_number): ''' Skips all remaining test steps starting with provided starting step - starting_step must be provided, and is not derived intentionally. By providing argument + starting_step_number gives the first step to be skipped, as defined in the TestStep.test_plan_number + starting_step_number must be provided, and is not derived intentionally. By providing argument test is more deliberately identifying where test skips are starting from, making it easier to validate against the test plan for correctness. ''' - last_step = len(self.get_test_steps(self.current_test_info.name)) + 1 - for index in range(starting_step, last_step): - self.skip_step(index) + steps = self.get_test_steps(self.current_test_info.name) + for idx, step in enumerate(steps): + if step.test_plan_number == starting_step_number: + starting_step_idx = idx + break + else: + asserts.fail("skip_all_remaining_steps was provided with invalid starting_step_num") + remaining = steps[starting_step_idx:] + for step in remaining: + self.skip_step(step.test_plan_number) def step(self, step: typing.Union[int, str]): test_name = self.current_test_info.name diff --git a/src/python_testing/spec_parsing_support.py b/src/python_testing/spec_parsing_support.py index c58f38e9a5ac89..3a784178cdb880 100644 --- a/src/python_testing/spec_parsing_support.py +++ b/src/python_testing/spec_parsing_support.py @@ -76,6 +76,7 @@ def __str__(self): @dataclass class XmlCommand: + id: int name: str conformance: Callable[[uint], ConformanceDecision] @@ -100,6 +101,7 @@ class XmlCluster: attributes: dict[uint, XmlAttribute] accepted_commands: dict[uint, XmlCommand] generated_commands: dict[uint, XmlCommand] + unknown_commands: list[XmlCommand] events: dict[uint, XmlEvent] pics: str @@ -107,6 +109,35 @@ class XmlCluster: class CommandType(Enum): ACCEPTED = auto() GENERATED = auto() + # This will happen for derived clusters, where the direction isn't noted. On normal clusters, this is a problem. + UNKNOWN = auto() + + +# workaround for aliased clusters not appearing in the xml. Remove this once https://github.com/csa-data-model/projects/issues/373 is addressed +CONC_CLUSTERS = {0x040C: ('Carbon Monoxide Concentration Measurement', 'CMOCONC'), + 0x040D: ('Carbon Dioxide Concentration Measurement', 'CDOCONC'), + 0x0413: ('Nitrogen Dioxide Concentration Measurement', 'NDOCONC'), + 0x0415: ('Ozone Concentration Measurement', 'OZCONC'), + 0x042A: ('PM2.5 Concentration Measurement', 'PMICONC'), + 0x042B: ('Formaldehyde Concentration Measurement', 'FLDCONC'), + 0x042C: ('PM1 Concentration Measurement', 'PMHCONC'), + 0x042D: ('PM10 Concentration Measurement', 'PMKCONC'), + 0x042E: ('Total Volatile Organic Compounds Concentration Measurement', 'TVOCCONC'), + 0x042F: ('Radon Concentration Measurement', 'RNCONC')} +CONC_BASE_NAME = 'Concentration Measurement Clusters' +RESOURCE_CLUSTERS = {0x0071: ('HEPA Filter Monitoring', 'HEPAFREMON'), + 0x0072: ('Activated Carbon Filter Monitoring', 'ACFREMON')} +RESOURCE_BASE_NAME = 'Resource Monitoring Clusters' +WATER_CLUSTER = {0x0405: ('Relative Humidity Measurement', 'RH')} +WATER_BASE_NAME = 'Water Content Measurement Clusters' +CLUSTER_ALIASES = {CONC_BASE_NAME: CONC_CLUSTERS, RESOURCE_BASE_NAME: RESOURCE_CLUSTERS, WATER_BASE_NAME: WATER_CLUSTER} + + +def is_alias(id: uint): + for base, alias in CLUSTER_ALIASES.items(): + if id in alias: + return True + return False class ClusterParser: @@ -317,17 +348,29 @@ def parse_attributes(self) -> dict[uint, XmlAttribute]: ), read_access=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kView, write_access=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kUnknownEnumValue, write_optional=False) return attributes - def parse_commands(self, command_type: CommandType) -> dict[uint, XmlAttribute]: - commands = {} + def get_command_type(self, element: ElementTree.Element) -> CommandType: + try: + if element.attrib['direction'].lower() == 'responsefromserver': + return CommandType.GENERATED + if element.attrib['direction'].lower() == 'commandtoclient': + return CommandType.UNKNOWN + except KeyError: + return CommandType.ACCEPTED + + def parse_unknown_commands(self) -> list[XmlCommand]: + commands = [] for element, conformance_xml, access_xml in self.command_elements: + if self.get_command_type(element) != CommandType.UNKNOWN: + continue code = int(element.attrib['id'], 0) - dir = CommandType.ACCEPTED - try: - if element.attrib['direction'].lower() == 'responsefromserver': - dir = CommandType.GENERATED - except KeyError: - pass - if dir != command_type: + conformance = self.parse_conformance(conformance_xml) + commands.append(XmlCommand(id=code, name=element.attrib['name'], conformance=conformance)) + return commands + + def parse_commands(self, command_type: CommandType) -> dict[uint, XmlCommand]: + commands = {} + for element, conformance_xml, access_xml in self.command_elements: + if self.get_command_type(element) != command_type: continue code = int(element.attrib['id'], 0) conformance = self.parse_conformance(conformance_xml) @@ -335,7 +378,7 @@ def parse_commands(self, command_type: CommandType) -> dict[uint, XmlAttribute]: continue if code in commands: conformance = or_operation([conformance, commands[code].conformance]) - commands[code] = XmlCommand(name=element.attrib['name'], conformance=conformance) + commands[code] = XmlCommand(id=code, name=element.attrib['name'], conformance=conformance) return commands def parse_events(self) -> dict[uint, XmlAttribute]: @@ -362,96 +405,71 @@ def create_cluster(self) -> XmlCluster: attributes=self.parse_attributes(), accepted_commands=self.parse_commands(CommandType.ACCEPTED), generated_commands=self.parse_commands(CommandType.GENERATED), + unknown_commands=self.parse_unknown_commands(), events=self.parse_events(), pics=self._pics) def get_problems(self) -> list[ProblemNotice]: return self._problems -def build_xml_clusters() -> tuple[list[XmlCluster], list[ProblemNotice]]: - # workaround for aliased clusters not appearing in the xml. Remove this once https://github.com/csa-data-model/projects/issues/373 is addressed - conc_clusters = {0x040C: ('Carbon Monoxide Concentration Measurement', 'CMOCONC'), - 0x040D: ('Carbon Dioxide Concentration Measurement', 'CDOCONC'), - 0x0413: ('Nitrogen Dioxide Concentration Measurement', 'NDOCONC'), - 0x0415: ('Ozone Concentration Measurement', 'OZCONC'), - 0x042A: ('PM2.5 Concentration Measurement', 'PMICONC'), - 0x042B: ('Formaldehyde Concentration Measurement', 'FLDCONC'), - 0x042C: ('PM1 Concentration Measurement', 'PMHCONC'), - 0x042D: ('PM10 Concentration Measurement', 'PMKCONC'), - 0x042E: ('Total Volatile Organic Compounds Concentration Measurement', 'TVOCCONC'), - 0x042F: ('Radon Concentration Measurement', 'RNCONC')} - conc_base_name = 'Concentration Measurement Clusters' - resource_clusters = {0x0071: ('HEPA Filter Monitoring', 'HEPAFREMON'), - 0x0072: ('Activated Carbon Filter Monitoring', 'ACFREMON')} - resource_base_name = 'Resource Monitoring Clusters' - water_clusters = {0x0405: ('Relative Humidity Measurement', 'RH')} - water_base_name = 'Water Content Measurement Clusters' - aliases = {conc_base_name: conc_clusters, resource_base_name: resource_clusters, water_base_name: water_clusters} - - def is_alias(id: uint): - for base, alias in aliases.items(): - if id in alias: - return True - return False +def add_cluster_data_from_xml(xml: ElementTree.Element, clusters: dict[int, XmlCluster], pure_base_clusters: dict[str, XmlCluster], ids_by_name: dict[str, int], problems: list[ProblemNotice]) -> None: + ''' Adds cluster data to the supplied dicts as appropriate + + xml: XML element read from from the XML cluster file + clusters: dict of id -> XmlCluster. This function will append new clusters as appropriate to this dict. + pure_base_clusters: dict of base name -> XmlCluster. This data structure is used to hold pure base clusters that don't have + an ID. This function will append new pure base clusters as approrpriate to this dict. + ids_by_name: dict of cluster name -> ID. This function will append new IDs as appropriate to this dict. + problems: list of any problems encountered during spec parsing. This function will append problems as appropriate to this list. + ''' + cluster = xml.iter('cluster') + for c in cluster: + name = c.attrib['name'] + if not c.attrib['id']: + # Fully derived clusters have no id, but also shouldn't appear on a device. + # We do need to keep them, though, because we need to update the derived + # clusters. We keep them in a special dict by name, so they can be thrown + # away later. + cluster_id = None + else: + cluster_id = int(c.attrib['id'], 0) + ids_by_name[name] = cluster_id - def combine_attributes(base: dict[uint, XmlAttribute], derived: dict[uint, XmlAttribute], cluster_id: uint) -> dict[uint, XmlAttribute]: - ret = deepcopy(base) - extras = {k: v for k, v in derived.items() if k not in base.keys()} - overrides = {k: v for k, v in derived.items() if k in base.keys()} - ret.update(extras) - for id, override in overrides.items(): - if override.conformance: - ret[id].conformance = override.conformance - if override.read_access: - ret[id].read_access = override.read_access - if override.write_access: - ret[id].write_access = override.write_access - if ret[id].read_access is None and ret[id].write_access is None: - location = AttributePathLocation(endpoint_id=0, cluster_id=cluster_id, attribute_id=id) - problems.append(ProblemNotice(test_name='Spec XML parsing', location=location, - severity=ProblemSeverity.WARNING, problem='Unable to find access element')) - if ret[id].read_access is None: - ret[id].read_access == Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kUnknownEnumValue - if ret[id].write_access is None: - ret[id].write_access = Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kUnknownEnumValue - return ret + parser = ClusterParser(c, cluster_id, name, is_alias(cluster_id)) + new = parser.create_cluster() + problems = problems + parser.get_problems() + + if cluster_id: + clusters[cluster_id] = new + else: + pure_base_clusters[name] = new + + +def check_clusters_for_unknown_commands(clusters: dict[int, XmlCluster], problems: list[ProblemNotice]): + for id, cluster in clusters.items(): + for cmd in cluster.unknown_commands: + problems.append(ProblemNotice(test_name="Spec XML parsing", location=CommandPathLocation( + endpoint_id=0, cluster_id=id, command_id=cmd.id), severity=ProblemSeverity.WARNING, problem="Command with unknown direction")) + +def build_xml_clusters() -> tuple[list[XmlCluster], list[ProblemNotice]]: dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', 'clusters') clusters: dict[int, XmlCluster] = {} - derived_clusters: dict[str, XmlCluster] = {} - ids_by_name = {} - problems = [] + pure_base_clusters: dict[str, XmlCluster] = {} + ids_by_name: dict[str, int] = {} + problems: list[ProblemNotice] = [] for xml in glob.glob(f"{dir}/*.xml"): logging.info(f'Parsing file {xml}') tree = ElementTree.parse(f'{xml}') root = tree.getroot() - cluster = root.iter('cluster') - for c in cluster: - name = c.attrib['name'] - if not c.attrib['id']: - # Fully derived clusters have no id, but also shouldn't appear on a device. - # We do need to keep them, though, because we need to update the derived - # clusters. We keep them in a special dict by name, so they can be thrown - # away later. - cluster_id = None - else: - cluster_id = int(c.attrib['id'], 0) - ids_by_name[name] = cluster_id - - parser = ClusterParser(c, cluster_id, name, is_alias(cluster_id)) - new = parser.create_cluster() - problems = problems + parser.get_problems() - - if cluster_id: - clusters[cluster_id] = new - else: - derived_clusters[name] = new + add_cluster_data_from_xml(root, clusters, pure_base_clusters, ids_by_name, problems) # There are a few clusters where the conformance columns are listed as desc. These clusters need specific, targeted tests # to properly assess conformance. Here, we list them as Optional to allow these for the general test. Targeted tests are described below. # Descriptor - TagList feature - this feature is mandated when the duplicate condition holds for the endpoint. It is tested in DESC-2.2 # Actions cluster - all commands - these need to be listed in the ActionsList attribute to be supported. # We do not currently have a test for this. Please see https://github.com/CHIP-Specifications/chip-test-plans/issues/3646. + def remove_problem(location: typing.Union[CommandPathLocation, FeaturePathLocation]): nonlocal problems problems = [p for p in problems if p.location != location] @@ -466,40 +484,11 @@ def remove_problem(location: typing.Union[CommandPathLocation, FeaturePathLocati clusters[action_id].accepted_commands[c].conformance = optional() remove_problem(CommandPathLocation(endpoint_id=0, cluster_id=action_id, command_id=c)) - # We have the information now about which clusters are derived, so we need to fix them up. Apply first the base cluster, - # then add the specific cluster overtop - for id, c in clusters.items(): - if c.derived: - base_name = c.derived - if base_name in ids_by_name: - base = clusters[ids_by_name[c.derived]] - else: - base = derived_clusters[base_name] - - feature_map = deepcopy(base.feature_map) - feature_map.update(c.feature_map) - attribute_map = deepcopy(base.attribute_map) - attribute_map.update(c.attribute_map) - command_map = deepcopy(base.command_map) - command_map.update(c.command_map) - features = deepcopy(base.features) - features.update(c.features) - attributes = combine_attributes(base.attributes, c.attributes, id) - accepted_commands = deepcopy(base.accepted_commands) - accepted_commands.update(c.accepted_commands) - generated_commands = deepcopy(base.generated_commands) - generated_commands.update(c.generated_commands) - events = deepcopy(base.events) - events.update(c.events) - new = XmlCluster(revision=c.revision, derived=c.derived, name=c.name, - feature_map=feature_map, attribute_map=attribute_map, command_map=command_map, - features=features, attributes=attributes, accepted_commands=accepted_commands, - generated_commands=generated_commands, events=events, pics=c.pics) - clusters[id] = new + combine_derived_clusters_with_base(clusters, pure_base_clusters, ids_by_name) - for alias_base_name, aliased_clusters in aliases.items(): + for alias_base_name, aliased_clusters in CLUSTER_ALIASES.items(): for id, (alias_name, pics) in aliased_clusters.items(): - base = derived_clusters[alias_base_name] + base = pure_base_clusters[alias_base_name] new = deepcopy(base) new.derived = alias_base_name new.name = alias_name @@ -529,4 +518,72 @@ def remove_problem(location: typing.Union[CommandPathLocation, FeaturePathLocati clusters[acl_id].attributes[Clusters.AccessControl.Attributes.Acl.attribute_id].write_access = Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister clusters[acl_id].attributes[Clusters.AccessControl.Attributes.Extension.attribute_id].write_access = Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister + check_clusters_for_unknown_commands(clusters, problems) + return clusters, problems + + +def combine_derived_clusters_with_base(xml_clusters: dict[int, XmlCluster], pure_base_clusters: dict[str, XmlCluster], ids_by_name: dict[str, int]) -> None: + ''' Overrides base elements with the derived cluster values for derived clusters. ''' + + def combine_attributes(base: dict[uint, XmlAttribute], derived: dict[uint, XmlAttribute], cluster_id: uint) -> dict[uint, XmlAttribute]: + ret = deepcopy(base) + extras = {k: v for k, v in derived.items() if k not in base.keys()} + overrides = {k: v for k, v in derived.items() if k in base.keys()} + ret.update(extras) + for id, override in overrides.items(): + if override.conformance: + ret[id].conformance = override.conformance + if override.read_access: + ret[id].read_access = override.read_access + if override.write_access: + ret[id].write_access = override.write_access + if ret[id].read_access is None and ret[id].write_access is None: + location = AttributePathLocation(endpoint_id=0, cluster_id=cluster_id, attribute_id=id) + problems.append(ProblemNotice(test_name='Spec XML parsing', location=location, + severity=ProblemSeverity.WARNING, problem='Unable to find access element')) + if ret[id].read_access is None: + ret[id].read_access == Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kUnknownEnumValue + if ret[id].write_access is None: + ret[id].write_access = Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kUnknownEnumValue + return ret + + # We have the information now about which clusters are derived, so we need to fix them up. Apply first the base cluster, + # then add the specific cluster overtop + for id, c in xml_clusters.items(): + if c.derived: + base_name = c.derived + if base_name in ids_by_name: + base = xml_clusters[ids_by_name[c.derived]] + else: + base = pure_base_clusters[base_name] + + feature_map = deepcopy(base.feature_map) + feature_map.update(c.feature_map) + attribute_map = deepcopy(base.attribute_map) + attribute_map.update(c.attribute_map) + command_map = deepcopy(base.command_map) + command_map.update(c.command_map) + features = deepcopy(base.features) + features.update(c.features) + attributes = combine_attributes(base.attributes, c.attributes, id) + accepted_commands = deepcopy(base.accepted_commands) + accepted_commands.update(c.accepted_commands) + generated_commands = deepcopy(base.generated_commands) + generated_commands.update(c.generated_commands) + events = deepcopy(base.events) + events.update(c.events) + unknown_commands = deepcopy(base.unknown_commands) + for cmd in c.unknown_commands: + if cmd.id in accepted_commands.keys() and cmd.name == accepted_commands[cmd.id].name: + accepted_commands[cmd.id].conformance = cmd.conformance + elif cmd.id in generated_commands.keys() and cmd.name == generated_commands[cmd.id].name: + generated_commands[cmd.id].conformance = cmd.conformance + else: + unknown_commands.append(cmd) + + new = XmlCluster(revision=c.revision, derived=c.derived, name=c.name, + feature_map=feature_map, attribute_map=attribute_map, command_map=command_map, + features=features, attributes=attributes, accepted_commands=accepted_commands, + generated_commands=generated_commands, unknown_commands=unknown_commands, events=events, pics=c.pics) + xml_clusters[id] = new diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn index 1389bddc3ca4c0..9f24ad171be72a 100644 --- a/src/system/BUILD.gn +++ b/src/system/BUILD.gn @@ -60,8 +60,6 @@ if (chip_device_platform == "cc13x2_26x2") { import("${qpg_sdk_build_root}/qpg_sdk.gni") } else if (chip_device_platform == "k32w0") { import("//build_overrides/k32w0_sdk.gni") -} else if (chip_device_platform == "k32w1") { - import("//build_overrides/k32w1_sdk.gni") } else if (chip_device_platform == "nxp") { import("//build_overrides/nxp_sdk.gni") } else if (chip_device_platform == "psoc6") { @@ -189,9 +187,6 @@ source_set("system_config_header") { if (chip_device_platform == "k32w0") { public_deps += [ "${k32w0_sdk_build_root}:k32w0_sdk" ] } - if (chip_device_platform == "k32w1") { - public_deps += [ "${k32w1_sdk_build_root}:k32w1_sdk" ] - } if (chip_device_platform == "nxp") { public_deps += [ "${nxp_sdk_build_root}:nxp_sdk" ] } diff --git a/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py b/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py index d99d25e5d2b8b2..af6544d8856020 100755 --- a/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py +++ b/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py @@ -52,7 +52,7 @@ TEST_EXTPANID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" -TEST_END_DEVICE_APP = "lit-icd-app" +TEST_END_DEVICE_APP = "chip-all-clusters-app" TEST_SUBSCRIPTION_CAPACITY = 3 diff --git a/src/test_driver/linux-cirque/SubscriptionResumptionTest.py b/src/test_driver/linux-cirque/SubscriptionResumptionTest.py index 47de0f4f4a1d79..18fa1205289efd 100755 --- a/src/test_driver/linux-cirque/SubscriptionResumptionTest.py +++ b/src/test_driver/linux-cirque/SubscriptionResumptionTest.py @@ -46,7 +46,7 @@ TEST_EXTPANID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" -TEST_END_DEVICE_APP = "lit-icd-app" +TEST_END_DEVICE_APP = "chip-all-clusters-app" DEVICE_CONFIG = { 'device0': { diff --git a/src/transport/UnauthenticatedSessionTable.h b/src/transport/UnauthenticatedSessionTable.h index 48e2025d10a487..f5ba35df533de5 100644 --- a/src/transport/UnauthenticatedSessionTable.h +++ b/src/transport/UnauthenticatedSessionTable.h @@ -285,17 +285,26 @@ class UnauthenticatedSessionTable return CHIP_NO_ERROR; } -#if !CHIP_SYSTEM_CONFIG_POOL_USE_HEAP +#if CHIP_SYSTEM_CONFIG_POOL_USE_HEAP + // permanent failure if heap was insufficient + return CHIP_ERROR_NO_MEMORY; +#else entryToUse = FindLeastRecentUsedEntry(); -#endif // CHIP_SYSTEM_CONFIG_POOL_USE_HEAP + VerifyOrReturnError(entryToUse != nullptr, CHIP_ERROR_NO_MEMORY); + + // Drop the least recent entry to allow for a new alloc. + mEntries.ReleaseObject(entryToUse); + entryToUse = mEntries.CreateObject(sessionRole, ephemeralInitiatorNodeID, config, *this); + if (entryToUse == nullptr) { - return CHIP_ERROR_NO_MEMORY; + // this is NOT expected: we freed an object to have space + return CHIP_ERROR_INTERNAL; } - mEntries.ResetObject(entryToUse, sessionRole, ephemeralInitiatorNodeID, config, *this); entry = entryToUse; return CHIP_NO_ERROR; +#endif // CHIP_SYSTEM_CONFIG_POOL_USE_HEAP } CHECK_RETURN_VALUE UnauthenticatedSession * FindEntry(UnauthenticatedSession::SessionRole sessionRole, diff --git a/third_party/imgui/repo b/third_party/imgui/repo index f50ddc431e3b88..536090303a8fca 160000 --- a/third_party/imgui/repo +++ b/third_party/imgui/repo @@ -1 +1 @@ -Subproject commit f50ddc431e3b8840036e88abc4c3cf74500aa12b +Subproject commit 536090303a8fca7d896f77d6d63dc59249bc87f4 diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index 6b36a5db07ae0e..ede909f99ab6e6 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit 6b36a5db07ae0e299c9e67f526c28db93e586e25 +Subproject commit ede909f99ab6e6a958a41e365251c2a1d2c4ed4d diff --git a/third_party/nxp/k32w1_sdk/BUILD.gn b/third_party/nxp/k32w1_sdk/BUILD.gn index 8173cdd0df7863..9a6cf009555de3 100644 --- a/third_party/nxp/k32w1_sdk/BUILD.gn +++ b/third_party/nxp/k32w1_sdk/BUILD.gn @@ -12,10 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") + import("//build_overrides/mbedtls.gni") -import("${k32w1_sdk_build_root}/k32w1_sdk.gni") +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") + import("${mbedtls_root}/mbedtls.gni") declare_args() { @@ -25,7 +29,7 @@ declare_args() { assert(k32w1_sdk_target != "", "k32w1_sdk_target must be specified") -group("k32w1_sdk") { +group("nxp_sdk") { public_deps = [ k32w1_sdk_target ] } @@ -63,6 +67,12 @@ config("mbedtls_k32w1_config") { ] } + if (chip_crypto == "platform") { + defines += [ + # "MBEDTLS_CCM_ALT", + ] + } + include_dirs = [ chip_root ] } @@ -75,7 +85,7 @@ mbedtls_target("mbedtls") { public_configs = [ ":mbedtls_k32w1_config" ] public_deps = [ - ":k32w1_sdk", + ":nxp_sdk", "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w1:openthread_mbedtls_config_k32w1", ] } diff --git a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni index 14f355b9da068c..7a8bf40afe7a04 100644 --- a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni +++ b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni @@ -13,27 +13,46 @@ # limitations under the License. import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") + +import("//build_overrides/nxp_sdk.gni") + import("//build_overrides/mbedtls.gni") import("//build_overrides/openthread.gni") import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/src/crypto/crypto.gni") -import("${chip_root}/src/lib/core/core.gni") + import("${chip_root}/src/platform/device.gni") -import("${chip_root}/src/platform/nxp/k32w/k32w1/args.gni") + +import("${chip_root}/src/lib/core/core.gni") +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") + +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") declare_args() { # Location of the k32w1 SDK. k32w1_sdk_root = getenv("NXP_K32W1_SDK_ROOT") - use_smu2_as_system_memory = false + use_smu2_static = false + use_smu2_dynamic = false + use_hw_sha256 = false + use_hw_aes = false + + # ICD Matter Configuration flags + chip_ot_idle_interval_ms = 2000 # 2s Idle Intervals + chip_ot_active_interval_ms = 500 # 500ms Active Intervals + + nxp_idle_mode_interval_s = 600 # 10min Idle Mode Interval + nxp_active_mode_interval_ms = 10000 # 10s Active Mode Interval + nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold + nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric } openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" assert(k32w1_sdk_root != "", "k32w1_sdk_root must be specified") -assert(!(use_smu2_as_system_memory && !chip_openthread_ftd), +assert(!((use_smu2_static && !chip_openthread_ftd) || + (use_smu2_dynamic && !chip_openthread_ftd)), "SMU2 can be used as system memory only with OT-FTD suppport") # Defines an k32w1 SDK build target. @@ -64,7 +83,7 @@ template("k32w1_sdk") { _sdk_include_dirs = [ "${k32w1_sdk_root}/devices/K32W1480", "${k32w1_sdk_root}/CMSIS/Core/Include", - "${k32w1_sdk_root}/platform/drivers/snt", + "${k32w1_sdk_root}/platform/drivers/elemu", "${k32w1_sdk_root}/platform/drivers/spc", "${k32w1_sdk_root}/platform/drivers/ccm32k", "${k32w1_sdk_root}/platform/drivers/wuu", @@ -114,6 +133,7 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/include", "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/include/platform/k32w1", + "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/include/environment/freertos", "${k32w1_sdk_root}/middleware/multicore/mcmgr/src", "${k32w1_sdk_root}/middleware/wireless/ble_controller/interface", @@ -130,7 +150,7 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/middleware/mbedtls/include/mbedtls", "${k32w1_sdk_root}/middleware/mbedtls/include", "${k32w1_sdk_root}/middleware/secure-subsystem/inc", - "${k32w1_sdk_root}/middleware/secure-subsystem/inc/snt", + "${k32w1_sdk_root}/middleware/secure-subsystem/inc/elemu", "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1", "${k32w1_sdk_root}/middleware/wireless/XCVR/drv", @@ -187,7 +207,6 @@ template("k32w1_sdk") { "SERIAL_MANAGER_NON_BLOCKING_MODE=1", "SERIAL_USE_CONFIGURE_STRUCTURE=1", "SDK_COMPONENT_INTEGRATION=1", - "SERIAL_PORT_TYPE_UART=1", "gSerialManagerMaxInterfaces_c=1", "SDK_OS_FREE_RTOS", "gAppHighSystemClockFrequency_d=1", @@ -206,15 +225,15 @@ template("k32w1_sdk") { "gAppLowpowerEnabled_d=1", "BUTTON_SHORT_PRESS_THRESHOLD=1500", "BUTTON_LONG_PRESS_THRESHOLD=2500", - "SSS_CONFIG_FILE=\"fsl_sss_config_snt.h\"", - "SSCP_CONFIG_FILE=\"fsl_sscp_config_snt.h\"", + "SSS_CONFIG_FILE=\"fsl_sss_config_elemu.h\"", + "SSCP_CONFIG_FILE=\"fsl_sscp_config_elemu.h\"", "SDK_DEBUGCONSOLE=1", "NO_SYSCORECLK_UPD=0", "USE_RTOS=1", "USE_SDK_OSA=0", "FSL_RTOS_FREE_RTOS=1", - "MinimalHeapSize_c=0x8C00", + "MinimalHeapSize_c=0x7C00", "gMemManagerLightExtendHeapAreaUsage=0", "DEBUG_SERIAL_INTERFACE_INSTANCE=0", "APP_SERIAL_INTERFACE_INSTANCE=1", @@ -249,8 +268,23 @@ template("k32w1_sdk") { # gConnectPowerLeveldBm_c "gAdvertisingPowerLeveldBm_c=0", "gConnectPowerLeveldBm_c=0", + + #move these platform specific defines to args.gni + "NXP_OT_IDLE_INTERVAL=${chip_ot_idle_interval_ms}", + "NXP_OT_ACTIVE_INTERVAL=${chip_ot_active_interval_ms}", + "NXP_ICD_ENABLED=1", + "NXP_ACTIVE_MODE_THRESHOLD=${nxp_active_mode_threshold_ms}", + "NXP_ACTIVE_MODE_INTERVAL=${nxp_active_mode_interval_ms}", + "NXP_IDLE_MODE_INTERVAL=${nxp_idle_mode_interval_s}", + "NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${nxp_icd_supported_clients_per_fabric}", ] + if (chip_enable_pw_rpc) { + defines += [ "SERIAL_PORT_TYPE_UART_DMA=1" ] + } else { + defines += [ "SERIAL_PORT_TYPE_UART=1" ] + } + if (chip_with_low_power == 1 && chip_logging == true) { print( "WARNING: enabling logs in low power might break the LP timings. Use at your own risk!") @@ -270,13 +304,25 @@ template("k32w1_sdk") { defines += [ "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1" ] } - if (use_smu2_as_system_memory) { + if (use_smu2_static) { defines += [ "__STARTUP_CLEAR_SMU2", "USE_SMU2_AS_SYSTEM_MEMORY", + "USE_SMU2_STATIC", + ] + } + + if (use_smu2_dynamic) { + defines += [ + "USE_SMU2_AS_SYSTEM_MEMORY", + "USE_SMU2_DYNAMIC", ] } + if (chip_with_factory_data == 1) { + defines += [ "CONFIG_CHIP_LOAD_REAL_FACTORY_DATA=1" ] + } + if (chip_with_low_power == 1) { defines += [ "chip_with_low_power=1", @@ -304,6 +350,14 @@ template("k32w1_sdk") { ] } + if (use_hw_sha256) { + defines += [ "USE_HW_SHA256" ] + } + + if (use_hw_aes) { + defines += [ "USE_HW_AES" ] + } + if (defined(invoker.defines)) { defines += invoker.defines } @@ -348,6 +402,7 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_clock.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_cmc.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_crc.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_elemu.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_gpio.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_imu.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_controller.c", @@ -356,7 +411,6 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lptmr.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_ltc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_snt.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_spc.c", "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_wuu.c", "${k32w1_sdk_root}/devices/K32W1480/utilities/debug_console/fsl_debug_console.c", @@ -364,6 +418,13 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/devices/K32W1480/utilities/str/fsl_str.c", "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/matter/ble_init.c", ] + + if (chip_enable_pw_rpc) { + sources += [ + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_edma.c", + "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart_edma.c", + ] + } } else { sources += [ "${k32w1_sdk_root}/devices/KW45B41Z83/drivers/fsl_clock.c", @@ -371,6 +432,7 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/platform/drivers/ccm32k/fsl_ccm32k.c", "${k32w1_sdk_root}/platform/drivers/cmc/fsl_cmc.c", "${k32w1_sdk_root}/platform/drivers/crc/fsl_crc.c", + "${k32w1_sdk_root}/platform/drivers/elemu/fsl_elemu.c", "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_controller.c", "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_flash.c", "${k32w1_sdk_root}/platform/drivers/gpio/fsl_gpio.c", @@ -379,13 +441,19 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/platform/drivers/lptmr/fsl_lptmr.c", "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart.c", "${k32w1_sdk_root}/platform/drivers/ltc/fsl_ltc.c", - "${k32w1_sdk_root}/platform/drivers/snt/fsl_snt.c", "${k32w1_sdk_root}/platform/drivers/spc/fsl_spc.c", "${k32w1_sdk_root}/platform/drivers/wuu/fsl_wuu.c", "${k32w1_sdk_root}/platform/utilities/assert/fsl_assert.c", "${k32w1_sdk_root}/platform/utilities/debug_console/fsl_debug_console.c", "${k32w1_sdk_root}/platform/utilities/str/fsl_str.c", ] + + if (chip_enable_pw_rpc) { + sources += [ + "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_edma.c", + "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart_edma.c", + ] + } } sources += [ @@ -422,7 +490,9 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/virtio/virtqueue.c", "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes.c", "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes_cmac.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ccm.c", "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ecdh.c", + "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_hmac_sha256.c", "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_init.c", "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_sha256.c", "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sscp_mu.c", @@ -460,6 +530,7 @@ template("k32w1_sdk") { "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_extflash.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ics.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_lowpower.c", + "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_lowpower_timer.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ot.c", "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ota.c", "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/PhyTime.c", diff --git a/third_party/nxp/k32w1_sdk/nxp_arm.gni b/third_party/nxp/k32w1_sdk/nxp_arm.gni new file mode 100644 index 00000000000000..78d1036cc8536a --- /dev/null +++ b/third_party/nxp/k32w1_sdk/nxp_arm.gni @@ -0,0 +1,23 @@ +# 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. + +import("//build_overrides/nxp_sdk.gni") +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +assert(nxp_platform == "k32w/k32w1", "${nxp_platform} must be k32w/k32w1.") + +arm_arch = "armv8-m.main+dsp+fp" +arm_cpu = "cortex-m33" +arm_fpu = "fpv5-sp-d16" +arm_float_abi = "hard" diff --git a/third_party/nxp/k32w1_sdk/nxp_executable.gni b/third_party/nxp/k32w1_sdk/nxp_executable.gni new file mode 100644 index 00000000000000..bc78dfc13bf95c --- /dev/null +++ b/third_party/nxp/k32w1_sdk/nxp_executable.gni @@ -0,0 +1,34 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +import("${build_root}/toolchain/flashable_executable.gni") + +template("k32w1_executable") { + output_base_name = get_path_info(invoker.output_name, "name") + objcopy_image_name = output_base_name + ".srec" + objcopy_image_format = "srec" + objcopy = "arm-none-eabi-objcopy" + + # Copy flashing dependencies to the output directory so that the output + # is collectively self-contained; this allows flashing to work reliably + # even if the build and flashing steps take place on different machines + # or in different containers. + + flashable_executable(target_name) { + forward_variables_from(invoker, "*") + } +} diff --git a/third_party/openthread/ot-nxp b/third_party/openthread/ot-nxp index eb23212ca1e329..0a8fcca1828cac 160000 --- a/third_party/openthread/ot-nxp +++ b/third_party/openthread/ot-nxp @@ -1 +1 @@ -Subproject commit eb23212ca1e329a29c95c29c09438c8f2256d5c6 +Subproject commit 0a8fcca1828cac3e3d70577010c365b4dc8e3d66 diff --git a/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn b/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn index 341c8960ede578..446768b23b778c 100644 --- a/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn +++ b/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn @@ -13,9 +13,12 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/k32w1_sdk.gni") +import("//build_overrides/nxp_sdk.gni") import("//build_overrides/openthread.gni") -import("${chip_root}/third_party/nxp/k32w1_sdk/k32w1_sdk.gni") + +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" @@ -28,7 +31,16 @@ config("openthread_k32w1_config") { "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1", "MBEDTLS_ENTROPY_HARDWARE_ALT=1", "OPENTHREAD_PLATFORM_CORE_CONFIG_FILE=\"app/project_include/OpenThreadConfig.h\"", + "MBEDTLS_THREADING_C=1", + "MBEDTLS_THREADING_ALT=1", ] + + if (use_smu2_dynamic) { + defines += [ + "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1", + "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0", + ] + } } source_set("openthread_core_config_k32w1") { @@ -46,13 +58,13 @@ source_set("openthread_mbedtls_config_k32w1") { source_set("libopenthread-k32w1") { sources = [ + "${openthread_nxp_root}/src/common/crypto.c", "${openthread_nxp_root}/src/common/flash_nvm.c", "${openthread_nxp_root}/src/k32w1/k32w1/alarm.c", "${openthread_nxp_root}/src/k32w1/k32w1/diag.c", "${openthread_nxp_root}/src/k32w1/k32w1/entropy.c", "${openthread_nxp_root}/src/k32w1/k32w1/logging.c", "${openthread_nxp_root}/src/k32w1/k32w1/misc.c", - "${openthread_nxp_root}/src/k32w1/k32w1/power.c", "${openthread_nxp_root}/src/k32w1/k32w1/radio.c", "${openthread_nxp_root}/src/k32w1/k32w1/system.c", "${openthread_nxp_root}/src/k32w1/k32w1/uart.c", @@ -60,6 +72,14 @@ source_set("libopenthread-k32w1") { if (chip_crypto == "platform") { sources += [ "${openthread_nxp_root}/src/k32w1/k32w1/ecdsa_sss.cpp" ] + + if (use_hw_sha256) { + sources += [ "${openthread_nxp_root}/src/k32w1/k32w1/sha256_sss.cpp" ] + } + + if (use_hw_aes) { + sources += [ "${openthread_nxp_root}/src/k32w1/k32w1/aes_sss.cpp" ] + } } if (chip_with_ot_cli == 1) { @@ -68,7 +88,7 @@ source_set("libopenthread-k32w1") { public_deps = [ ":openthread_core_config_k32w1", - "${k32w1_sdk_build_root}:k32w1_sdk", + "${nxp_sdk_build_root}:nxp_sdk", "${openthread_root}/src/core:libopenthread_core_headers", "../../..:libopenthread-platform", "../../..:libopenthread-platform-utils", diff --git a/third_party/openthread/repo b/third_party/openthread/repo index cf357d70be94e6..b212a0a748070c 160000 --- a/third_party/openthread/repo +++ b/third_party/openthread/repo @@ -1 +1 @@ -Subproject commit cf357d70be94e6f3f21d07b3c16e29bb7ec5cc7e +Subproject commit b212a0a748070ccbda765c3ebed2aab8b6b08fce diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index fd560b150c0d53..f3bf92d768d543 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -267,8 +267,8 @@ template("siwx917_sdk") { defines += [ "SL_ICD_ENABLED=1", "SL_ACTIVE_MODE_THRESHOLD=${sl_active_mode_threshold_ms}", - "SL_ACTIVE_MODE_INTERVAL=${sl_active_mode_interval_ms}", - "SL_IDLE_MODE_INTERVAL=${sl_idle_mode_interval_s}", + "SL_ACTIVE_MODE_DURATION_MS=${sl_active_mode_duration_ms}", + "SL_IDLE_MODE_DURATION_S=${sl_idle_mode_duration_s}", "SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${sl_icd_supported_clients_per_fabric}", "SL_SI91X_MCU_WIRELESS_BASED_WAKEUP=1", "SL_SI91X_MCU_BUTTON_BASED_WAKEUP=1", diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 415f89b4db04fb..bed0a1e43c308d 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -54,8 +54,8 @@ declare_args() { sl_ot_csl_timeout_sec = 30 # 30s CSL timeout # ICD Matter Configuration flags - sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval - sl_active_mode_interval_ms = 1000 # 1s Active Mode Interval + sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration + sl_active_mode_duration_ms = 1000 # 1s Active Mode Duration sl_active_mode_threshold_ms = 500 # 500ms Active Mode Threshold sl_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric sl_use_subscription_synching = false @@ -420,8 +420,8 @@ template("efr32_sdk") { defines += [ "SL_ICD_ENABLED=1", "SL_ACTIVE_MODE_THRESHOLD=${sl_active_mode_threshold_ms}", - "SL_ACTIVE_MODE_INTERVAL=${sl_active_mode_interval_ms}", - "SL_IDLE_MODE_INTERVAL=${sl_idle_mode_interval_s}", + "SL_ACTIVE_MODE_DURATION_MS=${sl_active_mode_duration_ms}", + "SL_IDLE_MODE_DURATION_S=${sl_idle_mode_duration_s}", "SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${sl_icd_supported_clients_per_fabric}", ] diff --git a/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py b/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py new file mode 100644 index 00000000000000..fbdf81b0dfd8fa --- /dev/null +++ b/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py @@ -0,0 +1,63 @@ +# Copyright 2020 Texas Instruments Incorporated + +"""A wrapper to run the SDK makefiles for Platform driver generation +Args: +1. [TI Simplelink SDK Root] +2. [Matter repository Root] +3. [Path to built drivers in repo] +""" + +import argparse +import os +import shutil +import subprocess +import sys + +parser = argparse.ArgumentParser() +parser.add_argument('--sdk', help="TI SDK root") +parser.add_argument('--chip-root', help="CHIP Root") +parser.add_argument('--src-path', help="the path where the built drivers exist") +parser.add_argument('--dest-path', help="path where drivers will be copied to") + +args = parser.parse_args() + +ret = False + +if os.getenv('_PW_ACTUAL_ENVIRONMENT_ROOT'): + CHIP_ENV_ROOT = os.getenv('_PW_ACTUAL_ENVIRONMENT_ROOT') +else: + CHIP_ENV_ROOT = os.path.join(args.chip_root, ".environment") + +GCC_ARMCOMPILER_PATH = os.path.join(CHIP_ENV_ROOT, "cipd", "packages", "arm") + +if not os.path.isdir(GCC_ARMCOMPILER_PATH): + print("Compiler Path is invalid: " + GCC_ARMCOMPILER_PATH) + sys.exit(2) + +source_file = args.sdk + args.src_path +dest_path = args.dest_path + +make_command = ["make", "-C", args.sdk, "CMAKE=cmake", "GCC_ARMCOMPILER=" + + GCC_ARMCOMPILER_PATH, "IAR_ARMCOMPILER=", "TICLANG_ARMCOMPILER=", "GENERATOR=Ninja"] + +pid = os.fork() +if pid: + status = os.wait() + if os.path.exists(source_file): + shutil.copy(source_file, dest_path) + else: + print("Driver does not exist or path is incorrect.") + sys.exit(2) + +else: + make_command = ["make", "-C", args.sdk, "CMAKE=cmake", "GCC_ARMCOMPILER=" + + GCC_ARMCOMPILER_PATH, "IAR_ARMCOMPILER=", "TICLANG_ARMCOMPILER=", "GENERATOR=Ninja"] + res = subprocess.run(make_command, capture_output=True, encoding="utf8") + if res.returncode != 0: + print("!!!!!!!!!!!! EXEC FAILED !!!!!!!!!!!!!!!!") + print("!!!!!!!!!!!!!!! STDOUT !!!!!!!!!!!!!!!!!!") + print("%s" % res.stdout) + print("!!!!!!!!!!!!!!! STDERR !!!!!!!!!!!!!!!!!!") + print("%s" % res.stderr) + print("res.returncode: %d", res.returncode) + sys.exit(1) diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_board.gni b/third_party/ti_simplelink_sdk/ti_simplelink_board.gni index 747ca4adcbea49..e1828c9f88f302 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_board.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_board.gni @@ -76,12 +76,14 @@ if (ti_simplelink_board == "CC1352R1_LAUNCHXL") { } else if (ti_simplelink_board == "CC3220SF_LAUNCHXL") { ti_simplelink_device_family = "cc32xx" ti_simplelink_soc_family = "cc32xx" + ti_simplelink_isa = "m4" # set -DDeviceFamily_CC3220 ti_simplelink_soc = "cc32xxSF" } else if (ti_simplelink_board == "CC3235SF_LAUNCHXL") { ti_simplelink_device_family = "cc32xx" ti_simplelink_soc_family = "cc32xx" + ti_simplelink_isa = "m4" # set -DDeviceFamily_CC3220 ti_simplelink_soc = "cc32xxSF" diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index ce836e6a5e8567..98a6acb916d30e 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -58,53 +58,58 @@ template("ti_sysconfig") { gen_outputs += [ output_dir + "/" + output ] } + config("cc13x2_26x2_${target_name}_config") { + ldflags = [ + "-nostartfiles", + "-fno-exceptions", + "-fno-unwind-tables", + ] + defines = [ "DeviceFamily_CC13X2_CC26X2" ] + } + + config("cc13x2x7_26x2x7_${target_name}_config") { + ldflags = [ + "-nostartfiles", + "-fno-exceptions", + "-fno-unwind-tables", + ] + defines = [ "DeviceFamily_CC26X2X7" ] + } + + config("cc13x4_26x4_${target_name}_config") { + ldflags = [ + "-nostartfiles", + "-fno-exceptions", + "-fno-unwind-tables", + ] + if (ti_simplelink_device == "") { + defines = [ "DeviceFamily_CC13X4" ] + } else { + defines = [ "DeviceFamily_CC26X4" ] + } + } + + config("cc32xx_${target_name}_config") { + ldflags = [ "-nostartfiles" ] + defines = [ "CC32XXWARE" ] + } + config("${target_name}_config") { include_dirs = [ output_dir, "${ti_simplelink_sdk_root}/source", ] - defines = [] - ldflags = [] + forward_variables_from(invoker, + [ + "cflags", + "ldflags", + ]) if (defined(invoker.include_dirs)) { include_dirs += invoker.include_dirs } - if (ti_simplelink_device_family == "cc13x2_26x2") { - ldflags += [ - "-nostartfiles", - "-fno-exceptions", - "-fno-unwind-tables", - ] - defines += [ "DeviceFamily_CC13X2_CC26X2" ] - } else if (ti_simplelink_device_family == "cc13x2x7_26x2x7") { - ldflags += [ - "-nostartfiles", - "-fno-exceptions", - "-fno-unwind-tables", - ] - defines += [ "DeviceFamily_CC26X2X7" ] - } else if (ti_simplelink_device_family == "cc13x4_26x4") { - ldflags += [ - "-nostartfiles", - "-fno-exceptions", - "-fno-unwind-tables", - ] - if (ti_simplelink_device == "") { - defines += [ "DeviceFamily_CC13X4" ] - } else { - defines += [ "DeviceFamily_CC26X4" ] - } - } else if (ti_simplelink_device_family == "cc32xx") { - ldflags += [ "-nostartfiles" ] - defines += [ "CC32XXWARE" ] - } - if (defined(invoker.cflags)) { - cflags = invoker.cflags - } - if (defined(invoker.ldflags)) { - ldflags += invoker.ldflags - } + configs = [ ":${ti_simplelink_device_family}_${target_name}_config" ] } pw_python_action("${target_name}_gen") { @@ -168,101 +173,104 @@ template("ti_sysconfig") { } template("ti_simplelink_sdk") { + assert(ti_simplelink_sdk_root != "", + "ti_simplelink_sdk_root must be specified") + + action("build_external_library") { + script = "${ti_simplelink_sdk_build_root}/run_sdk_drivers_gen.py" + outputs = [ "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a" ] + args = [ + "--sdk", + rebase_path(ti_simplelink_sdk_root), + "--chip-root", + rebase_path(chip_root), + "--src-path", + "/source/ti/drivers/lib/gcc/${ti_simplelink_isa}/drivers_${ti_simplelink_soc_family}.a", + "--dest-path", + rebase_path(target_gen_dir), + ] + } + if (defined(invoker.ti_simplelink_sdk_root)) { ti_simplelink_sdk_root = invoker.ti_simplelink_sdk_root } - assert(ti_simplelink_sdk_root != "", - "ti_simplelink_sdk_root must be specified") - sdk_target_name = target_name - config("${sdk_target_name}_config") { - include_dirs = [] - libs = [] - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } + config("cc13x2_26x2_sdk_config") { + libs = [ + "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib", + ] + defines = [ "DeviceFamily_CC13X2_CC26X2" ] + } - # Treat these includes as system includes, so warnings in them are not fatal. - include_dirs += [ - "${ti_simplelink_sdk_root}/source", - "${ti_simplelink_sdk_root}/source/third_party/CMSIS/Include", - "${chip_root}/third_party/mbedtls/repo/include", + config("cc13x2x7_26x2x7_sdk_config") { + libs = [ + "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/driverlib/bin/gcc/driverlib.lib", ] - defines = [] + defines = [ "DeviceFamily_CC13X2X7_CC26X2X7" ] + } - if (ti_simplelink_device_family == "cc13x2x7_26x2x7") { - libs += [ - "${ti_simplelink_sdk_root}/source/ti/drivers/lib/gcc/${ti_simplelink_isa}/drivers_${ti_simplelink_soc_family}.a", - "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_cc13x2.a", - ] - } else if (ti_simplelink_device_family == "cc13x2_26x2" || - ti_simplelink_device_family == "cc13x2x7_26x2x7" || - ti_simplelink_device_family == "cc13x4_26x4") { - assert(ti_simplelink_soc_family != "", - "ti_simplelink_soc_family must be specified") - assert(ti_simplelink_device_family != "", - "ti_simplelink_device_family must be specified") + config("cc13x4_26x4_sdk_config") { + libs = [ + "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib/bin/gcc/driverlib.lib", + ] + defines = [ "FLASH_ONLY_BUILD" ] + if (ti_simplelink_device == "") { + defines += [ "DeviceFamily_CC13X4" ] + } else { + defines += [ "DeviceFamily_CC26X4" ] + } + if (ti_simplelink_board == "LP_EM_CC1354P10_1" || + (ti_simplelink_board == "CC2674" && + ti_simplelink_device == "CC2674R10RGZ")) { + defines += [ "EM_CC1354P10_1_LP" ] + } + } - libs += [ - "${ti_simplelink_sdk_root}/source/ti/drivers/lib/gcc/${ti_simplelink_isa}/drivers_${ti_simplelink_soc_family}.a", - "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", - ] - } else if (ti_simplelink_device_family == "cc32xx") { - assert(ti_simplelink_soc_family != "", - "ti_simplelink_soc_family must be specified") - assert(ti_simplelink_device_family != "", - "ti_simplelink_device_family must be specified") + config("cc32xx_sdk_config") { + defines = [ "DeviceFamily_CC3220" ] - defines += [ "DeviceFamily_CC3220" ] + libs = [ + "${ti_simplelink_sdk_root}/source/ti/drivers/lib/gcc/m4/drivers_cc32xx.a", + "${ti_simplelink_sdk_root}/source/ti/devices/cc32xx/driverlib/gcc/Release/driverlib.a", + "${ti_simplelink_sdk_root}/source/ti/drivers/net/wifi/gcc/rtos/simplelink.a", + "${ti_simplelink_sdk_root}/source/ti/net/lib/gcc/m4/slnetsock_debug.a", + "${ti_simplelink_sdk_root}/source/ti/drivers/net/wifi/slnetif/gcc/Release/slnetifwifi.a", + "${ti_simplelink_sdk_root}/source/ti/drivers/lib/gcc/m4/drivers_${ti_simplelink_soc_family}.a", + ] + include_dirs = [ + "${ti_simplelink_sdk_root}/examples/rtos/common/", + "${ti_simplelink_sdk_root}/examples/rtos/common/ifmod", + ] + } - libs += [ - "${ti_simplelink_sdk_root}/source/ti/drivers/lib/gcc/m4/drivers_cc32xx.a", - "${ti_simplelink_sdk_root}/source/ti/devices/cc32xx/driverlib/gcc/Release/driverlib.a", - "${ti_simplelink_sdk_root}/source/ti/drivers/net/wifi/gcc/rtos/simplelink.a", - "${ti_simplelink_sdk_root}/source/ti/net/lib/gcc/m4/slnetsock_debug.a", - "${ti_simplelink_sdk_root}/source/ti/drivers/net/wifi/slnetif/gcc/Release/slnetifwifi.a", - ] - include_dirs += [ - "${ti_simplelink_sdk_root}/examples/rtos/common/", - "${ti_simplelink_sdk_root}/examples/rtos/common/ifmod", - ] - } + config("external_library_config") { + libs = [ "${target_gen_dir}/drivers_cc13x4.a" ] + } - if (ti_simplelink_device_family == "cc13x2_26x2") { - defines += [ "DeviceFamily_CC13X2_CC26X2" ] - libs += [ "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib" ] - } else if (ti_simplelink_device_family == "cc13x2x7_26x2x7") { - defines += [ "DeviceFamily_CC13X2X7_CC26X2X7" ] - libs += [ "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/driverlib/bin/gcc/driverlib.lib" ] - } else if (ti_simplelink_device_family == "cc13x4_26x4") { - if (ti_simplelink_device == "") { - defines += [ "DeviceFamily_CC13X4" ] - } else { - defines += [ "DeviceFamily_CC26X4" ] - } - if (ti_simplelink_board == "LP_EM_CC1354P10_1" || - (ti_simplelink_board == "CC2674" && - ti_simplelink_device == "CC2674R10RGZ")) { - defines += [ "EM_CC1354P10_1_LP" ] - } - defines += [ "FLASH_ONLY_BUILD" ] - libs += [ "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib/bin/gcc/driverlib.lib" ] - } + group("external_library") { + public_configs = [ ":external_library_config" ] + deps = [ ":build_external_library" ] + } - if (ti_simplelink_device_family == "cc32xx") { - assert(ti_simplelink_soc_family != "", - "ti_simplelink_soc_family must be specified") - assert(ti_simplelink_device_family != "", - "ti_simplelink_device_family must be specified") + config("${sdk_target_name}_config") { + include_dirs = [ + "${ti_simplelink_sdk_root}/source", + "${ti_simplelink_sdk_root}/source/third_party/CMSIS/Include", + "${chip_root}/third_party/mbedtls/repo/include", + ] - libs += [ "${ti_simplelink_sdk_root}/source/ti/drivers/lib/gcc/m4/drivers_${ti_simplelink_soc_family}.a" ] + if (defined(invoker.include_dirs)) { + include_dirs += invoker.include_dirs } - if (defined(invoker.defines)) { - defines += invoker.defines - } + forward_variables_from(invoker, [ "defines" ]) + + configs = [ ":${ti_simplelink_device_family}_sdk_config" ] } source_set("${sdk_target_name}_dpl") { @@ -393,7 +401,41 @@ template("ti_simplelink_sdk") { } } - config("${sdk_target_name}_dmm_config") { + config("${sdk_target_name}_cc13x2_26x2_dmm_config") { + defines = [ + "INCLUDE_BGET_STATS", + "USE_DMM", + "NVOCMP_FREERTOS_MUTEX=1", + "USEOT", + "ICALL_EVENTS", + "ICALL_JT", + "ICALL_LITE", + "ICALL_MAX_NUM_ENTITIES=6", + "ICALL_MAX_NUM_TASKS=3", + "ICALL_STACK0_ADDR", + "POWER_SAVING", + "TBM_ACTIVE_ITEMS_ONLY", + "NPI_USE_UART", + "NPI_FLOW_CTRL=0", + "OSAL_CBTIMER_NUM_TASKS=1", + "USE_ICALL", + "BLE_START", + "FREERTOS", + ] + cflags = [ + "-Wno-conversion", + "-Wno-comment", + "-Wno-shadow", + "@" + rebase_path(ti_simplelink_sdk_root + + "/source/ti/ble5stack/config/build_components.opt", + root_build_dir), + "@" + rebase_path(ti_simplelink_sdk_root + + "/source/ti/ble5stack/config/factory_config.opt", + root_build_dir), + ] + } + + config("${sdk_target_name}_cc13x2x7_26x2x7_dmm_config") { include_dirs = [] libs = [] @@ -418,146 +460,218 @@ template("ti_simplelink_sdk") { "FREERTOS", ] - if (ti_simplelink_device_family == "cc13x2x7_26x2x7") { - libs += [ - "${ti_simplelink_sdk_root}/source/ti/dmm/lib/gcc/m4f/libdmmlib_freertos.a", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/libraries/cc26x2r1/OneLib.a", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/libraries/cc26x2r1/StackWrapper.a", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/libraries/cc26x2r1/ble_r2.symbols", - ] + libs += [ + "${ti_simplelink_sdk_root}/source/ti/dmm/lib/gcc/m4f/libdmmlib_freertos.a", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/libraries/cc26x2r1/OneLib.a", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/libraries/cc26x2r1/StackWrapper.a", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/libraries/cc26x2r1/ble_r2.symbols", + ] - defines += [ - "FLASH_ROM_BUILD", - "ONE_BLE_LIB_SIZE_OPTIMIZATION", - "STACK_LIBRARY", - "CC26XX", - "CC26X2", - "CC26X2R1_LAUNCHXL", - ] - include_dirs += [ - # DMM/BLE: - "${ti_simplelink_sdk_root}/source", - - # Eclipse the SDK config header from DMM - "${chip_root}/src/platform/cc13x2_26x2", - - # CHIPoBLE Added include dirs - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/itm", - "${ti_simplelink_sdk_root}/source/ti/dmm/thread/platform", - "${ti_simplelink_sdk_root}/source/", - "${ti_simplelink_sdk_root}/source/ti/", - "${ti_simplelink_sdk_root}/source/ti/dmm/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/source/activity/", - "${ti_simplelink_sdk_root}/source/ti/common/nv", - - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/inc", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/rf_patches", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/driverlib", - - "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/npi/stack/", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/rcosc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/controller/cc26xx/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/rom", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/icall/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/icall/src", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/target/_common", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/target/_common/cc26xx", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/heapmgr", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/profiles/dev_info", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/target/_common/cc26xx/", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/profiles/simple_profile", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/icall/src/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/osal/src/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/controller/cc26xx/inc/", - "${ti_simplelink_sdk_root}/source/ti/common/cc26xx", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos/", - ] - } else if (ti_simplelink_device_family == "cc13x4_26x4") { - libs += [ "${ti_simplelink_sdk_root}/source/ti/dmm/lib/gcc/m33f/libdmmlib_freertos.a" ] - if (ti_simplelink_board == "LP_EM_CC1354P10_1" || - (ti_simplelink_board == "CC2674" && - ti_simplelink_device == "CC2674R10RGZ")) { - libs += [ - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_1/OneLib.a", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_1/StackWrapper.a", - ] - } else if (ti_simplelink_board == "LP_EM_CC1354P10_6" || - (ti_simplelink_board == "CC2674" && - ti_simplelink_device == "CC2674P10RGZ")) { - libs += [ - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_6/OneLib.a", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_6/StackWrapper.a", - ] - } + defines += [ + "FLASH_ROM_BUILD", + "ONE_BLE_LIB_SIZE_OPTIMIZATION", + "STACK_LIBRARY", + "CC26XX", + "CC26X2", + "CC26X2R1_LAUNCHXL", + ] - defines += [ - "ONE_BLE_LIB_SIZE_OPTIMIZATION", - "NVOCMP_NVPAGES=5", - "NVOCMP_NWSAMEITEM=1", - "CC13X2P", - "SYSCFG", - "CC13X4", - "CC13XX", - "EXTENDED_STACK_SETTINGS=EXTENDED_STACK_SETTINGS_DEFAULT", - ] + include_dirs += [ + # DMM/BLE: + "${ti_simplelink_sdk_root}/source", + + # Eclipse the SDK config header from DMM + "${chip_root}/src/platform/cc13x2_26x2", + + # CHIPoBLE Added include dirs + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/itm", + "${ti_simplelink_sdk_root}/source/ti/dmm/thread/platform", + "${ti_simplelink_sdk_root}/source/", + "${ti_simplelink_sdk_root}/source/ti/", + "${ti_simplelink_sdk_root}/source/ti/dmm/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/source/activity/", + "${ti_simplelink_sdk_root}/source/ti/common/nv", + + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/inc", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/rf_patches", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/driverlib", + + "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/npi/stack/", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/rcosc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/controller/cc26xx/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/rom", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/icall/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/icall/src", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/target/_common", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/target/_common/cc26xx", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/heapmgr", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/profiles/dev_info", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/hal/src/target/_common/cc26xx/", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/profiles/simple_profile", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/icall/src/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/osal/src/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/controller/cc26xx/inc/", + "${ti_simplelink_sdk_root}/source/ti/common/cc26xx", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos/", + ] + + cflags = [ + "-Wno-conversion", + "-Wno-comment", + "-Wno-shadow", + "@" + rebase_path(ti_simplelink_sdk_root + + "/source/ti/ble5stack/config/build_components.opt", + root_build_dir), + "@" + rebase_path(ti_simplelink_sdk_root + + "/source/ti/ble5stack/config/factory_config.opt", + root_build_dir), + ] + } + + config("${sdk_target_name}_cc13x4_26x4_dmm_config") { + include_dirs = [] + libs = [] - include_dirs += [ - # DMM/BLE: - "${ti_simplelink_sdk_root}/source", - - # Eclipse the SDK config header from DMM - "${chip_root}/src/platform/cc13x4_26x4", - "${chip_root}/src/platform/cc13xx_26xx", - - # CHIPoBLE Added include dirs - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/itm", - "${ti_simplelink_sdk_root}/source/ti/dmm/thread/platform", - "${ti_simplelink_sdk_root}/source/", - "${ti_simplelink_sdk_root}/source/ti/", - "${ti_simplelink_sdk_root}/source/ti/dmm/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/source/activity/", - "${ti_simplelink_sdk_root}/source/ti/common/nv", - - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/inc", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/rf_patches", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib", - - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx/npi/stack/", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx/rcosc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/controller/cc26xx/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/rom", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx/freertos", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/icall/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/icall/src", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/target/_common", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/target/_common/cc26xx", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/heapmgr", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/profiles/dev_info", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/target/_common/cc26xx/", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/profiles/simple_profile", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/icall/src/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/osal/src/inc", - "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/controller/cc26xx/inc/", - "${ti_simplelink_sdk_root}/source/ti/common/cc26xx", - "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos/", + defines = [ + "INCLUDE_BGET_STATS", + "USE_DMM", + "NVOCMP_FREERTOS_MUTEX=1", + "USEOT", + "ICALL_EVENTS", + "ICALL_JT", + "ICALL_LITE", + "ICALL_MAX_NUM_ENTITIES=6", + "ICALL_MAX_NUM_TASKS=3", + "ICALL_STACK0_ADDR", + "POWER_SAVING", + "TBM_ACTIVE_ITEMS_ONLY", + "NPI_USE_UART", + "NPI_FLOW_CTRL=0", + "OSAL_CBTIMER_NUM_TASKS=1", + "USE_ICALL", + "BLE_START", + "FREERTOS", + ] + libs += [ "${ti_simplelink_sdk_root}/source/ti/dmm/lib/gcc/m4f/libdmmlib_freertos.a" ] + if (ti_simplelink_board == "LP_EM_CC1354P10_1" || + (ti_simplelink_board == "CC2674" && + ti_simplelink_device == "CC2674R10RGZ")) { + libs += [ + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_1/OneLib.a", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_1/StackWrapper.a", + ] + } else if (ti_simplelink_board == "LP_EM_CC1354P10_6" || + (ti_simplelink_board == "CC2674" && + ti_simplelink_device == "CC2674P10RGZ")) { + libs += [ + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_6/OneLib.a", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/libraries/cc1354p10_6/StackWrapper.a", ] } + defines += [ + "ONE_BLE_LIB_SIZE_OPTIMIZATION", + "NVOCMP_NVPAGES=5", + "NVOCMP_NWSAMEITEM=1", + "CC13X2P", + "SYSCFG", + "CC13X4", + "CC13XX", + "EXTENDED_STACK_SETTINGS=EXTENDED_STACK_SETTINGS_DEFAULT", + ] + + include_dirs += [ + # DMM/BLE: + "${ti_simplelink_sdk_root}/source", + + # Eclipse the SDK config header from DMM + "${chip_root}/src/platform/cc13x4_26x4", + "${chip_root}/src/platform/cc13xx_26xx", + + # CHIPoBLE Added include dirs + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/itm", + "${ti_simplelink_sdk_root}/source/ti/dmm/thread/platform", + "${ti_simplelink_sdk_root}/source/", + "${ti_simplelink_sdk_root}/source/ti/", + "${ti_simplelink_sdk_root}/source/ti/dmm/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/", + "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/source/activity/", + "${ti_simplelink_sdk_root}/source/ti/common/nv", + + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/inc", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/rf_patches", + "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib", + + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx/npi/stack/", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx/rcosc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/controller/cc26xx/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/rom", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/common/cc26xx/freertos", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/icall/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/icall/src", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/target/_common", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/target/_common/cc26xx", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/heapmgr", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/profiles/dev_info", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/hal/src/target/_common/cc26xx/", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/profiles/simple_profile", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/icall/src/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/osal/src/inc", + "${ti_simplelink_sdk_root}/source/ti/ble5stack_flash/controller/cc26xx/inc/", + "${ti_simplelink_sdk_root}/source/ti/common/cc26xx", + "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos/", + ] + + cflags = [ + "-Wno-conversion", + "-Wno-comment", + "-Wno-shadow", + "@" + rebase_path(ti_simplelink_sdk_root + + "/source/ti/ble5stack/config/build_components.opt", + root_build_dir), + "@" + rebase_path(ti_simplelink_sdk_root + + "/source/ti/ble5stack/config/factory_config.opt", + root_build_dir), + ] + } + + config("${sdk_target_name}_cc32xx_dmm_config") { + include_dirs = [] + libs = [] + defines = [ + "INCLUDE_BGET_STATS", + "USE_DMM", + "NVOCMP_FREERTOS_MUTEX=1", + "USEOT", + "ICALL_EVENTS", + "ICALL_JT", + "ICALL_LITE", + "ICALL_MAX_NUM_ENTITIES=6", + "ICALL_MAX_NUM_TASKS=3", + "ICALL_STACK0_ADDR", + "POWER_SAVING", + "TBM_ACTIVE_ITEMS_ONLY", + "NPI_USE_UART", + "NPI_FLOW_CTRL=0", + "OSAL_CBTIMER_NUM_TASKS=1", + "USE_ICALL", + "BLE_START", + "FREERTOS", + ] cflags = [ "-Wno-conversion", "-Wno-comment", @@ -643,7 +757,7 @@ template("ti_simplelink_sdk") { public_configs = [ ":${sdk_target_name}_config", - ":${sdk_target_name}_dmm_config", + ":${sdk_target_name}_${ti_simplelink_device_family}_dmm_config", ] } } @@ -652,6 +766,7 @@ template("ti_simplelink_sdk") { public_deps = [ ":${sdk_target_name}_dpl", ":${sdk_target_name}_freertos", + ":build_external_library", ] if (ti_simplelink_device_family == "cc13x2_26x2" || ti_simplelink_device_family == "cc13x2x7_26x2x7" || @@ -663,71 +778,7 @@ template("ti_simplelink_sdk") { } if (defined(invoker.public_configs)) { public_configs = invoker.public_configs + public_configs += [ ":external_library_config" ] } } } - -# "${openthread_root}/src/core:libopenthread_core_headers", - -# config("${sdk_target_name}_openthread_platform_config") { -# include_dirs = [ -# "${chip_root}/third_party/openthread/repo/examples/platforms", -# "${chip_root}/third_party/openthread/repo/src/core", -# "${ti_simplelink_sdk_root}/source/ti/devices/${ti_simplelink_device_family}", -# ] - -# if (ti_simplelink_device_family == "cc13x2_26x2") { -# include_dirs += [ -# "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2_cc26x2", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2", -# ] -# } else if (ti_simplelink_device_family == "cc13x2x7_26x2x7") { -# include_dirs += [ -# "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2", -# ] -# } -# } - -# source_set("${sdk_target_name}_openthread_platform") { -# cflags = [ -# "-Wno-int-conversion", -# "-Wno-address-of-packed-member", -# "-Wno-implicit-fallthrough", -# "-Wno-unused-label", -# ] -# public_deps = [ -# ":${sdk_target_name}_freertos", -# "${chip_root}/third_party/ti_simplelink_sdk:freertos", -# "${chip_root}/third_party/ti_simplelink_sdk:mbedtls", -# "${chip_root}/third_party/ti_simplelink_sdk:ti_simplelink_sysconfig", -# "${openthread_root}/src/core:libopenthread_core_headers", -# ] - -# configs -= [ "${build_root}/config/compiler:std_default" ] -# configs += [ ":${sdk_target_name}_posix_config" ] -# sources = [ -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/alarm.c", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/alarm_micro.c", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/diag.c", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/entropy.c", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/misc.c", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/radio.c", -# "${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/settings.c", -# #"${ot_cc13x2_cc26x2}/src/cc13x2_cc26x2/system.c", -# ] - -# public_configs = [ -# ":${sdk_target_name}_config", -# ":${sdk_target_name}_openthread_platform_config", -# "${chip_root}/third_party/openthread/repo:openthread_config", -# ] - -# if (chip_openthread_ftd) { -# public_configs += -# [ "${chip_root}/third_party/openthread/repo:openthread_ftd_config" ] -# } else { -# public_configs += -# [ "${chip_root}/third_party/openthread/repo:openthread_mtd_config" ] -# } -# }