diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 391e7bde76f92b..6cac33b9ab1f99 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -435,6 +435,7 @@ hciconfig hdlc HKDF hoc +homebrew hostapd hostname href diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 3140094dec60f6..a8888242625839 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -82,7 +82,7 @@ jobs: /tmp/bloat_reports/ - name: Build pigweed-app example - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/examples/mbed_example.sh -a=pigweed-app -b=$APP_TARGET -p=$APP_PROFILE .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ diff --git a/zzz_generated/ota-provider-app/zap-generated/CHIPClustersWrite.cpp b/config/ios/SystemProjectConfig.h similarity index 77% rename from zzz_generated/ota-provider-app/zap-generated/CHIPClustersWrite.cpp rename to config/ios/SystemProjectConfig.h index 759d13c5028d26..06d9baaee59492 100644 --- a/zzz_generated/ota-provider-app/zap-generated/CHIPClustersWrite.cpp +++ b/config/ios/SystemProjectConfig.h @@ -15,4 +15,12 @@ * limitations under the License. */ -// THIS FILE IS GENERATED BY ZAP +/** + * @file + * chip::System project configuration for standalone builds on iOS + * + */ +#ifndef SYSTEMPROJECTCONFIG_H +#define SYSTEMPROJECTCONFIG_H + +#endif /* SYSTEMPROJECTCONFIG_H */ diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index 35343fc1561630..b6a6cf69ea079b 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -69,4 +69,8 @@ #define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 +#ifndef DYNAMIC_ENDPOINT_COUNT +#define DYNAMIC_ENDPOINT_COUNT 4 +#endif + #endif /* CHIPPROJECTCONFIG_H */ diff --git a/docs/README.md b/docs/README.md index f71b164d56f965..9b49300f55f6b8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,7 +6,7 @@ [the build guide](guides/BUILDING.md) - Documentation about running [cirque](https://github.com/openweave/cirque) tests can be found in - [the cirque test guide](src/test_driver/linux-cirque/README.md) + [the cirque test guide](../src/test_driver/linux-cirque/README.md) - Documentation about standard build & development flows using [Visual Studio Code](https://code.visualstudio.com/) can be found in [the development guide](./VSCODE_DEVELOPMENT.md) diff --git a/docs/guides/BUILDING.md b/docs/guides/BUILDING.md index 1d8a4c2b602b65..5a76a187e39fd2 100644 --- a/docs/guides/BUILDING.md +++ b/docs/guides/BUILDING.md @@ -60,6 +60,8 @@ brew install openssl pkg-config However, that does not expose the package to `pkg-config`. To fix that, one needs to run something like the following: +Intel: + ``` cd /usr/local/lib/pkgconfig ln -s ../../Cellar/openssl@1.1/1.1.1g/lib/pkgconfig/* . @@ -68,6 +70,12 @@ ln -s ../../Cellar/openssl@1.1/1.1.1g/lib/pkgconfig/* . where `openssl@1.1/1.1.1g` may need to be replaced with the actual version of OpenSSL installed by Brew. +Apple Silicon: + +``` +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"/opt/homebrew/opt/openssl@3/lib/pkgconfig" +``` + Note: If using MacPorts, `port install openssl` is sufficient to satisfy this dependency. diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h new file mode 100644 index 00000000000000..2d4f674a65920d --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h @@ -0,0 +1,73 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ModeSelect { + +/** + * This implementation statically defines the options. + */ + +class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager +{ + using ModeOptionStructType = Structs::ModeOptionStruct::Type; + using storage_value_type = const ModeOptionStructType; + + struct EndpointSpanPair + { + const EndpointId mEndpointId; + const Span mSpan; + + EndpointSpanPair(const EndpointId aEndpointId, const Span && aSpan) : + mEndpointId(aEndpointId), mSpan(aSpan) + {} + + EndpointSpanPair() : mEndpointId(0), mSpan(Span()) {} + }; + + static storage_value_type coffeeOptions[]; + static const EndpointSpanPair supportedOptionsByEndpoints[EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT]; + +public: + static const StaticSupportedModesManager instance; + + const SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; + + EmberAfStatus getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const override; + + ~StaticSupportedModesManager(){}; + + StaticSupportedModesManager() {} + + static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; } +}; + +const SupportedModesManager * getSupportedModesManager(); + +} // namespace ModeSelect +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp new file mode 100644 index 00000000000000..62a864be8adc68 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp @@ -0,0 +1,71 @@ +#include + +using namespace std; +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ModeSelect; + +using ModeOptionStructType = Structs::ModeOptionStruct::Type; +using storage_value_type = const ModeOptionStructType; +namespace { +Structs::ModeOptionStruct::Type buildModeOptionStruct(const char * label, uint8_t mode, uint32_t semanticTag) +{ + Structs::ModeOptionStruct::Type option; + option.label = CharSpan(label, strlen(label)); + option.mode = mode; + option.semanticTag = semanticTag; + return option; +} +} // namespace + +// TODO: Configure your options for each endpoint +storage_value_type StaticSupportedModesManager::coffeeOptions[] = { buildModeOptionStruct("Black", 0, 0), + buildModeOptionStruct("Cappuccino", 4, 0), + buildModeOptionStruct("Espresso", 7, 0) }; +const StaticSupportedModesManager::EndpointSpanPair + StaticSupportedModesManager::supportedOptionsByEndpoints[EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT] = { + EndpointSpanPair(1, Span(StaticSupportedModesManager::coffeeOptions)) // Options for Endpoint 1 + }; + +const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); + +const SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const +{ + for (auto & endpointSpanPair : supportedOptionsByEndpoints) + { + if (endpointSpanPair.mEndpointId == endpointId) + { + return ModeOptionsProvider(endpointSpanPair.mSpan.data(), endpointSpanPair.mSpan.end()); + } + } + return ModeOptionsProvider(nullptr, nullptr); +} + +EmberAfStatus StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointId, unsigned char mode, + const ModeOptionStructType ** dataPtr) const +{ + auto modeOptionsProvider = this->getModeOptionsProvider(endpointId); + if (modeOptionsProvider.begin() == nullptr) + { + return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER; + } + auto * begin = this->getModeOptionsProvider(endpointId).begin(); + auto * end = this->getModeOptionsProvider(endpointId).end(); + + for (auto * it = begin; it != end; ++it) + { + auto & modeOption = *it; + if (modeOption.mode == mode) + { + *dataPtr = &modeOption; + return EMBER_ZCL_STATUS_SUCCESS; + } + } + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %" PRIu8, mode); + return EMBER_ZCL_STATUS_INVALID_ARGUMENT; +} + +const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() +{ + return &StaticSupportedModesManager::instance; +} diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 7104367e829820..6b0541edb6b76b 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -36,6 +36,7 @@ list( ${chip_dir}/zzz_generated/all-clusters-app/zap-generated/CHIPClusters.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp @@ -63,6 +64,7 @@ target_include_directories( ${chip_dir}/zzz_generated/all-clusters-app/zap-generated ${chip_dir}/zzz_generated/app-common ${chip_dir}/examples/all-clusters-app/all-clusters-common + ${chip_dir}/examples/all-clusters-app/all-clusters-common/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir_output}/gen/include ${chip_dir}/src/include/ diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index d342e16e5beff0..a29e7a7ee086f3 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -19,6 +19,7 @@ # The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/all-clusters-app" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" "${CMAKE_CURRENT_LIST_DIR}/include" ) set(SRC_DIRS_LIST @@ -55,7 +56,8 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-playback-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-provider" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/target-navigator-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread_network_diagnostics_server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/tv-channel-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes" diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index f7b180f4461187..351b79e8f5f316 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -18,6 +18,7 @@ import("//build_overrides/chip.gni") executable("chip-all-clusters-app") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "include/tv-callbacks.cpp", "main.cpp", ] @@ -28,6 +29,9 @@ executable("chip-all-clusters-app") { "${chip_root}/src/lib", ] + include_dirs = + [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] + cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt index a05bf5cca47a4a..2357c24ea3017f 100644 --- a/examples/all-clusters-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-app/mbed/CMakeLists.txt @@ -37,6 +37,8 @@ target_include_directories(${APP_TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/main/include/ ${APP_ROOT}/all-clusters-common + ${APP_ROOT}/all-clusters-common/include + ${APP_CLUSTERS} ${MBED_COMMON}/util/include ${CHIP_ROOT}/src/app ${CHIP_ROOT}/third_party/nlio/repo/include @@ -67,6 +69,7 @@ target_sources(${APP_TARGET} PRIVATE ${CHIP_ROOT}/src/app/server/CommissioningWindowManager.cpp ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp + ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp ${APP_UTIL}/DataModelHandler.cpp ${APP_UTIL}/af-event.cpp @@ -112,7 +115,6 @@ target_sources(${APP_TARGET} PRIVATE ${APP_CLUSTERS}/media-input-server/media-input-server.cpp ${APP_CLUSTERS}/media-playback-server/media-playback-server.cpp ${APP_CLUSTERS}/mode-select-server/mode-select-server.cpp - ${APP_CLUSTERS}/mode-select-server/static-supported-modes-manager.cpp ${APP_CLUSTERS}/network-commissioning/network-commissioning-ember.cpp ${APP_CLUSTERS}/network-commissioning/network-commissioning.cpp ${APP_CLUSTERS}/on-off-server/on-off-server.cpp @@ -120,6 +122,7 @@ target_sources(${APP_TARGET} PRIVATE ${APP_CLUSTERS}/scenes/scenes.cpp ${APP_CLUSTERS}/target-navigator-server/target-navigator-server.cpp ${APP_CLUSTERS}/thermostat-server/thermostat-server.cpp + ${APP_CLUSTERS}/thermostat-user-interface-configuration-server/thermostat-user-interface-configuration-server.cpp ${APP_CLUSTERS}/tv-channel-server/tv-channel-server.cpp ${APP_CLUSTERS}/operational-credentials-server/operational-credentials-server.cpp ${APP_CLUSTERS}/test-cluster-server/test-cluster-server.cpp diff --git a/examples/all-clusters-app/p6/BUILD.gn b/examples/all-clusters-app/p6/BUILD.gn index d34ad7bf427d55..5b99c3f3b3b6f6 100644 --- a/examples/all-clusters-app/p6/BUILD.gn +++ b/examples/all-clusters-app/p6/BUILD.gn @@ -61,6 +61,7 @@ p6_executable("clusters_app") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/init_p6Platform.cpp", "src/AppTask.cpp", @@ -82,6 +83,7 @@ p6_executable("clusters_app") { "include", "${examples_plat_dir}", "${p6_project_dir}/include", + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", ] defines = [] diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 80d17acd86d325..c83caa07ebcb5b 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -74,27 +74,27 @@ static Device gLight4("Light 4", "Den"); // Declare On/Off cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(onOffAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_ON_OFF_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* on/off */ -DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_ON_OFF_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* on/off */ + DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Descriptor cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(descriptorAttrs) DECLARE_DYNAMIC_ATTRIBUTE(ZCL_DEVICE_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* device list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_SERVER_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* server list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CLIENT_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* client list */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0) /* parts list */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* parts list */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Bridged Device Basic information cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(bridgedDeviceBasicAttrs) DECLARE_DYNAMIC_ATTRIBUTE(ZCL_USER_LABEL_ATTRIBUTE_ID, CHAR_STRING, kUserLabelSize, 0), /* UserLabel */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* Reachable */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* Reachable */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Fixed Label cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(fixedLabelAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0) /* label list */ -DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0), /* label list */ + DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Cluster List for Bridged Light endpoint DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedLightClusters) diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 530e255599cc49..2339e88e2ba376 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -94,27 +94,27 @@ static Device * gDevices[DYNAMIC_ENDPOINT_COUNT]; // Declare On/Off cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(onOffAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_ON_OFF_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* on/off */ -DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_ON_OFF_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* on/off */ + DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Descriptor cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(descriptorAttrs) DECLARE_DYNAMIC_ATTRIBUTE(ZCL_DEVICE_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* device list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_SERVER_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* server list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CLIENT_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* client list */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0) /* parts list */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* parts list */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Bridged Device Basic information cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(bridgedDeviceBasicAttrs) DECLARE_DYNAMIC_ATTRIBUTE(ZCL_USER_LABEL_ATTRIBUTE_ID, CHAR_STRING, kUserLabelSize, 0), /* UserLabel */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* Reachable */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* Reachable */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Fixed Label cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(fixedLabelAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0) /* label list */ -DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0), /* label list */ + DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Cluster List for Bridged Light endpoint DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedLightClusters) @@ -135,10 +135,10 @@ DECLARE_DYNAMIC_ENDPOINT(bridgedLightEndpoint, bridgedLightClusters); // Declare Switch cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(switchAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID, INT8U, 1, 0), /* NumberOfPositions */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CURRENT_POSITION_ATTRIBUTE_ID, INT8U, 1, 0), /* CurrentPosition */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID, INT8U, 1, 0), /* MultiPressMax */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_FEATURE_MAP_SERVER_ATTRIBUTE_ID, BITMAP32, 4, 0) /* FeatureMap */ +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID, INT8U, 1, 0), /* NumberOfPositions */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CURRENT_POSITION_ATTRIBUTE_ID, INT8U, 1, 0), /* CurrentPosition */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID, INT8U, 1, 0), /* MultiPressMax */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_FEATURE_MAP_SERVER_ATTRIBUTE_ID, BITMAP32, 4, 0), /* FeatureMap */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Descriptor cluster attributes @@ -146,19 +146,19 @@ DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(switchDescriptorAttrs) DECLARE_DYNAMIC_ATTRIBUTE(ZCL_DEVICE_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* device list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_SERVER_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* server list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CLIENT_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* client list */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0) /* parts list */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* parts list */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Bridged Device Basic information cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(switchBridgedDeviceBasicAttrs) DECLARE_DYNAMIC_ATTRIBUTE(ZCL_USER_LABEL_ATTRIBUTE_ID, CHAR_STRING, kUserLabelSize, 0), /* UserLabel */ - DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* Reachable */ + DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* Reachable */ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Fixed Label cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(switchFixedLabelAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0) /* label list */ -DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0), /* label list */ + DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Cluster List for Bridged Switch endpoint DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedSwitchClusters) diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 7f5a419fe7dd25..67551c0617e951 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -34,8 +34,12 @@ executable("chip-tool") { "commands/discover/DiscoverCommand.cpp", "commands/discover/DiscoverCommissionablesCommand.cpp", "commands/discover/DiscoverCommissionersCommand.cpp", - "commands/pairing/CommissionedListCommand.cpp", - "commands/pairing/CommissionedListCommand.h", + + # TODO - enable CommissionedListCommand once DNS Cache is implemented + # "commands/pairing/CommissionedListCommand.cpp", + # "commands/pairing/CommissionedListCommand.h", + "commands/pairing/ConfigureFabricCommand.cpp", + "commands/pairing/ConfigureFabricCommand.h", "commands/pairing/PairingCommand.cpp", "commands/payload/AdditionalDataParseCommand.cpp", "commands/payload/SetupPayloadParseCommand.cpp", diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 25fdfa8ec7a697..30816eb6cceaf8 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -36,7 +36,7 @@ CHIP_ERROR ModelCommand::RunCommand() return err; } -void ModelCommand::OnDeviceConnectedFn(void * context, chip::Controller::Device * device) +void ModelCommand::OnDeviceConnectedFn(void * context, ChipDevice * device) { ModelCommand * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index c70d35477f80c4..b7135a5dc49ca8 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -31,7 +31,7 @@ class ModelCommand : public CHIPCommand { public: - using ChipDevice = ::chip::Controller::Device; + using ChipDevice = ::chip::DeviceProxy; ModelCommand(const char * commandName) : CHIPCommand(commandName), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), @@ -57,6 +57,6 @@ class ModelCommand : public CHIPCommand static void OnDeviceConnectedFn(void * context, ChipDevice * device); static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); - chip::Callback::Callback mOnDeviceConnectedCallback; - chip::Callback::Callback mOnDeviceConnectionFailureCallback; + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; }; diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index 6d70fc68d8016e..c36b7786c9cd2f 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -61,8 +61,8 @@ CHIP_ERROR CHIPCommand::Run() // TODO - OpCreds should only be generated for pairing command // store the credentials in persistent storage, and // generate when not available in the storage. - ReturnLogErrorOnFailure(mOpCredsIssuer.GenerateNOCChainAfterValidation(mStorage.GetLocalNodeId(), 0, ephemeralKey.Pubkey(), - rcacSpan, icacSpan, nocSpan)); + ReturnLogErrorOnFailure(mOpCredsIssuer.GenerateNOCChainAfterValidation(mStorage.GetLocalNodeId(), mStorage.GetFabricId(), + ephemeralKey.Pubkey(), rcacSpan, icacSpan, nocSpan)); chip::Controller::FactoryInitParams factoryInitParams; factoryInitParams.fabricStorage = &mFabricStorage; diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 9bb5345e8f47fe..51f3aab0994948 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -28,10 +28,9 @@ class PersistentStorage; class CHIPCommand : public Command { public: - using ChipDevice = ::chip::Controller::Device; + using ChipDevice = ::chip::DeviceProxy; using ChipDeviceCommissioner = ::chip::Controller::DeviceCommissioner; using ChipDeviceController = ::chip::Controller::DeviceController; - using ChipSerializedDevice = ::chip::Controller::SerializedDevice; using IPAddress = ::chip::Inet::IPAddress; using NodeId = ::chip::NodeId; using PeerAddress = ::chip::Transport::PeerAddress; diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp b/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp index af7b276d4554a3..653bc23caef3e8 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp +++ b/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp @@ -34,17 +34,18 @@ void DiscoverCommissionablesCommand::OnDiscoveredDevice(const chip::Dnssd::Disco Encoding::BytesToUppercaseHexString(nodeData.rotatingId, nodeData.rotatingIdLen, rotatingId, sizeof(rotatingId)); ChipLogProgress(Discovery, "Discovered Node: "); + ChipLogProgress(Discovery, "\tInstance name:\t\t%s", nodeData.instanceName); ChipLogProgress(Discovery, "\tHost name:\t\t%s", nodeData.hostName); ChipLogProgress(Discovery, "\tPort:\t\t\t%u", nodeData.port); ChipLogProgress(Discovery, "\tLong discriminator:\t%u", nodeData.longDiscriminator); ChipLogProgress(Discovery, "\tVendor ID:\t\t%u", nodeData.vendorId); ChipLogProgress(Discovery, "\tProduct ID:\t\t%u", nodeData.productId); - ChipLogProgress(Discovery, "\tCommissioning Mode\t%u", nodeData.commissioningMode); - ChipLogProgress(Discovery, "\tDevice Type\t\t%u", nodeData.deviceType); - ChipLogProgress(Discovery, "\tDevice Name\t\t%s", nodeData.deviceName); - ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); - ChipLogProgress(Discovery, "\tPairing Instruction\t%s", nodeData.pairingInstruction); - ChipLogProgress(Discovery, "\tPairing Hint\t\t0x%x", nodeData.pairingHint); + ChipLogProgress(Discovery, "\tCommissioning Mode:\t%u", nodeData.commissioningMode); + ChipLogProgress(Discovery, "\tDevice Type:\t\t%u", nodeData.deviceType); + ChipLogProgress(Discovery, "\tDevice Name:\t\t%s", nodeData.deviceName); + ChipLogProgress(Discovery, "\tRotating Id:\t\t%s", rotatingId); + ChipLogProgress(Discovery, "\tPairing Instruction:\t%s", nodeData.pairingInstruction); + ChipLogProgress(Discovery, "\tPairing Hint:\t\t%u", nodeData.pairingHint); for (int i = 0; i < nodeData.numIPs; i++) { char buf[chip::Inet::IPAddress::kMaxStringLength]; diff --git a/examples/chip-tool/commands/pairing/Commands.h b/examples/chip-tool/commands/pairing/Commands.h index 3b7ba676271605..696171e06fa2d3 100644 --- a/examples/chip-tool/commands/pairing/Commands.h +++ b/examples/chip-tool/commands/pairing/Commands.h @@ -19,6 +19,7 @@ #pragma once #include "CommissionedListCommand.h" +#include "ConfigureFabricCommand.h" #include "PairingCommand.h" class Unpair : public PairingCommand @@ -170,7 +171,9 @@ void registerCommandsPairing(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), + // TODO - enable CommissionedListCommand once DNS Cache is implemented + // make_unique(), + make_unique(), }; commands.Register(clusterName, clusterCommands); diff --git a/examples/chip-tool/commands/pairing/ConfigureFabricCommand.cpp b/examples/chip-tool/commands/pairing/ConfigureFabricCommand.cpp new file mode 100644 index 00000000000000..cf486f802d41ca --- /dev/null +++ b/examples/chip-tool/commands/pairing/ConfigureFabricCommand.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "ConfigureFabricCommand.h" + +CHIP_ERROR ConfigureFabricCommand::Run() +{ + ReturnLogErrorOnFailure(mStorage.Init()); + return mStorage.SetFabric(mFabricName); +} diff --git a/examples/chip-tool/commands/pairing/ConfigureFabricCommand.h b/examples/chip-tool/commands/pairing/ConfigureFabricCommand.h new file mode 100644 index 00000000000000..043b2bddcc08fa --- /dev/null +++ b/examples/chip-tool/commands/pairing/ConfigureFabricCommand.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "../../config/PersistentStorage.h" +#include "../common/Command.h" + +class ConfigureFabricCommand : public Command +{ +public: + ConfigureFabricCommand() : Command("configure-fabric") { AddArgument("name", &mFabricName); } + CHIP_ERROR Run() override; + +private: + PersistentStorage mStorage; + char * mFabricName; +}; diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index efd4581ca57211..20fa405af043ad 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -89,7 +89,7 @@ CHIP_ERROR PairingCommand::RunInternal(NodeId remoteId) return err; } -void PairingCommand::OnDeviceConnectedFn(void * context, chip::Controller::Device * device) +void PairingCommand::OnDeviceConnectedFn(void * context, chip::DeviceProxy * device) { PairingCommand * command = reinterpret_cast(context); command->OpenCommissioningWindow(); @@ -248,7 +248,7 @@ CHIP_ERROR PairingCommand::SetupNetwork() break; case PairingNetworkType::WiFi: case PairingNetworkType::Thread: - err = mController.GetDevice(mNodeId, &mDevice); + err = mController.GetDeviceBeingCommissioned(mNodeId, &mDevice); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Setup failure! No pairing for device: %" PRIu64, mNodeId)); mCluster.Associate(mDevice, mEndpointId); diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index c3c23cfffffefa..2dc38bac1c35af 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -210,15 +210,15 @@ class PairingCommand : public CHIPCommand, chip::Callback::Callback * mOnAddWiFiNetworkCallback = nullptr; chip::Callback::Callback * mOnEnableNetworkCallback = nullptr; chip::Callback::Callback * mOnFailureCallback = nullptr; - ChipDevice * mDevice; + chip::CommissioneeDeviceProxy * mDevice; chip::Controller::NetworkCommissioningCluster mCluster; chip::EndpointId mEndpointId = 0; - static void OnDeviceConnectedFn(void * context, chip::Controller::Device * device); + static void OnDeviceConnectedFn(void * context, chip::DeviceProxy * device); static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); - chip::Callback::Callback mOnDeviceConnectedCallback; - chip::Callback::Callback mOnDeviceConnectionFailureCallback; + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; chip::Callback::Callback mOnOpenCommissioningWindowCallback; }; diff --git a/examples/chip-tool/commands/reporting/ReportingCommand.cpp b/examples/chip-tool/commands/reporting/ReportingCommand.cpp index 2a6ad8b15d430d..b0be63f6bf5500 100644 --- a/examples/chip-tool/commands/reporting/ReportingCommand.cpp +++ b/examples/chip-tool/commands/reporting/ReportingCommand.cpp @@ -35,7 +35,7 @@ CHIP_ERROR ReportingCommand::RunCommand() return err; } -void ReportingCommand::OnDeviceConnectedFn(void * context, chip::Controller::Device * device) +void ReportingCommand::OnDeviceConnectedFn(void * context, chip::DeviceProxy * device) { ReportingCommand * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, diff --git a/examples/chip-tool/commands/reporting/ReportingCommand.h b/examples/chip-tool/commands/reporting/ReportingCommand.h index aba585685f81af..0aa5169f4f2e95 100644 --- a/examples/chip-tool/commands/reporting/ReportingCommand.h +++ b/examples/chip-tool/commands/reporting/ReportingCommand.h @@ -48,9 +48,9 @@ class ReportingCommand : public CHIPCommand NodeId mNodeId; uint8_t mEndPointId; - static void OnDeviceConnectedFn(void * context, chip::Controller::Device * device); + static void OnDeviceConnectedFn(void * context, chip::DeviceProxy * device); static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); - chip::Callback::Callback mOnDeviceConnectedCallback; - chip::Callback::Callback mOnDeviceConnectionFailureCallback; + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; }; diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index e8d19276ee61d9..094e5e505db943 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -23,7 +23,7 @@ CHIP_ERROR TestCommand::RunCommand() return mController.GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); } -void TestCommand::OnDeviceConnectedFn(void * context, chip::Controller::Device * device) +void TestCommand::OnDeviceConnectedFn(void * context, chip::DeviceProxy * device) { ChipLogProgress(chipTool, " **** Test Setup: Device Connected\n"); auto * command = static_cast(context); @@ -109,17 +109,6 @@ bool TestCommand::CheckConstraintMaxLength(const char * itemName, uint64_t curre return true; } -bool TestCommand::CheckValueAsList(const char * itemName, uint64_t current, uint64_t expected) -{ - if (current != expected) - { - Exit(std::string(itemName) + " count mismatch: " + std::to_string(current) + " != " + std::to_string(expected)); - return false; - } - - return true; -} - bool TestCommand::CheckValueAsString(const char * itemName, const chip::ByteSpan current, const char * expected) { const chip::ByteSpan expectedArgument = chip::ByteSpan(chip::Uint8::from_const_char(expected), strlen(expected)); @@ -138,7 +127,8 @@ bool TestCommand::CheckValueAsString(const char * itemName, const chip::CharSpan const chip::CharSpan expectedArgument(expected, strlen(expected)); if (!current.data_equal(expectedArgument)) { - Exit(std::string(itemName) + " value mismatch, expecting " + std::string(expected)); + Exit(std::string(itemName) + " value mismatch, expected '" + expected + "' but got '" + + std::string(current.data(), current.size()) + "'"); return false; } diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 25eaaa5e5c9506..0cf358d260a559 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -53,7 +53,7 @@ class TestCommand : public CHIPCommand ChipDevice * mDevice; chip::NodeId mNodeId; - static void OnDeviceConnectedFn(void * context, chip::Controller::Device * device); + static void OnDeviceConnectedFn(void * context, chip::DeviceProxy * device); static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); static void OnWaitForMsFn(chip::System::Layer * systemLayer, void * context); @@ -106,7 +106,8 @@ class TestCommand : public CHIPCommand { if (current != expected) { - Exit(std::string(itemName) + " value mismatch: " + std::to_string(current) + " != " + std::to_string(expected)); + Exit(std::string(itemName) + " value mismatch: expected " + std::to_string(expected) + " but got " + + std::to_string(current)); return false; } @@ -116,78 +117,58 @@ class TestCommand : public CHIPCommand template ::value, int> = 0> bool CheckValue(const char * itemName, T current, U expected) { - return CheckValue(itemName, to_underlying(current), expected); + return CheckValue(itemName, chip::to_underlying(current), expected); } - bool CheckValueAsList(const char * itemName, uint64_t current, uint64_t expected); - - template - bool CheckValueAsListHelper(const char * itemName, typename chip::app::DataModel::DecodableList::Iterator iter) + /** + * Check that the next list item, which is at index "index", exists and + * decodes properly. + */ + template + bool CheckNextListItemDecodes(const char * listName, typename std::remove_reference_t::Iterator & iter, size_t index) { - if (iter.Next()) - { - Exit(std::string(itemName) + " value mismatch: expected no more items but found " + std::to_string(iter.GetValue())); - return false; - } + bool hasValue = iter.Next(); if (iter.GetStatus() != CHIP_NO_ERROR) { - Exit(std::string(itemName) + - " value mismatch: expected no more items but got an error: " + iter.GetStatus().AsString()); + Exit(std::string(listName) + " value mismatch: error '" + iter.GetStatus().AsString() + "'decoding item at index " + + std::to_string(index)); return false; } - return true; - } - template - bool CheckValueAsListHelper(const char * itemName, typename chip::app::DataModel::DecodableList::Iterator & iter, - const U & firstItem, ValueTypes &&... otherItems) - { - bool haveValue = iter.Next(); - if (iter.GetStatus() != CHIP_NO_ERROR) - { - Exit(std::string(itemName) + " value mismatch: expected " + std::to_string(firstItem) + - " but got error: " + iter.GetStatus().AsString()); - return false; - } - if (!haveValue) - { - Exit(std::string(itemName) + " value mismatch: expected " + std::to_string(firstItem) + - " but found nothing or an error"); - return false; - } - if (iter.GetValue() != firstItem) + if (hasValue) { - Exit(std::string(itemName) + " value mismatch: expected " + std::to_string(firstItem) + " but found " + - std::to_string(iter.GetValue())); - return false; + return true; } - return CheckValueAsListHelper(itemName, iter, std::forward(otherItems)...); - } - template - bool CheckValueAsList(const char * itemName, chip::app::DataModel::DecodableList list, ValueTypes &&... items) - { - auto iter = list.begin(); - return CheckValueAsListHelper(itemName, iter, std::forward(items)...); + Exit(std::string(listName) + " value mismatch: should have value at index " + std::to_string(index) + + " but doesn't (actual value too short)"); + return false; } - template - bool CheckValueAsListLength(const char * itemName, chip::app::DataModel::DecodableList list, uint64_t expectedLength) + /** + * Check that there are no more list items now that we have seen + * "expectedCount" of them. + */ + template + bool CheckNoMoreListItems(const char * listName, typename std::remove_reference_t::Iterator & iter, + size_t expectedCount) { - // We don't just use list.ComputeSize(), because we want to check that - // all the values in the list correctly decode to our type too. - auto iter = list.begin(); - uint64_t count = 0; - while (iter.Next()) - { - ++count; - } + bool hasValue = iter.Next(); if (iter.GetStatus() != CHIP_NO_ERROR) { - Exit(std::string(itemName) + " list length mismatch: expected " + std::to_string(expectedLength) + " but got an error"); + Exit(std::string(listName) + " value mismatch: error '" + iter.GetStatus().AsString() + + "'decoding item after we have seen " + std::to_string(expectedCount) + " items"); return false; } - return CheckValueAsList(itemName, count, expectedLength); + + if (!hasValue) + { + return true; + } + + Exit(std::string(listName) + " value mismatch: expected only " + std::to_string(expectedCount) + + " items, but have more than that (actual value too long)"); + return false; } bool CheckValueAsString(const char * itemName, chip::ByteSpan current, const char * expected); @@ -230,8 +211,8 @@ class TestCommand : public CHIPCommand return false; } - chip::Callback::Callback mOnDeviceConnectedCallback; - chip::Callback::Callback mOnDeviceConnectionFailureCallback; + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; void Wait() { diff --git a/examples/chip-tool/config/PersistentStorage.cpp b/examples/chip-tool/config/PersistentStorage.cpp index 8eff627554f626..6fdde413fbab61 100644 --- a/examples/chip-tool/config/PersistentStorage.cpp +++ b/examples/chip-tool/config/PersistentStorage.cpp @@ -37,6 +37,10 @@ constexpr const char kDefaultSectionName[] = "Default"; constexpr const char kPortKey[] = "ListenPort"; constexpr const char kLoggingKey[] = "LoggingLevel"; constexpr const char kLocalNodeIdKey[] = "LocalNodeId"; +constexpr const char kFabricIdKey[] = "LocalFabricId"; +constexpr const FabricId kFabricAlpha = 1; +constexpr const FabricId kFabricBeta = 2; +constexpr const FabricId kFabricGamma = 3; constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Detail; namespace { @@ -156,9 +160,11 @@ CHIP_ERROR PersistentStorage::CommitConfig() uint16_t PersistentStorage::GetListenPort() { CHIP_ERROR err = CHIP_NO_ERROR; - // By default chip-tool listens on CHIP_PORT + 1. This is done in order to avoid + + // By default chip-tool listens on CHIP_PORT + N. This is done in order to avoid // having 2 servers listening on CHIP_PORT when one runs an accessory server locally. - uint16_t chipListenPort = CHIP_PORT + 1; + FabricId N = GetFabricId(); + uint16_t chipListenPort = static_cast(CHIP_PORT + N); char value[6]; uint16_t size = static_cast(sizeof(value)); @@ -228,3 +234,43 @@ CHIP_ERROR PersistentStorage::SetLocalNodeId(NodeId value) uint64_t nodeId = Encoding::LittleEndian::HostSwap64(value); return SyncSetKeyValue(kLocalNodeIdKey, &nodeId, sizeof(nodeId)); } + +FabricId PersistentStorage::GetFabricId() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + uint64_t fabricId; + uint16_t size = static_cast(sizeof(fabricId)); + err = SyncGetKeyValue(kFabricIdKey, &fabricId, size); + if (err == CHIP_NO_ERROR) + { + return static_cast(Encoding::LittleEndian::HostSwap64(fabricId)); + } + + return kFabricAlpha; +} + +CHIP_ERROR PersistentStorage::SetFabric(const char * fabricName) +{ + uint64_t fabricId = kFabricAlpha; + + if (strcasecmp(fabricName, "alpha") == 0) + { + fabricId = kFabricAlpha; + } + else if (strcasecmp(fabricName, "beta") == 0) + { + fabricId = kFabricBeta; + } + else if (strcasecmp(fabricName, "gamma") == 0) + { + fabricId = kFabricGamma; + } + else + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + fabricId = Encoding::LittleEndian::HostSwap64(fabricId); + return SyncSetKeyValue(kFabricIdKey, &fabricId, sizeof(fabricId)); +} diff --git a/examples/chip-tool/config/PersistentStorage.h b/examples/chip-tool/config/PersistentStorage.h index c2832a3c407e29..10f4bb1ad76d5d 100644 --- a/examples/chip-tool/config/PersistentStorage.h +++ b/examples/chip-tool/config/PersistentStorage.h @@ -42,6 +42,25 @@ class PersistentStorage : public chip::PersistentStorageDelegate // Store local node id. CHIP_ERROR SetLocalNodeId(chip::NodeId nodeId); + /** + * @brief + * Configure the fabric used for pairing and sending commands. + * + * @param[in] fabricName The name of the fabric. It must be one of the following strings: + * - alpha + * - beta + * - gamma + * + * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. + */ + CHIP_ERROR SetFabric(const char * fabricName); + + /** + * @brief + * Return the stored fabric id, or the one for the "alpha" fabric if nothing is stored. + */ + chip::FabricId GetFabricId(); + private: CHIP_ERROR CommitConfig(); inipp::Ini mConfig; diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index 317553d3548140..0ef29f39e91a3d 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -153,6 +153,11 @@ CHIP_ERROR LogValue(const char * label, size_t indent, {{zapTypeToDecodableClust } // anonymous namespace +static void OnDefaultSuccessResponseWithoutExit(void * context) +{ + ChipLogProgress(chipTool, "Default Success Response"); +} + static void OnDefaultSuccessResponse(void * context) { ChipLogProgress(chipTool, "Default Success Response"); @@ -179,79 +184,124 @@ static void OnDefaultFailure(void * context, EmberAfStatus status) OnDefaultFailureResponse(context, status); }; -static void OnBooleanAttributeResponse(void * context, bool value) +static void OnBooleanAttributeReport(void * context, bool value) { ChipLogProgress(chipTool, "Boolean attribute Response: %d", value); +} + +static void OnBooleanAttributeResponse(void * context, bool value) +{ + OnBooleanAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt8uAttributeResponse(void * context, uint8_t value) +static void OnInt8uAttributeReport(void * context, uint8_t value) { ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value); +} + +static void OnInt8uAttributeResponse(void * context, uint8_t value) +{ + OnInt8uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt16uAttributeResponse(void * context, uint16_t value) +static void OnInt16uAttributeReport(void * context, uint16_t value) { ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value); +} + +static void OnInt16uAttributeResponse(void * context, uint16_t value) +{ + OnInt16uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt32uAttributeResponse(void * context, uint32_t value) +static void OnInt32uAttributeReport(void * context, uint32_t value) { ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value); +} + +static void OnInt32uAttributeResponse(void * context, uint32_t value) +{ + OnInt32uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt64uAttributeResponse(void * context, uint64_t value) +static void OnInt64uAttributeReport(void * context, uint64_t value) { ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value); +} + +static void OnInt64uAttributeResponse(void * context, uint64_t value) +{ + OnInt64uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt8sAttributeResponse(void * context, int8_t value) +static void OnInt8sAttributeReport(void * context, int8_t value) { ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); +} + +static void OnInt8sAttributeResponse(void * context, int8_t value) +{ + OnInt8sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt16sAttributeResponse(void * context, int16_t value) +static void OnInt16sAttributeReport(void * context, int16_t value) { ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); +} + +static void OnInt16sAttributeResponse(void * context, int16_t value) +{ + OnInt16sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt32sAttributeResponse(void * context, int32_t value) +static void OnInt32sAttributeReport(void * context, int32_t value) { ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); +} + +static void OnInt32sAttributeResponse(void * context, int32_t value) +{ + OnInt32sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt64sAttributeResponse(void * context, int64_t value) +static void OnInt64sAttributeReport(void * context, int64_t value) { ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); +} + +static void OnInt64sAttributeResponse(void * context, int64_t value) +{ + OnInt64sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnOctetStringAttributeResponse(void * context, const chip::ByteSpan value) +static void OnOctetStringAttributeReport(void * context, const chip::ByteSpan value) { char buffer[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; if (CHIP_NO_ERROR == chip::Encoding::BytesToUppercaseHexString(value.data(), value.size(), &buffer[0], CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE)) { @@ -259,14 +309,24 @@ static void OnOctetStringAttributeResponse(void * context, const chip::ByteSpan } else { ChipLogProgress(chipTool, "OctetString attribute Response len: %zu", value.size()); } +} + +static void OnOctetStringAttributeResponse(void * context, const chip::ByteSpan value) +{ + OnOctetStringAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnCharStringAttributeResponse(void * context, const chip::CharSpan value) +static void OnCharStringAttributeReport(void * context, const chip::CharSpan value) { ChipLogProgress(chipTool, "CharString attribute Response: %.*s", static_cast(value.size()), value.data()); +} + +static void OnCharStringAttributeResponse(void * context, const chip::CharSpan value) +{ + OnCharStringAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -445,12 +505,14 @@ public: AddArgument("attr-name", "{{asDelimitedCommand (asUpperCamelCase name)}}"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -462,21 +524,25 @@ public: chip::Controller::{{asUpperCamelCase parent.name}}Cluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttribute{{asUpperCamelCase name}}(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttribute{{asUpperCamelCase name}}(onReportCallback->Cancel())); - return cluster.SubscribeAttribute{{asUpperCamelCase name}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttribute{{asUpperCamelCase name}}(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback<{{chipCallback.name}}AttributeCallback> * onReportCallback = new chip::Callback::Callback<{{chipCallback.name}}AttributeCallback>(On{{chipCallback.name}}AttributeResponse, this); + chip::Callback::Callback<{{chipCallback.name}}AttributeCallback> * onReportCallback = new chip::Callback::Callback<{{chipCallback.name}}AttributeCallback>(On{{chipCallback.name}}AttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; {{/if}} diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 46a869fdfea6fc..9946d32a9c4de1 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -193,26 +193,8 @@ class {{filename}}: public TestCommand {{/if}} {{#chip_tests_item_response_parameters}} {{~#*inline "item"}}{{asLowerCamelCase name}}{{#if isOptional}}.Value(){{/if}}{{/inline}} - {{~#*inline "itemValue"}}{{>item}}{{#if isNullable}}.Value(){{/if}}{{/inline}} {{#if hasExpectedValue}} - {{#if isOptional}} - {{~#*inline "item"}}{{asLowerCamelCase name}}{{/inline}} - VerifyOrReturn(CheckValuePresent("{{> item}}", {{> item}})); - {{/if}} - {{#if (isLiteralNull expectedValue)}} - VerifyOrReturn(CheckValueNull("{{> item}}", {{> item}})); - {{else}} - {{#if isNullable}} - VerifyOrReturn(CheckValueNonNull("{{> item}}", {{> item}})); - {{/if}} - VerifyOrReturn(CheckValue - {{~#if isList}}AsListLength("{{>itemValue}}", {{>itemValue}}, {{expectedValue.length}}) - {{else if isArray}}AsList("{{>itemValue}}", {{>itemValue}}{{#if expectedValue.length}}, {{expectedValue}}{{/if}}) - {{else if (isString type)}}AsString("{{>itemValue}}", {{>itemValue}}, "{{expectedValue}}") - {{else}}<{{chipType}}>("{{>itemValue}}", {{>itemValue}}, {{expectedValue}}{{asTypeLiteralSuffix type}}) - {{/if}} - ); - {{/if}} + {{>valueEquals actual=(asLowerCamelCase name) label=(asLowerCamelCase name) expected=expectedValue}} {{/if}} {{#if hasExpectedConstraints}} {{#if isOptional}} diff --git a/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt b/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt new file mode 100644 index 00000000000000..9fe0a9af1faf41 --- /dev/null +++ b/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt @@ -0,0 +1,37 @@ +{{#if isOptional}} + VerifyOrReturn(CheckValuePresent("{{label}}", {{actual}})); + {{>valueEquals label=(concat label ".Value()") actual=(concat actual ".Value()") expected=expected isOptional=false}} +{{else if isNullable}} + {{#if (isLiteralNull expected)}} + VerifyOrReturn(CheckValueNull("{{label}}", {{actual}})); + {{else}} + VerifyOrReturn(CheckValueNonNull("{{label}}", {{actual}})); + {{>valueEquals label=(concat label ".Value()") actual=(concat actual ".Value()") expected=expected isNullable=false}} + {{/if}} +{{else if isArray}} + auto iter = {{actual}}.begin(); + {{#each expected}} + VerifyOrReturn(CheckNextListItemDecodes("{{../label}}", iter, {{@index}})); + {{>valueEquals label=(concat ../label "[" @index "]") actual="iter.GetValue()" expected=this isArray=false type=../type chipType=../chipType}} + {{/each}} + VerifyOrReturn(CheckNoMoreListItems("{{label}}", iter, {{expected.length}})); +{{else}} + {{#if_is_struct type}} + {{! Iterate over the actual types in the struct, so we pick up the right + type/optionality/nullability information for them for our recursive + call. }} + {{#zcl_struct_items_by_struct_name type}} + {{#if (expectedValueHasProp ../expected (asLowerCamelCase label))}} + {{>valueEquals label=(concat ../label "." (asLowerCamelCase label)) actual=(concat ../actual "." (asLowerCamelCase label)) expected=(lookup ../expected (asLowerCamelCase label))}} + {{/if}} + {{/zcl_struct_items_by_struct_name}} + {{! Maybe we should add a check for properties in the expected object (other + than "global") that are not present in the struct ? }} + {{else}} + VerifyOrReturn(CheckValue + {{~#if (isString type)}}AsString("{{label}}", {{actual}}, "{{expected}}") + {{else}}<{{chipType}}>("{{label}}", {{actual}}, {{expected}}{{asTypeLiteralSuffix type}}) + {{/if}} + ); + {{/if_is_struct}} +{{/if}} diff --git a/examples/chip-tool/templates/templates.json b/examples/chip-tool/templates/templates.json index 9fa7f7f4d4c38e..17afafd04192de 100644 --- a/examples/chip-tool/templates/templates.json +++ b/examples/chip-tool/templates/templates.json @@ -31,6 +31,10 @@ { "name": "commandValue", "path": "partials/test_cluster_command_value.zapt" + }, + { + "name": "valueEquals", + "path": "partials/test_cluster_value_equals.zapt" } ], "templates": [ diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 5003ad980ca36a..8961aea870e187 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -48,6 +48,7 @@ function getTests() 'Test_TC_CC_7_3', 'Test_TC_CC_7_4', 'Test_TC_CC_8_1', + 'Test_TC_CC_9_1', 'Test_TC_CC_9_2', 'Test_TC_CC_9_3', ]; @@ -55,6 +56,7 @@ function getTests() const DeviceManagement = [ 'Test_TC_DM_1_1', 'Test_TC_DM_3_1', + 'Test_TC_DM_2_2', ]; const ElectricalMeasurement = [ @@ -101,6 +103,7 @@ function getTests() 'Test_TC_OO_1_1', 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', + 'Test_TC_OO_2_3', ]; const PressureMeasurement = [ @@ -144,6 +147,7 @@ function getTests() const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', + 'Test_TC_WNCV_2_2', 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', diff --git a/examples/ota-requestor-app/linux/BUILD.gn b/examples/ota-requestor-app/linux/BUILD.gn index 72f31fa74dd2d4..2d698377703640 100644 --- a/examples/ota-requestor-app/linux/BUILD.gn +++ b/examples/ota-requestor-app/linux/BUILD.gn @@ -21,7 +21,6 @@ executable("chip-ota-requestor-app") { deps = [ "${chip_root}/examples/ota-requestor-app/ota-requestor-common", "${chip_root}/examples/platform/linux:app-main", - "${chip_root}/src/app/device", "${chip_root}/src/app/server", "${chip_root}/src/lib", ] diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index ae16b33848f535..8831810a607532 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -18,8 +18,13 @@ #include #include -#include +#include #include +#include +#include +#include +#include +#include #include #include #include @@ -31,9 +36,13 @@ using chip::ByteSpan; using chip::CharSpan; +using chip::DeviceProxy; using chip::EndpointId; using chip::FabricIndex; using chip::NodeId; +using chip::OnDeviceConnected; +using chip::OnDeviceConnectionFailure; +using chip::PeerId; using chip::Server; using chip::VendorId; using chip::bdx::TransferSession; @@ -43,21 +52,19 @@ using chip::System::Layer; using chip::Transport::PeerAddress; using namespace chip::ArgParser; using namespace chip::Messaging; -using namespace chip::app::device; using namespace chip::app::Clusters::OtaSoftwareUpdateProvider::Commands; void OnQueryImageResponse(void * context, const QueryImageResponse::DecodableType & response); void OnQueryImageFailure(void * context, EmberAfStatus status); -void OnConnected(void * context, OperationalDeviceProxy * operationalDeviceProxy); -void OnConnectionFailure(void * context, OperationalDeviceProxy * operationalDeviceProxy, CHIP_ERROR error); +void OnConnected(void * context, chip::DeviceProxy * deviceProxy); +void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error); bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, const char * aName, const char * aValue); // TODO: would be nicer to encapsulate these globals and the callbacks in some sort of class -OperationalDeviceProxy gOperationalDeviceProxy; ExchangeContext * exchangeCtx = nullptr; BdxDownloader bdxDownloader; -Callback mOnConnectedCallback(OnConnected, nullptr); -Callback mOnConnectionFailureCallback(OnConnectionFailure, nullptr); +Callback mOnConnectedCallback(OnConnected, nullptr); +Callback mOnConnectionFailureCallback(OnConnectionFailure, nullptr); constexpr uint16_t kOptionProviderNodeId = 'n'; constexpr uint16_t kOptionProviderFabricIndex = 'f'; @@ -117,9 +124,11 @@ void OnQueryImageResponse(void * context, const QueryImageResponse::DecodableTyp initOptions.FileDesLength = static_cast(strlen(testFileDes)); initOptions.FileDesignator = reinterpret_cast(testFileDes); + chip::OperationalDeviceProxy * operationalDeviceProxy = Server::GetInstance().GetOperationalDeviceProxy(); + if (operationalDeviceProxy != nullptr) { - chip::Messaging::ExchangeManager * exchangeMgr = gOperationalDeviceProxy.GetDevice().GetExchangeManager(); - chip::Optional session = gOperationalDeviceProxy.GetDevice().GetSecureSession(); + chip::Messaging::ExchangeManager * exchangeMgr = operationalDeviceProxy->GetExchangeManager(); + chip::Optional session = operationalDeviceProxy->GetSecureSession(); if (exchangeMgr != nullptr && session.HasValue()) { exchangeCtx = exchangeMgr->NewContext(session.Value(), &bdxDownloader); @@ -144,7 +153,7 @@ void OnQueryImageFailure(void * context, EmberAfStatus status) ChipLogDetail(SoftwareUpdate, "QueryImage failure response %" PRIu8, status); } -void OnConnected(void * context, OperationalDeviceProxy * operationalDeviceProxy) +void OnConnected(void * context, chip::DeviceProxy * deviceProxy) { CHIP_ERROR err = CHIP_NO_ERROR; chip::Controller::OtaSoftwareUpdateProviderCluster cluster; @@ -161,7 +170,7 @@ void OnConnected(void * context, OperationalDeviceProxy * operationalDeviceProxy constexpr bool kExampleClientCanConsent = false; ByteSpan metadata; - err = cluster.Associate(&(operationalDeviceProxy->GetDevice()), kOtaProviderEndpoint); + err = cluster.Associate(deviceProxy, kOtaProviderEndpoint); if (err != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Associate() failed: %" CHIP_ERROR_FORMAT, err.Format()); @@ -183,9 +192,9 @@ void OnConnected(void * context, OperationalDeviceProxy * operationalDeviceProxy } } -void OnConnectionFailure(void * context, OperationalDeviceProxy * operationalDeviceProxy, CHIP_ERROR error) +void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error) { - ChipLogError(SoftwareUpdate, "failed to connect: %" CHIP_ERROR_FORMAT, error.Format()); + ChipLogError(SoftwareUpdate, "failed to connect to 0x%" PRIX64 ": %" CHIP_ERROR_FORMAT, deviceId, error.Format()); } bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, const char * aName, const char * aValue) @@ -245,24 +254,32 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, void SendQueryImageCommand(chip::NodeId peerNodeId = providerNodeId, chip::FabricIndex peerFabricIndex = providerFabricIndex) { - // Explicitly calling UpdateAddress() should not be needed once OperationalDeviceProxy can resolve IP address from node ID and - // fabric index - IPAddress ipAddr; - IPAddress::FromString(ipAddress, ipAddr); - PeerAddress addr = PeerAddress::UDP(ipAddr, CHIP_PORT); - gOperationalDeviceProxy.UpdateAddress(addr); - - Server * server = &(Server::GetInstance()); - OperationalDeviceProxyInitParams initParams = { + Server * server = &(Server::GetInstance()); + chip::DeviceProxyInitParams initParams = { .sessionManager = &(server->GetSecureSessionManager()), .exchangeMgr = &(server->GetExchangeManager()), .idAllocator = &(server->GetSessionIDAllocator()), - .fabricsTable = &(server->GetFabricTable()), + .fabricInfo = server->GetFabricTable().FindFabricWithIndex(providerFabricIndex), + // TODO: Determine where this should be instantiated + .imDelegate = chip::Platform::New(), }; + chip::OperationalDeviceProxy * operationalDeviceProxy = + new chip::OperationalDeviceProxy(initParams, PeerId().SetNodeId(providerNodeId)); + server->SetOperationalDeviceProxy(operationalDeviceProxy); + + // Explicitly calling UpdateDeviceData() should not be needed once OperationalDeviceProxy can resolve IP address from node ID + // and fabric index + IPAddress ipAddr; + IPAddress::FromString(ipAddress, ipAddr); + PeerAddress addr = PeerAddress::UDP(ipAddr, CHIP_PORT); + uint32_t idleInterval; + uint32_t activeInterval; + operationalDeviceProxy->GetMRPIntervals(idleInterval, activeInterval); + operationalDeviceProxy->UpdateDeviceData(addr, idleInterval, activeInterval); + CHIP_ERROR err = CHIP_NO_ERROR; - gOperationalDeviceProxy.Init(peerNodeId, peerFabricIndex, initParams); - err = gOperationalDeviceProxy.Connect(&mOnConnectedCallback, &mOnConnectionFailureCallback); + err = operationalDeviceProxy->Connect(&mOnConnectedCallback, &mOnConnectionFailureCallback); if (err != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Cannot establish connection to peer device: %" CHIP_ERROR_FORMAT, err.Format()); diff --git a/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.cpp b/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.cpp index e3164884823c44..ce69fadfa6cb10 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.cpp +++ b/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.cpp @@ -18,19 +18,8 @@ #include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include - -using chip::FabricInfo; ExampleOTARequestor ExampleOTARequestor::sInstance; @@ -53,9 +42,8 @@ ExampleOTARequestor::ExampleOTARequestor() mProviderFabricIndex = chip::kUndefinedFabricIndex; } -void ExampleOTARequestor::Init(chip::Controller::ControllerDeviceInitParams connectParams, uint32_t startDelayMs) +void ExampleOTARequestor::Init(uint32_t startDelayMs) { - mConnectParams = connectParams; mOtaStartDelayMs = startDelayMs; } @@ -128,14 +116,3 @@ void ExampleOTARequestor::StartDelayTimerHandler(chip::System::Layer * systemLay VerifyOrReturn(appState != nullptr); static_cast(appState)->ConnectToProvider(); } - -chip::FabricInfo * ExampleOTARequestor::GetProviderFabricInfo() -{ - if (mConnectParams.fabricsTable == nullptr) - { - ChipLogError(SoftwareUpdate, "FabricTable is null!"); - return nullptr; - } - - return mConnectParams.fabricsTable->FindFabricWithIndex(mProviderFabricIndex); -} diff --git a/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.h b/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.h index 4cdcc2eea2297a..9e1675e40be0e1 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.h +++ b/examples/ota-requestor-app/ota-requestor-common/ExampleOTARequestor.h @@ -19,11 +19,9 @@ #pragma once #include -#include -#include -#include -#include -#include +#include +#include +#include // An example implementation for how an application might handle receiving an AnnounceOTAProvider command. In this case, the // AnnounceOTAProvider command will be used as a trigger to send a QueryImage command and begin the OTA process. This class also @@ -33,7 +31,7 @@ class ExampleOTARequestor public: static ExampleOTARequestor & GetInstance() { return sInstance; } - void Init(chip::Controller::ControllerDeviceInitParams connectParams, uint32_t startDelayMs); + void Init(uint32_t startDelayMs); EmberAfStatus HandleAnnounceOTAProvider( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, @@ -47,12 +45,9 @@ class ExampleOTARequestor static void StartDelayTimerHandler(chip::System::Layer * systemLayer, void * appState); void ConnectToProvider(); - chip::FabricInfo * GetProviderFabricInfo(); static ExampleOTARequestor sInstance; - chip::Controller::Device mProviderDevice; - chip::Controller::ControllerDeviceInitParams mConnectParams; chip::NodeId mProviderNodeId; chip::FabricIndex mProviderFabricIndex; uint32_t mOtaStartDelayMs; diff --git a/examples/placeholder/linux/apps/app1/tests.js b/examples/placeholder/linux/apps/app1/tests.js index b48f9853011538..0db800bdaa7fb5 100644 --- a/examples/placeholder/linux/apps/app1/tests.js +++ b/examples/placeholder/linux/apps/app1/tests.js @@ -17,7 +17,9 @@ function getTests() { - const tests = []; + const tests = [ + "Test_TC_DM_1_3_Simulated", + ]; return tests.join(', '); } diff --git a/examples/placeholder/templates/templates.json b/examples/placeholder/templates/templates.json index 4e422b59efd955..3505d79ab47745 100644 --- a/examples/placeholder/templates/templates.json +++ b/examples/placeholder/templates/templates.json @@ -30,6 +30,10 @@ { "name": "commandValue", "path": "../../../examples/chip-tool/templates/partials/test_cluster_command_value.zapt" + }, + { + "name": "valueEquals", + "path": "../../../examples/chip-tool/templates/partials/test_cluster_value_equals.zapt" } ], "templates": [ diff --git a/examples/tv-casting-app/linux/main.cpp b/examples/tv-casting-app/linux/main.cpp index 305c1434a93e6e..7a1e18e67e30be 100644 --- a/examples/tv-casting-app/linux/main.cpp +++ b/examples/tv-casting-app/linux/main.cpp @@ -37,13 +37,13 @@ using chip::ArgParser::HelpOptions; using chip::ArgParser::OptionDef; using chip::ArgParser::OptionSet; -struct DeviceType +struct TVExampleDeviceType { const char * name; uint16_t id; }; -constexpr DeviceType kKnownDeviceTypes[] = { { "video-player", 35 }, { "dimmable-light", 257 } }; +constexpr TVExampleDeviceType kKnownDeviceTypes[] = { { "video-player", 35 }, { "dimmable-light", 257 } }; constexpr int kKnownDeviceTypesCount = sizeof kKnownDeviceTypes / sizeof *kKnownDeviceTypes; constexpr uint16_t kOptionDeviceType = 't'; constexpr uint16_t kCommissioningWindowTimeoutInSec = 3 * 60; diff --git a/scripts/build/builders/esp32.py b/scripts/build/builders/esp32.py index 51dfbcf55874a5..f3f709e4e76e83 100644 --- a/scripts/build/builders/esp32.py +++ b/scripts/build/builders/esp32.py @@ -129,7 +129,7 @@ def generate(self): if not self.enable_ipv4: self._Execute( - ['bash', '-c', 'echo CONFIG_DISABLE_IPV4=y >>%s' % shlex.quote(defaults_out)]) + ['bash', '-c', 'echo -e "\\nCONFIG_DISABLE_IPV4=y\\n" >>%s' % shlex.quote(defaults_out)]) cmd = "\nexport SDKCONFIG_DEFAULTS={defaults}\nidf.py -C {example_path} -B {out} reconfigure".format( defaults=shlex.quote(defaults_out), diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index bea6e68bc04ed8..3b83c1ad24c1ff 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -168,7 +168,7 @@ cp examples/all-clusters-app/esp32/sdkconfig.defaults {out}/esp32-devkitc-all-cl rm -f examples/all-clusters-app/esp32/sdkconfig -bash -c 'echo CONFIG_DISABLE_IPV4=y >>{out}/esp32-devkitc-all-clusters-ipv6only/sdkconfig.defaults' +bash -c 'echo -e "\nCONFIG_DISABLE_IPV4=y\n" >>{out}/esp32-devkitc-all-clusters-ipv6only/sdkconfig.defaults' bash -c 'source $IDF_PATH/export.sh; source scripts/activate.sh; export SDKCONFIG_DEFAULTS={out}/esp32-devkitc-all-clusters-ipv6only/sdkconfig.defaults @@ -236,7 +236,7 @@ cp examples/all-clusters-app/esp32/sdkconfig_m5stack.defaults {out}/esp32-m5stac rm -f examples/all-clusters-app/esp32/sdkconfig -bash -c 'echo CONFIG_DISABLE_IPV4=y >>{out}/esp32-m5stack-all-clusters-ipv6only/sdkconfig.defaults' +bash -c 'echo -e "\nCONFIG_DISABLE_IPV4=y\n" >>{out}/esp32-m5stack-all-clusters-ipv6only/sdkconfig.defaults' bash -c 'source $IDF_PATH/export.sh; source scripts/activate.sh; export SDKCONFIG_DEFAULTS={out}/esp32-m5stack-all-clusters-ipv6only/sdkconfig.defaults @@ -260,7 +260,7 @@ cp examples/all-clusters-app/esp32/sdkconfig_m5stack_rpc.defaults {out}/esp32-m5 rm -f examples/all-clusters-app/esp32/sdkconfig -bash -c 'echo CONFIG_DISABLE_IPV4=y >>{out}/esp32-m5stack-all-clusters-rpc-ipv6only/sdkconfig.defaults' +bash -c 'echo -e "\nCONFIG_DISABLE_IPV4=y\n" >>{out}/esp32-m5stack-all-clusters-rpc-ipv6only/sdkconfig.defaults' bash -c 'source $IDF_PATH/export.sh; source scripts/activate.sh; export SDKCONFIG_DEFAULTS={out}/esp32-m5stack-all-clusters-rpc-ipv6only/sdkconfig.defaults diff --git a/scripts/constraints.txt b/scripts/constraints.txt index 1309fd92849ce8..ed8c52b36fa478 100644 --- a/scripts/constraints.txt +++ b/scripts/constraints.txt @@ -113,7 +113,7 @@ numpy==1.20.3 # via pandas packaging==20.9 # via west -pandas==1.2.4 ; platform_machine != "aarch64" +pandas==1.2.4 ; platform_machine != "aarch64" and platform_machine != "arm64" # via -r requirements.txt parso==0.8.2 # via jedi diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 7905aff72b6862..f68b124bb7d6f7 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -42,7 +42,7 @@ protobuf anytree cxxfilt ghapi -pandas ; platform_machine != 'aarch64' +pandas ; platform_machine != 'aarch64' and platform_machine != 'arm64' # scripts/build click diff --git a/scripts/tests/test_suites.sh b/scripts/tests/test_suites.sh index 7f53ad9bf1ffc5..4b025baa1a2b9c 100755 --- a/scripts/tests/test_suites.sh +++ b/scripts/tests/test_suites.sh @@ -16,8 +16,13 @@ # limitations under the License. # +# Fail if one of our sub-commands fails. set -e +# Fail if anything in a pipeline fails, not just the last command (which for +# us tends to be 'tee'). +set -o pipefail + declare -i iterations=2 declare -i delay=0 declare -i node_id=0x12344321 @@ -58,7 +63,7 @@ else application="all-clusters" declare test_filenames="${single_case-Test*}.yaml" fi -declare -a test_array="($(find src/app/tests/suites -type f -name "$test_filenames" -exec basename {} .yaml \;))" +declare -a test_array="($(find src/app/tests/suites -type f -name "$test_filenames" -not -name "*Simulated*" -exec basename {} .yaml \;))" if [[ $iterations == 0 ]]; then echo "Invalid iteration count: '$1'" @@ -129,6 +134,12 @@ for j in "${iter_array[@]}"; do # kicking off the subshell, sometimes we try to do it before # the data is there yet. background_pid="$(/dev/null; then + echo " * [CI DEBUG] Looking for commissionable Nodes" + # Ignore the error that timeout generates + cat <(timeout 1 dns-sd -B _matterc._udp) + fi echo " * Pairing to device" "${test_case_wrapper[@]}" out/debug/standalone/chip-tool pairing qrcode "$node_id" MT:D8XA0CQM00KA0648G00 | tee "$pairing_log_file" echo " * Starting test run: $i" diff --git a/src/app/AttributeAccessInterface.h b/src/app/AttributeAccessInterface.h index 15627a40fead13..8c9a020e18106a 100644 --- a/src/app/AttributeAccessInterface.h +++ b/src/app/AttributeAccessInterface.h @@ -149,7 +149,7 @@ class AttributeAccessInterface * specific endpoint. This is used to clean up overrides registered for an * endpoint that becomes disabled. */ - bool MatchesExactly(EndpointId aEndpointId) const { return mEndpointId.HasValue() && mEndpointId.Value() == aEndpointId; } + bool MatchesEndpoint(EndpointId aEndpointId) const { return mEndpointId.HasValue() && mEndpointId.Value() == aEndpointId; } /** * Check whether another AttributeAccessInterface wants to handle the same set of diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 86aba27dd1de4c..05c460035c7125 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -40,6 +40,8 @@ static_library("app") { "Command.h", "CommandHandler.cpp", "CommandSender.cpp", + "DeviceProxy.cpp", + "DeviceProxy.h", "EventManagement.cpp", "InteractionModelEngine.cpp", "MessageDef/ArrayBuilder.cpp", @@ -106,6 +108,8 @@ static_library("app") { "MessageDef/TimedRequestMessage.cpp", "MessageDef/WriteRequestMessage.cpp", "MessageDef/WriteResponseMessage.cpp", + "OperationalDeviceProxy.cpp", + "OperationalDeviceProxy.h", "ReadClient.cpp", "ReadHandler.cpp", "WriteClient.cpp", @@ -125,6 +129,7 @@ static_library("app") { public_deps = [ ":app_buildconfig", + "${chip_root}/src/app/util:device_callbacks_manager", "${chip_root}/src/lib/support", "${chip_root}/src/messaging", "${chip_root}/src/protocols/secure_channel", diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index c2ada186d9e53d..9e01074e1ed2f3 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -129,7 +129,7 @@ void CommandHandler::Close() if (mpCallback) { - mpCallback->OnDone(this); + mpCallback->OnDone(*this); } } @@ -171,7 +171,7 @@ CHIP_ERROR CommandHandler::ProcessCommandDataIB(CommandDataIB::Parser & aCommand err = commandPath.GetEndpointId(&endpointId); SuccessOrExit(err); - VerifyOrExit(ServerClusterCommandExists(ConcreteCommandPath(endpointId, clusterId, commandId)), + VerifyOrExit(mpCallback->CommandExists(ConcreteCommandPath(endpointId, clusterId, commandId)), err = CHIP_ERROR_INVALID_PROFILE_ID); err = aCommandElement.GetData(&commandDataReader); if (CHIP_END_OF_TLV == err) @@ -189,7 +189,7 @@ CHIP_ERROR CommandHandler::ProcessCommandDataIB(CommandDataIB::Parser & aCommand endpointId, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); const ConcreteCommandPath concretePath(endpointId, clusterId, commandId); SuccessOrExit(MatterPreCommandReceivedCallback(concretePath)); - DispatchSingleClusterCommand(concretePath, commandDataReader, this); + mpCallback->DispatchCommand(*this, ConcreteCommandPath(endpointId, clusterId, commandId), commandDataReader); MatterPostCommandReceivedCallback(concretePath); } diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index 3bcd67df051f96..5ea3810c2e17a4 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -56,7 +56,19 @@ class CommandHandler : public Command * Method that signals to a registered callback that this object * has completed doing useful work and is now safe for release/destruction. */ - virtual void OnDone(CommandHandler * apCommandObj) = 0; + virtual void OnDone(CommandHandler & apCommandObj) = 0; + + /* + * Upon processing of a CommandDataIB, this method is invoked to dispatch the command + * to the right server-side handler provided by the application. + */ + virtual void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) = 0; + + /* + * Check to see if a command implementation exists for a specific concrete command path. + */ + virtual bool CommandExists(const ConcreteCommandPath & aCommandPath) = 0; }; /* @@ -137,5 +149,6 @@ class CommandHandler : public Command bool mSuppressResponse = false; bool mTimedRequest = false; }; + } // namespace app } // namespace chip diff --git a/src/app/CommandHandlerInterface.h b/src/app/CommandHandlerInterface.h new file mode 100644 index 00000000000000..c16ee865a8df78 --- /dev/null +++ b/src/app/CommandHandlerInterface.h @@ -0,0 +1,181 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include // So we can encode lists + +namespace chip { +namespace app { + +/* + * This interface permits applications to register a server-side command handler + * at run-time for a given cluster. The handler can either be configured to handle all endpoints + * for the given cluster or only handle a specific endpoint. + * + * If a command is not handled through this interface, it will default to invoking the generated DispatchSingleClusterCommand + * instead. + * + */ +class CommandHandlerInterface +{ +public: + struct HandlerContext + { + public: + HandlerContext(CommandHandler & commandHandler, const ConcreteCommandPath & requestPath, TLV::TLVReader & aReader) : + mCommandHandler(commandHandler), mRequestPath(requestPath), mPayload(aReader) + {} + + void SetCommandHandled() { mCommandHandled = true; } + void SetCommandNotHandled() { mCommandHandled = false; } + + /* + * Returns a TLVReader positioned at the TLV struct that contains the payload of the command. + * + * If the reader is requested from the context, then we can assume there is an intention + * to access the payload of this command and consequently, to handle this command. + * + * If this is not true, the application should call SetCommandNotHandled(). + * + */ + TLV::TLVReader & GetReader() + { + SetCommandHandled(); + return mPayload; + } + + CommandHandler & mCommandHandler; + const ConcreteCommandPath & mRequestPath; + TLV::TLVReader & mPayload; + bool mCommandHandled = false; + }; + + /** + * aEndpointId can be Missing to indicate that this object is meant to be + * used with all endpoints. + */ + CommandHandlerInterface(Optional aEndpointId, ClusterId aClusterId) : + mEndpointId(aEndpointId), mClusterId(aClusterId) + {} + + virtual ~CommandHandlerInterface() {} + + /** + * Callback that must be implemented to handle an invoke request. + * + * The callee is required to handle *all* errors that may occur during the handling of this command, + * including errors like those encountered during decode and encode of the payloads as + * well as application-specific errors. As part of handling the error, the callee is required + * to handle generation of an appropriate status response. + * + * The only exception to this rule is if the HandleCommand helper method is used below - it will + * help handle some of these cases (see below). + * + * @param [in] handlerContext Context that encapsulates the current invoke request. + * Handlers are responsible for correctly calling SetCommandHandled() + * on the context if they did handle the command. + * + * This is not necessary if the HandleCommand() method below is invoked. + */ + virtual void InvokeCommand(HandlerContext & handlerContext) = 0; + + /** + * Mechanism for keeping track of a chain of CommandHandlerInterface. + */ + void SetNext(CommandHandlerInterface * aNext) { mNext = aNext; } + CommandHandlerInterface * GetNext() const { return mNext; } + + /** + * Check whether a this CommandHandlerInterface is relevant for a + * particular endpoint+cluster. An CommandHandlerInterface will be used + * for an invoke from a particular cluster only when this function returns + * true. + */ + bool Matches(EndpointId aEndpointId, ClusterId aClusterId) const + { + return (!mEndpointId.HasValue() || mEndpointId.Value() == aEndpointId) && mClusterId == aClusterId; + } + + /** + * Check whether an CommandHandlerInterface is relevant for a particular + * specific endpoint. This is used to clean up overrides registered for an + * endpoint that becomes disabled. + */ + bool MatchesEndpoint(EndpointId aEndpointId) const { return mEndpointId.HasValue() && mEndpointId.Value() == aEndpointId; } + + /** + * Check whether another CommandHandlerInterface wants to handle the same set of + * commands as we do. + */ + bool Matches(const CommandHandlerInterface & aOther) const + { + return mClusterId == aOther.mClusterId && + (!mEndpointId.HasValue() || !aOther.mEndpointId.HasValue() || mEndpointId.Value() == aOther.mEndpointId.Value()); + } + +protected: + /* + * Helper function to automatically de-serialize the data payload into a cluster object + * of type RequestT if the Cluster ID and Command ID in the context match. Upon successful + * de-serialization, the provided function is invoked and passed in a reference to the cluster object. + * + * Any errors encountered in this function prior to calling func result in the automatic generation of a status response. + * If `func` is called, the responsibility for doing so shifts to the callee to handle any further errors that are encountered. + * + * The provided function is expected to have the following signature: + * void Func(HandlerContext &handlerContext, const RequestT &requestPayload); + */ + template + void HandleCommand(HandlerContext & handlerContext, FuncT func) + { + if (!handlerContext.mCommandHandled && (handlerContext.mRequestPath.mClusterId == RequestT::GetClusterId()) && + (handlerContext.mRequestPath.mCommandId == RequestT::GetCommandId())) + { + RequestT requestPayload; + + // + // If the command matches what the caller is looking for, let's mark this as being handled + // even if errors happen after this. This ensures that we don't execute any fall-back strategies + // to handle this command since at this point, the caller is taking responsibility for handling + // the command in its entirety, warts and all. + // + handlerContext.SetCommandHandled(); + + if (DataModel::Decode(handlerContext.mPayload, requestPayload) != CHIP_NO_ERROR) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, + Protocols::InteractionModel::Status::InvalidCommand); + return; + } + + func(handlerContext, requestPayload); + } + } + +private: + Optional mEndpointId; + ClusterId mClusterId; + CommandHandlerInterface * mNext = nullptr; +}; + +} // namespace app +} // namespace chip diff --git a/src/app/CommandSender.h b/src/app/CommandSender.h index 04ee3f9092b620..f582a9fce97b68 100644 --- a/src/app/CommandSender.h +++ b/src/app/CommandSender.h @@ -64,12 +64,12 @@ class CommandSender final : public Command, public Messaging::ExchangeDelegate * The CommandSender object MUST continue to exist after this call is completed. The application shall wait until it * receives an OnDone call to destroy the object. * - * @param[in] apCommandSender: The command sender object that initiated the command transaction. - * @param[in] aPath: The command path field in invoke command response. - * @param[in] aStatusIB: It will always have a success status. If apData is null, it can be any success status, including - * possibly a cluster-specific one. If apData is not null it aStatusIB will always be a generic - * SUCCESS status with no-cluster specific information. - * @param[in] aData: The command data, will be nullptr if the server returns a StatusIB. + * @param[in] apCommandSender The command sender object that initiated the command transaction. + * @param[in] aPath The command path field in invoke command response. + * @param[in] aStatusIB It will always have a success status. If apData is null, it can be any success status, + * including possibly a cluster-specific one. If apData is not null it aStatusIB will always + * be a generic SUCCESS status with no-cluster specific information. + * @param[in] aData The command data, will be nullptr if the server returns a StatusIB. */ virtual void OnResponse(CommandSender * apCommandSender, const ConcreteCommandPath & aPath, const StatusIB & aStatusIB, TLV::TLVReader * apData) @@ -89,9 +89,9 @@ class CommandSender final : public Command, public Messaging::ExchangeDelegate * The CommandSender object MUST continue to exist after this call is completed. The application shall wait until it * receives an OnDone call to destroy and free the object. * - * @param[in] apCommandSender: The command sender object that initiated the command transaction. - * @param[in] aStatusIB: The status code including IM status code and optional cluster status code - * @param[in] aError: A system error code that conveys the overall error code. + * @param[in] apCommandSender The command sender object that initiated the command transaction. + * @param[in] aStatusIB The status code including IM status code and optional cluster status code + * @param[in] aError A system error code that conveys the overall error code. */ virtual void OnError(const CommandSender * apCommandSender, const StatusIB & aStatusIB, CHIP_ERROR aError) {} diff --git a/src/controller/DeviceControllerInteractionModelDelegate.h b/src/app/DeviceControllerInteractionModelDelegate.h similarity index 53% rename from src/controller/DeviceControllerInteractionModelDelegate.h rename to src/app/DeviceControllerInteractionModelDelegate.h index 929d8eddfe3162..01a61173a15306 100644 --- a/src/controller/DeviceControllerInteractionModelDelegate.h +++ b/src/app/DeviceControllerInteractionModelDelegate.h @@ -4,7 +4,8 @@ #include #include -#include +#include +#include namespace chip { namespace Controller { @@ -22,22 +23,78 @@ class DeviceControllerInteractionModelDelegate : public chip::app::ReadClient::C { public: void OnResponse(app::CommandSender * apCommandSender, const app::ConcreteCommandPath & aPath, - const chip::app::StatusIB & aStatus, TLV::TLVReader * aData) override; + const chip::app::StatusIB & aStatus, TLV::TLVReader * aData) override + { + // Generally IM has more detailed errors than ember library, here we always use the, the actual handling of the + // commands should implement full IMDelegate. + // #6308 By implement app side IM delegate, we should be able to accept detailed error codes. + // Note: The IMDefaultResponseCallback is a bridge to the old CallbackMgr before IM is landed, so it still accepts + // EmberAfStatus instead of IM status code. + if (aData != nullptr) + { + chip::app::DispatchSingleClusterResponseCommand(aPath, *aData, apCommandSender); + } + else + { + IMDefaultResponseCallback(apCommandSender, EMBER_ZCL_STATUS_SUCCESS); + } + } + void OnError(const app::CommandSender * apCommandSender, const chip::app::StatusIB & aStatus, - CHIP_ERROR aProtocolError) override; - void OnDone(app::CommandSender * apCommandSender) override; + CHIP_ERROR aProtocolError) override + { + // The IMDefaultResponseCallback started out life as an Ember function, so it only accepted + // Ember status codes. Consequently, let's convert the IM code over to a meaningful Ember status before dispatching. + // + // This however, results in loss (aError is completely discarded). When full cluster-specific status codes are implemented + // as well, this will be an even bigger problem. + // + // For now, #10331 tracks this issue. + IMDefaultResponseCallback(apCommandSender, app::ToEmberAfStatus(aStatus.mStatus)); + } + + void OnDone(app::CommandSender * apCommandSender) override { return chip::Platform::Delete(apCommandSender); } void OnResponse(const app::WriteClient * apWriteClient, const app::ConcreteAttributePath & aPath, - app::StatusIB attributeStatus) override; - void OnError(const app::WriteClient * apWriteClient, CHIP_ERROR aError) override; - void OnDone(app::WriteClient * apWriteClient) override; + app::StatusIB attributeStatus) override + { + IMWriteResponseCallback(apWriteClient, attributeStatus.mStatus); + } + + void OnError(const app::WriteClient * apWriteClient, CHIP_ERROR aError) override + { + IMWriteResponseCallback(apWriteClient, Protocols::InteractionModel::Status::Failure); + } + + void OnDone(app::WriteClient * apWriteClient) override {} void OnEventData(const app::ReadClient * apReadClient, TLV::TLVReader & aEventList) override {} + void OnAttributeData(const app::ReadClient * apReadClient, const app::ConcreteAttributePath & aPath, TLV::TLVReader * apData, - const app::StatusIB & aStatus) override; - void OnSubscriptionEstablished(const app::ReadClient * apReadClient) override; - void OnError(const app::ReadClient * apReadClient, CHIP_ERROR aError) override; - void OnDone(app::ReadClient * apReadClient) override; + const app::StatusIB & aStatus) override + { + IMReadReportAttributesResponseCallback(apReadClient, &aPath, apData, aStatus.mStatus); + } + + void OnSubscriptionEstablished(const app::ReadClient * apReadClient) override + { + IMSubscribeResponseCallback(apReadClient, EMBER_ZCL_STATUS_SUCCESS); + } + + void OnError(const app::ReadClient * apReadClient, CHIP_ERROR aError) override + { + app::ClusterInfo path; + path.mNodeId = apReadClient->GetPeerNodeId(); + IMReadReportAttributesResponseCallback(apReadClient, nullptr, nullptr, Protocols::InteractionModel::Status::Failure); + } + + void OnDone(app::ReadClient * apReadClient) override + { + if (apReadClient->IsSubscriptionType()) + { + this->FreeAttributePathParam(reinterpret_cast(apReadClient)); + } + } // TODO: FreeAttributePathParam and AllocateAttributePathParam are used by CHIPDevice.cpp for getting a long-live attribute path // object. diff --git a/src/app/DeviceProxy.cpp b/src/app/DeviceProxy.cpp new file mode 100644 index 00000000000000..3c7c6b1f84bfd1 --- /dev/null +++ b/src/app/DeviceProxy.cpp @@ -0,0 +1,168 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains implementation of Device class. The objects of this + * class will be used by Controller applications to interact with CHIP + * devices. The class provides mechanism to construct, send and receive + * messages to and from the corresponding CHIP devices. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::Callback; + +namespace chip { + +CHIP_ERROR DeviceProxy::SendCommands(app::CommandSender * commandObj) +{ + VerifyOrReturnLogError(IsSecureConnected(), CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(commandObj != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + return commandObj->SendCommandRequest(GetSecureSession().Value()); +} + +void DeviceProxy::AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, app::TLVDataFilter tlvDataFilter) +{ + // Interaction model uses the object instead of a sequence number as the identifier of transactions. + // Since the objects can be identified by its pointer which fits into a uint64 value (the type of NodeId), we use it for the + // "node id" field in callback manager. + static_assert(std::is_same::value, "chip::NodeId is not uint64_t"); + chip::NodeId transactionId = reinterpret_cast(commandObj); + mCallbacksMgr.AddResponseCallback(transactionId, 0 /* seqNum, always 0 for IM before #6559 */, onSuccessCallback, + onFailureCallback, tlvDataFilter); +} + +void DeviceProxy::CancelIMResponseHandler(void * commandObj) +{ + // Interaction model uses the object instead of a sequence number as the identifier of transactions. + // Since the objects can be identified by its pointer which fits into a uint64 value (the type of NodeId), we use it for the + // "node id" field in callback manager. + static_assert(std::is_same::value, "chip::NodeId is not uint64_t"); + chip::NodeId transactionId = reinterpret_cast(commandObj); + mCallbacksMgr.CancelResponseCallback(transactionId, 0 /* seqNum, always 0 for IM before #6559 */); +} + +void DeviceProxy::AddReportHandler(EndpointId endpoint, ClusterId cluster, AttributeId attribute, + Callback::Cancelable * onReportCallback, app::TLVDataFilter tlvDataFilter) +{ + mCallbacksMgr.AddReportCallback(GetDeviceId(), endpoint, cluster, attribute, onReportCallback, tlvDataFilter); +} + +CHIP_ERROR DeviceProxy::SendReadAttributeRequest(app::AttributePathParams aPath, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, app::TLVDataFilter aTlvDataFilter) +{ + VerifyOrReturnLogError(IsSecureConnected(), CHIP_ERROR_INCORRECT_STATE); + + app::ReadClient * readClient = nullptr; + ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewReadClient( + &readClient, app::ReadClient::InteractionType::Read, GetInteractionModelDelegate())); + + if (onSuccessCallback != nullptr || onFailureCallback != nullptr) + { + AddIMResponseHandler(readClient, onSuccessCallback, onFailureCallback, aTlvDataFilter); + } + // The application context is used to identify different requests from client application the type of it is intptr_t, here we + // use the seqNum. + chip::app::ReadPrepareParams readPrepareParams(GetSecureSession().Value()); + readPrepareParams.mpAttributePathParamsList = &aPath; + readPrepareParams.mAttributePathParamsListSize = 1; + + CHIP_ERROR err = readClient->SendReadRequest(readPrepareParams); + + if (err != CHIP_NO_ERROR) + { + CancelIMResponseHandler(readClient); + } + return err; +} + +CHIP_ERROR DeviceProxy::SendSubscribeAttributeRequest(app::AttributePathParams aPath, uint16_t mMinIntervalFloorSeconds, + uint16_t mMaxIntervalCeilingSeconds, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + VerifyOrReturnLogError(IsSecureConnected(), CHIP_ERROR_INCORRECT_STATE); + + uint8_t seqNum = GetNextSequenceNumber(); + + app::AttributePathParams * path = GetInteractionModelDelegate()->AllocateAttributePathParam(1, seqNum); + + VerifyOrReturnError(path != nullptr, CHIP_ERROR_NO_MEMORY); + + *path = aPath; + + app::ReadClient * readClient = nullptr; + ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewReadClient( + &readClient, app::ReadClient::InteractionType::Subscribe, GetInteractionModelDelegate())); + + // The application context is used to identify different requests from client application the type of it is intptr_t, here we + // use the seqNum. + VerifyOrReturnError(GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); + app::ReadPrepareParams params(GetSecureSession().Value()); + params.mpAttributePathParamsList = path; + params.mAttributePathParamsListSize = 1; + params.mMinIntervalFloorSeconds = mMinIntervalFloorSeconds; + params.mMaxIntervalCeilingSeconds = mMaxIntervalCeilingSeconds; + params.mKeepSubscriptions = false; + + CHIP_ERROR err = readClient->SendSubscribeRequest(params); + if (err != CHIP_NO_ERROR) + { + GetInteractionModelDelegate()->FreeAttributePathParam(reinterpret_cast(readClient)); + readClient->Shutdown(); + return err; + } + + if (onSuccessCallback != nullptr || onFailureCallback != nullptr) + { + AddIMResponseHandler(readClient, onSuccessCallback, onFailureCallback); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceProxy::SendWriteAttributeRequest(app::WriteClientHandle aHandle, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + VerifyOrReturnLogError(IsSecureConnected(), CHIP_ERROR_INCORRECT_STATE); + + CHIP_ERROR err = CHIP_NO_ERROR; + + app::WriteClient * writeClient = aHandle.Get(); + + if (onSuccessCallback != nullptr || onFailureCallback != nullptr) + { + AddIMResponseHandler(writeClient, onSuccessCallback, onFailureCallback); + } + if ((err = aHandle.SendWriteRequest(GetSecureSession().Value())) != CHIP_NO_ERROR) + { + CancelIMResponseHandler(writeClient); + } + return err; +} + +} // namespace chip diff --git a/src/app/DeviceProxy.h b/src/app/DeviceProxy.h new file mode 100644 index 00000000000000..7303defc1b9960 --- /dev/null +++ b/src/app/DeviceProxy.h @@ -0,0 +1,142 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains definitions for DeviceProxy base class. The objects of this + * class will be used by applications to interact with peer CHIP devices. + * The class provides mechanism to construct, send and receive messages to and + * from the corresponding CHIP devices. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace chip { + +class DLL_EXPORT DeviceProxy +{ +public: + virtual ~DeviceProxy() {} + DeviceProxy() {} + + /** + * Called when a connection is closing. + * The object releases all resources associated with the connection. + */ + virtual void OnConnectionExpired(SessionHandle session) = 0; + + /** + * Mark any open session with the device as expired. + */ + virtual CHIP_ERROR Disconnect() = 0; + + virtual NodeId GetDeviceId() const = 0; + + virtual bool GetAddress(Inet::IPAddress & addr, uint16_t & port) const { return false; } + + virtual CHIP_ERROR SendReadAttributeRequest(app::AttributePathParams aPath, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, app::TLVDataFilter aTlvDataFilter); + + virtual CHIP_ERROR SendSubscribeAttributeRequest(app::AttributePathParams aPath, uint16_t mMinIntervalFloorSeconds, + uint16_t mMaxIntervalCeilingSeconds, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + virtual CHIP_ERROR ShutdownSubscriptions() { return CHIP_ERROR_NOT_IMPLEMENTED; } + + virtual CHIP_ERROR SendWriteAttributeRequest(app::WriteClientHandle aHandle, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback); + + virtual CHIP_ERROR SendCommands(app::CommandSender * commandObj); + + virtual void AddReportHandler(EndpointId endpoint, ClusterId cluster, AttributeId attribute, + Callback::Cancelable * onReportCallback, app::TLVDataFilter tlvDataFilter); + + // Interaction model uses the object and callback interface instead of sequence number to mark different transactions. + virtual void AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, app::TLVDataFilter tlvDataFilter = nullptr); + + virtual void CancelIMResponseHandler(void * commandObj); + + virtual Controller::DeviceControllerInteractionModelDelegate * GetInteractionModelDelegate() = 0; + + virtual Messaging::ExchangeManager * GetExchangeManager() const = 0; + + virtual chip::Optional GetSecureSession() const = 0; + + virtual bool IsActive() const { return true; } + + void GetMRPIntervals(uint32_t & idleInterval, uint32_t & activeInterval) const + { + idleInterval = mMrpIdleInterval; + activeInterval = mMrpActiveInterval; + } + +protected: + virtual bool IsSecureConnected() const = 0; + + virtual uint8_t GetNextSequenceNumber() = 0; + + app::CHIPDeviceCallbacksMgr & mCallbacksMgr = app::CHIPDeviceCallbacksMgr::GetInstance(); + + uint32_t mMrpIdleInterval = CHIP_CONFIG_MRP_DEFAULT_IDLE_RETRY_INTERVAL; + uint32_t mMrpActiveInterval = CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL; +}; + +/** + * This class defines an interface for an object that the user of Device + * can register as a delegate. The delegate object will be called by the + * Device when a new message or status update is received from the corresponding + * CHIP device. + */ +class DLL_EXPORT DeviceStatusDelegate +{ +public: + virtual ~DeviceStatusDelegate() {} + + /** + * @brief + * Called when a message is received from the device. + * + * @param[in] msg Received message buffer. + */ + virtual void OnMessage(System::PacketBufferHandle && msg) = 0; + + /** + * @brief + * Called when response to OpenPairingWindow is received from the device. + * + * @param[in] status CHIP_NO_ERROR on success, or corresponding error. + */ + virtual void OnPairingWindowOpenStatus(CHIP_ERROR status){}; + + /** + * @brief + * Called when device status is updated. + * + */ + virtual void OnStatusChange(void){}; +}; + +} // namespace chip diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 1186ca94cdf4db..b48978ee13d0e2 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -61,6 +61,21 @@ CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeM void InteractionModelEngine::Shutdown() { + CommandHandlerInterface * handlerIter = mCommandHandlerList; + + // + // Walk our list of command handlers and de-register them, before finally + // nulling out the list entirely. + // + while (handlerIter) + { + CommandHandlerInterface * next = handlerIter->GetNext(); + handlerIter->SetNext(nullptr); + handlerIter = next; + } + + mCommandHandlerList = nullptr; + // // Since modifying the pool during iteration is generally frowned upon, // I've chosen to just destroy the object but not necessarily de-allocate it. @@ -277,9 +292,9 @@ CHIP_ERROR InteractionModelEngine::OnUnknownMsgType(Messaging::ExchangeContext * return err; } -void InteractionModelEngine::OnDone(CommandHandler * apCommandObj) +void InteractionModelEngine::OnDone(CommandHandler & apCommandObj) { - mCommandHandlerObjs.ReleaseObject(apCommandObj); + mCommandHandlerObjs.ReleaseObject(&apCommandObj); } CHIP_ERROR InteractionModelEngine::OnInvokeCommandRequest(Messaging::ExchangeContext * apExchangeContext, @@ -545,5 +560,119 @@ bool InteractionModelEngine::IsOverlappedAttributePath(ClusterInfo & aAttributeP return false; } +void InteractionModelEngine::DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) +{ + CommandHandlerInterface * handler = FindCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); + + if (handler) + { + CommandHandlerInterface::HandlerContext context(apCommandObj, aCommandPath, apPayload); + handler->InvokeCommand(context); + + // + // If the command was handled, don't proceed any further and return successfully. + // + if (context.mCommandHandled) + { + return; + } + } + + DispatchSingleClusterCommand(aCommandPath, apPayload, &apCommandObj); +} + +bool InteractionModelEngine::CommandExists(const ConcreteCommandPath & aCommandPath) +{ + return ServerClusterCommandExists(aCommandPath); +} + +CHIP_ERROR InteractionModelEngine::RegisterCommandHandler(CommandHandlerInterface * handler) +{ + VerifyOrReturnError(handler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->Matches(*handler)) + { + ChipLogError(InteractionModel, "Duplicate command handler registration failed"); + return CHIP_ERROR_INCORRECT_STATE; + } + } + + handler->SetNext(mCommandHandlerList); + mCommandHandlerList = handler; + + return CHIP_NO_ERROR; +} + +void InteractionModelEngine::UnregisterCommandHandlers(EndpointId endpointId) +{ + CommandHandlerInterface * prev = nullptr; + + for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->MatchesEndpoint(endpointId)) + { + if (prev == nullptr) + { + mCommandHandlerList = cur->GetNext(); + } + else + { + prev->SetNext(cur->GetNext()); + } + + cur->SetNext(nullptr); + } + else + { + prev = cur; + } + } +} + +CHIP_ERROR InteractionModelEngine::UnregisterCommandHandler(CommandHandlerInterface * handler) +{ + VerifyOrReturnError(handler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + CommandHandlerInterface * prev = nullptr; + + for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->Matches(*handler)) + { + if (prev == nullptr) + { + mCommandHandlerList = cur->GetNext(); + } + else + { + prev->SetNext(cur->GetNext()); + } + + cur->SetNext(nullptr); + + return CHIP_NO_ERROR; + } + + prev = cur; + } + + return CHIP_ERROR_KEY_NOT_FOUND; +} + +CommandHandlerInterface * InteractionModelEngine::FindCommandHandler(EndpointId endpointId, ClusterId clusterId) +{ + for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->Matches(endpointId, clusterId)) + { + return cur; + } + } + + return nullptr; +} + } // namespace app } // namespace chip diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 8c6143474f7bba..d5fce192f6e56a 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -187,19 +188,24 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman bool MergeOverlappedAttributePath(ClusterInfo * apAttributePathList, ClusterInfo & aAttributePath); bool IsOverlappedAttributePath(ClusterInfo & aAttributePath); + CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); + CHIP_ERROR UnregisterCommandHandler(CommandHandlerInterface * handler); + CommandHandlerInterface * FindCommandHandler(EndpointId endpointId, ClusterId clusterId); + void UnregisterCommandHandlers(EndpointId endpointId); + private: friend class reporting::Engine; friend class TestCommandInteraction; - void OnDone(CommandHandler * apCommandObj); + void OnDone(CommandHandler & apCommandObj) override; CHIP_ERROR OnUnknownMsgType(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); CHIP_ERROR OnInvokeCommandRequest(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, - System::PacketBufferHandle && aPayload); - void OnResponseTimeout(Messaging::ExchangeContext * ec); + System::PacketBufferHandle && aPayload) override; + void OnResponseTimeout(Messaging::ExchangeContext * ec) override; /** * Called when Interaction Model receives a Read Request message. Errors processing @@ -222,9 +228,15 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman CHIP_ERROR OnUnsolicitedReportData(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); + void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) override; + bool CommandExists(const ConcreteCommandPath & aCommandPath) override; + Messaging::ExchangeManager * mpExchangeMgr = nullptr; InteractionModelDelegate * mpDelegate = nullptr; + CommandHandlerInterface * mCommandHandlerList = nullptr; + // TODO(#8006): investgate if we can disable some IM functions on some compact accessories. // TODO(#8006): investgate if we can provide more flexible object management on devices with more resources. BitMapObjectPool mCommandHandlerObjs; diff --git a/src/app/MessageDef/AttributeDataIB.h b/src/app/MessageDef/AttributeDataIB.h index a4144c4374d276..7327f38692bba9 100644 --- a/src/app/MessageDef/AttributeDataIB.h +++ b/src/app/MessageDef/AttributeDataIB.h @@ -79,7 +79,7 @@ class Parser : public StructParser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a Path * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetPath(AttributePathIB::Parser * const apPath) const; + CHIP_ERROR GetPath(AttributePathIB::Parser * const apAttributePath) const; /** * @brief Get a TLVReader for the Data. Next() must be called before accessing them. diff --git a/src/app/MessageDef/AttributePathIB.h b/src/app/MessageDef/AttributePathIB.h index 4ac86981b0e55c..c07b1026126f6b 100644 --- a/src/app/MessageDef/AttributePathIB.h +++ b/src/app/MessageDef/AttributePathIB.h @@ -63,7 +63,7 @@ class Parser : public ListParser /** * @brief Get the EnableTagCompression * - * @param [in] apNodeId A pointer to apNodeId + * @param [in] apEnableTagCompression A pointer to apEnableTagCompression * * @return #CHIP_NO_ERROR on success * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not boolean types @@ -80,7 +80,7 @@ class Parser : public ListParser * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types * #CHIP_END_OF_TLV if there is no such element */ - CHIP_ERROR GetNode(NodeId * const apNode) const; + CHIP_ERROR GetNode(NodeId * const apNodeId) const; /** * @brief Get the Endpoint. diff --git a/src/app/MessageDef/EventDataIB.h b/src/app/MessageDef/EventDataIB.h index 3e63b7eb5f8db4..700e0da810ead1 100644 --- a/src/app/MessageDef/EventDataIB.h +++ b/src/app/MessageDef/EventDataIB.h @@ -175,7 +175,7 @@ class Builder : public StructBuilder * @brief Inject PriorityLevel into the TLV stream to indicate the priority level associated with * the cluster that is referenced by the path. * - * @param [in] aPriorityLevel This is an integer representation of the priority level. + * @param [in] aPriority This is an integer representation of the priority level. * * @return A reference to *this */ diff --git a/src/app/MessageDef/EventPathIB.h b/src/app/MessageDef/EventPathIB.h index 8b2d6a1fe486ad..95cc79c9cffcda 100644 --- a/src/app/MessageDef/EventPathIB.h +++ b/src/app/MessageDef/EventPathIB.h @@ -90,7 +90,7 @@ class Parser : public ListParser /** * @brief Get a TLVReader for the ClusterId. Next() must be called before accessing them. * - * @param [in] apClusterId A pointer to apClusterId + * @param [in] apCluster A pointer to apCluster * * @return #CHIP_NO_ERROR on success * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types @@ -101,7 +101,7 @@ class Parser : public ListParser /** * @brief Get a TLVReader for the EventId. Next() must be called before accessing them. * - * @param [in] apEventId A pointer to apEventId + * @param [in] apEvent A pointer to apEvent * * @return #CHIP_NO_ERROR on success * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types @@ -110,9 +110,9 @@ class Parser : public ListParser CHIP_ERROR GetEvent(EventId * const apEvent) const; /** - * @brief Get a TLVReader for the EventId. Next() must be called before accessing them. + * @brief Get a TLVReader for the bool isUrgent. Next() must be called before accessing them. * - * @param [in] apEventId A pointer to apEventId + * @param [in] apISUrgent A pointer to apIsUrgent * * @return #CHIP_NO_ERROR on success * #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types @@ -136,7 +136,7 @@ class Builder : public ListBuilder /** * @brief Inject Endpoint into the TLV stream. * - * @param [in] aEndpoint EndpointId for this eevent path + * @param [in] aEndpoint EndpointId for this event path * * @return A reference to *this */ @@ -154,16 +154,16 @@ class Builder : public ListBuilder /** * @brief Inject Event into the TLV stream. * - * @param [in] aEvent ClusterId for this event path + * @param [in] aEvent EventId for this event path * * @return A reference to *this */ EventPathIB::Builder & Event(const EventId aEvent); /** - * @brief Inject EventId into the TLV stream. + * @brief Inject urgent boolean into the TLV stream. * - * @param [in] aEventId ClusterId for this event path + * @param [in] aIsUrgent boolean for this event path * * @return A reference to *this */ diff --git a/src/app/MessageDef/InvokeResponseIB.h b/src/app/MessageDef/InvokeResponseIB.h index 83de7bc7810b14..83e935ce6cfc07 100644 --- a/src/app/MessageDef/InvokeResponseIB.h +++ b/src/app/MessageDef/InvokeResponseIB.h @@ -71,7 +71,7 @@ class Parser : public StructParser /** * @brief Get a parser for a Status. * - * @param [in] apCommand A pointer to the CommandStatusIB parser. + * @param [in] apStatus A pointer to the CommandStatusIB parser. * * @return #CHIP_NO_ERROR on success * #CHIP_END_OF_TLV if there is no such element diff --git a/src/app/OperationalDeviceProxy.cpp b/src/app/OperationalDeviceProxy.cpp new file mode 100644 index 00000000000000..95bc97ca3bc720 --- /dev/null +++ b/src/app/OperationalDeviceProxy.cpp @@ -0,0 +1,315 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains implementation of Device class. The objects of this + * class will be used by Controller applications to interact with CHIP + * devices. The class provides mechanism to construct, send and receive + * messages to and from the corresponding CHIP devices. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::Callback; + +namespace chip { + +CHIP_ERROR OperationalDeviceProxy::Connect(Callback::Callback * onConnection, + Callback::Callback * onFailure) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + switch (mState) + { + case State::Uninitialized: + err = CHIP_ERROR_INCORRECT_STATE; + break; + + case State::NeedsAddress: + err = Dnssd::Resolver::Instance().ResolveNodeId(mPeerId, chip::Inet::IPAddressType::kAny); + EnqueueConnectionCallbacks(onConnection, onFailure); + break; + + case State::Initialized: + err = EstablishConnection(); + if (err == CHIP_NO_ERROR) + { + EnqueueConnectionCallbacks(onConnection, onFailure); + } + break; + case State::Connecting: + EnqueueConnectionCallbacks(onConnection, onFailure); + break; + + case State::SecureConnected: + if (onConnection != nullptr) + { + onConnection->mCall(onConnection->mContext, this); + } + break; + + default: + err = CHIP_ERROR_INCORRECT_STATE; + }; + + if (err != CHIP_NO_ERROR && onFailure != nullptr) + { + onFailure->mCall(onFailure->mContext, mPeerId.GetNodeId(), err); + } + + return err; +} + +CHIP_ERROR OperationalDeviceProxy::UpdateDeviceData(const Transport::PeerAddress & addr, uint32_t mrpIdleInterval, + uint32_t mrpActiveInterval) +{ + VerifyOrReturnLogError(mState != State::Uninitialized, CHIP_ERROR_INCORRECT_STATE); + + CHIP_ERROR err = CHIP_NO_ERROR; + mDeviceAddress = addr; + + mMrpIdleInterval = mrpIdleInterval; + mMrpActiveInterval = mrpActiveInterval; + + if (mState == State::NeedsAddress) + { + mState = State::Initialized; + err = EstablishConnection(); + if (err != CHIP_NO_ERROR) + { + OnSessionEstablishmentError(err); + } + } + else + { + if (!mSecureSession.HasValue()) + { + // Nothing needs to be done here. It's not an error to not have a + // secureSession. For one thing, we could have gotten an different + // UpdateAddress already and that caused connections to be torn down and + // whatnot. + return CHIP_NO_ERROR; + } + + Transport::SecureSession * secureSession = mInitParams.sessionManager->GetSecureSession(mSecureSession.Value()); + if (secureSession != nullptr) + { + secureSession->SetPeerAddress(addr); + secureSession->SetMRPIntervals(mrpIdleInterval, mrpActiveInterval); + } + } + + return err; +} + +bool OperationalDeviceProxy::GetAddress(Inet::IPAddress & addr, uint16_t & port) const +{ + if (mState == State::Uninitialized || mState == State::NeedsAddress) + { + return false; + } + + addr = mDeviceAddress.GetIPAddress(); + port = mDeviceAddress.GetPort(); + return true; +} + +CHIP_ERROR OperationalDeviceProxy::EstablishConnection() +{ + // Create a UnauthenticatedSession for CASE pairing. + // Don't use mSecureSession here, because mSecureSession is for encrypted communication. + Optional session = mInitParams.sessionManager->CreateUnauthenticatedSession(mDeviceAddress); + VerifyOrReturnError(session.HasValue(), CHIP_ERROR_NO_MEMORY); + + session.Value().GetUnauthenticatedSession()->SetMRPIntervals(mMrpIdleInterval, mMrpActiveInterval); + + Messaging::ExchangeContext * exchange = mInitParams.exchangeMgr->NewContext(session.Value(), &mCASESession); + VerifyOrReturnError(exchange != nullptr, CHIP_ERROR_INTERNAL); + + ReturnErrorOnFailure(mCASESession.MessageDispatch().Init(mInitParams.sessionManager)); + + uint16_t keyID = 0; + ReturnErrorOnFailure(mInitParams.idAllocator->Allocate(keyID)); + + ReturnErrorOnFailure( + mCASESession.EstablishSession(mDeviceAddress, mInitParams.fabricInfo, mPeerId.GetNodeId(), keyID, exchange, this)); + + mState = State::Connecting; + + return CHIP_NO_ERROR; +} + +void OperationalDeviceProxy::EnqueueConnectionCallbacks(Callback::Callback * onConnection, + Callback::Callback * onFailure) +{ + if (onConnection != nullptr) + { + mConnectionSuccess.Enqueue(onConnection->Cancel()); + } + + if (onFailure != nullptr) + { + mConnectionFailure.Enqueue(onFailure->Cancel()); + } +} + +void OperationalDeviceProxy::DequeueConnectionSuccessCallbacks(bool executeCallback) +{ + Cancelable ready; + mConnectionSuccess.DequeueAll(ready); + while (ready.mNext != &ready) + { + Callback::Callback * cb = Callback::Callback::FromCancelable(ready.mNext); + + cb->Cancel(); + if (executeCallback) + { + cb->mCall(cb->mContext, this); + } + } +} + +void OperationalDeviceProxy::DequeueConnectionFailureCallbacks(CHIP_ERROR error, bool executeCallback) +{ + Cancelable ready; + mConnectionFailure.DequeueAll(ready); + while (ready.mNext != &ready) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(ready.mNext); + + cb->Cancel(); + if (executeCallback) + { + cb->mCall(cb->mContext, mPeerId.GetNodeId(), error); + } + } +} + +void OperationalDeviceProxy::OnSessionEstablishmentError(CHIP_ERROR error) +{ + VerifyOrReturn(mState != State::Uninitialized && mState != State::NeedsAddress, + ChipLogError(Controller, "OnSessionEstablishmentError was called while the device was not initialized")); + + mState = State::Initialized; + mInitParams.idAllocator->Free(mCASESession.GetLocalSessionId()); + + DequeueConnectionSuccessCallbacks(/* executeCallback */ false); + DequeueConnectionFailureCallbacks(error, /* executeCallback */ true); +} + +void OperationalDeviceProxy::OnSessionEstablished() +{ + VerifyOrReturn(mState != State::Uninitialized, + ChipLogError(Controller, "OnSessionEstablished was called while the device was not initialized")); + + CHIP_ERROR err = mInitParams.sessionManager->NewPairing( + Optional::Value(mDeviceAddress), mPeerId.GetNodeId(), &mCASESession, + CryptoContext::SessionRole::kInitiator, mInitParams.fabricInfo->GetFabricIndex()); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "Failed in setting up CASE secure channel: err %s", ErrorStr(err)); + OnSessionEstablishmentError(err); + return; + } + mSecureSession.SetValue(SessionHandle(mPeerId.GetNodeId(), mCASESession.GetLocalSessionId(), mCASESession.GetPeerSessionId(), + mInitParams.fabricInfo->GetFabricIndex())); + + mState = State::SecureConnected; + + DequeueConnectionFailureCallbacks(CHIP_NO_ERROR, /* executeCallback */ false); + DequeueConnectionSuccessCallbacks(/* executeCallback */ true); +} + +CHIP_ERROR OperationalDeviceProxy::Disconnect() +{ + ReturnErrorCodeIf(mState != State::SecureConnected, CHIP_ERROR_INCORRECT_STATE); + if (mSecureSession.HasValue()) + { + mInitParams.sessionManager->ExpirePairing(mSecureSession.Value()); + } + mState = State::Initialized; + mCASESession.Clear(); + return CHIP_NO_ERROR; +} + +void OperationalDeviceProxy::Clear() +{ + mCASESession.Clear(); + + mState = State::Uninitialized; + mStatusDelegate = nullptr; + if (mInitParams.exchangeMgr) + { + // Ensure that any exchange contexts we have open get closed now, + // because we don't want them to call back in to us after this + // point. + mInitParams.exchangeMgr->CloseAllContextsForDelegate(this); + } + mInitParams = DeviceProxyInitParams(); +} + +void OperationalDeviceProxy::OnConnectionExpired(SessionHandle session) +{ + VerifyOrReturn(mSecureSession.HasValue() && mSecureSession.Value() == session, + ChipLogDetail(Controller, "Connection expired, but it doesn't match the current session")); + mState = State::Initialized; + mSecureSession.ClearValue(); +} + +CHIP_ERROR OperationalDeviceProxy::OnMessageReceived(Messaging::ExchangeContext * exchange, const PayloadHeader & payloadHeader, + System::PacketBufferHandle && msgBuf) +{ + if (mState == State::SecureConnected) + { + if (mStatusDelegate != nullptr) + { + mStatusDelegate->OnMessage(std::move(msgBuf)); + } + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OperationalDeviceProxy::ShutdownSubscriptions() +{ + return app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(mInitParams.fabricInfo->GetFabricIndex(), + GetDeviceId()); +} + +OperationalDeviceProxy::~OperationalDeviceProxy() +{ + if (mInitParams.exchangeMgr) + { + // Ensure that any exchange contexts we have open get closed now, + // because we don't want them to call back in to us after this + // point. + mInitParams.exchangeMgr->CloseAllContextsForDelegate(this); + } +} + +} // namespace chip diff --git a/src/app/OperationalDeviceProxy.h b/src/app/OperationalDeviceProxy.h new file mode 100644 index 00000000000000..e860972071aad0 --- /dev/null +++ b/src/app/OperationalDeviceProxy.h @@ -0,0 +1,218 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains definitions for Device class. The objects of this + * class will be used by Controller applications to interact with CHIP + * devices. The class provides mechanism to construct, send and receive + * messages to and from the corresponding CHIP devices. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { + +class DeviceStatusDelegate; + +struct DeviceProxyInitParams +{ + SessionManager * sessionManager = nullptr; + Messaging::ExchangeManager * exchangeMgr = nullptr; + SessionIDAllocator * idAllocator = nullptr; + FabricInfo * fabricInfo = nullptr; + + Controller::DeviceControllerInteractionModelDelegate * imDelegate = nullptr; +}; + +class OperationalDeviceProxy; + +typedef void (*OnDeviceConnected)(void * context, DeviceProxy * device); +typedef void (*OnDeviceConnectionFailure)(void * context, NodeId deviceId, CHIP_ERROR error); + +class DLL_EXPORT OperationalDeviceProxy : public DeviceProxy, Messaging::ExchangeDelegate, public SessionEstablishmentDelegate +{ +public: + virtual ~OperationalDeviceProxy(); + OperationalDeviceProxy(DeviceProxyInitParams params, PeerId peerId) + { + VerifyOrReturn(params.sessionManager != nullptr); + VerifyOrReturn(params.exchangeMgr != nullptr); + VerifyOrReturn(params.idAllocator != nullptr); + VerifyOrReturn(params.fabricInfo != nullptr); + + mInitParams = params; + mPeerId = peerId; + mState = State::NeedsAddress; + } + + void Clear(); + + /* + * This function can be called to establish a secure session with the device. + * + * The device is expected to have been commissioned, A CASE session + * setup will be triggered. + * + * On establishing the session, the callback function `onConnection` will be called. If the + * session setup fails, `onFailure` will be called. + * + * If the session already exists, `onConnection` will be called immediately. + */ + CHIP_ERROR Connect(Callback::Callback * onConnection, + Callback::Callback * onFailure); + + bool IsConnected() const { return mState == State::SecureConnected; } + + bool IsConnecting() const { return mState == State::Connecting; } + + /** + * Called when a connection is closing. + * The object releases all resources associated with the connection. + */ + void OnConnectionExpired(SessionHandle session) override; + + /** + * Mark any open session with the device as expired. + */ + CHIP_ERROR Disconnect() override; + + NodeId GetDeviceId() const override { return mPeerId.GetNodeId(); } + /* + // ----- Messaging ----- + CHIP_ERROR SendReadAttributeRequest(app::AttributePathParams aPath, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, app::TLVDataFilter aTlvDataFilter) override; + + CHIP_ERROR SendSubscribeAttributeRequest(app::AttributePathParams aPath, uint16_t mMinIntervalFloorSeconds, + uint16_t mMaxIntervalCeilingSeconds, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) override; + + CHIP_ERROR SendWriteAttributeRequest(app::WriteClientHandle aHandle, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) override; + + CHIP_ERROR SendCommands(app::CommandSender * commandObj) override; + + void AddReportHandler(EndpointId endpoint, ClusterId cluster, AttributeId attribute, Callback::Cancelable * + onReportCallback, app::TLVDataFilter tlvDataFilter) override; + + void AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * + onFailureCallback, app::TLVDataFilter tlvDataFilter = nullptr) override; void CancelIMResponseHandler(void * commandObj) + override; + */ + /** + * @brief + * This function is called when a message is received from the corresponding + * device. The message ownership is transferred to the function, and it is expected + * to release the message buffer before returning. + */ + CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * exchange, const PayloadHeader & payloadHeader, + System::PacketBufferHandle && msgBuf) override; + + void OnResponseTimeout(Messaging::ExchangeContext * ec) override {} + + /** + * Update data of the device. + * This function will set new IP address, port and MRP retransmission intervals of the device. + * Since the device settings might have been moved from RAM to the persistent storage, the function + * will load the device settings first, before making the changes. + */ + CHIP_ERROR UpdateDeviceData(const Transport::PeerAddress & addr, uint32_t mrpIdleInterval, uint32_t mrpActiveInterval); + + /** + * Set the delegate object which will be called when a message is received. + * The user of this Device object must reset the delegate (by calling + * SetDelegate(nullptr)) before releasing their delegate object. + */ + void SetDelegate(DeviceStatusDelegate * delegate) { mStatusDelegate = delegate; } + + PeerId GetPeerId() const { return mPeerId; } + + bool MatchesSession(SessionHandle session) const { return mSecureSession.HasValue() && mSecureSession.Value() == session; } + + uint8_t GetNextSequenceNumber() override { return mSequenceNumber++; }; + + CHIP_ERROR ShutdownSubscriptions() override; + + //////////// SessionEstablishmentDelegate Implementation /////////////// + void OnSessionEstablishmentError(CHIP_ERROR error) override; + void OnSessionEstablished() override; + + CASESession & GetCASESession() { return mCASESession; } + + Controller::DeviceControllerInteractionModelDelegate * GetInteractionModelDelegate() override { return mInitParams.imDelegate; } + + Messaging::ExchangeManager * GetExchangeManager() const override { return mInitParams.exchangeMgr; } + + chip::Optional GetSecureSession() const override { return mSecureSession; } + + bool GetAddress(Inet::IPAddress & addr, uint16_t & port) const override; + +private: + enum class State + { + Uninitialized, + NeedsAddress, + Initialized, + Connecting, + SecureConnected, + }; + + DeviceProxyInitParams mInitParams; + + CASESession mCASESession; + + PeerId mPeerId; + + Transport::PeerAddress mDeviceAddress = Transport::PeerAddress::UDP(Inet::IPAddress::Any); + + State mState = State::Uninitialized; + + DeviceStatusDelegate * mStatusDelegate = nullptr; + Optional mSecureSession = Optional::Missing(); + + uint8_t mSequenceNumber = 0; + + Callback::CallbackDeque mConnectionSuccess; + Callback::CallbackDeque mConnectionFailure; + + CHIP_ERROR EstablishConnection(); + + bool IsSecureConnected() const override { return mState == State::SecureConnected; } + + void EnqueueConnectionCallbacks(Callback::Callback * onConnection, + Callback::Callback * onFailure); + + void DequeueConnectionSuccessCallbacks(bool executeCallback); + void DequeueConnectionFailureCallbacks(CHIP_ERROR error, bool executeCallback); +}; + +} // namespace chip diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index bdfba725964cda..3e678746b0df30 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -63,11 +63,11 @@ class ReadClient : public Messaging::ExchangeDelegate * Notification that a list of events is received on the given read client. * The ReadClient object MUST continue to exist after this call is completed. * - * @param[in] apReadClient The read client which initialized the read transaction. - * @param[in] apEventReportsReader TLV reader positioned at the list that contains the events. The - * implementation of EventStreamReceived is expected to call Next() on the reader to - * advance it to the first element of the list, then process the elements from beginning to - * the end. The callee is expected to consume all events. + * @param[in] apReadClient The read client which initialized the read transaction. + * @param[in] apEventReportsReader TLV reader positioned at the list that contains the events. The + * implementation of EventStreamReceived is expected to call Next() on the reader to + * advance it to the first element of the list, then process the elements from beginning to + * the end. The callee is expected to consume all events. */ virtual void OnEventData(const ReadClient * apReadClient, TLV::TLVReader & aEventReports) {} @@ -81,11 +81,11 @@ class ReadClient : public Messaging::ExchangeDelegate * - Receiving attribute data as reports of subscriptions * - Receiving attribute data as initial reports of subscriptions * - * @param[in] apReadClient: The read client object that initiated the read or subscribe transaction. - * @param[in] aPath: The attribute path field in report response. - * @param[in] apData: The attribute data of the given path, will be a nullptr if status is not Success. - * @param[in] aStatus: Attribute-specific status, containing an InteractionModel::Status code as well as an optional - * cluster-specific status code. + * @param[in] apReadClient The read client object that initiated the read or subscribe transaction. + * @param[in] aPath The attribute path field in report response. + * @param[in] apData The attribute data of the given path, will be a nullptr if status is not Success. + * @param[in] aStatus Attribute-specific status, containing an InteractionModel::Status code as well as an + * optional cluster-specific status code. */ virtual void OnAttributeData(const ReadClient * apReadClient, const ConcreteAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) @@ -97,7 +97,7 @@ class ReadClient : public Messaging::ExchangeDelegate * The ReadClient object MUST continue to exist after this call is completed. The application shall wait until it * receives an OnDone call before it shuts down the object. * - * @param[in] apReadClient: The read client object that initiated the read transaction. + * @param[in] apReadClient The read client object that initiated the read transaction. */ virtual void OnSubscriptionEstablished(const ReadClient * apReadClient) {} @@ -112,8 +112,8 @@ class ReadClient : public Messaging::ExchangeDelegate * The ReadClient object MUST continue to exist after this call is completed. The application shall wait until it * receives an OnDone call before it shuts down the object. * - * @param[in] apReadClient: The read client object that initiated the attribute read transaction. - * @param[in] aError: A system error code that conveys the overall error code. + * @param[in] apReadClient The read client object that initiated the attribute read transaction. + * @param[in] aError A system error code that conveys the overall error code. */ virtual void OnError(const ReadClient * apReadClient, CHIP_ERROR aError) {} @@ -126,7 +126,7 @@ class ReadClient : public Messaging::ExchangeDelegate * - Be called even in error circumstances. * - Only be called after a successful call to SendWriteRequest as been made. * - * @param[in] apReadClient: The read client object of the terminated read transaction. + * @param[in] apReadClient The read client object of the terminated read transaction. */ virtual void OnDone(ReadClient * apReadClient) = 0; }; diff --git a/src/app/WriteClient.cpp b/src/app/WriteClient.cpp index 211d8db96214c0..26699e402b76a3 100644 --- a/src/app/WriteClient.cpp +++ b/src/app/WriteClient.cpp @@ -244,12 +244,21 @@ CHIP_ERROR WriteClient::SendWriteRequest(SessionHandle session, System::Clock::T // Create a new exchange context. mpExchangeCtx = mpExchangeMgr->NewContext(session, this); VerifyOrExit(mpExchangeCtx != nullptr, err = CHIP_ERROR_NO_MEMORY); - mpExchangeCtx->SetResponseTimeout(timeout); + if (session.IsGroupSession()) + { + // Exchange will be closed by WriteClientHandle::SendWriteRequest for group messages + err = mpExchangeCtx->SendMessage(Protocols::InteractionModel::MsgType::WriteRequest, std::move(packet), + Messaging::SendFlags(Messaging::SendMessageFlags::kNoAutoRequestAck)); + } + else + { + mpExchangeCtx->SetResponseTimeout(timeout); - err = mpExchangeCtx->SendMessage(Protocols::InteractionModel::MsgType::WriteRequest, std::move(packet), - Messaging::SendFlags(Messaging::SendMessageFlags::kExpectResponse)); - SuccessOrExit(err); - MoveToState(State::AwaitingResponse); + err = mpExchangeCtx->SendMessage(Protocols::InteractionModel::MsgType::WriteRequest, std::move(packet), + Messaging::SendFlags(Messaging::SendMessageFlags::kExpectResponse)); + SuccessOrExit(err); + MoveToState(State::AwaitingResponse); + } exit: if (err != CHIP_NO_ERROR) @@ -350,10 +359,11 @@ CHIP_ERROR WriteClientHandle::SendWriteRequest(SessionHandle session, System::Cl { CHIP_ERROR err = mpWriteClient->SendWriteRequest(session, timeout); - if (err == CHIP_NO_ERROR) + // Transferring ownership of the underlying WriteClient to the IM layer. IM will manage its lifetime. + // For groupcast writes, there is no transfer of ownership since the interaction is done upon transmission of the action + if (err == CHIP_NO_ERROR && !session.IsGroupSession()) { - // On success, the InteractionModelEngine will be responible to take care of the lifecycle of the WriteClient, so we release - // the WriteClient without closing it. + // Release the WriteClient without closing it. mpWriteClient = nullptr; } else diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index 050aef4b558a38..cb7b1562873608 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -66,10 +66,10 @@ class WriteClient : public Messaging::ExchangeDelegate * The WriteClient object MUST continue to exist after this call is completed. The application shall wait until it * receives an OnDone call before it shuts down the object. * - * @param[in] apWriteClient: The write client object that initiated the write transaction. - * @param[in] aPath: The attribute path field in write response. - * @param[in] attributeStatus: Attribute-specific status, containing an InteractionModel::Status code as well as - * an optional cluster-specific status code. + * @param[in] apWriteClient The write client object that initiated the write transaction. + * @param[in] aPath The attribute path field in write response. + * @param[in] attributeStatus Attribute-specific status, containing an InteractionModel::Status code as well as + * an optional cluster-specific status code. */ virtual void OnResponse(const WriteClient * apWriteClient, const ConcreteAttributePath & aPath, StatusIB attributeStatus) {} @@ -84,8 +84,8 @@ class WriteClient : public Messaging::ExchangeDelegate * The WriteClient object MUST continue to exist after this call is completed. The application shall wait until it * receives an OnDone call before it shuts down the object. * - * @param[in] apWriteClient: The write client object that initiated the attribute write transaction. - * @param[in] aError: A system error code that conveys the overall error code. + * @param[in] apWriteClient The write client object that initiated the attribute write transaction. + * @param[in] aError A system error code that conveys the overall error code. */ virtual void OnError(const WriteClient * apWriteClient, CHIP_ERROR aError) {} @@ -98,7 +98,7 @@ class WriteClient : public Messaging::ExchangeDelegate * - Be called even in error circumstances. * - Only be called after a successful call to SendWriteRequest as been made. * - * @param[in] apWriteClient: The write client object of the terminated write transaction. + * @param[in] apWriteClient The write client object of the terminated write transaction. */ virtual void OnDone(WriteClient * apWriteClient) = 0; }; diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index f676f582969223..ceaf3a8ee97cd9 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -145,7 +145,7 @@ template("chip_data_model") { } else if (cluster == "mode-select-server") { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp", - "${_app_root}/clusters/${cluster}/static-supported-modes-manager.cpp", + "${_app_root}/clusters/${cluster}/supported-modes-manager.h", ] } else { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ] @@ -157,7 +157,6 @@ template("chip_data_model") { "${invoker.zap_pregenerated_dir}/CHIPClusters.cpp", "${invoker.zap_pregenerated_dir}/CHIPClusters.h", "${invoker.zap_pregenerated_dir}/CHIPClustersInvoke.cpp", - "${invoker.zap_pregenerated_dir}/CHIPClustersWrite.cpp", "${invoker.zap_pregenerated_dir}/attribute-size.cpp", "${invoker.zap_pregenerated_dir}/callback-stub.cpp", ] @@ -178,7 +177,6 @@ template("chip_data_model") { sources += [ "${invoker.zap_pregenerated_dir}/tests/CHIPClustersTest.cpp", "${invoker.zap_pregenerated_dir}/tests/CHIPClustersTest.h", - "${invoker.zap_pregenerated_dir}/tests/CHIPClustersTestWrite.cpp", ] } } diff --git a/src/app/clusters/descriptor/descriptor.cpp b/src/app/clusters/descriptor/descriptor.cpp index ad0eb53c7e4581..9a24fdf34624b8 100644 --- a/src/app/clusters/descriptor/descriptor.cpp +++ b/src/app/clusters/descriptor/descriptor.cpp @@ -152,7 +152,5 @@ CHIP_ERROR DescriptorAttrAccess::Read(const ConcreteAttributePath & aPath, Attri void MatterDescriptorPluginServerInitCallback(void) { -#if CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ registerAttributeAccessOverride(&gAttrAccess); -#endif } diff --git a/src/app/clusters/general_diagnostics_server/general_diagnostics_server.cpp b/src/app/clusters/general_diagnostics_server/general_diagnostics_server.cpp index ced518d665f14d..538fcff5252262 100644 --- a/src/app/clusters/general_diagnostics_server/general_diagnostics_server.cpp +++ b/src/app/clusters/general_diagnostics_server/general_diagnostics_server.cpp @@ -30,6 +30,7 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::GeneralDiagnostics::Attributes; using chip::DeviceLayer::ConnectivityMgr; +using chip::DeviceLayer::PlatformManager; using chip::DeviceLayer::PlatformMgr; namespace { @@ -44,16 +45,16 @@ class GeneralDiagosticsAttrAccess : public AttributeAccessInterface private: template - CHIP_ERROR ReadIfSupported(CHIP_ERROR (DeviceLayer::PlatformManager::*getter)(T &), AttributeValueEncoder & aEncoder); + CHIP_ERROR ReadIfSupported(CHIP_ERROR (PlatformManager::*getter)(T &), AttributeValueEncoder & aEncoder); CHIP_ERROR ReadNetworkInterfaces(AttributeValueEncoder & aEncoder); }; template -CHIP_ERROR GeneralDiagosticsAttrAccess::ReadIfSupported(CHIP_ERROR (DeviceLayer::PlatformManager::*getter)(T &), +CHIP_ERROR GeneralDiagosticsAttrAccess::ReadIfSupported(CHIP_ERROR (PlatformManager::*getter)(T &), AttributeValueEncoder & aEncoder) { T data; - CHIP_ERROR err = (DeviceLayer::PlatformMgr().*getter)(data); + CHIP_ERROR err = (PlatformMgr().*getter)(data); if (err == CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE) { data = 0; @@ -108,16 +109,16 @@ CHIP_ERROR GeneralDiagosticsAttrAccess::Read(const ConcreteAttributePath & aPath return ReadNetworkInterfaces(aEncoder); } case RebootCount::Id: { - return ReadIfSupported(&DeviceLayer::PlatformManager::GetRebootCount, aEncoder); + return ReadIfSupported(&PlatformManager::GetRebootCount, aEncoder); } case UpTime::Id: { - return ReadIfSupported(&DeviceLayer::PlatformManager::GetUpTime, aEncoder); + return ReadIfSupported(&PlatformManager::GetUpTime, aEncoder); } case TotalOperationalHours::Id: { - return ReadIfSupported(&DeviceLayer::PlatformManager::GetTotalOperationalHours, aEncoder); + return ReadIfSupported(&PlatformManager::GetTotalOperationalHours, aEncoder); } case BootReasons::Id: { - return ReadIfSupported(&DeviceLayer::PlatformManager::GetBootReasons, aEncoder); + return ReadIfSupported(&PlatformManager::GetBootReasons, aEncoder); } default: { break; @@ -139,8 +140,6 @@ class GeneralDiagnosticDelegate : public DeviceLayer::ConnectivityManagerDelegat if (emberAfEndpointIndexIsEnabled(index)) { EndpointId endpointId = emberAfEndpointFromIndex(index); - if (endpointId == 0) - continue; if (emberAfContainsServer(endpointId, GeneralDiagnostics::Id)) { 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 8662d94f7ace7b..7d90cf1c030a09 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -51,25 +51,22 @@ CHIP_ERROR ModeSelectAttrAccess::Read(const ConcreteAttributePath & aPath, Attri { VerifyOrDie(aPath.mClusterId == ModeSelect::Id); - const ModeSelect::StaticSupportedModesManager & gSupportedModeManager = - ModeSelect::StaticSupportedModesManager::getStaticSupportedModesManagerInstance(); + const ModeSelect::SupportedModesManager * gSupportedModeManager = ModeSelect::getSupportedModesManager(); if (ModeSelect::Attributes::SupportedModes::Id == aPath.mAttributeId) { - const ModeSelect::StaticSupportedModesManager::IteratorFactory * iteratorFactory = - gSupportedModeManager.getIteratorFactory(aPath.mEndpointId); - if (iteratorFactory == nullptr) + const ModeSelect::SupportedModesManager::ModeOptionsProvider modeOptionsProvider = + gSupportedModeManager->getModeOptionsProvider(aPath.mEndpointId); + if (modeOptionsProvider.begin() == nullptr) { aEncoder.Encode(DataModel::List()); return CHIP_NO_ERROR; } CHIP_ERROR err; - err = aEncoder.EncodeList([iteratorFactory](const TagBoundEncoder & encoder) -> CHIP_ERROR { - const auto & end = *(iteratorFactory->end()); - for (auto it = *(iteratorFactory->begin()); it != end; ++it) + err = aEncoder.EncodeList([modeOptionsProvider](const TagBoundEncoder & encoder) -> CHIP_ERROR { + const auto * end = modeOptionsProvider.end(); + for (auto * it = modeOptionsProvider.begin(); it != end; ++it) { - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: dereferencing it"); - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: it= %p", (void *) it.operator->()); auto & modeOption = *it; ReturnErrorOnFailure(encoder.Encode(modeOption)); } @@ -90,9 +87,8 @@ bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandle uint8_t newMode = commandData.newMode; // Check that the newMode matches one of the supported options const ModeSelect::Structs::ModeOptionStruct::Type * modeOptionPtr; - const ModeSelect::StaticSupportedModesManager & gSupportedModeManager = - ModeSelect::StaticSupportedModesManager::getStaticSupportedModesManagerInstance(); - EmberAfStatus checkSupportedModeStatus = gSupportedModeManager.getModeOptionByMode(endpointId, newMode, &modeOptionPtr); + EmberAfStatus checkSupportedModeStatus = + ModeSelect::getSupportedModesManager()->getModeOptionByMode(endpointId, newMode, &modeOptionPtr); if (EMBER_ZCL_STATUS_SUCCESS != checkSupportedModeStatus) { emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: Failed to find the option with mode %" PRIu8, newMode); diff --git a/src/app/clusters/mode-select-server/static-supported-modes-manager.cpp b/src/app/clusters/mode-select-server/static-supported-modes-manager.cpp deleted file mode 100644 index d65d0bda793437..00000000000000 --- a/src/app/clusters/mode-select-server/static-supported-modes-manager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -// Created by Ding, Li-an on 10/21/21. -// -#include -#include -#include - -using namespace std; -using namespace chip; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::ModeSelect; - -using ModeOptionStructType = Structs::ModeOptionStruct::Type; -using storage_value_type = const ModeOptionStructType *; -namespace { -Structs::ModeOptionStruct::Type buildModeOptionStruct(const char * label, uint8_t mode, uint32_t semanticTag) -{ - Structs::ModeOptionStruct::Type option; - option.label = CharSpan(label, strlen(label)); - option.mode = mode; - option.semanticTag = semanticTag; - return option; -} -} // namespace - -const Structs::ModeOptionStruct::Type StaticSupportedModesManager::blackOption = buildModeOptionStruct("Black", 0, 0); -const Structs::ModeOptionStruct::Type StaticSupportedModesManager::cappuccinoOption = buildModeOptionStruct("Cappuccino", 4, 0); -const Structs::ModeOptionStruct::Type StaticSupportedModesManager::espressoOption = buildModeOptionStruct("Espresso", 7, 0); -storage_value_type StaticSupportedModesManager::coffeeOptions[] = { &blackOption, &cappuccinoOption, &espressoOption }; -const Span StaticSupportedModesManager::coffeeOptionsSpan = - Span(StaticSupportedModesManager::coffeeOptions); -const map> StaticSupportedModesManager::optionsByEndpoints = { - { 1, StaticSupportedModesManager::coffeeOptionsSpan } -}; - -const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); - -const StaticSupportedModesManager::IteratorFactory * StaticSupportedModesManager::getIteratorFactory(EndpointId endpointId) const -{ - const auto & it = _iteratorFactoriesByEndpoints.find(endpointId); - return (it == _iteratorFactoriesByEndpoints.end()) ? nullptr : &(it->second); -} - -EmberAfStatus StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointId, unsigned char mode, - const ModeOptionStructType ** dataPtr) const -{ - auto * iteratorFactory = this->getIteratorFactory(endpointId); - if (iteratorFactory == nullptr) - { - return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER; - } - const StaticSupportedModesManager::Iterator & begin = *(this->getIteratorFactory(endpointId)->begin()); - const StaticSupportedModesManager::Iterator & end = *(this->getIteratorFactory(endpointId)->end()); - for (auto it = begin; it != end; ++it) - { - auto & modeOption = *it; - if (modeOption.mode == mode) - { - *dataPtr = &modeOption; - return EMBER_ZCL_STATUS_SUCCESS; - } - } - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %c", mode); - return EMBER_ZCL_STATUS_INVALID_ARGUMENT; -} diff --git a/src/app/clusters/mode-select-server/static-supported-modes-manager.h b/src/app/clusters/mode-select-server/static-supported-modes-manager.h deleted file mode 100644 index b48b96e7a8e60c..00000000000000 --- a/src/app/clusters/mode-select-server/static-supported-modes-manager.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace chip { -namespace app { -namespace Clusters { -namespace ModeSelect { - -/** - * This implementation statically defines the options. - */ - -class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager -{ - using ModeOptionStructType = Structs::ModeOptionStruct::Type; - using storage_value_type = const ModeOptionStructType *; - - static const ModeOptionStructType blackOption; - static const ModeOptionStructType cappuccinoOption; - static const ModeOptionStructType espressoOption; - - static const ModeOptionStructType * coffeeOptions[]; - static const Span coffeeOptionsSpan; - static const std::map> optionsByEndpoints; - -public: - static const StaticSupportedModesManager instance; - - struct Iterator : public chip::app::Clusters::ModeSelect::SupportedModesManager::ModeOptionStructIterator - { - using iterator_category = std::forward_iterator_tag; - using difference_type = std::ptrdiff_t; - using pointer = storage_value_type *; - using base_iterator_type = chip::app::Clusters::ModeSelect::SupportedModesManager::ModeOptionStructIterator; - - Iterator(const pointer aPtr) : mPtr(aPtr) {} - ~Iterator() = default; - - const ModeOptionStructType & operator*() const override { return **mPtr; } - const ModeOptionStructType * operator->() override { return *mPtr; } - const ModeOptionStructType * operator->() const override { return *mPtr; } - - // Prefix increment - base_iterator_type & operator++() override - { - ++mPtr; - return *this; - } - - bool operator==(const base_iterator_type & other) const override - { - // Warning: we are not doing type check - // TODO: use of typeid requires -frtti - // if (typeid(other) != typeid(*this)) - // { - // return false; - // } - return this->operator->() == other.operator->(); - } - bool operator!=(const base_iterator_type & other) const override { return !((*this) == other); } - - private: - pointer mPtr; - }; - - struct IteratorFactory : public chip::app::Clusters::ModeSelect::SupportedModesManager::ModeOptionStructIteratorFactory - { - using pointer = Iterator *; - using const_pointer = const pointer; - - IteratorFactory(const Span & aSupportedOptions) : - _begin(Iterator(aSupportedOptions.data())), _end(Iterator(aSupportedOptions.data() + aSupportedOptions.size())) - {} - ~IteratorFactory() = default; - - const Iterator * begin() const override { return &_begin; } - const Iterator * end() const override { return &_end; } - - private: - const Iterator _begin; - const Iterator _end; - }; - - const IteratorFactory * getIteratorFactory(EndpointId endpointId) const override; - - EmberAfStatus getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const override; - - ~StaticSupportedModesManager(){}; - - StaticSupportedModesManager() : StaticSupportedModesManager(&optionsByEndpoints) {} - - static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; } - -private: - StaticSupportedModesManager(const std::map> * const supportedModes) : - _iteratorFactoriesByEndpoints(std::map()) - { - for (auto & entry : *supportedModes) - { - _iteratorFactoriesByEndpoints.insert( - std::pair(entry.first, IteratorFactory(entry.second))); - } - } - // TODO: Implement move constructor? - - std::map _iteratorFactoriesByEndpoints; -}; - -} // namespace ModeSelect -} // namespace Clusters -} // namespace app -} // namespace chip 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 f4d6d50216c61e..4fb5bfb0c350c3 100644 --- a/src/app/clusters/mode-select-server/supported-modes-manager.h +++ b/src/app/clusters/mode-select-server/supported-modes-manager.h @@ -18,9 +18,6 @@ #pragma once -#include -#include - #include #include #include @@ -41,53 +38,35 @@ class SupportedModesManager using ModeOptionStructType = Structs::ModeOptionStruct::Type; public: - struct ModeOptionStructIterator - { - using iterator_category = std::forward_iterator_tag; - using difference_type = std::ptrdiff_t; - using value_type = const ModeOptionStructType; - using pointer = value_type *; - using reference = value_type &; - - virtual reference operator*() const = 0; - virtual pointer operator->() = 0; - virtual pointer operator->() const = 0; - - // Prefix increment - virtual ModeOptionStructIterator & operator++() = 0; - - virtual bool operator==(const ModeOptionStructIterator & other) const = 0; - virtual bool operator!=(const ModeOptionStructIterator & other) const = 0; - - virtual ~ModeOptionStructIterator() {} - }; - /** - * A factory that can return the ModeOptionStructIterators for a specific endpoint. + * A class that can return the supported ModeOptions for a specific endpoint. */ - struct ModeOptionStructIteratorFactory + struct ModeOptionsProvider { - using const_pointer = const ModeOptionStructIterator *; + using pointer = const ModeOptionStructType *; /** * Returns the ModeOptionStructIterator to the first option. */ - virtual const_pointer begin() const = 0; + inline pointer begin() const { return mBegin; } /** * Returns the ModeOptionStructIterator to an element after the last option. */ - virtual const_pointer end() const = 0; + inline pointer end() const { return mEnd; } - virtual ~ModeOptionStructIteratorFactory() {} + ModeOptionsProvider(const pointer aBegin, const pointer aEnd) : mBegin(aBegin), mEnd(aEnd) {} + + pointer mBegin; + pointer mEnd; }; /** * Given the endpointId, returns all its supported modes options. * @param endpointId - * @return The iterator factory for the endpoint, or nullptr if the endpoint doesn't support ModeSelectCluster. + * @return The mode options provider for the endpoint. */ - virtual const ModeOptionStructIteratorFactory * getIteratorFactory(EndpointId endpointId) const = 0; + virtual const ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const = 0; /** * Given the endpointId and a mode value, find the ModeOptionStruct that matches the mode. @@ -102,6 +81,8 @@ class SupportedModesManager virtual ~SupportedModesManager() {} }; +const SupportedModesManager * getSupportedModesManager(); + } // namespace ModeSelect } // namespace Clusters } // namespace app diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 5826a0ad877804..3af39b6c45e95d 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -232,9 +232,7 @@ void MatterOperationalCredentialsPluginServerInitCallback(void) { emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Initiating OpCreds cluster by writing fabrics list from fabric table."); -#if CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ registerAttributeAccessOverride(&gAttrAccess); -#endif Server::GetInstance().GetFabricTable().SetFabricDelegate(&gFabricDelegate); } diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp index 689969833e948d..b5c1682977711f 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -40,10 +40,6 @@ using namespace chip::app::Clusters::TestCluster; using namespace chip::app::Clusters::TestCluster::Commands; using namespace chip::app::Clusters::TestCluster::Attributes; -#if !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ -constexpr const char * kErrorStr = "Test Cluster: List Octet cluster (0x%02x) Error setting '%s' attribute: 0x%02x"; -#endif // CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ - namespace { class TestAttrAccess : public AttributeAccessInterface @@ -87,81 +83,18 @@ CHIP_ERROR TestAttrAccess::Read(const ConcreteAttributePath & aPath, AttributeVa return CHIP_NO_ERROR; } -#if !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ -EmberAfStatus writeAttribute(EndpointId endpoint, AttributeId attributeId, uint8_t * buffer, int32_t index = -1) -{ - EmberAfAttributeSearchRecord record; - record.endpoint = endpoint; - record.clusterId = TestCluster::Id; - record.clusterMask = CLUSTER_MASK_SERVER; - record.manufacturerCode = EMBER_AF_NULL_MANUFACTURER_CODE; - record.attributeId = attributeId; - - // When reading or writing a List attribute the 'index' value could have 3 types of values: - // -1: Read/Write the whole list content, including the number of elements in the list - // 0: Read/Write the number of elements in the list, represented as a uint16_t - // n: Read/Write the nth element of the list - // - // Since the first 2 bytes of the attribute are used to store the number of elements, elements indexing starts - // at 1. In order to hide this to the rest of the code of this file, the element index is incremented by 1 here. - // This also allows calling writeAttribute() with no index arg to mean "write the length". - return emAfReadOrWriteAttribute(&record, NULL, buffer, 0, true, index + 1); -} - -EmberAfStatus writeTestListInt8uAttribute(EndpointId endpoint) -{ - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - AttributeId attributeId = ZCL_LIST_ATTRIBUTE_ID; - - uint16_t attributeCount = 4; - for (uint8_t index = 0; index < attributeCount; index++) - { - status = writeAttribute(endpoint, attributeId, (uint8_t *) &index, index); - VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); - } - - status = writeAttribute(endpoint, attributeId, (uint8_t *) &attributeCount); - VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); - return status; -} -#endif // !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ - CHIP_ERROR TestAttrAccess::ReadListInt8uAttribute(AttributeValueEncoder & aEncoder) { return aEncoder.EncodeList([](const TagBoundEncoder & encoder) -> CHIP_ERROR { - constexpr uint16_t attributeCount = 4; - for (uint8_t index = 0; index < attributeCount; index++) + constexpr uint8_t maxValue = 4; + for (uint8_t value = 1; value <= maxValue; value++) { - ReturnErrorOnFailure(encoder.Encode(index)); + ReturnErrorOnFailure(encoder.Encode(value)); } return CHIP_NO_ERROR; }); } -#if !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ -EmberAfStatus writeTestListOctetAttribute(EndpointId endpoint) -{ - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - AttributeId attributeId = ZCL_LIST_OCTET_STRING_ATTRIBUTE_ID; - - uint16_t attributeCount = 4; - char data[6] = { 'T', 'e', 's', 't', 'N', '\0' }; - ByteSpan span = ByteSpan(Uint8::from_char(data), strlen(data)); - - for (uint8_t index = 0; index < attributeCount; index++) - { - sprintf(data + strlen(data) - 1, "%d", index); - - status = writeAttribute(endpoint, attributeId, (uint8_t *) &span, index); - VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); - } - - status = writeAttribute(endpoint, attributeId, (uint8_t *) &attributeCount); - VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); - return status; -} -#endif // !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ - CHIP_ERROR TestAttrAccess::ReadListOctetStringAttribute(AttributeValueEncoder & aEncoder) { return aEncoder.EncodeList([](const TagBoundEncoder & encoder) -> CHIP_ERROR { @@ -178,34 +111,6 @@ CHIP_ERROR TestAttrAccess::ReadListOctetStringAttribute(AttributeValueEncoder & }); } -#if !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ -EmberAfStatus writeTestListStructOctetAttribute(EndpointId endpoint) -{ - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - AttributeId attributeId = ZCL_LIST_STRUCT_OCTET_STRING_ATTRIBUTE_ID; - - uint16_t attributeCount = 4; - char data[6] = { 'T', 'e', 's', 't', 'N', '\0' }; - ByteSpan span = ByteSpan(Uint8::from_char(data), strlen(data)); - - for (uint8_t index = 0; index < attributeCount; index++) - { - sprintf(data + strlen(data) - 1, "%d", index); - - _TestListStructOctet structOctet; - structOctet.fabricIndex = index; - structOctet.operationalCert = span; - - status = writeAttribute(endpoint, attributeId, (uint8_t *) &structOctet, index); - VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); - } - - status = writeAttribute(endpoint, attributeId, (uint8_t *) &attributeCount); - VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); - return status; -} -#endif // !CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ - CHIP_ERROR TestAttrAccess::ReadListStructOctetStringAttribute(AttributeValueEncoder & aEncoder) { return aEncoder.EncodeList([](const TagBoundEncoder & encoder) -> CHIP_ERROR { @@ -487,28 +392,5 @@ bool emberAfTestClusterClusterTestNullableOptionalRequestCallback( void MatterTestClusterPluginServerInitCallback(void) { -#if CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ registerAttributeAccessOverride(&gAttrAccess); -#else // CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - - for (uint8_t index = 0; index < emberAfEndpointCount(); index++) - { - EndpointId endpoint = emberAfEndpointFromIndex(index); - if (!emberAfContainsCluster(endpoint, TestCluster::Id)) - { - continue; - } - - status = writeTestListInt8uAttribute(endpoint); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "test list int8u", status)); - - status = writeTestListOctetAttribute(endpoint); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "test list octet", status)); - - status = writeTestListStructOctetAttribute(endpoint); - VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, - ChipLogError(Zcl, kErrorStr, endpoint, "test list struct octet", status)); - } -#endif // CHIP_CLUSTER_CONFIG_ENABLE_COMPLEX_ATTRIBUTE_READ } diff --git a/src/app/clusters/thermostat-user-interface-configuration-server/thermostat-user-interface-configuration-server.cpp b/src/app/clusters/thermostat-user-interface-configuration-server/thermostat-user-interface-configuration-server.cpp new file mode 100644 index 00000000000000..5759a1fe65c4e9 --- /dev/null +++ b/src/app/clusters/thermostat-user-interface-configuration-server/thermostat-user-interface-configuration-server.cpp @@ -0,0 +1,60 @@ +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + +Protocols::InteractionModel::Status MatterThermostatUserInterfaceConfigurationClusterServerPreAttributeChangedCallback( + const app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) +{ + if (size != 0) + { + if (ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id == attributePath.mAttributeId) + { + EmberAfTemperatureDisplayMode mode = static_cast(chip::Encoding::Get8(value)); + if ((EMBER_ZCL_TEMPERATURE_DISPLAY_MODE_CELSIUS != mode) && (EMBER_ZCL_TEMPERATURE_DISPLAY_MODE_FAHRENHEIT != mode)) + { + return Protocols::InteractionModel::Status::Failure; + } + } + else if (ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id == attributePath.mAttributeId) + { + EmberAfKeypadLockout lockout = static_cast(chip::Encoding::Get8(value)); + if ((EMBER_ZCL_KEYPAD_LOCKOUT_NO_LOCKOUT != lockout) && (EMBER_ZCL_KEYPAD_LOCKOUT_LEVEL_ONE_LOCKOUT != lockout) && + (EMBER_ZCL_KEYPAD_LOCKOUT_LEVEL_TWO_LOCKOUT != lockout) && + (EMBER_ZCL_KEYPAD_LOCKOUT_LEVEL_THREE_LOCKOUT != lockout) && + (EMBER_ZCL_KEYPAD_LOCKOUT_LEVEL_FOUR_LOCKOUT != lockout) && (EMBER_ZCL_KEYPAD_LOCKOUT_LEVELFIVE_LOCKOUT != lockout)) + { + return Protocols::InteractionModel::Status::Failure; + } + } + else if (ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id == attributePath.mAttributeId) + { + uint8_t prog = chip::Encoding::Get8(value); + if (prog > 1) + { + return Protocols::InteractionModel::Status::Failure; + } + } + } + + return Protocols::InteractionModel::Status::Success; +} diff --git a/src/app/server/Server.h b/src/app/server/Server.h index b61500015b9286..112f5d769ac9eb 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include @@ -71,6 +72,13 @@ class Server : public Messaging::ExchangeDelegate TransportMgrBase & GetTransportManager() { return mTransports; } + chip::OperationalDeviceProxy * GetOperationalDeviceProxy() { return mOperationalDeviceProxy; } + + void SetOperationalDeviceProxy(chip::OperationalDeviceProxy * operationalDeviceProxy) + { + mOperationalDeviceProxy = operationalDeviceProxy; + } + #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * getBleLayerObject() { return mBleLayer; } #endif @@ -148,6 +156,8 @@ class Server : public Messaging::ExchangeDelegate ServerStorageDelegate mServerStorage; CommissioningWindowManager mCommissioningWindowManager; + chip::OperationalDeviceProxy * mOperationalDeviceProxy = nullptr; + // TODO @ceille: Maybe use OperationalServicePort and CommissionableServicePort uint16_t mSecuredServicePort; uint16_t mUnsecuredServicePort; diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index b248171eb30427..5883e649bd7fa8 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -140,7 +140,12 @@ class MockCommandSenderCallback : public CommandSender::Callback class MockCommandHandlerCallback : public CommandHandler::Callback { public: - void OnDone(chip::app::CommandHandler * apCommandHandler) final { onFinalCalledTimes++; } + void OnDone(CommandHandler & apCommandHandler) final { onFinalCalledTimes++; } + void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) final + { + DispatchSingleClusterCommand(aCommandPath, apPayload, &apCommandObj); + } + bool CommandExists(const ConcreteCommandPath & aCommandPath) { return ServerClusterCommandExists(aCommandPath); } int onFinalCalledTimes = 0; } mockCommandHandlerDelegate; diff --git a/src/app/tests/TestOperationalDeviceProxy.cpp b/src/app/tests/TestOperationalDeviceProxy.cpp new file mode 100644 index 00000000000000..fb1d0936bed521 --- /dev/null +++ b/src/app/tests/TestOperationalDeviceProxy.cpp @@ -0,0 +1,108 @@ +/* + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::Transport; +using namespace chip::Messaging; + +#if INET_CONFIG_ENABLE_IPV4 +namespace { + +using TestTransportMgr = TransportMgr; + +void TestOperationalDeviceProxy_EstablishSessionDirectly(nlTestSuite * inSuite, void * inContext) +{ + Platform::MemoryInit(); + TestTransportMgr transportMgr; + SessionManager sessionManager; + ExchangeManager exchangeMgr; + Inet::InetLayer inetLayer; + System::LayerImpl systemLayer; + // Heap-allocate the fairly large FabricTable so we don't end up with a huge + // stack. + FabricTable * fabrics = Platform::New(); + FabricInfo * fabric = fabrics->FindFabricWithIndex(1); + secure_channel::MessageCounterManager messageCounterManager; + SessionIDAllocator idAllocator; + + systemLayer.Init(); + inetLayer.Init(systemLayer, nullptr); + transportMgr.Init(UdpListenParameters(&inetLayer).SetAddressType(Inet::IPAddressType::kIPv4).SetListenPort(CHIP_PORT)); + sessionManager.Init(&systemLayer, &transportMgr, &messageCounterManager); + exchangeMgr.Init(&sessionManager); + messageCounterManager.Init(&exchangeMgr); + + DeviceProxyInitParams params = { + .sessionManager = &sessionManager, + .exchangeMgr = &exchangeMgr, + .idAllocator = &idAllocator, + .fabricInfo = fabric, + }; + NodeId mockNodeId = 1; + OperationalDeviceProxy device(params, PeerId().SetNodeId(mockNodeId)); + Inet::IPAddress mockAddr; + Inet::IPAddress::FromString("127.0.0.1", mockAddr); + PeerAddress addr = PeerAddress::UDP(mockAddr, CHIP_PORT); + device.UpdateAddress(addr); + + NL_TEST_ASSERT(inSuite, device.Connect(nullptr, nullptr) == CHIP_NO_ERROR); + + device.Clear(); + messageCounterManager.Shutdown(); + exchangeMgr.Shutdown(); + sessionManager.Shutdown(); + Platform::Delete(fabrics); + transportMgr.Close(); + inetLayer.Shutdown(); + systemLayer.Shutdown(); + Platform::MemoryShutdown(); +} + +// clang-format off +const nlTest sTests[] = +{ + NL_TEST_DEF("TestOperationalDeviceProxy_EstablishSessionDirectly", TestOperationalDeviceProxy_EstablishSessionDirectly), + NL_TEST_SENTINEL() +}; +// clang-format on + +} // namespace + +int TestOperationalDeviceProxy() +{ + nlTestSuite theSuite = { "OperationalDeviceProxy", &sTests[0], NULL, NULL }; + nlTestRunner(&theSuite, nullptr); + return nlTestRunnerStats(&theSuite); +} + +CHIP_REGISTER_TEST_SUITE(TestOperationalDeviceProxy) + +#endif // INET_CONFIG_ENABLE_IPV4 diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 1a5067e5cc0976..fd83dd21491365 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -44,6 +44,7 @@ class TestWriteInteraction { public: static void TestWriteClient(nlTestSuite * apSuite, void * apContext); + static void TestWriteClientGroup(nlTestSuite * apSuite, void * apContext); static void TestWriteHandler(nlTestSuite * apSuite, void * apContext); static void TestWriteRoundtrip(nlTestSuite * apSuite, void * apContext); static void TestWriteRoundtripWithClusterObjects(nlTestSuite * apSuite, void * apContext); @@ -233,6 +234,33 @@ void TestWriteInteraction::TestWriteClient(nlTestSuite * apSuite, void * apConte NL_TEST_ASSERT(apSuite, rm->TestGetCountRetransTable() == 0); } +void TestWriteInteraction::TestWriteClientGroup(nlTestSuite * apSuite, void * apContext) +{ + TestContext & ctx = *static_cast(apContext); + + CHIP_ERROR err = CHIP_NO_ERROR; + + app::WriteClient writeClient; + app::WriteClientHandle writeClientHandle; + writeClientHandle.SetWriteClient(&writeClient); + + System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); + TestWriteClientCallback callback; + err = writeClient.Init(&ctx.GetExchangeManager(), &callback); + NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + AddAttributeDataIB(apSuite, apContext, writeClientHandle); + + SessionHandle groupSession = ctx.GetSessionBobToFriends(); + NL_TEST_ASSERT(apSuite, groupSession.IsGroupSession()); + + err = writeClientHandle.SendWriteRequest(groupSession); + + // Write will fail until issue #11078 is completed + NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_NOT_CONNECTED); + // The internal WriteClient should be shutdown once we SendWriteRequest for group. + NL_TEST_ASSERT(apSuite, nullptr == writeClientHandle.mpWriteClient); +} + void TestWriteInteraction::TestWriteHandler(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); @@ -384,6 +412,7 @@ namespace { const nlTest sTests[] = { NL_TEST_DEF("CheckWriteClient", chip::app::TestWriteInteraction::TestWriteClient), + NL_TEST_DEF("CheckWriteClientGroup", chip::app::TestWriteInteraction::TestWriteClientGroup), NL_TEST_DEF("CheckWriteHandler", chip::app::TestWriteInteraction::TestWriteHandler), NL_TEST_DEF("CheckWriteRoundtrip", chip::app::TestWriteInteraction::TestWriteRoundtrip), NL_TEST_DEF("TestWriteRoundtripWithClusterObjects", chip::app::TestWriteInteraction::TestWriteRoundtripWithClusterObjects), diff --git a/src/app/tests/suites/TV_AudioOutputCluster.yaml b/src/app/tests/suites/TV_AudioOutputCluster.yaml index f6116a67fa399f..642f02b61485b8 100644 --- a/src/app/tests/suites/TV_AudioOutputCluster.yaml +++ b/src/app/tests/suites/TV_AudioOutputCluster.yaml @@ -25,9 +25,9 @@ tests: response: value: [ - { index: 1, outputType: 0, name: 12 }, - { index: 2, outputType: 0, name: 12 }, - { index: 3, outputType: 0, name: 12 }, + { index: 1, outputType: 0, name: "exampleName" }, + { index: 2, outputType: 0, name: "exampleName" }, + { index: 3, outputType: 0, name: "exampleName" }, ] - label: "Select Output Command" diff --git a/src/app/tests/suites/TV_MediaInputCluster.yaml b/src/app/tests/suites/TV_MediaInputCluster.yaml index b07076486f99ff..fe7fe12e9a44ce 100644 --- a/src/app/tests/suites/TV_MediaInputCluster.yaml +++ b/src/app/tests/suites/TV_MediaInputCluster.yaml @@ -25,8 +25,18 @@ tests: response: value: [ - { index: 1, inputType: 4, name: 12, description: 19 }, - { index: 2, inputType: 4, name: 12, description: 19 }, + { + index: 1, + inputType: 4, + name: "exampleName", + description: "exampleDescription", + }, + { + index: 2, + inputType: 4, + name: "exampleName", + description: "exampleDescription", + }, ] - label: "Select Input Command" diff --git a/src/app/tests/suites/TV_TargetNavigatorCluster.yaml b/src/app/tests/suites/TV_TargetNavigatorCluster.yaml index 807f3e8010270d..83d85cdfd3723f 100644 --- a/src/app/tests/suites/TV_TargetNavigatorCluster.yaml +++ b/src/app/tests/suites/TV_TargetNavigatorCluster.yaml @@ -23,7 +23,11 @@ tests: command: "readAttribute" attribute: "Target Navigator List" response: - value: [{ identifier: 1, name: 12 }, { identifier: 2, name: 12 }] + value: + [ + { identifier: 1, name: "exampleName" }, + { identifier: 2, name: "exampleName" }, + ] - label: "Navigate Target Command" command: "NavigateTarget" diff --git a/src/app/tests/suites/TV_TvChannelCluster.yaml b/src/app/tests/suites/TV_TvChannelCluster.yaml index 31d92d203696c0..289fb04de607d7 100644 --- a/src/app/tests/suites/TV_TvChannelCluster.yaml +++ b/src/app/tests/suites/TV_TvChannelCluster.yaml @@ -28,16 +28,16 @@ tests: { majorNumber: 1, minorNumber: 2, - name: 12, - callSign: 13, - affiliateCallSign: 13, + name: "exampleName", + callSign: "exampleCSign", + affiliateCallSign: "exampleASign", }, { majorNumber: 2, minorNumber: 3, - name: 12, - callSign: 13, - affiliateCallSign: 13, + name: "exampleName", + callSign: "exampleCSign", + affiliateCallSign: "exampleASign", }, ] # TODO: Enable the test once struct response is supported diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index 2189baf294f3e9..25d05b0a9f0c88 100644 --- a/src/app/tests/suites/TestDescriptorCluster.yaml +++ b/src/app/tests/suites/TestDescriptorCluster.yaml @@ -29,9 +29,26 @@ tests: command: "readAttribute" attribute: "Server List" response: - value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - # CLUSTER_ID value is dummy 0 since yaml compares only the length of the List. - # right now + value: [ + 0x0003, # Identify + 0x001D, # Descriptor + 0x0028, # Basic Information + 0x0029, # OTA Software Update Provider + 0x002A, # OTA Software Update Requestor + 0x0030, # General Commissioning + 0x0031, # Network Commissioning + 0x0032, # Diagnostic Logs + 0x0033, # General Diagnostics + 0x0034, # Software Diagnostics + 0x0035, # Thread Network Diagnostiscs + 0x0036, # WiFi Network Diagnostics + 0x0037, # Ethernet Network Diagnostics + 0x003C, # Administrator Commissioning + 0x003E, # Operational Credentials + 0x0405, # Relative Humidity Measurement (why on EP0?) + 0xF000, # Binding + 0xF004, # Group Key Management + ] - label: "Read attribute Client list" command: "readAttribute" diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 38947caee43fb7..94d70422ee3ca5 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -22,3 +22,15 @@ PICS: - label: "Does the device support discovery over WiFi?" id: WIFI value: true + + - label: "Does the device support manufacturing date" + id: MANF_DATE + value: true + + - label: "Does the device support part number" + id: PART_NUM + value: true + + - label: "Does the device support Intermediate CA Certificate" + id: DM_ICACERT + value: true diff --git a/src/app/tests/suites/certification/Test_TC_CC_9_1.yaml b/src/app/tests/suites/certification/Test_TC_CC_9_1.yaml new file mode 100644 index 00000000000000..bb191c60cc2d0a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CC_9_1.yaml @@ -0,0 +1,577 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 27.2.20. [TC-CC-9.1] ColorLoopSet Validation + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Precondition : Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: "Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 4 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 30 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopTime attribute from DUT" + command: "readAttribute" + attribute: "color loop time" + response: + value: 30 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 8 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 160 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopStartEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 160 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 1 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue #10816 Disabled as value needs to be same as EnhancedCurrentHue + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "color loop stored enhanced hue" + response: + value: 0 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + #Issue #10816 Disabled as value needs to be same as EnhancedCurrentHue + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - name: "action" + value: 0 + - name: "direction" + value: 1 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 1 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 1 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue #10816 Disabled as value needs to be same as EnhancedCurrentHue + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "color loop stored enhanced hue" + response: + value: 0 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + #Issue #10816 Disabled as value needs to be same as ColorLoopStoredEnhancedHue. + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Enhanced Move To Hue command 10" + command: "EnhancedMoveToHue" + arguments: + values: + - name: "enhancedHue" + value: 40960 + - name: "direction" + value: 0 + - name: "transitionTime" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Wait 2000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 2000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 40960 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 2 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + #Issue #335 expected value is 2 but returned is 1 + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue# 10816 Disabled as value needs to be same as EnhancedCurrentHue. + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "color loop stored enhanced hue" + response: + value: 0 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + #Issue #10816 Disabled as value needs to be same as ColorLoopStoredEnhancedHue. + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - name: "action" + value: 0 + - name: "direction" + value: 1 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + #Issue #336 expected value is 1 but returned is 2 + - label: "Read ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 1 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 2 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue #10816 Disabled as value needs to be same as EnhancedCurrentHue. + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "color loop stored enhanced hue" + response: + value: 0 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + #Issue #10816 Disabled as value needs to be same as ColorLoopStoredEnhancedHue.. + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Turn Off light for color control tests" + cluster: "On/Off" + command: "Off" diff --git a/src/app/tests/suites/certification/Test_TC_DM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DM_1_1.yaml index 5557b3f11ade64..f057fa32dac99e 100644 --- a/src/app/tests/suites/certification/Test_TC_DM_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DM_1_1.yaml @@ -109,6 +109,7 @@ tests: - label: "Query ManufacturingDate" command: "readAttribute" attribute: "ManufacturingDate" + PICS: MANF_DATE optional: true response: constraints: @@ -120,6 +121,7 @@ tests: - label: "Query PartNumber" command: "readAttribute" attribute: "PartNumber" + PICS: PART_NUM optional: true response: constraints: diff --git a/src/app/tests/suites/certification/Test_TC_DM_1_3_Simulated.yaml b/src/app/tests/suites/certification/Test_TC_DM_1_3_Simulated.yaml new file mode 100644 index 00000000000000..393462dcb59588 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DM_1_3_Simulated.yaml @@ -0,0 +1,100 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 10.1.3. [TC-DM-1.3] Basic Cluster Server Attributes [DUT - Controller] + +config: + cluster: "Basic" + endpoint: 0 + +tests: + - label: "Log OnOff Test Startup" + cluster: "LogCommands" + command: "Log" + arguments: + values: + - name: "message" + value: "*** Basic Cluster Tests Ready" + + - label: "Query Interaction Model Version" + wait: "readAttribute" + attribute: "InteractionModelVersion" + + - label: "Query Vendor Name" + wait: "readAttribute" + attribute: "VendorName" + + - label: "Query VendorID" + wait: "readAttribute" + attribute: "VendorID" + + - label: "Query Product Name" + wait: "readAttribute" + attribute: "ProductName" + + - label: "Query ProductID" + wait: "readAttribute" + attribute: "ProductID" + + - label: "Query User Label" + wait: "readAttribute" + attribute: "UserLabel" + + - label: "Query User Location" + wait: "readAttribute" + attribute: "Location" + + - label: "Query HardwareVersion" + wait: "readAttribute" + attribute: "HardwareVersion" + + - label: "Query HardwareVersionString" + wait: "readAttribute" + attribute: "HardwareVersionString" + + - label: "Query SoftwareVersion" + wait: "readAttribute" + attribute: "SoftwareVersion" + + - label: "Query SoftwareVersionString" + wait: "readAttribute" + attribute: "SoftwareVersionString" + + - label: "Query ManufacturingDate" + wait: "readAttribute" + attribute: "ManufacturingDate" + + - label: "Query PartNumber" + wait: "readAttribute" + attribute: "PartNumber" + + - label: "Query ProductURL" + wait: "readAttribute" + attribute: "ProductURL" + + - label: "Query ProductLabel" + wait: "readAttribute" + attribute: "ProductLabel" + + - label: "Query SerialNumber" + wait: "readAttribute" + attribute: "SerialNumber" + + - label: "Query LocalConfigDisabled" + wait: "readAttribute" + attribute: "LocalConfigDisabled" + + - label: "Query Reachable" + wait: "readAttribute" + attribute: "Reachable" diff --git a/src/app/tests/suites/certification/Test_TC_DM_2_2.yaml b/src/app/tests/suites/certification/Test_TC_DM_2_2.yaml new file mode 100644 index 00000000000000..2260a43bee3ae2 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DM_2_2.yaml @@ -0,0 +1,87 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 3.2.2. [TC-DM-2.2] Operational Credential Attributes + +config: + cluster: "Operational Credentials" + endpoint: 0 + +tests: + - label: "Query NOCs" + command: "readAttribute" + # TODO: Enabled and update value when SDK supports this. + disabled: true + attribute: "NOCs" + PICS: DM_ICACERT + response: + value: [{ NOC: 0 }] + constraints: + type: list + + - label: "Query NOCs" + command: + "readAttribute" + # TODO: Enabled and update value when SDK supports this. + disabled: true + attribute: "NOCs" + PICS: DM_ICACERT + response: + value: [{ NOC: 0, ICAC: 0 }] + constraints: + type: list + + - label: "Query fabrics list" + command: "readAttribute" + attribute: "fabrics list" + response: + value: + [ + { + FabricIndex: 0, + RootPublicKey: 65, + VendorID: 65521, + FabricID: 0, + NodeID: 305414945, + Label: "", + }, + ] + constraints: + type: list + + - label: "Query Supported Fabrics" + command: "readAttribute" + attribute: "SupportedFabrics" + response: + value: 16 + constraints: + type: uint8 + + - label: "Query Commissioned Fabrics" + command: "readAttribute" + attribute: "CommissionedFabrics" + response: + value: 1 + constraints: + type: uint8 + + - label: "Query User Trusted Root Certificates" + command: "readAttribute" + attribute: "TrustedRootCertificates" + response: + # Can't check for the expected value here, since we don't know it. + # TODO: Check the length, at least? + # value: [237] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_OO_2_3.yaml b/src/app/tests/suites/certification/Test_TC_OO_2_3.yaml new file mode 100644 index 00000000000000..49b79183e2fa04 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OO_2_3.yaml @@ -0,0 +1,1000 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 3.2.3. [TC-OO-2.3] Secondary functionality with server as DUT + +config: + cluster: "On/Off" + endpoint: 1 + +tests: + - label: "Send On Command" + command: "On" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 0 + + #Issue #339/#9810 OnWithRecallGlobalScene command is failing + - label: "Sends OnWithRecallGlobalScene command to DUT" + disabled: true + command: "OnWithRecallGlobalScene" + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 0 + + - label: "Send On Command" + command: "On" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 0 + + - label: "Send On Command" + command: "On" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OnWithRecallGlobalScene command is failing + - label: "Sends OnWithRecallGlobalScene command to DUT" + disabled: true + command: "OnWithRecallGlobalScene" + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 200 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Send On Command" + command: "On" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Send Off Command" + command: "Off" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 30000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 30000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Send On Command" + command: "On" + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 40000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 40000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 200 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Send Off Command" + command: "Off" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 200 + + - label: "Send On Command" + command: "On" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Send Off Command" + command: "Off" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 40000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 40000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 40000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 40000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Send Off Command" + command: "Off" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_2_2.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_2_2.yaml new file mode 100644 index 00000000000000..6fbb7050fe2980 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_2_2.yaml @@ -0,0 +1,35 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 39.2.2. [TC-WNCV-2.2] ConfigStatus Attribute with server as DUT + +config: + cluster: "Window Covering" + endpoint: 1 + +tests: + #Issue #10811 if condition is required, need YAML support for this + - label: "Reads ConfigStatus attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "ConfigStatus" + response: + value: 4 + + - label: "Reads ConfigStatus attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "ConfigStatus" + response: + value: 8 diff --git a/src/app/tests/suites/templates/templates.json b/src/app/tests/suites/templates/templates.json index 25969ba92b180c..c89feb38d74ba5 100644 --- a/src/app/tests/suites/templates/templates.json +++ b/src/app/tests/suites/templates/templates.json @@ -23,11 +23,6 @@ "path": "../../../zap-templates/templates/app/tests/CHIPClusters-src.zapt", "name": "Tests C++ API", "output": "tests/CHIPClustersTest.cpp" - }, - { - "path": "../../../zap-templates/templates/app/tests/CHIPClustersWrite-src.zapt", - "name": "Tests WriteAttribute instantiations", - "output": "tests/CHIPClustersTestWrite.cpp" } ] } diff --git a/src/app/util/CHIPDeviceCallbacksMgr.cpp b/src/app/util/CHIPDeviceCallbacksMgr.cpp index 5dbc9efdb254cc..e8b905e00cd271 100644 --- a/src/app/util/CHIPDeviceCallbacksMgr.cpp +++ b/src/app/util/CHIPDeviceCallbacksMgr.cpp @@ -32,6 +32,12 @@ namespace chip { namespace app { +CHIPDeviceCallbacksMgr & CHIPDeviceCallbacksMgr::GetInstance() +{ + static CHIPDeviceCallbacksMgr instance; + return instance; +} + CHIP_ERROR CHIPDeviceCallbacksMgr::AddResponseCallback(NodeId nodeId, uint8_t sequenceNumber, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, TLVDataFilter filter) diff --git a/src/app/util/CHIPDeviceCallbacksMgr.h b/src/app/util/CHIPDeviceCallbacksMgr.h index cba369a4103d32..9d8741cf15bebe 100644 --- a/src/app/util/CHIPDeviceCallbacksMgr.h +++ b/src/app/util/CHIPDeviceCallbacksMgr.h @@ -63,11 +63,7 @@ class DLL_EXPORT CHIPDeviceCallbacksMgr CHIPDeviceCallbacksMgr(const CHIPDeviceCallbacksMgr &&) = delete; CHIPDeviceCallbacksMgr & operator=(const CHIPDeviceCallbacksMgr &) = delete; - static CHIPDeviceCallbacksMgr & GetInstance() - { - static CHIPDeviceCallbacksMgr instance; - return instance; - } + static CHIPDeviceCallbacksMgr & GetInstance(); CHIP_ERROR AddResponseCallback(NodeId nodeId, uint8_t sequenceNumber, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, TLVDataFilter callbackFilter = nullptr); diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index d600c92748d997..fedddb9ea5a572 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -40,6 +40,7 @@ ******************************************************************************/ #include "app/util/common.h" +#include #include #include #include @@ -970,6 +971,10 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) (cluster->mask & CLUSTER_MASK_CLIENT ? EMBER_AF_CLIENT_CLUSTER_TICK : EMBER_AF_SERVER_CLUSTER_TICK)); } + // Clear out any command handler overrides registered for this + // endpoint. + chip::app::InteractionModelEngine::GetInstance()->UnregisterCommandHandlers(endpoint); + // Clear out any attribute access overrides registered for this // endpoint. app::AttributeAccessInterface * prev = nullptr; @@ -977,7 +982,7 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) while (cur) { app::AttributeAccessInterface * next = cur->GetNext(); - if (cur->MatchesExactly(endpoint)) + if (cur->MatchesEndpoint(endpoint)) { // Remove it from the list if (prev) @@ -989,6 +994,8 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) gAttributeAccessOverrides = next; } + cur->SetNext(nullptr); + // Do not change prev in this case. } else diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index 8a4b9075cf43d0..641412b92f1833 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -91,7 +91,9 @@ #define DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(attrListName) EmberAfAttributeMetadata attrListName[] = { #define DECLARE_DYNAMIC_ATTRIBUTE_LIST_END() \ - , { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() } /* cluster revision */ \ + { \ + 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() \ + } /* cluster revision */ \ } #define DECLARE_DYNAMIC_ATTRIBUTE(attId, attType, attSizeBytes, attrMask) \ diff --git a/src/app/zap-templates/app-templates.json b/src/app/zap-templates/app-templates.json index a63053e4b6a09b..123c2b3a3501be 100644 --- a/src/app/zap-templates/app-templates.json +++ b/src/app/zap-templates/app-templates.json @@ -88,11 +88,6 @@ "path": "templates/app/CHIPClustersInvoke-src.zapt", "name": "C++ ZCL Invoke API", "output": "CHIPClustersInvoke.cpp" - }, - { - "path": "templates/app/CHIPClustersWrite-src.zapt", - "name": "C++ ZCL Write API", - "output": "CHIPClustersWrite.cpp" } ] } diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 326cec63461e0b..f67e4c42ff4147 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -467,6 +467,42 @@ function chip_tests_item_response_type(options) return asPromise.call(this, promise, options); } +// test_cluster_command_value and test_cluster_value-equals are recursive partials using #each. At some point the |global| +// context is lost and it fails. Make sure to attach the global context as a property of the | value | +// that is evaluated. +function attachGlobal(global, value) +{ + if (Array.isArray(value)) { + value = value.map(v => attachGlobal(global, v)); + } else if (value instanceof Object) { + for (key in value) { + if (key == "global") { + continue; + } + value[key] = attachGlobal(global, value[key]); + } + } else if (value === null) { + value = new NullObject(); + } else { + switch (typeof value) { + case 'number': + value = new Number(value); + break; + case 'string': + value = new String(value); + break; + case 'boolean': + value = new Boolean(value); + break; + default: + throw new Error('Unsupported value: ' + JSON.stringify(value)); + } + } + + value.global = global; + return value; +} + function chip_tests_item_parameters(options) { const commandValues = this.arguments.values; @@ -494,41 +530,6 @@ function chip_tests_item_parameters(options) 'Missing "' + commandArg.name + '" in arguments list: \n\t* ' + commandValues.map(command => command.name).join('\n\t* ')); } - // test_cluster_command_value is a recursive partial using #each. At some point the |global| - // context is lost and it fails. Make sure to attach the global context as a property of the | value | - // that is evaluated. - function attachGlobal(global, value) - { - if (Array.isArray(value)) { - value = value.map(v => attachGlobal(global, v)); - } else if (value instanceof Object) { - for (key in value) { - if (key == "global") { - continue; - } - value[key] = attachGlobal(global, value[key]); - } - } else if (value === null) { - value = new NullObject(); - } else { - switch (typeof value) { - case 'number': - value = new Number(value); - break; - case 'string': - value = new String(value); - break; - case 'boolean': - value = new Boolean(value); - break; - default: - throw new Error('Unsupported value: ' + JSON.stringify(value)); - } - } - - value.global = global; - return value; - } commandArg.definedValue = attachGlobal(this.global, expected.value); return commandArg; @@ -558,7 +559,7 @@ function chip_tests_item_response_parameters(options) const expected = responseValues.splice(expectedIndex, 1)[0]; if ('value' in expected) { responseArg.hasExpectedValue = true; - responseArg.expectedValue = expected.value; + responseArg.expectedValue = attachGlobal(this.global, expected.value); } if ('constraints' in expected) { @@ -590,6 +591,11 @@ function isLiteralNull(value, options) return (value === null) || (value instanceof NullObject); } +function expectedValueHasProp(value, name) +{ + return name in value; +} + // // Module exports // @@ -601,3 +607,4 @@ exports.chip_tests_item_response_parameters = chip_tests_item_response_parameter exports.chip_tests_pics = chip_tests_pics; exports.isTestOnlyCluster = isTestOnlyCluster; exports.isLiteralNull = isLiteralNull; +exports.expectedValueHasProp = expectedValueHasProp; diff --git a/src/app/zap-templates/templates/app/CHIPClustersInvoke-src.zapt b/src/app/zap-templates/templates/app/CHIPClustersInvoke-src.zapt index 73a706135f0071..dababb33e1b4a5 100644 --- a/src/app/zap-templates/templates/app/CHIPClustersInvoke-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClustersInvoke-src.zapt @@ -28,7 +28,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseSuccessCallback successCb, CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); diff --git a/src/app/zap-templates/templates/app/CHIPClustersWrite-src.zapt b/src/app/zap-templates/templates/app/CHIPClustersWrite-src.zapt deleted file mode 100644 index efd19d6928f312..00000000000000 --- a/src/app/zap-templates/templates/app/CHIPClustersWrite-src.zapt +++ /dev/null @@ -1,57 +0,0 @@ -{{> header}} - -{{#if (chip_has_client_clusters)}} -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -{{#chip_client_clusters}} - -// {{asUpperCamelCase name}} Cluster Attributes -{{#chip_server_cluster_attributes}} -{{#if isWritableAttribute}} -{{#*inline "attributeTypeInfo"}}chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo{{/inline}} -template CHIP_ERROR ClusterBase::WriteAttribute<{{>attributeTypeInfo}}>(const {{>attributeTypeInfo}}::Type & requestData, void *context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); -{{/if}} -{{/chip_server_cluster_attributes}} -{{/chip_client_clusters}} - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, - app::StatusIB status, CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), mEndpoint, - requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip -{{/if}} diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index 4577cdf81406ec..a741b46ed6c434 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -106,7 +106,7 @@ var endpointClusterWithInit = [ 'Pump Configuration and Control', ]; var endpointClusterWithAttributeChanged = [ 'Identify', 'Door Lock', 'Pump Configuration and Control' ]; -var endpointClusterWithPreAttribute = [ 'IAS Zone' ]; +var endpointClusterWithPreAttribute = [ 'IAS Zone', 'Thermostat User Interface Configuration' ]; var endpointClusterWithMessageSent = [ 'IAS Zone' ]; /** diff --git a/src/app/zap-templates/templates/app/tests/CHIPClustersWrite-src.zapt b/src/app/zap-templates/templates/app/tests/CHIPClustersWrite-src.zapt deleted file mode 100644 index 5068082e472513..00000000000000 --- a/src/app/zap-templates/templates/app/tests/CHIPClustersWrite-src.zapt +++ /dev/null @@ -1,50 +0,0 @@ -{{#if (chip_has_client_clusters)}} -{{> header}} - -#include - -#include - -namespace chip { -namespace Controller { - -{{#chip_client_clusters}} - -{{#chip_server_cluster_attributes}} -{{#unless isWritableAttribute}} -{{#*inline "attributeTypeInfo"}}chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo{{/inline}} -template CHIP_ERROR ClusterBase::WriteAttribute<{{>attributeTypeInfo}}>(const {{>attributeTypeInfo}}::Type & requestData, void *context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); -{{/unless}} -{{/chip_server_cluster_attributes}} -{{/chip_client_clusters}} - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip -{{/if}} diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index 1bbbc01244077c..ff0d53a307a099 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -69,7 +69,7 @@ 'THERMOSTAT_CLUSTER': ['thermostat-server'], 'THREAD_NETWORK_DIAGNOSTICS_CLUSTER': ['thread_network_diagnostics_server'], 'WINDOW_COVERING_CLUSTER': ['window-covering-server'], - 'THERMOSTAT_UI_CONFIG_CLUSTER': [], + 'THERMOSTAT_UI_CONFIG_CLUSTER': ['thermostat-user-interface-configuration-server'], 'WIFI_NETWORK_DIAGNOSTICS_CLUSTER': ['wifi_network_diagnostics_server'], 'WAKE_ON_LAN_CLUSTER': [], 'ZLL_COMMISSIONING_CLUSTER': [] diff --git a/src/controller/BUILD.gn b/src/controller/BUILD.gn index 9616fb766507bd..33874bd47a60b6 100644 --- a/src/controller/BUILD.gn +++ b/src/controller/BUILD.gn @@ -30,12 +30,12 @@ static_library("controller") { "CHIPCluster.h", "CHIPCommissionableNodeController.cpp", "CHIPCommissionableNodeController.h", - "CHIPDevice.cpp", - "CHIPDevice.h", "CHIPDeviceController.cpp", "CHIPDeviceController.h", "CHIPDeviceControllerFactory.cpp", "CHIPDeviceControllerFactory.h", + "CommissioneeDeviceProxy.cpp", + "CommissioneeDeviceProxy.h", "DeviceAddressUpdateDelegate.h", "DeviceDiscoveryDelegate.h", "EmptyDataModelHandler.cpp", diff --git a/src/controller/CHIPCluster.cpp b/src/controller/CHIPCluster.cpp index 5ced92e3c468e2..b6d2e03112c52f 100644 --- a/src/controller/CHIPCluster.cpp +++ b/src/controller/CHIPCluster.cpp @@ -31,7 +31,7 @@ namespace chip { namespace Controller { -CHIP_ERROR ClusterBase::Associate(Device * device, EndpointId endpoint) +CHIP_ERROR ClusterBase::Associate(DeviceProxy * device, EndpointId endpoint) { CHIP_ERROR err = CHIP_NO_ERROR; // TODO: Check if the device supports mCluster at the requested endpoint diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h index 7fc7ff3f3ccd93..34c48c354141d5 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -27,8 +27,8 @@ #pragma once #include "app/ConcreteCommandPath.h" +#include #include -#include #include #include @@ -46,7 +46,7 @@ class DLL_EXPORT ClusterBase public: virtual ~ClusterBase() {} - CHIP_ERROR Associate(Device * device, EndpointId endpoint); + CHIP_ERROR Associate(DeviceProxy * device, EndpointId endpoint); void Dissociate(); @@ -62,9 +62,45 @@ class DLL_EXPORT ClusterBase CHIP_ERROR InvokeCommand(const RequestDataT & requestData, void * context, CommandResponseSuccessCallback successCb, CommandResponseFailureCallback failureCb); + /** + * Functions for writing attributes. We have lots of different + * AttributeInfo but a fairly small set of types that get written. So we + * want to keep the template on AttributeInfo very small, and put all the + * work in the template with a small number of instantiations (one per + * type). + */ + template + CHIP_ERROR WriteAttribute(const AttrType & requestData, void * context, ClusterId clusterId, AttributeId attributeId, + WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) + { + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { + if (successCb != nullptr) + { + successCb(context); + } + }; + + auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, + CHIP_ERROR aError) { + if (failureCb != nullptr) + { + failureCb(context, app::ToEmberAfStatus(status.mStatus)); + } + }; + + return chip::Controller::WriteAttribute(mDevice->GetSecureSession().Value(), mEndpoint, clusterId, attributeId, + requestData, onSuccessCb, onFailureCb); + } + template CHIP_ERROR WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); + WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) + { + return WriteAttribute(requestData, context, AttributeInfo::GetClusterId(), AttributeInfo::GetAttributeId(), successCb, + failureCb); + } protected: ClusterBase(uint16_t cluster) : mClusterId(cluster) {} @@ -85,7 +121,7 @@ class DLL_EXPORT ClusterBase app::TLVDataFilter tlvDataFilter); const ClusterId mClusterId; - Device * mDevice; + DeviceProxy * mDevice; EndpointId mEndpoint; }; diff --git a/src/controller/CHIPDevice.cpp b/src/controller/CHIPDevice.cpp deleted file mode 100644 index 43445614c9f693..00000000000000 --- a/src/controller/CHIPDevice.cpp +++ /dev/null @@ -1,887 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * This file contains implementation of Device class. The objects of this - * class will be used by Controller applications to interact with CHIP - * devices. The class provides mechanism to construct, send and receive - * messages to and from the corresponding CHIP devices. - */ - -#include - -#include - -#if CONFIG_DEVICE_LAYER -#include -#endif - -#if CHIP_SYSTEM_CONFIG_USE_LWIP -#include -#include -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace chip::Inet; -using namespace chip::System; -using namespace chip::Callback; - -namespace chip { -namespace Controller { -CHIP_ERROR Device::LoadSecureSessionParametersIfNeeded(bool & didLoad) -{ - didLoad = false; - - // If there is no secure connection to the device, try establishing it - if (mState != ConnectionState::SecureConnected) - { - ReturnErrorOnFailure(LoadSecureSessionParameters()); - didLoad = true; - } - else - { - if (mSecureSession.HasValue()) - { - Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); - // Check if the connection state has the correct transport information - if (secureSession->GetPeerAddress().GetTransportType() == Transport::Type::kUndefined) - { - mState = ConnectionState::NotConnected; - ReturnErrorOnFailure(LoadSecureSessionParameters()); - didLoad = true; - } - } - else - { - mState = ConnectionState::NotConnected; - ReturnErrorOnFailure(LoadSecureSessionParameters()); - didLoad = true; - } - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::SendCommands(app::CommandSender * commandObj) -{ - bool loadedSecureSession = false; - ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(loadedSecureSession)); - VerifyOrReturnError(mState == ConnectionState::SecureConnected, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(commandObj != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - return commandObj->SendCommandRequest(mSecureSession.Value()); -} - -CHIP_ERROR Device::Serialize(SerializedDevice & output) -{ - SerializableDevice serializable; - - static_assert(BASE64_ENCODED_LEN(sizeof(serializable)) <= sizeof(output.inner), - "Size of serializable should be <= size of output"); - - CHIP_ZERO_AT(serializable); - CHIP_ZERO_AT(output); - - serializable.mOpsCreds = mPairing; - serializable.mDeviceId = Encoding::LittleEndian::HostSwap64(mDeviceId); - serializable.mDevicePort = Encoding::LittleEndian::HostSwap16(mDeviceAddress.GetPort()); - serializable.mFabricIndex = Encoding::LittleEndian::HostSwap16(mFabricIndex); - - // The connection state could be null if the device is moving from PASE connection to CASE connection. - // The device parameters (e.g. mDeviceOperationalCertProvisioned) are updated during this transition. - // The state during this transistion is being persisted so that the next access of the device will - // trigger the CASE based secure session. - if (mSecureSession.HasValue()) - { - Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); - const uint32_t localMessageCounter = secureSession->GetSessionMessageCounter().GetLocalMessageCounter().Value(); - const uint32_t peerMessageCounter = secureSession->GetSessionMessageCounter().GetPeerMessageCounter().GetCounter(); - - serializable.mLocalMessageCounter = Encoding::LittleEndian::HostSwap32(localMessageCounter); - serializable.mPeerMessageCounter = Encoding::LittleEndian::HostSwap32(peerMessageCounter); - } - else - { - serializable.mLocalMessageCounter = 0; - serializable.mPeerMessageCounter = 0; - } - - serializable.mDeviceOperationalCertProvisioned = (mDeviceOperationalCertProvisioned) ? 1 : 0; - - serializable.mDeviceTransport = to_underlying(mDeviceAddress.GetTransportType()); - - ReturnErrorOnFailure(mDeviceAddress.GetInterface().GetInterfaceName(Uint8::to_char(serializable.mInterfaceName), - sizeof(serializable.mInterfaceName))); - static_assert(sizeof(serializable.mDeviceAddr) <= INET6_ADDRSTRLEN, "Size of device address must fit within INET6_ADDRSTRLEN"); - mDeviceAddress.GetIPAddress().ToString(Uint8::to_char(serializable.mDeviceAddr), sizeof(serializable.mDeviceAddr)); - - const uint16_t serializedLen = chip::Base64Encode(Uint8::to_const_uchar(reinterpret_cast(&serializable)), - static_cast(sizeof(serializable)), Uint8::to_char(output.inner)); - VerifyOrReturnError(serializedLen > 0, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(serializedLen < sizeof(output.inner), CHIP_ERROR_INVALID_ARGUMENT); - output.inner[serializedLen] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::Deserialize(const SerializedDevice & input) -{ - SerializableDevice serializable; - constexpr size_t maxlen = BASE64_ENCODED_LEN(sizeof(serializable)); - const size_t len = strnlen(Uint8::to_const_char(&input.inner[0]), maxlen); - - VerifyOrReturnError(len < sizeof(SerializedDevice), CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(CanCastTo(len), CHIP_ERROR_INVALID_ARGUMENT); - - CHIP_ZERO_AT(serializable); - const uint16_t deserializedLen = Base64Decode(Uint8::to_const_char(input.inner), static_cast(len), - Uint8::to_uchar(reinterpret_cast(&serializable))); - - VerifyOrReturnError(deserializedLen > 0, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(deserializedLen <= sizeof(serializable), CHIP_ERROR_INVALID_ARGUMENT); - - // The second parameter to FromString takes the strlen value. We are subtracting 1 - // from the sizeof(serializable.mDeviceAddr) to account for null termination, since - // strlen doesn't include null character in the size. - Inet::IPAddress ipAddress = {}; - VerifyOrReturnError( - IPAddress::FromString(Uint8::to_const_char(serializable.mDeviceAddr), sizeof(serializable.mDeviceAddr) - 1, ipAddress), - CHIP_ERROR_INVALID_ADDRESS); - - mPairing = serializable.mOpsCreds; - mDeviceId = Encoding::LittleEndian::HostSwap64(serializable.mDeviceId); - const uint16_t port = Encoding::LittleEndian::HostSwap16(serializable.mDevicePort); - const uint16_t index = Encoding::LittleEndian::HostSwap16(serializable.mFabricIndex); - mLocalMessageCounter = Encoding::LittleEndian::HostSwap32(serializable.mLocalMessageCounter); - mPeerMessageCounter = Encoding::LittleEndian::HostSwap32(serializable.mPeerMessageCounter); - - VerifyOrReturnError(CanCastTo(index), CHIP_ERROR_INVALID_ARGUMENT); - mFabricIndex = static_cast(index); - - // TODO - Remove the hack that's incrementing message counter while deserializing device - // This hack was added as a quick workaround for TE3 testing. The commissioning code - // is closing the exchange after the device has already been serialized and persisted to the storage. - // While closing the exchange, the outstanding ack gets sent to the device, thus incrementing - // the local message counter. As the device information was stored prior to sending the ack, it now has - // the old counter value (which is 1 less than the updated counter). - mLocalMessageCounter++; - - mDeviceOperationalCertProvisioned = (serializable.mDeviceOperationalCertProvisioned != 0); - - // The InterfaceNameToId() API requires initialization of mInterface, and lock/unlock of - // LwIP stack. - Inet::InterfaceId interfaceId; - if (serializable.mInterfaceName[0] != '\0') - { -#if CHIP_SYSTEM_CONFIG_USE_LWIP - LOCK_TCPIP_CORE(); -#endif - CHIP_ERROR inetErr = Inet::InterfaceId::InterfaceNameToId(Uint8::to_const_char(serializable.mInterfaceName), interfaceId); -#if CHIP_SYSTEM_CONFIG_USE_LWIP - UNLOCK_TCPIP_CORE(); -#endif - ReturnErrorOnFailure(inetErr); - } - - static_assert(std::is_same::type, uint8_t>::value, - "The underlying type of Transport::Type is not uint8_t."); - switch (static_cast(serializable.mDeviceTransport)) - { - case Transport::Type::kUdp: - mDeviceAddress = Transport::PeerAddress::UDP(ipAddress, port, interfaceId); - break; - case Transport::Type::kBle: - mDeviceAddress = Transport::PeerAddress::BLE(); - break; - case Transport::Type::kTcp: - case Transport::Type::kUndefined: - default: - return CHIP_ERROR_INTERNAL; - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::Persist() -{ - CHIP_ERROR error = CHIP_NO_ERROR; - if (mStorageDelegate != nullptr) - { - SerializedDevice serialized; - ReturnErrorOnFailure(Serialize(serialized)); - - // TODO: no need to base-64 the serialized values AGAIN - PERSISTENT_KEY_OP(GetDeviceId(), kPairedDeviceKeyPrefix, key, - error = mStorageDelegate->SyncSetKeyValue(key, serialized.inner, sizeof(serialized.inner))); - if (error != CHIP_NO_ERROR) - { - ChipLogError(Controller, "Failed to persist device %" CHIP_ERROR_FORMAT, error.Format()); - } - } - return error; -} - -void Device::OnNewConnection(SessionHandle session) -{ - // Only allow update if the session has been initialized and matches - if (mSecureSession.HasValue() && !MatchesSession(session)) - { - return; - } - - mState = ConnectionState::SecureConnected; - mSecureSession.SetValue(session); - - // Reset the message counters here because this is the first time we get a handle to the secure session. - // Since CHIPDevices can be serialized/deserialized in the middle of what is conceptually a single PASE session - // we need to restore the session counters along with the session information. - Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); - VerifyOrReturn(secureSession != nullptr); - - secureSession->SetMRPIntervals(mMrpIdleInterval, mMrpActiveInterval); - - MessageCounter & localCounter = secureSession->GetSessionMessageCounter().GetLocalMessageCounter(); - if (localCounter.SetCounter(mLocalMessageCounter) != CHIP_NO_ERROR) - { - ChipLogError(Controller, "Unable to restore local counter to %" PRIu32, mLocalMessageCounter); - } - Transport::PeerMessageCounter & peerCounter = secureSession->GetSessionMessageCounter().GetPeerMessageCounter(); - peerCounter.SetCounter(mPeerMessageCounter); -} - -void Device::OnConnectionExpired(SessionHandle session) -{ - VerifyOrReturn(mSecureSession.HasValue() && mSecureSession.Value() == session, - ChipLogDetail(Controller, "Connection expired, but it doesn't match the current session")); - mState = ConnectionState::NotConnected; - mSecureSession.ClearValue(); -} - -CHIP_ERROR Device::OnMessageReceived(Messaging::ExchangeContext * exchange, const PayloadHeader & payloadHeader, - System::PacketBufferHandle && msgBuf) -{ - if (mState == ConnectionState::SecureConnected) - { - if (mStatusDelegate != nullptr) - { - mStatusDelegate->OnMessage(std::move(msgBuf)); - } - else - { - HandleDataModelMessage(exchange, std::move(msgBuf)); - } - } - return CHIP_NO_ERROR; -} - -void Device::OnResponseTimeout(Messaging::ExchangeContext * ec) {} - -void Device::OnOpenPairingWindowSuccessResponse(void * context) -{ - ChipLogProgress(Controller, "Successfully opened pairing window on the device"); - Device * device = reinterpret_cast(context); - if (device->mCommissioningWindowCallback != nullptr) - { - device->mCommissioningWindowCallback->mCall(device->mCommissioningWindowCallback->mContext, device->GetDeviceId(), - CHIP_NO_ERROR, device->mSetupPayload); - } -} - -void Device::OnOpenPairingWindowFailureResponse(void * context, uint8_t status) -{ - ChipLogError(Controller, "Failed to open pairing window on the device. Status %d", status); - Device * device = reinterpret_cast(context); - if (device->mCommissioningWindowCallback != nullptr) - { - CHIP_ERROR error = CHIP_ERROR_INVALID_PASE_PARAMETER; - // TODO - Use cluster enum chip::app::Clusters::AdministratorCommissioning::StatusCode::kBusy - if (status == 1) - { - error = CHIP_ERROR_ANOTHER_COMMISSIONING_IN_PROGRESS; - } - device->mCommissioningWindowCallback->mCall(device->mCommissioningWindowCallback->mContext, device->GetDeviceId(), error, - SetupPayload()); - } -} - -CHIP_ERROR Device::ComputePASEVerifier(uint32_t iterations, uint32_t setupPincode, const ByteSpan & salt, - PASEVerifier & outVerifier, uint32_t & outPasscodeId) -{ - ReturnErrorOnFailure(PASESession::GeneratePASEVerifier(outVerifier, iterations, salt, /* useRandomPIN= */ false, setupPincode)); - - outPasscodeId = mPAKEVerifierID++; - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::OpenCommissioningWindow(uint16_t timeout, uint32_t iteration, CommissioningWindowOption option, - const ByteSpan & salt, Callback::Callback * callback, - SetupPayload & setupPayload) -{ - constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; - - chip::Controller::AdministratorCommissioningCluster cluster; - cluster.Associate(this, kAdministratorCommissioningClusterEndpoint); - - Callback::Cancelable * successCallback = mOpenPairingSuccessCallback.Cancel(); - Callback::Cancelable * failureCallback = mOpenPairingFailureCallback.Cancel(); - - mCommissioningWindowCallback = callback; - if (option != CommissioningWindowOption::kOriginalSetupCode) - { - bool randomSetupPIN = (option == CommissioningWindowOption::kTokenWithRandomPIN); - PASEVerifier verifier; - - ReturnErrorOnFailure( - PASESession::GeneratePASEVerifier(verifier, iteration, salt, randomSetupPIN, setupPayload.setUpPINCode)); - - uint8_t serializedVerifier[2 * kSpake2p_WS_Length]; - VerifyOrReturnError(sizeof(serializedVerifier) == sizeof(verifier), CHIP_ERROR_INTERNAL); - - memcpy(serializedVerifier, verifier.mW0, kSpake2p_WS_Length); - memcpy(&serializedVerifier[kSpake2p_WS_Length], verifier.mL, kSpake2p_WS_Length); - - ReturnErrorOnFailure(cluster.OpenCommissioningWindow(successCallback, failureCallback, timeout, - ByteSpan(serializedVerifier, sizeof(serializedVerifier)), - setupPayload.discriminator, iteration, salt, mPAKEVerifierID++)); - } - else - { - ReturnErrorOnFailure(cluster.OpenBasicCommissioningWindow(successCallback, failureCallback, timeout)); - } - - setupPayload.version = 0; - setupPayload.rendezvousInformation = RendezvousInformationFlags(RendezvousInformationFlag::kOnNetwork); - - mSetupPayload = setupPayload; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::OpenPairingWindow(uint16_t timeout, CommissioningWindowOption option, SetupPayload & setupPayload) -{ - ByteSpan salt(reinterpret_cast(kSpake2pKeyExchangeSalt), strlen(kSpake2pKeyExchangeSalt)); - - return OpenCommissioningWindow(timeout, kPBKDFMinimumIterations, option, salt, nullptr, setupPayload); -} - -void Device::UpdateSession(bool connected) -{ - SessionHandle session = - SessionHandle(mDeviceId, mCASESession.GetLocalSessionId(), mCASESession.GetPeerSessionId(), mFabricIndex); - if (connected) - { - OnNewConnection(session); - } - else - { - OnConnectionExpired(session); - } -} - -CHIP_ERROR Device::CloseSession() -{ - ReturnErrorCodeIf(mState != ConnectionState::SecureConnected, CHIP_ERROR_INCORRECT_STATE); - if (mSecureSession.HasValue()) - { - mSessionManager->ExpirePairing(mSecureSession.Value()); - } - mState = ConnectionState::NotConnected; - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::UpdateDeviceData(const Transport::PeerAddress & addr, uint32_t mrpIdleInterval, uint32_t mrpActiveInterval) -{ - bool didLoad; - - mDeviceAddress = addr; - mMrpIdleInterval = mrpIdleInterval; - mMrpActiveInterval = mrpActiveInterval; - - ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(didLoad)); - - if (!mSecureSession.HasValue()) - { - // Nothing needs to be done here. It's not an error to not have a - // secureSession. For one thing, we could have gotten an different - // UpdateAddress already and that caused connections to be torn down and - // whatnot. - return CHIP_NO_ERROR; - } - - Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); - secureSession->SetPeerAddress(addr); - secureSession->SetMRPIntervals(mrpIdleInterval, mrpActiveInterval); - - return CHIP_NO_ERROR; -} - -void Device::Reset() -{ - if (IsActive() && mStorageDelegate != nullptr && mSessionManager != nullptr) - { - // If a session can be found, persist the device so that we track the newest message counter values - - if (mSecureSession.HasValue()) - { - Persist(); - } - } - - SetActive(false); - mCASESession.Clear(); - - mState = ConnectionState::NotConnected; - mSessionManager = nullptr; - mStatusDelegate = nullptr; - mInetLayer = nullptr; -#if CONFIG_NETWORK_LAYER_BLE - mBleLayer = nullptr; -#endif - if (mExchangeMgr) - { - // Ensure that any exchange contexts we have open get closed now, - // because we don't want them to call back in to us after this - // point. - mExchangeMgr->CloseAllContextsForDelegate(this); - } - mExchangeMgr = nullptr; - - ReleaseDAC(); - ReleasePAI(); -} - -CHIP_ERROR Device::LoadSecureSessionParameters() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - PASESession pairingSession; - - if (mSessionManager == nullptr || mState == ConnectionState::SecureConnected) - { - ExitNow(err = CHIP_ERROR_INCORRECT_STATE); - } - - if (mState == ConnectionState::Connecting) - { - ExitNow(err = CHIP_NO_ERROR); - } - - if (IsOperationalCertProvisioned()) - { - err = WarmupCASESession(); - SuccessOrExit(err); - } - else - { - err = pairingSession.FromSerializable(mPairing); - SuccessOrExit(err); - - err = mSessionManager->NewPairing(Optional::Value(mDeviceAddress), mDeviceId, &pairingSession, - CryptoContext::SessionRole::kInitiator, mFabricIndex); - SuccessOrExit(err); - } - -exit: - - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "LoadSecureSessionParameters returning error %" CHIP_ERROR_FORMAT, err.Format()); - } - return err; -} - -bool Device::GetAddress(Inet::IPAddress & addr, uint16_t & port) const -{ - if (mState == ConnectionState::NotConnected) - return false; - - addr = mDeviceAddress.GetIPAddress(); - port = mDeviceAddress.GetPort(); - return true; -} - -void Device::OperationalCertProvisioned() -{ - VerifyOrReturn(!mDeviceOperationalCertProvisioned, - ChipLogDetail(Controller, "Operational certificates already provisioned for this device")); - - ChipLogDetail(Controller, "Enabling CASE session establishment for the device"); - mDeviceOperationalCertProvisioned = true; - - Persist(); - CloseSession(); - mState = ConnectionState::NotConnected; -} - -CHIP_ERROR Device::WarmupCASESession() -{ - VerifyOrReturnError(mDeviceOperationalCertProvisioned, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mState == ConnectionState::NotConnected, CHIP_NO_ERROR); - - // Create a UnauthenticatedSession for CASE pairing. - // Don't use mSecureSession here, because mSecureSession is the secure session. - Optional session = mSessionManager->CreateUnauthenticatedSession(mDeviceAddress); - if (!session.HasValue()) - { - return CHIP_ERROR_NO_MEMORY; - } - - session.Value().GetUnauthenticatedSession()->SetMRPIntervals(mMrpIdleInterval, mMrpActiveInterval); - - Messaging::ExchangeContext * exchange = mExchangeMgr->NewContext(session.Value(), &mCASESession); - VerifyOrReturnError(exchange != nullptr, CHIP_ERROR_INTERNAL); - - ReturnErrorOnFailure(mCASESession.MessageDispatch().Init(mSessionManager)); - - uint16_t keyID = 0; - ReturnErrorOnFailure(mIDAllocator->Allocate(keyID)); - - mLocalMessageCounter = 0; - mPeerMessageCounter = 0; - - FabricInfo * fabric = mFabricsTable->FindFabricWithIndex(mFabricIndex); - ReturnErrorCodeIf(fabric == nullptr, CHIP_ERROR_INCORRECT_STATE); - - ReturnErrorOnFailure(mCASESession.EstablishSession(mDeviceAddress, fabric, mDeviceId, keyID, exchange, this)); - - mState = ConnectionState::Connecting; - - return CHIP_NO_ERROR; -} - -void Device::OnSessionEstablishmentError(CHIP_ERROR error) -{ - mState = ConnectionState::NotConnected; - mIDAllocator->Free(mCASESession.GetLocalSessionId()); - - Cancelable ready; - mConnectionFailure.DequeueAll(ready); - while (ready.mNext != &ready) - { - Callback::Callback * cb = - Callback::Callback::FromCancelable(ready.mNext); - - cb->Cancel(); - cb->mCall(cb->mContext, GetDeviceId(), error); - } -} - -void Device::OnSessionEstablished() -{ - CHIP_ERROR err = mSessionManager->NewPairing(Optional::Value(mDeviceAddress), mDeviceId, &mCASESession, - CryptoContext::SessionRole::kInitiator, mFabricIndex); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Controller, "Failed in setting up CASE secure channel: err %s", ErrorStr(err)); - OnSessionEstablishmentError(err); - return; - } - - Cancelable ready; - mConnectionSuccess.DequeueAll(ready); - while (ready.mNext != &ready) - { - Callback::Callback * cb = Callback::Callback::FromCancelable(ready.mNext); - - cb->Cancel(); - cb->mCall(cb->mContext, this); - } -} - -void Device::ReleaseDAC() -{ - if (mDAC != nullptr) - { - Platform::MemoryFree(mDAC); - } - mDACLen = 0; - mDAC = nullptr; -} - -CHIP_ERROR Device::SetDAC(const ByteSpan & dac) -{ - if (dac.size() == 0) - { - ReleaseDAC(); - return CHIP_NO_ERROR; - } - - VerifyOrReturnError(dac.size() <= Credentials::kMaxDERCertLength, CHIP_ERROR_INVALID_ARGUMENT); - if (mDACLen != 0) - { - ReleaseDAC(); - } - - VerifyOrReturnError(CanCastTo(dac.size()), CHIP_ERROR_INVALID_ARGUMENT); - if (mDAC == nullptr) - { - mDAC = static_cast(chip::Platform::MemoryAlloc(dac.size())); - } - VerifyOrReturnError(mDAC != nullptr, CHIP_ERROR_NO_MEMORY); - mDACLen = static_cast(dac.size()); - memcpy(mDAC, dac.data(), mDACLen); - - return CHIP_NO_ERROR; -} - -void Device::ReleasePAI() -{ - if (mPAI != nullptr) - { - chip::Platform::MemoryFree(mPAI); - } - mPAILen = 0; - mPAI = nullptr; -} - -CHIP_ERROR Device::SetPAI(const chip::ByteSpan & pai) -{ - if (pai.size() == 0) - { - ReleasePAI(); - return CHIP_NO_ERROR; - } - - VerifyOrReturnError(pai.size() <= Credentials::kMaxDERCertLength, CHIP_ERROR_INVALID_ARGUMENT); - if (mPAILen != 0) - { - ReleasePAI(); - } - - VerifyOrReturnError(CanCastTo(pai.size()), CHIP_ERROR_INVALID_ARGUMENT); - if (mPAI == nullptr) - { - mPAI = static_cast(chip::Platform::MemoryAlloc(pai.size())); - } - VerifyOrReturnError(mPAI != nullptr, CHIP_ERROR_NO_MEMORY); - mPAILen = static_cast(pai.size()); - memcpy(mPAI, pai.data(), mPAILen); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::EstablishConnectivity(Callback::Callback * onConnection, - Callback::Callback * onFailure) -{ - bool loadedSecureSession = false; - ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(loadedSecureSession)); - - if (loadedSecureSession) - { - if (IsOperationalCertProvisioned()) - { - if (onConnection != nullptr) - { - mConnectionSuccess.Enqueue(onConnection->Cancel()); - } - - if (onFailure != nullptr) - { - mConnectionFailure.Enqueue(onFailure->Cancel()); - } - } - else - { - if (onConnection != nullptr) - { - onConnection->mCall(onConnection->mContext, this); - } - } - } - - return CHIP_NO_ERROR; -} - -void Device::AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, app::TLVDataFilter tlvDataFilter) -{ - // Interaction model uses the object instead of a sequence number as the identifier of transactions. - // Since the objects can be identified by its pointer which fits into a uint64 value (the type of NodeId), we use it for the - // "node id" field in callback manager. - static_assert(std::is_same::value, "chip::NodeId is not uint64_t"); - chip::NodeId transactionId = reinterpret_cast(commandObj); - mCallbacksMgr.AddResponseCallback(transactionId, 0 /* seqNum, always 0 for IM before #6559 */, onSuccessCallback, - onFailureCallback, tlvDataFilter); -} - -void Device::CancelIMResponseHandler(void * commandObj) -{ - // Interaction model uses the object instead of a sequence number as the identifier of transactions. - // Since the objects can be identified by its pointer which fits into a uint64 value (the type of NodeId), we use it for the - // "node id" field in callback manager. - static_assert(std::is_same::value, "chip::NodeId is not uint64_t"); - chip::NodeId transactionId = reinterpret_cast(commandObj); - mCallbacksMgr.CancelResponseCallback(transactionId, 0 /* seqNum, always 0 for IM before #6559 */); -} - -void Device::AddReportHandler(EndpointId endpoint, ClusterId cluster, AttributeId attribute, - Callback::Cancelable * onReportCallback, app::TLVDataFilter tlvDataFilter) -{ - mCallbacksMgr.AddReportCallback(mDeviceId, endpoint, cluster, attribute, onReportCallback, tlvDataFilter); -} - -CHIP_ERROR Device::SendReadAttributeRequest(app::AttributePathParams aPath, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, app::TLVDataFilter aTlvDataFilter) -{ - bool loadedSecureSession = false; - - ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(loadedSecureSession)); - VerifyOrReturnError(mState == ConnectionState::SecureConnected, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); - - app::ReadClient * readClient = nullptr; - ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewReadClient( - &readClient, app::ReadClient::InteractionType::Read, mpIMDelegate)); - - if (onSuccessCallback != nullptr || onFailureCallback != nullptr) - { - AddIMResponseHandler(readClient, onSuccessCallback, onFailureCallback, aTlvDataFilter); - } - // The application context is used to identify different requests from client application the type of it is intptr_t, here we - // use the seqNum. - chip::app::ReadPrepareParams readPrepareParams(mSecureSession.Value()); - readPrepareParams.mpAttributePathParamsList = &aPath; - readPrepareParams.mAttributePathParamsListSize = 1; - - CHIP_ERROR err = readClient->SendReadRequest(readPrepareParams); - if (err != CHIP_NO_ERROR) - { - CancelIMResponseHandler(readClient); - } - return err; -} - -CHIP_ERROR Device::SendSubscribeAttributeRequest(app::AttributePathParams aPath, uint16_t mMinIntervalFloorSeconds, - uint16_t mMaxIntervalCeilingSeconds, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - bool loadedSecureSession = false; - - ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(loadedSecureSession)); - - app::ReadClient * readClient = nullptr; - ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewReadClient( - &readClient, app::ReadClient::InteractionType::Subscribe, mpIMDelegate)); - - app::AttributePathParams * path = mpIMDelegate->AllocateAttributePathParam(1, reinterpret_cast(readClient)); - - VerifyOrReturnError(path != nullptr, CHIP_ERROR_NO_MEMORY); - - *path = aPath; - - // The application context is used to identify different requests from client application the type of it is intptr_t, here we - // use the seqNum. - VerifyOrReturnError(GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); - app::ReadPrepareParams params(GetSecureSession().Value()); - params.mpAttributePathParamsList = path; - params.mAttributePathParamsListSize = 1; - params.mMinIntervalFloorSeconds = mMinIntervalFloorSeconds; - params.mMaxIntervalCeilingSeconds = mMaxIntervalCeilingSeconds; - params.mKeepSubscriptions = false; - - CHIP_ERROR err = readClient->SendSubscribeRequest(params); - if (err != CHIP_NO_ERROR) - { - mpIMDelegate->FreeAttributePathParam(reinterpret_cast(readClient)); - readClient->Shutdown(); - return err; - } - - if (onSuccessCallback != nullptr || onFailureCallback != nullptr) - { - AddIMResponseHandler(readClient, onSuccessCallback, onFailureCallback); - } - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::ShutdownSubscriptions() -{ - return app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(mFabricIndex, mDeviceId); -} - -CHIP_ERROR Device::SendWriteAttributeRequest(app::WriteClientHandle aHandle, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) -{ - bool loadedSecureSession = false; - CHIP_ERROR err = CHIP_NO_ERROR; - - ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(loadedSecureSession)); - VerifyOrReturnError(mState == ConnectionState::SecureConnected, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); - - app::WriteClient * writeClient = aHandle.Get(); - - if (onSuccessCallback != nullptr || onFailureCallback != nullptr) - { - AddIMResponseHandler(writeClient, onSuccessCallback, onFailureCallback); - } - if ((err = aHandle.SendWriteRequest(mSecureSession.Value())) != CHIP_NO_ERROR) - { - CancelIMResponseHandler(writeClient); - } - return err; -} - -Device::~Device() -{ - if (mExchangeMgr) - { - // Ensure that any exchange contexts we have open get closed now, - // because we don't want them to call back in to us after this - // point. - mExchangeMgr->CloseAllContextsForDelegate(this); - } - - ReleaseDAC(); - ReleasePAI(); -} - -CHIP_ERROR Device::SetNOCCertBufferSize(size_t new_size) -{ - ReturnErrorCodeIf(new_size > sizeof(mNOCCertBuffer), CHIP_ERROR_INVALID_ARGUMENT); - mNOCCertBufferSize = new_size; - return CHIP_NO_ERROR; -} - -CHIP_ERROR Device::SetICACertBufferSize(size_t new_size) -{ - ReturnErrorCodeIf(new_size > sizeof(mICACertBuffer), CHIP_ERROR_INVALID_ARGUMENT); - mICACertBufferSize = new_size; - return CHIP_NO_ERROR; -} - -} // namespace Controller -} // namespace chip diff --git a/src/controller/CHIPDevice.h b/src/controller/CHIPDevice.h deleted file mode 100644 index 4b4922795ddbc1..00000000000000 --- a/src/controller/CHIPDevice.h +++ /dev/null @@ -1,661 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * This file contains definitions for Device class. The objects of this - * class will be used by Controller applications to interact with CHIP - * devices. The class provides mechanism to construct, send and receive - * messages to and from the corresponding CHIP devices. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if CONFIG_NETWORK_LAYER_BLE -#include -#include -#endif - -namespace chip { -namespace Controller { - -class DeviceController; -class DeviceStatusDelegate; -struct SerializedDevice; - -constexpr size_t kMaxBlePendingPackets = 1; -constexpr size_t kOpCSRNonceLength = 32; -constexpr size_t kAttestationNonceLength = 32; - -using DeviceTransportMgr = TransportMgr /* BLE */ -#endif - >; - -using DeviceIPTransportMgr = TransportMgr; - -struct ControllerDeviceInitParams -{ - DeviceTransportMgr * transportMgr = nullptr; - SessionManager * sessionManager = nullptr; - Messaging::ExchangeManager * exchangeMgr = nullptr; - Inet::InetLayer * inetLayer = nullptr; - PersistentStorageDelegate * storageDelegate = nullptr; - SessionIDAllocator * idAllocator = nullptr; -#if CONFIG_NETWORK_LAYER_BLE - Ble::BleLayer * bleLayer = nullptr; -#endif - FabricTable * fabricsTable = nullptr; - DeviceControllerInteractionModelDelegate * imDelegate = nullptr; -}; - -class Device; - -typedef void (*OnDeviceConnected)(void * context, Device * device); -typedef void (*OnDeviceConnectionFailure)(void * context, NodeId deviceId, CHIP_ERROR error); -typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload); - -class Device : public Messaging::ExchangeDelegate, public SessionEstablishmentDelegate -{ -public: - ~Device(); - Device() : - mOpenPairingSuccessCallback(OnOpenPairingWindowSuccessResponse, this), - mOpenPairingFailureCallback(OnOpenPairingWindowFailureResponse, this) - {} - Device(const Device &) = delete; - - enum class CommissioningWindowOption - { - kOriginalSetupCode = 0, - kTokenWithRandomPIN, - kTokenWithProvidedPIN, - }; - - /** - * @brief - * Set the delegate object which will be called when a message is received. - * The user of this Device object must reset the delegate (by calling - * SetDelegate(nullptr)) before releasing their delegate object. - * - * @param[in] delegate The pointer to the delegate object. - */ - void SetDelegate(DeviceStatusDelegate * delegate) { mStatusDelegate = delegate; } - - // ----- Messaging ----- - CHIP_ERROR SendReadAttributeRequest(app::AttributePathParams aPath, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, app::TLVDataFilter aTlvDataFilter); - - CHIP_ERROR SendSubscribeAttributeRequest(app::AttributePathParams aPath, uint16_t mMinIntervalFloorSeconds, - uint16_t mMaxIntervalCeilingSeconds, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback); - CHIP_ERROR ShutdownSubscriptions(); - - CHIP_ERROR SendWriteAttributeRequest(app::WriteClientHandle aHandle, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback); - - /** - * @brief - * Send the command in internal command sender. - */ - CHIP_ERROR SendCommands(app::CommandSender * commandObj); - - /** - * @brief Get the IP address and port assigned to the device. - * - * @param[out] addr IP address of the device. - * @param[out] port Port number of the device. - * - * @return true, if the IP address and port were filled in the out parameters, false otherwise - */ - bool GetAddress(Inet::IPAddress & addr, uint16_t & port) const; - - /** - * @brief - * Initialize the device object with secure session manager and inet layer object - * references. This variant of function is typically used when the device object - * is created from a serialized device information. The other parameters (address, port, - * interface etc) are part of the serialized device, so those are not required to be - * initialized. - * - * Note: The lifetime of session manager and inet layer objects must be longer than - * that of this device object. If these objects are freed, while the device object is - * still using them, it can lead to unknown behavior and crashes. - * - * @param[in] params Wrapper object for transport manager etc. - * @param[in] fabric Local administrator that's initializing this device object - */ - void Init(ControllerDeviceInitParams params, FabricIndex fabric) - { - mSessionManager = params.sessionManager; - mExchangeMgr = params.exchangeMgr; - mInetLayer = params.inetLayer; - mFabricIndex = fabric; - mStorageDelegate = params.storageDelegate; - mIDAllocator = params.idAllocator; - mFabricsTable = params.fabricsTable; - mpIMDelegate = params.imDelegate; -#if CONFIG_NETWORK_LAYER_BLE - mBleLayer = params.bleLayer; -#endif - } - - /** - * @brief - * Initialize a new device object with secure session manager, inet layer object, - * and other device specific parameters. This variant of function is typically used when - * a new device is paired, and the corresponding device object needs to updated with - * all device specifc parameters (address, port, interface etc). - * - * This is not done as part of constructor so that the controller can have a list of - * uninitialized/unpaired device objects. The object is initialized only when the device - * is actually paired. - * - * @param[in] params Wrapper object for transport manager etc. - * @param[in] deviceId Node ID of the device - * @param[in] peerAddress The location of the peer. MUST be of type Transport::Type::kUdp - * @param[in] fabric Local administrator that's initializing this device object - */ - void Init(ControllerDeviceInitParams params, NodeId deviceId, const Transport::PeerAddress & peerAddress, FabricIndex fabric) - { - Init(params, fabric); - mDeviceId = deviceId; - mState = ConnectionState::Connecting; - - mDeviceAddress = peerAddress; - } - - /** @brief Serialize the Pairing Session to a string. It's guaranteed that the string - * will be null terminated, and there won't be any embedded null characters. - * - * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise - **/ - CHIP_ERROR Serialize(SerializedDevice & output); - - /** @brief Deserialize the Pairing Session from the string. It's expected that the string - * will be null terminated, and there won't be any embedded null characters. - * - * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise - **/ - CHIP_ERROR Deserialize(const SerializedDevice & input); - - /** - * @brief Serialize and store the Device in persistent storage - * - * @return Returns a CHIP_ERROR if either serialization or storage fails - */ - CHIP_ERROR Persist(); - - /** - * @brief - * Called when a new pairing is being established - * - * @param session A handle to the secure session - */ - void OnNewConnection(SessionHandle session); - - /** - * @brief - * Called when a connection is closing. - * - * The receiver should release all resources associated with the connection. - * - * @param session A handle to the secure session - */ - void OnConnectionExpired(SessionHandle session); - - /** - * @brief - * This function is called when a message is received from the corresponding CHIP - * device. The message ownership is transferred to the function, and it is expected - * to release the message buffer before returning. - * - * @param[in] exchange The exchange context the message was received - * on. The Device guarantees that it will call - * Close() on exchange when it's done processing - * the message. - * @param[in] payloadHeader Reference to payload header in the message - * @param[in] msgBuf The message buffer - */ - CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * exchange, const PayloadHeader & payloadHeader, - System::PacketBufferHandle && msgBuf) override; - - /** - * @brief ExchangeDelegate implementation of OnResponseTimeout. - */ - void OnResponseTimeout(Messaging::ExchangeContext * exchange) override; - - /** - * @brief - * Trigger a paired device to re-enter the commissioning mode. If an onboarding token is provided, the device will use - * the provided setup PIN code and the discriminator to advertise itself for commissioning availability. If the token - * is not provided, the device will use the manufacturer assigned setup PIN code and discriminator. - * - * The device will exit the commissioning mode after a successful commissioning, or after the given `timeout` time. - * - * @param[in] timeout The commissioning mode should terminate after this much time. - * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral - * PAKE passcode verifier to be used for this commissioning. - * @param[in] option The commissioning window can be opened using the original setup code, or an - * onboarding token can be generated using a random setup PIN code (or with - * the PIN code provied in the setupPayload). - * @param[in] salt The PAKE Salt associated with the PAKE Passcode ID and ephemeral PAKE passcode - * verifier to be used for this commissioning. - * @param[in] callback The function to be called on success or failure of opening of commissioning window. - * @param[out] setupPayload The setup payload corresponding to the generated onboarding token. - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR OpenCommissioningWindow(uint16_t timeout, uint32_t iteration, CommissioningWindowOption option, - const ByteSpan & salt, Callback::Callback * callback, - SetupPayload & setupPayload); - - /** - * @brief - * Trigger a paired device to re-enter the commissioning mode. If an onboarding token is provided, the device will use - * the provided setup PIN code and the discriminator to advertise itself for commissioning availability. If the token - * is not provided, the device will use the manufacturer assigned setup PIN code and discriminator. - * - * The device will exit the commissioning mode after a successful commissioning, or after the given `timeout` time. - * - * @param[in] timeout The commissioning mode should terminate after this much time. - * @param[in] option The commissioning window can be opened using the original setup code, or an - * onboarding token can be generated using a random setup PIN code (or with - * the PIN code provied in the setupPayload). This argument selects one of these - * methods. - * @param[out] setupPayload The setup payload corresponding to the generated onboarding token. - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR OpenPairingWindow(uint16_t timeout, CommissioningWindowOption option, SetupPayload & setupPayload); - - /** - * @brief - * Compute a PASE verifier and passcode ID for the desired setup pincode. - * - * This can be used to open a commissioning window on the device for - * additional administrator commissioning. - * - * @param[in] iterations The number of iterations to use when generating the verifier - * @param[in] setupPincode The desired PIN code to use - * @param[in] salt The 16-byte salt for verifier computation - * @param[out] outVerifier The PASEVerifier to be populated on success - * @param[out] outPasscodeId The passcode ID to be populated on success - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR ComputePASEVerifier(uint32_t iterations, uint32_t setupPincode, const ByteSpan & salt, PASEVerifier & outVerifier, - uint32_t & outPasscodeId); - - // TODO: This is a workaround for OperationalDeviceProxy class to call OnNewConnection/OnConnectionExpired. Once - // https://github.com/project-chip/connectedhomeip/issues/10423 is complete, this function can be removed. - void UpdateSession(bool connected); - - /** - * In case there exists an open session to the device, mark it as expired. - */ - CHIP_ERROR CloseSession(); - - /** - * @brief - * Update data of the device. - * - * This function will set new IP address, port and MRP retransmission intervals of the device. - * Since the device settings might have been moved from RAM to the persistent storage, the function - * will load the device settings first, before making the changes. - * - * @param[in] addr Address of the device to be set. - * @param[in] mrpIdleInterval MRP idle retransmission interval of the device to be set. - * @param[in] mrpActiveInterval MRP active retransmision interval of the device to be set. - * - * @return CHIP_NO_ERROR if the data has been updated, an error code otherwise. - */ - CHIP_ERROR UpdateDeviceData(const Transport::PeerAddress & addr, uint32_t mrpIdleInterval, uint32_t mrpActiveInterval); - /** - * @brief - * Return whether the current device object is actively associated with a paired CHIP - * device. An active object can be used to communicate with the corresponding device. - */ - bool IsActive() const { return mActive; } - - void SetActive(bool active) { mActive = active; } - - bool IsSecureConnected() const { return IsActive() && mState == ConnectionState::SecureConnected; } - - bool IsSessionSetupInProgress() const { return IsActive() && mState == ConnectionState::Connecting; } - - void Reset(); - - NodeId GetDeviceId() const { return mDeviceId; } - - bool MatchesSession(SessionHandle session) const { return mSecureSession.HasValue() && mSecureSession.Value() == session; } - - chip::Optional GetSecureSession() const { return mSecureSession; } - - Messaging::ExchangeManager * GetExchangeManager() const { return mExchangeMgr; } - - void SetAddress(const Inet::IPAddress & deviceAddr) { mDeviceAddress.SetIPAddress(deviceAddr); } - - void GetMRPIntervals(uint32_t & idleInterval, uint32_t & activeInterval) const - { - idleInterval = mMrpIdleInterval; - activeInterval = mMrpActiveInterval; - } - - PASESessionSerializable & GetPairing() { return mPairing; } - - uint8_t GetNextSequenceNumber() { return mSequenceNumber++; }; - void AddReportHandler(EndpointId endpoint, ClusterId cluster, AttributeId attribute, Callback::Cancelable * onReportCallback, - app::TLVDataFilter tlvDataFilter); - // Interaction model uses the object and callback interface instead of sequence number to mark different transactions. - void AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - app::TLVDataFilter tlvDataFilter = nullptr); - void CancelIMResponseHandler(void * commandObj); - - void OperationalCertProvisioned(); - bool IsOperationalCertProvisioned() const { return mDeviceOperationalCertProvisioned; } - - CHIP_ERROR LoadSecureSessionParametersIfNeeded() - { - bool loadedSecureSession = false; - return LoadSecureSessionParametersIfNeeded(loadedSecureSession); - }; - - //////////// SessionEstablishmentDelegate Implementation /////////////// - void OnSessionEstablishmentError(CHIP_ERROR error) override; - void OnSessionEstablished() override; - - CASESession & GetCASESession() { return mCASESession; } - - CHIP_ERROR SetCSRNonce(ByteSpan csrNonce) - { - VerifyOrReturnError(csrNonce.size() == sizeof(mCSRNonce), CHIP_ERROR_INVALID_ARGUMENT); - memcpy(mCSRNonce, csrNonce.data(), csrNonce.size()); - return CHIP_NO_ERROR; - } - - ByteSpan GetCSRNonce() const { return ByteSpan(mCSRNonce, sizeof(mCSRNonce)); } - - CHIP_ERROR SetAttestationNonce(ByteSpan attestationNonce) - { - VerifyOrReturnError(attestationNonce.size() == sizeof(mAttestationNonce), CHIP_ERROR_INVALID_ARGUMENT); - memcpy(mAttestationNonce, attestationNonce.data(), attestationNonce.size()); - return CHIP_NO_ERROR; - } - - ByteSpan GetAttestationNonce() const { return ByteSpan(mAttestationNonce, sizeof(mAttestationNonce)); } - - bool AreCredentialsAvailable() const { return (mDAC != nullptr && mDACLen != 0); } - - ByteSpan GetDAC() const { return ByteSpan(mDAC, mDACLen); } - ByteSpan GetPAI() const { return ByteSpan(mPAI, mPAILen); } - - CHIP_ERROR SetDAC(const ByteSpan & dac); - CHIP_ERROR SetPAI(const ByteSpan & pai); - - MutableByteSpan GetMutableNOCCert() { return MutableByteSpan(mNOCCertBuffer, sizeof(mNOCCertBuffer)); } - - CHIP_ERROR SetNOCCertBufferSize(size_t new_size); - - ByteSpan GetNOCCert() const { return ByteSpan(mNOCCertBuffer, mNOCCertBufferSize); } - - MutableByteSpan GetMutableICACert() { return MutableByteSpan(mICACertBuffer, sizeof(mICACertBuffer)); } - - CHIP_ERROR SetICACertBufferSize(size_t new_size); - - ByteSpan GetICACert() const { return ByteSpan(mICACertBuffer, mICACertBufferSize); } - - /* - * This function can be called to establish a secure session with the device. - * - * If the device doesn't have operational credentials, and is under commissioning process, - * PASE keys will be used for secure session. - * - * If the device has been commissioned and has operational credentials, CASE session - * setup will be triggered. - * - * On establishing the session, the callback function `onConnection` will be called. If the - * session setup fails, `onFailure` will be called. - * - * If the session already exists, `onConnection` will be called immediately. - */ - CHIP_ERROR EstablishConnectivity(Callback::Callback * onConnection, - Callback::Callback * onFailure); - - DeviceControllerInteractionModelDelegate * GetInteractionModelDelegate() { return mpIMDelegate; }; - -private: - enum class ConnectionState - { - NotConnected, - Connecting, - SecureConnected, - }; - - enum class ResetTransport - { - kYes, - kNo, - }; - /* Node ID assigned to the CHIP device */ - NodeId mDeviceId; - - /** Address used to communicate with the device. - */ - Transport::PeerAddress mDeviceAddress = Transport::PeerAddress::UDP(Inet::IPAddress::Any); - - uint32_t mMrpIdleInterval = CHIP_CONFIG_MRP_DEFAULT_IDLE_RETRY_INTERVAL; - uint32_t mMrpActiveInterval = CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL; - - Inet::InetLayer * mInetLayer = nullptr; - - bool mActive = false; - ConnectionState mState = ConnectionState::NotConnected; - -#if CONFIG_NETWORK_LAYER_BLE - Ble::BleLayer * mBleLayer = nullptr; -#endif - - PASESessionSerializable mPairing; - - DeviceStatusDelegate * mStatusDelegate = nullptr; - - SessionManager * mSessionManager = nullptr; - - Messaging::ExchangeManager * mExchangeMgr = nullptr; - - Optional mSecureSession = Optional::Missing(); - - DeviceControllerInteractionModelDelegate * mpIMDelegate = nullptr; - - uint8_t mSequenceNumber = 0; - - uint32_t mLocalMessageCounter = 0; - uint32_t mPeerMessageCounter = 0; - - app::CHIPDeviceCallbacksMgr & mCallbacksMgr = app::CHIPDeviceCallbacksMgr::GetInstance(); - - /** - * @brief - * This function loads the secure session object from the serialized operational - * credentials corresponding to the device. This is typically done when the device - * does not have an active secure channel. - */ - CHIP_ERROR LoadSecureSessionParameters(); - - /** - * @brief - * This function loads the secure session object from the serialized operational - * credentials corresponding if needed, based on the current state of the device and - * underlying transport object. - * - * @param[out] didLoad Were the secure session params loaded by the call to this function. - */ - CHIP_ERROR LoadSecureSessionParametersIfNeeded(bool & didLoad); - - /** - * This function triggers CASE session setup if the device has been provisioned with - * operational credentials, and there is no currently active session. - */ - - CHIP_ERROR WarmupCASESession(); - - void ReleaseDAC(); - void ReleasePAI(); - - static void OnOpenPairingWindowSuccessResponse(void * context); - static void OnOpenPairingWindowFailureResponse(void * context, uint8_t status); - - FabricIndex mFabricIndex = kUndefinedFabricIndex; - - FabricTable * mFabricsTable = nullptr; - - bool mDeviceOperationalCertProvisioned = false; - - CASESession mCASESession; - PersistentStorageDelegate * mStorageDelegate = nullptr; - - // TODO: Offload Nonces and DAC/PAI into a new struct - uint8_t mCSRNonce[kOpCSRNonceLength]; - uint8_t mAttestationNonce[kAttestationNonceLength]; - - uint8_t * mDAC = nullptr; - uint16_t mDACLen = 0; - uint8_t * mPAI = nullptr; - uint16_t mPAILen = 0; - - uint8_t mNOCCertBuffer[Credentials::kMaxCHIPCertLength]; - size_t mNOCCertBufferSize = 0; - - uint8_t mICACertBuffer[Credentials::kMaxCHIPCertLength]; - size_t mICACertBufferSize = 0; - - SessionIDAllocator * mIDAllocator = nullptr; - - uint16_t mPAKEVerifierID = 1; - - Callback::CallbackDeque mConnectionSuccess; - Callback::CallbackDeque mConnectionFailure; - - Callback::Callback * mCommissioningWindowCallback = nullptr; - SetupPayload mSetupPayload; - - Callback::Callback mOpenPairingSuccessCallback; - Callback::Callback mOpenPairingFailureCallback; -}; - -/** - * This class defines an interface for an object that the user of Device - * can register as a delegate. The delegate object will be called by the - * Device when a new message or status update is received from the corresponding - * CHIP device. - */ -class DeviceStatusDelegate -{ -public: - virtual ~DeviceStatusDelegate() {} - - /** - * @brief - * Called when a message is received from the device. - * - * @param[in] msg Received message buffer. - */ - virtual void OnMessage(System::PacketBufferHandle && msg) = 0; - - /** - * @brief - * Called when response to OpenPairingWindow is received from the device. - * - * @param[in] status CHIP_NO_ERROR on success, or corresponding error. - */ - virtual void OnPairingWindowOpenStatus(CHIP_ERROR status){}; - - /** - * @brief - * Called when device status is updated. - * - */ - virtual void OnStatusChange(void){}; -}; - -#ifdef IFNAMSIZ -constexpr uint16_t kMaxInterfaceName = IFNAMSIZ; -#else -constexpr uint16_t kMaxInterfaceName = 32; -#endif - -typedef struct SerializableDevice -{ - PASESessionSerializable mOpsCreds; - uint64_t mDeviceId; /* This field is serialized in LittleEndian byte order */ - uint8_t mDeviceAddr[INET6_ADDRSTRLEN]; - uint16_t mDevicePort; /* This field is serialized in LittleEndian byte order */ - uint16_t mFabricIndex; /* This field is serialized in LittleEndian byte order */ - uint8_t mDeviceTransport; - uint8_t mDeviceOperationalCertProvisioned; - uint8_t mInterfaceName[kMaxInterfaceName]; - uint32_t mLocalMessageCounter; /* This field is serialized in LittleEndian byte order */ - uint32_t mPeerMessageCounter; /* This field is serialized in LittleEndian byte order */ -} SerializableDevice; - -typedef struct SerializedDevice -{ - // Extra uint64_t to account for padding bytes (NULL termination, and some decoding overheads) - // The encoder may not include a NULL character, and there are maximum 2 bytes of padding. - // So extra 8 bytes should be sufficient to absorb this overhead. - uint8_t inner[BASE64_ENCODED_LEN(sizeof(SerializableDevice) + sizeof(uint64_t))]; -} SerializedDevice; - -} // namespace Controller -} // namespace chip diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index d4ccd3c41f6eb8..4916878f6f9fcd 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -44,6 +44,7 @@ #endif #include +#include #include #include #include @@ -106,7 +107,9 @@ using namespace chip::Protocols::UserDirectedCommissioning; constexpr uint32_t kSessionEstablishmentTimeout = 30 * kMillisecondsPerSecond; -DeviceController::DeviceController() +DeviceController::DeviceController() : + mOpenPairingSuccessCallback(OnOpenPairingWindowSuccessResponse, this), + mOpenPairingFailureCallback(OnOpenPairingWindowFailureResponse, this) { mState = State::NotInitialized; mStorageDelegate = nullptr; @@ -150,7 +153,6 @@ CHIP_ERROR DeviceController::Init(ControllerInitParams params) mSystemState = params.systemState->Retain(); mState = State::Initialized; - ReleaseAllDevices(); return CHIP_NO_ERROR; } @@ -209,11 +211,6 @@ CHIP_ERROR DeviceController::Shutdown() ChipLogDetail(Controller, "Shutting down the controller"); - for (uint32_t i = 0; i < kNumMaxActiveDevices; i++) - { - mActiveDevices[i].Reset(); - } - mState = State::NotInitialized; #if CHIP_DEVICE_CONFIG_ENABLE_DNSSD @@ -222,8 +219,6 @@ CHIP_ERROR DeviceController::Shutdown() mStorageDelegate = nullptr; - ReleaseAllDevices(); - mSystemState->Fabrics()->ReleaseFabricIndex(mFabricIndex); mSystemState->Release(); mSystemState = nullptr; @@ -237,56 +232,6 @@ CHIP_ERROR DeviceController::Shutdown() return CHIP_NO_ERROR; } -CHIP_ERROR DeviceController::GetDevice(NodeId deviceId, Device ** out_device) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - Device * device = nullptr; - uint16_t index = 0; - - VerifyOrExit(out_device != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); - index = FindDeviceIndex(deviceId); - - if (index < kNumMaxActiveDevices) - { - device = &mActiveDevices[index]; - } - else - { - err = InitializePairedDeviceList(); - SuccessOrExit(err); - - VerifyOrExit(mPairedDevices.Contains(deviceId), err = CHIP_ERROR_NOT_CONNECTED); - - index = GetInactiveDeviceIndex(); - VerifyOrExit(index < kNumMaxActiveDevices, err = CHIP_ERROR_NO_MEMORY); - device = &mActiveDevices[index]; - - { - SerializedDevice deviceInfo; - uint16_t size = sizeof(deviceInfo.inner); - - PERSISTENT_KEY_OP(deviceId, kPairedDeviceKeyPrefix, key, - err = mStorageDelegate->SyncGetKeyValue(key, deviceInfo.inner, size)); - SuccessOrExit(err); - VerifyOrExit(size <= sizeof(deviceInfo.inner), err = CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR); - - err = device->Deserialize(deviceInfo); - VerifyOrExit(err == CHIP_NO_ERROR, ReleaseDevice(device)); - - device->Init(GetControllerDeviceInitParams(), mFabricIndex); - } - } - - *out_device = device; - -exit: - if (err != CHIP_NO_ERROR && device != nullptr) - { - ReleaseDevice(device); - } - return err; -} - bool DeviceController::DoesDevicePairingExist(const PeerId & deviceId) { if (InitializePairedDeviceList() == CHIP_NO_ERROR) @@ -297,28 +242,52 @@ bool DeviceController::DoesDevicePairingExist(const PeerId & deviceId) return false; } -CHIP_ERROR DeviceController::GetConnectedDevice(NodeId deviceId, Callback::Callback * onConnection, - Callback::Callback * onFailure) +CHIP_ERROR DeviceController::GetOperationalDeviceWithAddress(NodeId deviceId, const Transport::PeerAddress & addr, + Callback::Callback * onConnection, + Callback::Callback * onFailure) { - CHIP_ERROR err = CHIP_NO_ERROR; - Device * device = nullptr; + OperationalDeviceProxy * device = FindOperationalDevice(deviceId); + if (device == nullptr) + { + FabricInfo * fabric = mSystemState->Fabrics()->FindFabricWithIndex(mFabricIndex); + VerifyOrReturnError(fabric != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + DeviceProxyInitParams initParams = { + .sessionManager = mSystemState->SessionMgr(), + .exchangeMgr = mSystemState->ExchangeMgr(), + .idAllocator = &mIDAllocator, + .fabricInfo = fabric, + .imDelegate = mSystemState->IMDelegate(), + }; - err = GetDevice(deviceId, &device); - SuccessOrExit(err); + PeerId peerID = fabric->GetPeerId(); + peerID.SetNodeId(deviceId); - if (device->IsSecureConnected()) - { - onConnection->mCall(onConnection->mContext, device); - return CHIP_NO_ERROR; + device = mOperationalDevices.CreateObject(initParams, peerID); + if (device == nullptr) + { + onFailure->mCall(onFailure->mContext, deviceId, CHIP_ERROR_NO_MEMORY); + return CHIP_ERROR_NO_MEMORY; + } } - err = device->EstablishConnectivity(onConnection, onFailure); - SuccessOrExit(err); + CHIP_ERROR err = CHIP_NO_ERROR; + if (addr != Transport::PeerAddress::UDP(Inet::IPAddress::Any)) + { + uint32_t idleInterval; + uint32_t activeInterval; + device->GetMRPIntervals(idleInterval, activeInterval); + err = device->UpdateDeviceData(addr, idleInterval, activeInterval); + if (err != CHIP_NO_ERROR) + { + ReleaseOperationalDevice(device); + return err; + } + } -exit: + err = device->Connect(onConnection, onFailure); if (err != CHIP_NO_ERROR) { - onFailure->mCall(onFailure->mContext, deviceId, err); + ReleaseOperationalDevice(device); } return err; @@ -334,30 +303,18 @@ CHIP_ERROR DeviceController::UpdateDevice(NodeId deviceId) #endif // CHIP_DEVICE_CONFIG_ENABLE_DNSSD } -void DeviceController::PersistDevice(Device * device) -{ - if (mState == State::Initialized) - { - device->Persist(); - } - else - { - ChipLogError(Controller, "Failed to persist device. Controller not initialized."); - } -} - CHIP_ERROR DeviceController::OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, System::PacketBufferHandle && msgBuf) { - uint16_t index; + OperationalDeviceProxy * device = nullptr; VerifyOrExit(mState == State::Initialized, ChipLogError(Controller, "OnMessageReceived was called in incorrect state")); VerifyOrExit(ec != nullptr, ChipLogError(Controller, "OnMessageReceived was called with null exchange")); - index = FindDeviceIndex(ec->GetSessionHandle().GetPeerNodeId()); - VerifyOrExit(index < kNumMaxActiveDevices, ChipLogError(Controller, "OnMessageReceived was called for unknown device object")); + device = FindOperationalDevice(ec->GetSessionHandle()); + VerifyOrExit(device != nullptr, ChipLogError(Controller, "OnMessageReceived was called for unknown device object")); - mActiveDevices[index].OnMessageReceived(ec, payloadHeader, std::move(msgBuf)); + device->OnMessageReceived(ec, payloadHeader, std::move(msgBuf)); exit: return CHIP_NO_ERROR; @@ -369,99 +326,56 @@ void DeviceController::OnResponseTimeout(Messaging::ExchangeContext * ec) ChipLogValueExchange(ec)); } -void DeviceController::OnNewConnection(SessionHandle session, Messaging::ExchangeManager * mgr) -{ - VerifyOrReturn(mState == State::Initialized, ChipLogError(Controller, "OnNewConnection was called in incorrect state")); - - uint16_t index = FindDeviceIndex(mgr->GetSessionManager()->GetSecureSession(session)->GetPeerNodeId()); - VerifyOrReturn(index < kNumMaxActiveDevices, - ChipLogDetail(Controller, "OnNewConnection was called for unknown device, ignoring it.")); - - mActiveDevices[index].OnNewConnection(session); -} +void DeviceController::OnNewConnection(SessionHandle session, Messaging::ExchangeManager * mgr) {} void DeviceController::OnConnectionExpired(SessionHandle session, Messaging::ExchangeManager * mgr) { VerifyOrReturn(mState == State::Initialized, ChipLogError(Controller, "OnConnectionExpired was called in incorrect state")); - uint16_t index = FindDeviceIndex(session); - VerifyOrReturn(index < kNumMaxActiveDevices, - ChipLogDetail(Controller, "OnConnectionExpired was called for unknown device, ignoring it.")); + OperationalDeviceProxy * device = FindOperationalDevice(session); + VerifyOrReturn(device != nullptr, ChipLogDetail(Controller, "OnConnectionExpired was called for unknown device, ignoring it.")); - mActiveDevices[index].OnConnectionExpired(session); + device->OnConnectionExpired(session); } -uint16_t DeviceController::GetInactiveDeviceIndex() +OperationalDeviceProxy * DeviceController::FindOperationalDevice(SessionHandle session) { - uint16_t i = 0; - while (i < kNumMaxActiveDevices && mActiveDevices[i].IsActive()) - i++; - if (i < kNumMaxActiveDevices) - { - mActiveDevices[i].SetActive(true); - } - - return i; -} - -void DeviceController::ReleaseDevice(Device * device) -{ - device->Reset(); -} + OperationalDeviceProxy * foundDevice = nullptr; + mOperationalDevices.ForEachActiveObject([&](auto * deviceProxy) { + if (deviceProxy->MatchesSession(session)) + { + foundDevice = deviceProxy; + return false; + } + return true; + }); -void DeviceController::ReleaseDevice(uint16_t index) -{ - if (index < kNumMaxActiveDevices) - { - ReleaseDevice(&mActiveDevices[index]); - } + return foundDevice; } -void DeviceController::ReleaseDeviceById(NodeId remoteDeviceId) +OperationalDeviceProxy * DeviceController::FindOperationalDevice(NodeId id) { - for (uint16_t i = 0; i < kNumMaxActiveDevices; i++) - { - if (mActiveDevices[i].GetDeviceId() == remoteDeviceId) + OperationalDeviceProxy * foundDevice = nullptr; + mOperationalDevices.ForEachActiveObject([&](auto * deviceProxy) { + if (deviceProxy->GetDeviceId() == id) { - ReleaseDevice(&mActiveDevices[i]); + foundDevice = deviceProxy; + return false; } - } -} + return true; + }); -void DeviceController::ReleaseAllDevices() -{ - for (uint16_t i = 0; i < kNumMaxActiveDevices; i++) - { - ReleaseDevice(&mActiveDevices[i]); - } + return foundDevice; } -uint16_t DeviceController::FindDeviceIndex(SessionHandle session) +void DeviceController::ReleaseOperationalDevice(NodeId id) { - uint16_t i = 0; - while (i < kNumMaxActiveDevices) - { - if (mActiveDevices[i].IsActive() && mActiveDevices[i].IsSecureConnected() && mActiveDevices[i].MatchesSession(session)) - { - return i; - } - i++; - } - return i; + ReleaseOperationalDevice(FindOperationalDevice(id)); } -uint16_t DeviceController::FindDeviceIndex(NodeId id) +void DeviceController::ReleaseOperationalDevice(OperationalDeviceProxy * device) { - uint16_t i = 0; - while (i < kNumMaxActiveDevices) - { - if (mActiveDevices[i].IsActive() && mActiveDevices[i].GetDeviceId() == id) - { - return i; - } - i++; - } - return i; + mOperationalDevices.ReleaseObject(device); } CHIP_ERROR DeviceController::InitializePairedDeviceList() @@ -534,22 +448,134 @@ void DeviceController::PersistNextKeyId() CHIP_ERROR DeviceController::GetPeerAddressAndPort(PeerId peerId, Inet::IPAddress & addr, uint16_t & port) { VerifyOrReturnError(GetCompressedFabricId() == peerId.GetCompressedFabricId(), CHIP_ERROR_INVALID_ARGUMENT); - uint16_t index = FindDeviceIndex(peerId.GetNodeId()); - VerifyOrReturnError(index < kNumMaxActiveDevices, CHIP_ERROR_NOT_CONNECTED); - VerifyOrReturnError(mActiveDevices[index].GetAddress(addr, port), CHIP_ERROR_NOT_CONNECTED); + OperationalDeviceProxy * device = FindOperationalDevice(peerId.GetNodeId()); + VerifyOrReturnError(device->GetAddress(addr, port), CHIP_ERROR_NOT_CONNECTED); + return CHIP_NO_ERROR; +} + +void DeviceController::OnOpenPairingWindowSuccessResponse(void * context) +{ + ChipLogProgress(Controller, "Successfully opened pairing window on the device"); + DeviceController * controller = reinterpret_cast(context); + if (controller->mCommissioningWindowCallback != nullptr) + { + controller->mCommissioningWindowCallback->mCall(controller->mCommissioningWindowCallback->mContext, + controller->mDeviceWithCommissioningWindowOpen, CHIP_NO_ERROR, + controller->mSetupPayload); + } +} + +void DeviceController::OnOpenPairingWindowFailureResponse(void * context, uint8_t status) +{ + ChipLogError(Controller, "Failed to open pairing window on the device. Status %d", status); + DeviceController * controller = reinterpret_cast(context); + if (controller->mCommissioningWindowCallback != nullptr) + { + CHIP_ERROR error = CHIP_ERROR_INVALID_PASE_PARAMETER; + // TODO - Use cluster enum chip::app::Clusters::AdministratorCommissioning::StatusCode::kBusy + if (status == 1) + { + error = CHIP_ERROR_ANOTHER_COMMISSIONING_IN_PROGRESS; + } + controller->mCommissioningWindowCallback->mCall(controller->mCommissioningWindowCallback->mContext, + controller->mDeviceWithCommissioningWindowOpen, error, SetupPayload()); + } +} + +CHIP_ERROR DeviceController::ComputePASEVerifier(uint32_t iterations, uint32_t setupPincode, const ByteSpan & salt, + PASEVerifier & outVerifier, uint32_t & outPasscodeId) +{ + ReturnErrorOnFailure(PASESession::GeneratePASEVerifier(outVerifier, iterations, salt, /* useRandomPIN= */ false, setupPincode)); + + outPasscodeId = mPAKEVerifierID++; + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceController::OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint16_t iteration, + uint16_t discriminator, uint8_t option, + Callback::Callback * callback) +{ + ChipLogProgress(Controller, "OpenCommissioningWindow for device ID %" PRIu64, deviceId); + VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); + + OperationalDeviceProxy * device = FindOperationalDevice(deviceId); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + std::string QRCode; + std::string manualPairingCode; + SetupPayload payload; + CommissioningWindowOption commissioningWindowOption; + ByteSpan salt(reinterpret_cast(kSpake2pKeyExchangeSalt), strlen(kSpake2pKeyExchangeSalt)); + + payload.discriminator = discriminator; + + switch (option) + { + case 0: + commissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode; + break; + case 1: + commissioningWindowOption = CommissioningWindowOption::kTokenWithRandomPIN; + break; + case 2: + commissioningWindowOption = CommissioningWindowOption::kTokenWithProvidedPIN; + break; + default: + ChipLogError(Controller, "Invalid Pairing Window option"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; + + chip::Controller::AdministratorCommissioningCluster cluster; + cluster.Associate(device, kAdministratorCommissioningClusterEndpoint); + + Callback::Cancelable * successCallback = mOpenPairingSuccessCallback.Cancel(); + Callback::Cancelable * failureCallback = mOpenPairingFailureCallback.Cancel(); + + payload.version = 0; + payload.rendezvousInformation = RendezvousInformationFlags(RendezvousInformationFlag::kOnNetwork); + + mCommissioningWindowCallback = callback; + if (commissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode) + { + bool randomSetupPIN = (commissioningWindowOption == CommissioningWindowOption::kTokenWithRandomPIN); + PASEVerifier verifier; + + ReturnErrorOnFailure(PASESession::GeneratePASEVerifier(verifier, iteration, salt, randomSetupPIN, payload.setUpPINCode)); + + uint8_t serializedVerifier[2 * kSpake2p_WS_Length]; + VerifyOrReturnError(sizeof(serializedVerifier) == sizeof(verifier), CHIP_ERROR_INTERNAL); + + memcpy(serializedVerifier, verifier.mW0, kSpake2p_WS_Length); + memcpy(&serializedVerifier[kSpake2p_WS_Length], verifier.mL, kSpake2p_WS_Length); + + ReturnErrorOnFailure(cluster.OpenCommissioningWindow(successCallback, failureCallback, timeout, + ByteSpan(serializedVerifier, sizeof(serializedVerifier)), + payload.discriminator, iteration, salt, mPAKEVerifierID++)); + + ReturnErrorOnFailure(ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(manualPairingCode)); + ChipLogProgress(Controller, "Manual pairing code: [%s]", manualPairingCode.c_str()); + + ReturnErrorOnFailure(QRCodeSetupPayloadGenerator(payload).payloadBase38Representation(QRCode)); + ChipLogProgress(Controller, "SetupQRCode: [%s]", QRCode.c_str()); + } + else + { + ReturnErrorOnFailure(cluster.OpenBasicCommissioningWindow(successCallback, failureCallback, timeout)); + } + + mSetupPayload = payload; + mDeviceWithCommissioningWindowOpen = deviceId; + return CHIP_NO_ERROR; } #if CHIP_DEVICE_CONFIG_ENABLE_DNSSD -void DeviceController::OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & nodeData) +Transport::PeerAddress DeviceController::ToPeerAddress(const chip::Dnssd::ResolvedNodeData & nodeData) const { - CHIP_ERROR err = CHIP_NO_ERROR; - Device * device = nullptr; Inet::InterfaceId interfaceId; - err = GetDevice(nodeData.mPeerId.GetNodeId(), &device); - SuccessOrExit(err); - // Only use the mDNS resolution's InterfaceID for addresses that are IPv6 LLA. // For all other addresses, we should rely on the device's routing table to route messages sent. // Forcing messages down an InterfaceId might fail. For example, in bridged networks like Thread, @@ -559,20 +585,22 @@ void DeviceController::OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & no interfaceId = nodeData.mInterfaceId; } - err = device->UpdateDeviceData(Transport::PeerAddress::UDP(nodeData.mAddress, nodeData.mPort, interfaceId), - nodeData.GetMrpRetryIntervalIdle().ValueOr(CHIP_CONFIG_MRP_DEFAULT_IDLE_RETRY_INTERVAL), - nodeData.GetMrpRetryIntervalActive().ValueOr(CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL)); - SuccessOrExit(err); + return Transport::PeerAddress::UDP(nodeData.mAddress, nodeData.mPort, interfaceId); +} - PersistDevice(device); +void DeviceController::OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & nodeData) +{ + OperationalDeviceProxy * device = FindOperationalDevice(nodeData.mPeerId.GetNodeId()); + VerifyOrReturn(device != nullptr); -exit: + CHIP_ERROR err = device->UpdateDeviceData( + ToPeerAddress(nodeData), nodeData.GetMrpRetryIntervalIdle().ValueOr(CHIP_CONFIG_MRP_DEFAULT_IDLE_RETRY_INTERVAL), + nodeData.GetMrpRetryIntervalActive().ValueOr(CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL)); if (mDeviceAddressUpdateDelegate != nullptr) { mDeviceAddressUpdateDelegate->OnAddressUpdateComplete(nodeData.mPeerId.GetNodeId(), err); } - return; }; void DeviceController::OnNodeIdResolutionFailed(const chip::PeerId & peer, CHIP_ERROR error) @@ -611,9 +639,9 @@ DeviceCommissioner::DeviceCommissioner() : mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this), mDeviceNOCChainCallback(OnDeviceNOCChainGeneration, this), mSetUpCodePairer(this) { - mPairingDelegate = nullptr; - mDeviceBeingPaired = kNumMaxActiveDevices; - mPairedDevicesUpdated = false; + mPairingDelegate = nullptr; + mPairedDevicesUpdated = false; + mDeviceBeingCommissioned = nullptr; } CHIP_ERROR DeviceCommissioner::Init(CommissionerInitParams params) @@ -662,10 +690,6 @@ CHIP_ERROR DeviceCommissioner::Shutdown() ChipLogDetail(Controller, "Shutting down the commissioner"); - mPairingSession.Clear(); - - PersistDeviceList(); - #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable if (mUdcTransportMgr != nullptr) { @@ -685,6 +709,85 @@ CHIP_ERROR DeviceCommissioner::Shutdown() return CHIP_NO_ERROR; } +void DeviceCommissioner::OnNewConnection(SessionHandle session, Messaging::ExchangeManager * mgr) +{ + VerifyOrReturn(mState == State::Initialized, ChipLogError(Controller, "OnNewConnection was called in incorrect state")); + + CommissioneeDeviceProxy * device = FindCommissioneeDevice(mgr->GetSessionManager()->GetSecureSession(session)->GetPeerNodeId()); + VerifyOrReturn(device != nullptr, ChipLogDetail(Controller, "OnNewConnection was called for unknown device, ignoring it.")); + + device->OnNewConnection(session); +} + +void DeviceCommissioner::OnConnectionExpired(SessionHandle session, Messaging::ExchangeManager * mgr) +{ + VerifyOrReturn(mState == State::Initialized, ChipLogError(Controller, "OnConnectionExpired was called in incorrect state")); + + CommissioneeDeviceProxy * device = FindCommissioneeDevice(session); + VerifyOrReturn(device != nullptr, ChipLogDetail(Controller, "OnConnectionExpired was called for unknown device, ignoring it.")); + + device->OnConnectionExpired(session); +} + +CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(SessionHandle session) +{ + CommissioneeDeviceProxy * foundDevice = nullptr; + mCommissioneeDevicePool.ForEachActiveObject([&](auto * deviceProxy) { + if (deviceProxy->MatchesSession(session)) + { + foundDevice = deviceProxy; + return false; + } + return true; + }); + + return foundDevice; +} + +CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(NodeId id) +{ + CommissioneeDeviceProxy * foundDevice = nullptr; + mCommissioneeDevicePool.ForEachActiveObject([&](auto * deviceProxy) { + if (deviceProxy->GetDeviceId() == id) + { + foundDevice = deviceProxy; + return false; + } + return true; + }); + + return foundDevice; +} + +void DeviceCommissioner::ReleaseCommissioneeDevice(CommissioneeDeviceProxy * device) +{ + mCommissioneeDevicePool.ReleaseObject(device); +} + +CHIP_ERROR DeviceCommissioner::GetDeviceBeingCommissioned(NodeId deviceId, CommissioneeDeviceProxy ** out_device) +{ + VerifyOrReturnError(out_device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + CommissioneeDeviceProxy * device = FindCommissioneeDevice(deviceId); + + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + *out_device = device; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceCommissioner::GetConnectedDevice(NodeId deviceId, Callback::Callback * onConnection, + Callback::Callback * onFailure) +{ + if (mDeviceBeingCommissioned != nullptr && mDeviceBeingCommissioned->GetDeviceId() == deviceId && + mDeviceBeingCommissioned->IsSecureConnected()) + { + onConnection->mCall(onConnection->mContext, mDeviceBeingCommissioned); + return CHIP_NO_ERROR; + } + return DeviceController::GetConnectedDevice(deviceId, onConnection, onFailure); +} + CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * setUpCode) { return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode); @@ -693,7 +796,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * se CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParameters & params) { CHIP_ERROR err = CHIP_NO_ERROR; - Device * device = nullptr; + CommissioneeDeviceProxy * device = nullptr; Transport::PeerAddress peerAddress = Transport::PeerAddress::UDP(Inet::IPAddress::Any); uint32_t mrpIdleInterval, mrpActiveInterval; @@ -706,7 +809,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam VerifyOrExit(IsOperationalNodeId(remoteDeviceId), err = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mDeviceBeingPaired == kNumMaxActiveDevices, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mDeviceBeingCommissioned == nullptr, err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(fabric != nullptr, err = CHIP_ERROR_INCORRECT_STATE); err = InitializePairedDeviceList(); @@ -731,9 +834,10 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam params.GetPeerAddress().GetInterface()); } - mDeviceBeingPaired = GetInactiveDeviceIndex(); - VerifyOrExit(mDeviceBeingPaired < kNumMaxActiveDevices, err = CHIP_ERROR_NO_MEMORY); - device = &mActiveDevices[mDeviceBeingPaired]; + device = mCommissioneeDevicePool.CreateObject(); + VerifyOrExit(device != nullptr, err = CHIP_ERROR_NO_MEMORY); + + mDeviceBeingCommissioned = device; // If the CSRNonce is passed in, using that else using a random one.. if (params.HasCSRNonce()) @@ -761,11 +865,11 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam mIsIPRendezvous = (params.GetPeerAddress().GetTransportType() != Transport::Type::kBle); - err = mPairingSession.MessageDispatch().Init(mSystemState->SessionMgr()); - SuccessOrExit(err); - device->Init(GetControllerDeviceInitParams(), remoteDeviceId, peerAddress, fabric->GetFabricIndex()); + err = device->GetPairing().MessageDispatch().Init(mSystemState->SessionMgr()); + SuccessOrExit(err); + mSystemState->SystemLayer()->StartTimer(chip::System::Clock::Milliseconds32(kSessionEstablishmentTimeout), OnSessionEstablishmentTimeoutCallback, this); if (params.GetPeerAddress().GetTransportType() != Transport::Type::kBle) @@ -796,13 +900,13 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam device->GetMRPIntervals(mrpIdleInterval, mrpActiveInterval); session.Value().GetUnauthenticatedSession()->SetMRPIntervals(mrpIdleInterval, mrpActiveInterval); - exchangeCtxt = mSystemState->ExchangeMgr()->NewContext(session.Value(), &mPairingSession); + exchangeCtxt = mSystemState->ExchangeMgr()->NewContext(session.Value(), &device->GetPairing()); VerifyOrExit(exchangeCtxt != nullptr, err = CHIP_ERROR_INTERNAL); err = mIDAllocator.Allocate(keyID); SuccessOrExit(err); - err = mPairingSession.Pair(params.GetPeerAddress(), params.GetSetupPINCode(), keyID, exchangeCtxt, this); + err = device->GetPairing().Pair(params.GetPeerAddress(), params.GetSetupPINCode(), keyID, exchangeCtxt, this); // Immediately persist the updted mNextKeyID value // TODO maybe remove FreeRendezvousSession() since mNextKeyID is always persisted immediately PersistNextKeyId(); @@ -811,15 +915,15 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam if (err != CHIP_NO_ERROR) { // Delete the current rendezvous session only if a device is not currently being paired. - if (mDeviceBeingPaired == kNumMaxActiveDevices) + if (mDeviceBeingCommissioned == nullptr) { FreeRendezvousSession(); } if (device != nullptr) { - ReleaseDevice(device); - mDeviceBeingPaired = kNumMaxActiveDevices; + ReleaseCommissioneeDevice(device); + mDeviceBeingCommissioned = nullptr; } } @@ -829,104 +933,19 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam CHIP_ERROR DeviceCommissioner::StopPairing(NodeId remoteDeviceId) { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mDeviceBeingPaired < kNumMaxActiveDevices, CHIP_ERROR_INCORRECT_STATE); - Device * device = &mActiveDevices[mDeviceBeingPaired]; - VerifyOrReturnError(device->GetDeviceId() == remoteDeviceId, CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR); + CommissioneeDeviceProxy * device = FindCommissioneeDevice(remoteDeviceId); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR); FreeRendezvousSession(); - ReleaseDevice(device); - mDeviceBeingPaired = kNumMaxActiveDevices; + ReleaseCommissioneeDevice(device); return CHIP_NO_ERROR; } CHIP_ERROR DeviceCommissioner::UnpairDevice(NodeId remoteDeviceId) { // TODO: Send unpairing message to the remote device. - - VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - - if (mDeviceBeingPaired < kNumMaxActiveDevices) - { - Device * device = &mActiveDevices[mDeviceBeingPaired]; - if (device->GetDeviceId() == remoteDeviceId) - { - FreeRendezvousSession(); - } - } - - if (mStorageDelegate != nullptr) - { - PERSISTENT_KEY_OP(remoteDeviceId, kPairedDeviceKeyPrefix, key, mStorageDelegate->SyncDeleteKeyValue(key)); - } - - mPairedDevices.Remove(remoteDeviceId); - mPairedDevicesUpdated = true; - ReleaseDeviceById(remoteDeviceId); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceCommissioner::OperationalDiscoveryComplete(NodeId remoteDeviceId) -{ - ChipLogProgress(Controller, "OperationalDiscoveryComplete for device ID %" PRIu64, remoteDeviceId); - VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - - Device * device = nullptr; - ReturnErrorOnFailure(GetDevice(remoteDeviceId, &device)); - device->OperationalCertProvisioned(); - PersistDevice(device); - PersistNextKeyId(); - - return GetConnectedDevice(remoteDeviceId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); -} - -CHIP_ERROR DeviceCommissioner::OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint16_t iteration, - uint16_t discriminator, uint8_t option, - Callback::Callback * callback) -{ - ChipLogProgress(Controller, "OpenCommissioningWindow for device ID %" PRIu64, deviceId); - VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - - Device * device = nullptr; - ReturnErrorOnFailure(GetDevice(deviceId, &device)); - - std::string QRCode; - std::string manualPairingCode; - SetupPayload payload; - Device::CommissioningWindowOption commissioningWindowOption; - ByteSpan salt(reinterpret_cast(kSpake2pKeyExchangeSalt), strlen(kSpake2pKeyExchangeSalt)); - - payload.discriminator = discriminator; - - switch (option) - { - case 0: - commissioningWindowOption = Device::CommissioningWindowOption::kOriginalSetupCode; - break; - case 1: - commissioningWindowOption = Device::CommissioningWindowOption::kTokenWithRandomPIN; - break; - case 2: - commissioningWindowOption = Device::CommissioningWindowOption::kTokenWithProvidedPIN; - break; - default: - ChipLogError(Controller, "Invalid Pairing Window option"); - return CHIP_ERROR_INVALID_ARGUMENT; - } - - ReturnErrorOnFailure(device->OpenCommissioningWindow(timeout, iteration, commissioningWindowOption, salt, callback, payload)); - - if (commissioningWindowOption != Device::CommissioningWindowOption::kOriginalSetupCode) - { - ReturnErrorOnFailure(ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(manualPairingCode)); - ChipLogProgress(Controller, "Manual pairing code: [%s]", manualPairingCode.c_str()); - - ReturnErrorOnFailure(QRCodeSetupPayloadGenerator(payload).payloadBase38Representation(QRCode)); - ChipLogProgress(Controller, "SetupQRCode: [%s]", QRCode.c_str()); - } - return CHIP_NO_ERROR; } @@ -939,19 +958,6 @@ void DeviceCommissioner::RendezvousCleanup(CHIP_ERROR status) { FreeRendezvousSession(); - // TODO: make mStorageDelegate mandatory once all controller applications implement the interface. - if (mDeviceBeingPaired != kNumMaxActiveDevices && mStorageDelegate != nullptr) - { - // Let's release the device that's being paired. - // If pairing was successful, its information is - // already persisted. The application will use GetDevice() - // method to get access to the device, which will fetch - // the device information from the persistent storage. - DeviceController::ReleaseDevice(mDeviceBeingPaired); - } - - mDeviceBeingPaired = kNumMaxActiveDevices; - if (mPairingDelegate != nullptr) { mPairingDelegate->OnPairingComplete(status); @@ -968,20 +974,26 @@ void DeviceCommissioner::OnSessionEstablishmentError(CHIP_ERROR err) } RendezvousCleanup(err); + + if (mDeviceBeingCommissioned != nullptr) + { + ReleaseCommissioneeDevice(mDeviceBeingCommissioned); + mDeviceBeingCommissioned = nullptr; + } } void DeviceCommissioner::OnSessionEstablished() { - VerifyOrReturn(mDeviceBeingPaired < kNumMaxActiveDevices, OnSessionEstablishmentError(CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR)); + VerifyOrReturn(mDeviceBeingCommissioned != nullptr, OnSessionEstablishmentError(CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR)); - Device * device = &mActiveDevices[mDeviceBeingPaired]; + PASESession * pairing = &mDeviceBeingCommissioned->GetPairing(); // TODO: the session should know which peer we are trying to connect to when started - mPairingSession.SetPeerNodeId(device->GetDeviceId()); + pairing->SetPeerNodeId(mDeviceBeingCommissioned->GetDeviceId()); - CHIP_ERROR err = mSystemState->SessionMgr()->NewPairing( - Optional::Value(mPairingSession.GetPeerAddress()), mPairingSession.GetPeerNodeId(), - &mPairingSession, CryptoContext::SessionRole::kInitiator, mFabricIndex); + CHIP_ERROR err = mSystemState->SessionMgr()->NewPairing(Optional::Value(pairing->GetPeerAddress()), + pairing->GetPeerNodeId(), pairing, + CryptoContext::SessionRole::kInitiator, mFabricIndex); if (err != CHIP_NO_ERROR) { ChipLogError(Controller, "Failed in setting up secure channel: err %s", ErrorStr(err)); @@ -1001,7 +1013,7 @@ void DeviceCommissioner::OnSessionEstablished() if (usingLegacyFlowWithImmediateStart) { - err = SendCertificateChainRequestCommand(device, CertificateType::kPAI); + err = SendCertificateChainRequestCommand(mDeviceBeingCommissioned, CertificateType::kPAI); if (err != CHIP_NO_ERROR) { ChipLogError(Ble, "Failed in sending 'Certificate Chain request' command to the device: err %s", ErrorStr(err)); @@ -1015,7 +1027,8 @@ void DeviceCommissioner::OnSessionEstablished() } } -CHIP_ERROR DeviceCommissioner::SendCertificateChainRequestCommand(Device * device, Credentials::CertificateType certificateType) +CHIP_ERROR DeviceCommissioner::SendCertificateChainRequestCommand(CommissioneeDeviceProxy * device, + Credentials::CertificateType certificateType) { ChipLogDetail(Controller, "Sending Certificate Chain request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1062,9 +1075,9 @@ void DeviceCommissioner::OnCertificateChainResponse(void * context, ByteSpan cer CHIP_ERROR DeviceCommissioner::ProcessCertificateChain(const ByteSpan & certificate) { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mDeviceBeingPaired < kNumMaxActiveDevices, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mDeviceBeingCommissioned != nullptr, CHIP_ERROR_INCORRECT_STATE); - Device * device = &mActiveDevices[mDeviceBeingPaired]; + CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; // PAI is being requested first - If PAI is not present, DAC will be requested next anyway. switch (mCertificateTypeBeingRequested) @@ -1102,7 +1115,7 @@ CHIP_ERROR DeviceCommissioner::ProcessCertificateChain(const ByteSpan & certific return CHIP_NO_ERROR; } -CHIP_ERROR DeviceCommissioner::SendAttestationRequestCommand(Device * device, const ByteSpan & attestationNonce) +CHIP_ERROR DeviceCommissioner::SendAttestationRequestCommand(CommissioneeDeviceProxy * device, const ByteSpan & attestationNonce) { ChipLogDetail(Controller, "Sending Attestation request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1141,16 +1154,18 @@ void DeviceCommissioner::OnAttestationResponse(void * context, chip::ByteSpan at CHIP_ERROR DeviceCommissioner::ValidateAttestationInfo(const ByteSpan & attestationElements, const ByteSpan & signature) { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mDeviceBeingPaired < kNumMaxActiveDevices, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mDeviceBeingCommissioned != nullptr, CHIP_ERROR_INCORRECT_STATE); - Device * device = &mActiveDevices[mDeviceBeingPaired]; + CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; DeviceAttestationVerifier * dac_verifier = GetDeviceAttestationVerifier(); + PASESession * pairing = &mDeviceBeingCommissioned->GetPairing(); + // Retrieve attestation challenge ByteSpan attestationChallenge = mSystemState->SessionMgr() - ->GetSecureSession({ mPairingSession.GetPeerNodeId(), mPairingSession.GetLocalSessionId(), - mPairingSession.GetPeerSessionId(), mFabricIndex }) + ->GetSecureSession({ pairing->GetPeerNodeId(), pairing->GetLocalSessionId(), + pairing->GetPeerSessionId(), mFabricIndex }) ->GetCryptoContext() .GetAttestationChallenge(); @@ -1195,9 +1210,9 @@ void DeviceCommissioner::HandleAttestationResult(CHIP_ERROR err) } VerifyOrReturn(mState == State::Initialized); - VerifyOrReturn(mDeviceBeingPaired < kNumMaxActiveDevices); + VerifyOrReturn(mDeviceBeingCommissioned != nullptr); - Device * device = &mActiveDevices[mDeviceBeingPaired]; + CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; ChipLogProgress(Controller, "Sending 'CSR request' command to the device."); CHIP_ERROR error = SendOperationalCertificateSigningRequestCommand(device); @@ -1209,7 +1224,7 @@ void DeviceCommissioner::HandleAttestationResult(CHIP_ERROR err) } } -CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(Device * device) +CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(CommissioneeDeviceProxy * device) { ChipLogDetail(Controller, "Sending OpCSR request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1261,16 +1276,16 @@ void DeviceCommissioner::OnDeviceNOCChainGeneration(void * context, CHIP_ERROR s DeviceCommissioner * commissioner = static_cast(context); ChipLogProgress(Controller, "Received callback from the CA for NOC Chain generation. Status %s", ErrorStr(status)); - Device * device = nullptr; + CommissioneeDeviceProxy * device = nullptr; VerifyOrExit(commissioner->mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(commissioner->mDeviceBeingPaired < kNumMaxActiveDevices, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(commissioner->mDeviceBeingCommissioned != nullptr, err = CHIP_ERROR_INCORRECT_STATE); // Check if the callback returned a failure VerifyOrExit(status == CHIP_NO_ERROR, err = status); // TODO - Verify that the generated root cert matches with commissioner's root cert - device = &commissioner->mActiveDevices[commissioner->mDeviceBeingPaired]; + device = commissioner->mDeviceBeingCommissioned; { // Reuse NOC Cert buffer for temporary store Root Cert. @@ -1315,20 +1330,23 @@ void DeviceCommissioner::OnDeviceNOCChainGeneration(void * context, CHIP_ERROR s CHIP_ERROR DeviceCommissioner::ProcessOpCSR(const ByteSpan & NOCSRElements, const ByteSpan & AttestationSignature) { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mDeviceBeingPaired < kNumMaxActiveDevices, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mDeviceBeingCommissioned != nullptr, CHIP_ERROR_INCORRECT_STATE); - Device * device = &mActiveDevices[mDeviceBeingPaired]; + CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; ChipLogProgress(Controller, "Getting certificate chain for the device from the issuer"); mOperationalCredentialsDelegate->SetNodeIdForNextNOCRequest(device->GetDeviceId()); - mOperationalCredentialsDelegate->SetFabricIdForNextNOCRequest(0); + + FabricInfo * fabric = mSystemState->Fabrics()->FindFabricWithIndex(mFabricIndex); + mOperationalCredentialsDelegate->SetFabricIdForNextNOCRequest(fabric->GetFabricId()); return mOperationalCredentialsDelegate->GenerateNOCChain(NOCSRElements, AttestationSignature, ByteSpan(), ByteSpan(), ByteSpan(), &mDeviceNOCChainCallback); } -CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(Device * device, const ByteSpan & nocCertBuf, const ByteSpan & icaCertBuf) +CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(CommissioneeDeviceProxy * device, const ByteSpan & nocCertBuf, + const ByteSpan & icaCertBuf) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); chip::Controller::OperationalCredentialsCluster cluster; @@ -1388,20 +1406,20 @@ void DeviceCommissioner::OnOperationalCertificateAddResponse(void * context, uin ChipLogProgress(Controller, "Device returned status %d on receiving the NOC", StatusCode); DeviceCommissioner * commissioner = static_cast(context); - CHIP_ERROR err = CHIP_NO_ERROR; - Device * device = nullptr; + CHIP_ERROR err = CHIP_NO_ERROR; + CommissioneeDeviceProxy * device = nullptr; VerifyOrExit(commissioner->mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); commissioner->mOpCSRResponseCallback.Cancel(); commissioner->mOnCertFailureCallback.Cancel(); - VerifyOrExit(commissioner->mDeviceBeingPaired < kNumMaxActiveDevices, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(commissioner->mDeviceBeingCommissioned != nullptr, err = CHIP_ERROR_INCORRECT_STATE); err = ConvertFromNodeOperationalCertStatus(StatusCode); SuccessOrExit(err); - device = &commissioner->mActiveDevices[commissioner->mDeviceBeingPaired]; + device = commissioner->mDeviceBeingCommissioned; err = commissioner->OnOperationalCredentialsProvisioningCompletion(device); @@ -1413,7 +1431,7 @@ void DeviceCommissioner::OnOperationalCertificateAddResponse(void * context, uin } } -CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(Device * device, const ByteSpan & rcac) +CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(CommissioneeDeviceProxy * device, const ByteSpan & rcac) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1437,17 +1455,17 @@ void DeviceCommissioner::OnRootCertSuccessResponse(void * context) ChipLogProgress(Controller, "Device confirmed that it has received the root certificate"); DeviceCommissioner * commissioner = static_cast(context); - CHIP_ERROR err = CHIP_NO_ERROR; - Device * device = nullptr; + CHIP_ERROR err = CHIP_NO_ERROR; + CommissioneeDeviceProxy * device = nullptr; VerifyOrExit(commissioner->mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); commissioner->mRootCertResponseCallback.Cancel(); commissioner->mOnRootCertFailureCallback.Cancel(); - VerifyOrExit(commissioner->mDeviceBeingPaired < kNumMaxActiveDevices, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(commissioner->mDeviceBeingCommissioned != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - device = &commissioner->mActiveDevices[commissioner->mDeviceBeingPaired]; + device = commissioner->mDeviceBeingCommissioned; ChipLogProgress(Controller, "Sending operational certificate chain to the device"); err = commissioner->SendOperationalCertificate(device, device->GetNOCCert(), device->GetICACert()); @@ -1470,7 +1488,7 @@ void DeviceCommissioner::OnRootCertFailureResponse(void * context, uint8_t statu commissioner->OnSessionEstablishmentError(CHIP_ERROR_INTERNAL); } -CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(Device * device) +CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(CommissioneeDeviceProxy * device) { ChipLogProgress(Controller, "Operational credentials provisioned on device %p", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1483,18 +1501,11 @@ CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(De else #endif { - mPairingSession.ToSerializable(device->GetPairing()); mSystemState->SystemLayer()->CancelTimer(OnSessionEstablishmentTimeoutCallback, this); mPairedDevices.Insert(device->GetDeviceId()); mPairedDevicesUpdated = true; - // Note - This assumes storage is synchronous, the device must be in storage before we can cleanup - // the rendezvous session and mark pairing success - PersistDevice(device); - // Also persist the device list at this time - // This makes sure that a newly added device is immediately available - PersistDeviceList(); if (mPairingDelegate != nullptr) { mPairingDelegate->OnStatusUpdate(DevicePairingDelegate::SecurePairingSuccess); @@ -1505,26 +1516,6 @@ CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(De return CHIP_NO_ERROR; } -void DeviceCommissioner::PersistDeviceList() -{ - if (mStorageDelegate != nullptr && mPairedDevicesUpdated && mState == State::Initialized) - { - mPairedDevices.Serialize([&](ByteSpan data) -> CHIP_ERROR { - VerifyOrReturnError(data.size() <= UINT16_MAX, CHIP_ERROR_INVALID_ARGUMENT); - PERSISTENT_KEY_OP(static_cast(0), kPairedDeviceListKeyPrefix, key, - mStorageDelegate->SyncSetKeyValue(key, data.data(), static_cast(data.size()))); - mPairedDevicesUpdated = false; - return CHIP_NO_ERROR; - }); - } -} - -void DeviceCommissioner::ReleaseDevice(Device * device) -{ - PersistDeviceList(); - DeviceController::ReleaseDevice(device); -} - #if CONFIG_NETWORK_LAYER_BLE CHIP_ERROR DeviceCommissioner::CloseBleConnection() { @@ -1538,9 +1529,9 @@ CHIP_ERROR DeviceCommissioner::CloseBleConnection() void DeviceCommissioner::OnSessionEstablishmentTimeout() { VerifyOrReturn(mState == State::Initialized); - VerifyOrReturn(mDeviceBeingPaired < kNumMaxActiveDevices); + VerifyOrReturn(mDeviceBeingCommissioned != nullptr); - Device * device = &mActiveDevices[mDeviceBeingPaired]; + CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; StopPairing(device->GetDeviceId()); if (mPairingDelegate != nullptr) @@ -1611,82 +1602,6 @@ void DeviceCommissioner::OnNodeDiscoveryComplete(const chip::Dnssd::DiscoveredNo #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY -void DeviceControllerInteractionModelDelegate::OnResponse(app::CommandSender * apCommandSender, - const app::ConcreteCommandPath & aPath, - const chip::app::StatusIB & aStatus, TLV::TLVReader * aData) -{ - // Generally IM has more detailed errors than ember library, here we always use the, the actual handling of the - // commands should implement full IMDelegate. - // #6308 By implement app side IM delegate, we should be able to accept detailed error codes. - // Note: The IMDefaultResponseCallback is a bridge to the old CallbackMgr before IM is landed, so it still accepts EmberAfStatus - // instead of IM status code. - if (aData != nullptr) - { - chip::app::DispatchSingleClusterResponseCommand(aPath, *aData, apCommandSender); - } - else - { - IMDefaultResponseCallback(apCommandSender, EMBER_ZCL_STATUS_SUCCESS); - } -} - -void DeviceControllerInteractionModelDelegate::OnError(const app::CommandSender * apCommandSender, - const chip::app::StatusIB & aStatus, CHIP_ERROR aError) -{ - // The IMDefaultResponseCallback started out life as an Ember function, so it only accepted - // Ember status codes. Consequently, let's convert the IM code over to a meaningful Ember status before dispatching. - // - // This however, results in loss (aError is completely discarded). When full cluster-specific status codes are implemented as - // well, this will be an even bigger problem. - // - // For now, #10331 tracks this issue. - IMDefaultResponseCallback(apCommandSender, app::ToEmberAfStatus(aStatus.mStatus)); -} - -void DeviceControllerInteractionModelDelegate::OnDone(app::CommandSender * apCommandSender) -{ - return chip::Platform::Delete(apCommandSender); -} - -void DeviceControllerInteractionModelDelegate::OnAttributeData(const app::ReadClient * apReadClient, - const app::ConcreteAttributePath & aPath, TLV::TLVReader * apData, - const app::StatusIB & aStatus) -{ - IMReadReportAttributesResponseCallback(apReadClient, &aPath, apData, aStatus.mStatus); -} - -void DeviceControllerInteractionModelDelegate::OnSubscriptionEstablished(const app::ReadClient * apReadClient) -{ - IMSubscribeResponseCallback(apReadClient, EMBER_ZCL_STATUS_SUCCESS); -} - -void DeviceControllerInteractionModelDelegate::OnError(const app::ReadClient * apReadClient, CHIP_ERROR aError) -{ - app::ClusterInfo path; - path.mNodeId = apReadClient->GetPeerNodeId(); - IMReadReportAttributesResponseCallback(apReadClient, nullptr, nullptr, Protocols::InteractionModel::Status::Failure); -} - -void DeviceControllerInteractionModelDelegate::OnDone(app::ReadClient * apReadClient) -{ - if (apReadClient->IsSubscriptionType()) - { - this->FreeAttributePathParam(reinterpret_cast(apReadClient)); - } -} - -void DeviceControllerInteractionModelDelegate::OnResponse(const app::WriteClient * apWriteClient, - const app::ConcreteAttributePath & aPath, app::StatusIB attributeStatus) -{ - IMWriteResponseCallback(apWriteClient, attributeStatus.mStatus); -} -void DeviceControllerInteractionModelDelegate::OnError(const app::WriteClient * apWriteClient, CHIP_ERROR aError) -{ - IMWriteResponseCallback(apWriteClient, Protocols::InteractionModel::Status::Failure); -} - -void DeviceControllerInteractionModelDelegate::OnDone(app::WriteClient * apWriteClient) {} - void BasicSuccess(void * context, uint16_t val) { ChipLogProgress(Controller, "Received success response 0x%x\n", val); @@ -1704,15 +1619,29 @@ void BasicFailure(void * context, uint8_t status) #if CHIP_DEVICE_CONFIG_ENABLE_DNSSD void DeviceCommissioner::OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & nodeData) { + ChipLogProgress(Controller, "OperationalDiscoveryComplete for device ID 0x" ChipLogFormatX64, + ChipLogValueX64(nodeData.mPeerId.GetNodeId())); + VerifyOrReturn(mState == State::Initialized); + + if (mDeviceBeingCommissioned != nullptr && mDeviceBeingCommissioned->GetDeviceId() == nodeData.mPeerId.GetNodeId()) + { + // Let's release the device that's being paired, if pairing was successful, + // and the device is available on the operational network. + ReleaseCommissioneeDevice(mDeviceBeingCommissioned); + mDeviceBeingCommissioned = nullptr; + } + + GetOperationalDeviceWithAddress(nodeData.mPeerId.GetNodeId(), ToPeerAddress(nodeData), &mOnDeviceConnectedCallback, + &mOnDeviceConnectionFailureCallback); + DeviceController::OnNodeIdResolved(nodeData); - OperationalDiscoveryComplete(nodeData.mPeerId.GetNodeId()); } void DeviceCommissioner::OnNodeIdResolutionFailed(const chip::PeerId & peer, CHIP_ERROR error) { - if (mDeviceBeingPaired < kNumMaxActiveDevices) + if (mDeviceBeingCommissioned != nullptr) { - Device * device = &mActiveDevices[mDeviceBeingPaired]; + CommissioneeDeviceProxy * device = mDeviceBeingCommissioned; if (device->GetDeviceId() == peer.GetNodeId() && mCommissioningStage == CommissioningStage::kFindOperational) { OnSessionEstablishmentError(error); @@ -1723,15 +1652,15 @@ void DeviceCommissioner::OnNodeIdResolutionFailed(const chip::PeerId & peer, CHI #endif -void DeviceCommissioner::OnDeviceConnectedFn(void * context, Device * device) +void DeviceCommissioner::OnDeviceConnectedFn(void * context, DeviceProxy * device) { DeviceCommissioner * commissioner = static_cast(context); VerifyOrReturn(commissioner != nullptr, ChipLogProgress(Controller, "Device connected callback with null context. Ignoring")); - if (commissioner->mDeviceBeingPaired < kNumMaxActiveDevices) + if (commissioner->mDeviceBeingCommissioned != nullptr) { - Device * deviceBeingPaired = &commissioner->mActiveDevices[commissioner->mDeviceBeingPaired]; - if (device == deviceBeingPaired && commissioner->mIsIPRendezvous) + CommissioneeDeviceProxy * deviceBeingPaired = commissioner->mDeviceBeingCommissioned; + if (device->GetDeviceId() == deviceBeingPaired->GetDeviceId() && commissioner->mIsIPRendezvous) { if (commissioner->mCommissioningStage == CommissioningStage::kFindOperational) { @@ -1813,13 +1742,13 @@ void DeviceCommissioner::AdvanceCommissioningStage(CHIP_ERROR err) { return; } - Device * device = nullptr; - if (mDeviceBeingPaired >= kNumMaxActiveDevices) + CommissioneeDeviceProxy * device = nullptr; + if (mDeviceBeingCommissioned == nullptr) { return; } - device = &mActiveDevices[mDeviceBeingPaired]; + device = mDeviceBeingCommissioned; // TODO(cecille): We probably want something better than this for breadcrumbs. uint64_t breadcrumb = static_cast(nextStage); @@ -1940,23 +1869,21 @@ void DeviceCommissioner::AdvanceCommissioningStage(CHIP_ERROR err) break; case CommissioningStage::kCleanup: ChipLogProgress(Controller, "Rendezvous cleanup"); - mPairingSession.ToSerializable(device->GetPairing()); mSystemState->SystemLayer()->CancelTimer(OnSessionEstablishmentTimeoutCallback, this); mPairedDevices.Insert(device->GetDeviceId()); mPairedDevicesUpdated = true; - // Note - This assumes storage is synchronous, the device must be in storage before we can cleanup - // the rendezvous session and mark pairing success - PersistDevice(device); - // Also persist the device list at this time - // This makes sure that a newly added device is immediately available - PersistDeviceList(); if (mPairingDelegate != nullptr) { mPairingDelegate->OnStatusUpdate(DevicePairingDelegate::SecurePairingSuccess); } RendezvousCleanup(CHIP_NO_ERROR); + if (mDeviceBeingCommissioned != nullptr) + { + ReleaseCommissioneeDevice(mDeviceBeingCommissioned); + mDeviceBeingCommissioned = nullptr; + } break; case CommissioningStage::kSecurePairing: case CommissioningStage::kError: diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 444729cffe75d7..6f684e7b76cebc 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -28,12 +28,13 @@ #pragma once +#include #include +#include #include #include -#include #include -#include +#include #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +56,8 @@ #include #include +#include + #if CONFIG_DEVICE_LAYER #include #endif @@ -172,6 +176,8 @@ struct CommissionerInitParams : public ControllerInitParams DevicePairingDelegate * pairingDelegate = nullptr; }; +typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload); + /** * @brief * Controller applications can use this class to communicate with already paired CHIP devices. The @@ -191,6 +197,13 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, DeviceController(); virtual ~DeviceController() {} + enum class CommissioningWindowOption + { + kOriginalSetupCode = 0, + kTokenWithRandomPIN, + kTokenWithProvidedPIN, + }; + CHIP_ERROR Init(ControllerInitParams params); /** @@ -204,17 +217,16 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, */ virtual CHIP_ERROR Shutdown(); - /** - * @brief - * This function is similar to the other GetDevice object, except it reads the serialized object from - * the persistent storage. - * - * @param[in] deviceId Node ID for the CHIP device - * @param[out] device The output device object - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. - */ - CHIP_ERROR GetDevice(NodeId deviceId, Device ** device); + CHIP_ERROR GetOperationalDevice(NodeId deviceId, Callback::Callback * onConnection, + Callback::Callback * onFailure) + { + return GetOperationalDeviceWithAddress(deviceId, Transport::PeerAddress::UDP(Inet::IPAddress::Any), onConnection, + onFailure); + } + + CHIP_ERROR GetOperationalDeviceWithAddress(NodeId deviceId, const Transport::PeerAddress & addr, + Callback::Callback * onConnection, + Callback::Callback * onFailure); CHIP_ERROR GetPeerAddressAndPort(PeerId peerId, Inet::IPAddress & addr, uint16_t & port); @@ -229,13 +241,16 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, * Once the connection is successfully establishes (or if it's already connected), it calls `onConnectedDevice` * callback. If it fails to establish the connection, it calls `onError` callback. */ - CHIP_ERROR GetConnectedDevice(NodeId deviceId, Callback::Callback * onConnection, - Callback::Callback * onFailure); + virtual CHIP_ERROR GetConnectedDevice(NodeId deviceId, Callback::Callback * onConnection, + Callback::Callback * onFailure) + { + return GetOperationalDeviceWithAddress(deviceId, Transport::PeerAddress::UDP(Inet::IPAddress::Any), onConnection, + onFailure); + } /** * @brief - * This function update the device informations asynchronously using mdns. - * If new device informations has been found, it will be persisted. + * This function update the device informations asynchronously using dnssd. * * @param[in] deviceId Node ID for the CHIP device * @@ -243,11 +258,69 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, */ CHIP_ERROR UpdateDevice(NodeId deviceId); - void PersistDevice(Device * device); + /** + * @brief + * Compute a PASE verifier and passcode ID for the desired setup pincode. + * + * This can be used to open a commissioning window on the device for + * additional administrator commissioning. + * + * @param[in] iterations The number of iterations to use when generating the verifier + * @param[in] setupPincode The desired PIN code to use + * @param[in] salt The 16-byte salt for verifier computation + * @param[out] outVerifier The PASEVerifier to be populated on success + * @param[out] outPasscodeId The passcode ID to be populated on success + * + * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error + */ + CHIP_ERROR ComputePASEVerifier(uint32_t iterations, uint32_t setupPincode, const ByteSpan & salt, PASEVerifier & outVerifier, + uint32_t & outPasscodeId); - virtual void ReleaseDevice(Device * device); + /** + * @brief + * Trigger a paired device to re-enter the commissioning mode. The device will exit the commissioning mode + * after a successful commissioning, or after the given `timeout` time. + * + * @param[in] deviceId The device Id. + * @param[in] timeout The commissioning mode should terminate after this much time. + * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral + * PAKE passcode verifier to be used for this commissioning. + * @param[in] discriminator The long discriminator for the DNS-SD advertisement. + * @param[in] option The commissioning window can be opened using the original setup code, or an + * onboarding token can be generated using a random setup PIN code (or with + * the PIN code provied in the setupPayload). + * @param[out] payload The generated setup payload. + * - The payload is generated only if the user didn't ask for using the original setup code. + * - If the user asked to use the provided setup PIN, the PIN must be provided as part of + * this payload + * + * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error + */ + CHIP_ERROR OpenCommissioningWindow(NodeId deviceId, uint16_t timeout, uint16_t iteration, uint16_t discriminator, + uint8_t option, SetupPayload & payload) + { + return OpenCommissioningWindowWithCallback(deviceId, timeout, iteration, discriminator, option, nullptr); + } - void ReleaseDeviceById(NodeId remoteDeviceId); + /** + * @brief + * Trigger a paired device to re-enter the commissioning mode. The device will exit the commissioning mode + * after a successful commissioning, or after the given `timeout` time. + * + * @param[in] deviceId The device Id. + * @param[in] timeout The commissioning mode should terminate after this much time. + * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral + * PAKE passcode verifier to be used for this commissioning. + * @param[in] discriminator The long discriminator for the DNS-SD advertisement. + * @param[in] option The commissioning window can be opened using the original setup code, or an + * onboarding token can be generated using a random setup PIN code (or with + * the PIN code provied in the setupPayload). + * @param[in] callback The function to be called on success or failure of opening of commissioning window. + * + * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error + */ + CHIP_ERROR OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint16_t iteration, uint16_t discriminator, + uint8_t option, Callback::Callback * callback); #if CHIP_DEVICE_CONFIG_ENABLE_DNSSD void RegisterDeviceAddressUpdateDelegate(DeviceAddressUpdateDelegate * delegate) { mDeviceAddressUpdateDelegate = delegate; } @@ -273,6 +346,8 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, return nullptr; } + void ReleaseOperationalDevice(NodeId remoteDeviceId); + protected: enum class State { @@ -282,11 +357,7 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, State mState; - /* A list of device objects that can be used for communicating with corresponding - CHIP devices. The list does not contain all the paired devices, but only the ones - which the controller application is currently accessing. - */ - Device mActiveDevices[kNumMaxActiveDevices]; + BitMapObjectPool mOperationalDevices; SerializableU64Set mPairedDevices; bool mPairedDevicesInitialized; @@ -296,6 +367,8 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, PersistentStorageDelegate * mStorageDelegate = nullptr; #if CHIP_DEVICE_CONFIG_ENABLE_DNSSD + Transport::PeerAddress ToPeerAddress(const chip::Dnssd::ResolvedNodeData & nodeData) const; + DeviceAddressUpdateDelegate * mDeviceAddressUpdateDelegate = nullptr; // TODO(cecille): Make this configuarable. static constexpr int kMaxCommissionableNodes = 10; @@ -303,10 +376,6 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, #endif DeviceControllerSystemState * mSystemState = nullptr; - uint16_t GetInactiveDeviceIndex(); - uint16_t FindDeviceIndex(SessionHandle session); - uint16_t FindDeviceIndex(NodeId id); - void ReleaseDevice(uint16_t index); CHIP_ERROR InitializePairedDeviceList(); CHIP_ERROR SetPairedDeviceList(ByteSpan pairedDeviceSerializedSet); ControllerDeviceInitParams GetControllerDeviceInitParams(); @@ -321,6 +390,10 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, uint16_t mVendorId; + //////////// ExchangeMgrDelegate Implementation /////////////// + void OnNewConnection(SessionHandle session, Messaging::ExchangeManager * mgr) override; + void OnConnectionExpired(SessionHandle session, Messaging::ExchangeManager * mgr) override; + #if CHIP_DEVICE_CONFIG_ENABLE_DNSSD //////////// ResolverDelegate Implementation /////////////// void OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & nodeData) override; @@ -334,13 +407,25 @@ class DLL_EXPORT DeviceController : public Messaging::ExchangeDelegate, System::PacketBufferHandle && msgBuf) override; void OnResponseTimeout(Messaging::ExchangeContext * ec) override; - //////////// ExchangeMgrDelegate Implementation /////////////// - void OnNewConnection(SessionHandle session, Messaging::ExchangeManager * mgr) override; - void OnConnectionExpired(SessionHandle session, Messaging::ExchangeManager * mgr) override; + OperationalDeviceProxy * FindOperationalDevice(SessionHandle session); + OperationalDeviceProxy * FindOperationalDevice(NodeId id); + void ReleaseOperationalDevice(OperationalDeviceProxy * device); void ReleaseAllDevices(); + Callback::Callback mOpenPairingSuccessCallback; + Callback::Callback mOpenPairingFailureCallback; + + // TODO - Support opening commissioning window simultaneously on multiple devices + Callback::Callback * mCommissioningWindowCallback = nullptr; + SetupPayload mSetupPayload; + NodeId mDeviceWithCommissioningWindowOpen; + + static void OnOpenPairingWindowSuccessResponse(void * context); + static void OnOpenPairingWindowFailureResponse(void * context, uint8_t status); + CHIP_ERROR ProcessControllerNOCChain(const ControllerInitParams & params); + uint16_t mPAKEVerifierID = 1; }; /** @@ -412,6 +497,11 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, */ CHIP_ERROR PairDevice(NodeId remoteDeviceId, RendezvousParameters & params); + CHIP_ERROR GetDeviceBeingCommissioned(NodeId deviceId, CommissioneeDeviceProxy ** device); + + CHIP_ERROR GetConnectedDevice(NodeId deviceId, Callback::Callback * onConnection, + Callback::Callback * onFailure) override; + /** * @brief * This function stops a pairing process that's in progress. It does not delete the pairing of a previously @@ -433,66 +523,12 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, */ CHIP_ERROR UnpairDevice(NodeId remoteDeviceId); - /** - * This function call indicates that the device has been provisioned with operational - * credentials, and is reachable on operational network. At this point, the device is - * available for CASE session establishment. - * - * The function updates the state of device proxy object such that all subsequent messages - * will use secure session established via CASE handshake. - */ - CHIP_ERROR OperationalDiscoveryComplete(NodeId remoteDeviceId); - - /** - * @brief - * Trigger a paired device to re-enter the commissioning mode. The device will exit the commissioning mode - * after a successful commissioning, or after the given `timeout` time. - * - * @param[in] deviceId The device Id. - * @param[in] timeout The commissioning mode should terminate after this much time. - * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral - * PAKE passcode verifier to be used for this commissioning. - * @param[in] discriminator The long discriminator for the DNS-SD advertisement. - * @param[in] option The commissioning window can be opened using the original setup code, or an - * onboarding token can be generated using a random setup PIN code (or with - * the PIN code provied in the setupPayload). - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR OpenCommissioningWindow(NodeId deviceId, uint16_t timeout, uint16_t iteration, uint16_t discriminator, - uint8_t option) - { - return OpenCommissioningWindowWithCallback(deviceId, timeout, iteration, discriminator, option, nullptr); - } - - /** - * @brief - * Trigger a paired device to re-enter the commissioning mode. The device will exit the commissioning mode - * after a successful commissioning, or after the given `timeout` time. - * - * @param[in] deviceId The device Id. - * @param[in] timeout The commissioning mode should terminate after this much time. - * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral - * PAKE passcode verifier to be used for this commissioning. - * @param[in] discriminator The long discriminator for the DNS-SD advertisement. - * @param[in] option The commissioning window can be opened using the original setup code, or an - * onboarding token can be generated using a random setup PIN code (or with - * the PIN code provied in the setupPayload). - * @param[in] callback The function to be called on success or failure of opening of commissioning window. - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint16_t iteration, uint16_t discriminator, - uint8_t option, Callback::Callback * callback); - //////////// SessionEstablishmentDelegate Implementation /////////////// void OnSessionEstablishmentError(CHIP_ERROR error) override; void OnSessionEstablished() override; void RendezvousCleanup(CHIP_ERROR status); - void ReleaseDevice(Device * device) override; - void AdvanceCommissioningStage(CHIP_ERROR err); #if CONFIG_NETWORK_LAYER_BLE @@ -578,10 +614,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, private: DevicePairingDelegate * mPairingDelegate; - /* This field is an index in mActiveDevices list. The object at this index in the list - contains the device object that's tracking the state of the device that's being paired. - If no device is currently being paired, this value will be kNumMaxPairedDevices. */ - uint16_t mDeviceBeingPaired; + CommissioneeDeviceProxy * mDeviceBeingCommissioned = nullptr; Credentials::CertificateType mCertificateTypeBeingRequested = Credentials::CertificateType::kUnknown; @@ -598,6 +631,8 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, CommissioningStage mCommissioningStage = CommissioningStage::kSecurePairing; + BitMapObjectPool mCommissioneeDevicePool; + #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable UserDirectedCommissioningServer * mUdcServer = nullptr; // mUdcTransportMgr is for insecure communication (ex. user directed commissioning) @@ -605,42 +640,45 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, uint16_t mUdcListenPort = CHIP_UDC_PORT; #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY - void PersistDeviceList(); - void FreeRendezvousSession(); CHIP_ERROR LoadKeyId(PersistentStorageDelegate * delegate, uint16_t & out); void OnSessionEstablishmentTimeout(); + //////////// ExchangeMgrDelegate Implementation /////////////// + void OnNewConnection(SessionHandle session, Messaging::ExchangeManager * mgr) override; + void OnConnectionExpired(SessionHandle session, Messaging::ExchangeManager * mgr) override; + static void OnSessionEstablishmentTimeoutCallback(System::Layer * aLayer, void * aAppState); /* This function sends a Device Attestation Certificate chain request to the device. The function does not hold a reference to the device object. */ - CHIP_ERROR SendCertificateChainRequestCommand(Device * device, Credentials::CertificateType certificateType); + CHIP_ERROR SendCertificateChainRequestCommand(CommissioneeDeviceProxy * device, Credentials::CertificateType certificateType); /* This function sends an Attestation request to the device. The function does not hold a reference to the device object. */ - CHIP_ERROR SendAttestationRequestCommand(Device * device, const ByteSpan & attestationNonce); + CHIP_ERROR SendAttestationRequestCommand(CommissioneeDeviceProxy * device, const ByteSpan & attestationNonce); /* This function sends an OpCSR request to the device. The function does not hold a refernce to the device object. */ - CHIP_ERROR SendOperationalCertificateSigningRequestCommand(Device * device); + CHIP_ERROR SendOperationalCertificateSigningRequestCommand(CommissioneeDeviceProxy * device); /* This function sends the operational credentials to the device. The function does not hold a refernce to the device object. */ - CHIP_ERROR SendOperationalCertificate(Device * device, const ByteSpan & nocCertBuf, const ByteSpan & icaCertBuf); + CHIP_ERROR SendOperationalCertificate(CommissioneeDeviceProxy * device, const ByteSpan & nocCertBuf, + const ByteSpan & icaCertBuf); /* This function sends the trusted root certificate to the device. The function does not hold a refernce to the device object. */ - CHIP_ERROR SendTrustedRootCertificate(Device * device, const ByteSpan & rcac); + CHIP_ERROR SendTrustedRootCertificate(CommissioneeDeviceProxy * device, const ByteSpan & rcac); /* This function is called by the commissioner code when the device completes the operational credential provisioning process. The function does not hold a refernce to the device object. */ - CHIP_ERROR OnOperationalCredentialsProvisioningCompletion(Device * device); + CHIP_ERROR OnOperationalCredentialsProvisioningCompletion(CommissioneeDeviceProxy * device); /* Callback when the previously sent CSR request results in failure */ static void OnCSRFailureResponse(void * context, uint8_t status); @@ -672,7 +710,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, /* Callback called when adding root cert to device results in failure */ static void OnRootCertFailureResponse(void * context, uint8_t status); - static void OnDeviceConnectedFn(void * context, Device * device); + static void OnDeviceConnectedFn(void * context, DeviceProxy * device); static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); static void OnDeviceNOCChainGeneration(void * context, CHIP_ERROR status, const ByteSpan & noc, const ByteSpan & icac, @@ -705,6 +743,10 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, void HandleAttestationResult(CHIP_ERROR err); + CommissioneeDeviceProxy * FindCommissioneeDevice(SessionHandle session); + CommissioneeDeviceProxy * FindCommissioneeDevice(NodeId id); + void ReleaseCommissioneeDevice(CommissioneeDeviceProxy * device); + // Cluster callbacks for advancing commissioning flows Callback::Callback mSuccess; Callback::Callback mFailure; @@ -728,8 +770,6 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, Callback::Callback mDeviceNOCChainCallback; SetUpCodePairer mSetUpCodePairer; - - PASESession mPairingSession; }; } // namespace Controller diff --git a/src/controller/CHIPDeviceControllerSystemState.h b/src/controller/CHIPDeviceControllerSystemState.h index f2d04909868f2c..5d0ab170d28ece 100644 --- a/src/controller/CHIPDeviceControllerSystemState.h +++ b/src/controller/CHIPDeviceControllerSystemState.h @@ -29,19 +29,35 @@ #pragma once -#include +#include #include +#include #include +#include #if CONFIG_DEVICE_LAYER #include #endif #if CONFIG_NETWORK_LAYER_BLE #include +#include #endif namespace chip { +constexpr size_t kMaxDeviceTransportBlePendingPackets = 1; + +using DeviceTransportMgr = TransportMgr /* BLE */ +#endif + >; + namespace Controller { struct DeviceControllerSystemStateParams diff --git a/src/controller/CommissioneeDeviceProxy.cpp b/src/controller/CommissioneeDeviceProxy.cpp new file mode 100644 index 00000000000000..f91d17e8ab3e3c --- /dev/null +++ b/src/controller/CommissioneeDeviceProxy.cpp @@ -0,0 +1,336 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains implementation of Device class. The objects of this + * class will be used by Controller applications to interact with CHIP + * devices. The class provides mechanism to construct, send and receive + * messages to and from the corresponding CHIP devices. + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip::Callback; + +namespace chip { + +// TODO - Refactor LoadSecureSessionParametersIfNeeded() as device object is no longer persisted +CHIP_ERROR CommissioneeDeviceProxy::LoadSecureSessionParametersIfNeeded(bool & didLoad) +{ + didLoad = false; + + // If there is no secure connection to the device, try establishing it + if (mState != ConnectionState::SecureConnected) + { + ReturnErrorOnFailure(LoadSecureSessionParameters()); + didLoad = true; + } + else + { + if (mSecureSession.HasValue()) + { + Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); + // Check if the connection state has the correct transport information + if (secureSession->GetPeerAddress().GetTransportType() == Transport::Type::kUndefined) + { + mState = ConnectionState::NotConnected; + ReturnErrorOnFailure(LoadSecureSessionParameters()); + didLoad = true; + } + } + else + { + mState = ConnectionState::NotConnected; + ReturnErrorOnFailure(LoadSecureSessionParameters()); + didLoad = true; + } + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommissioneeDeviceProxy::SendCommands(app::CommandSender * commandObj) +{ + bool loadedSecureSession = false; + ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(loadedSecureSession)); + VerifyOrReturnError(commandObj != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + return commandObj->SendCommandRequest(mSecureSession.Value()); +} + +void CommissioneeDeviceProxy::OnNewConnection(SessionHandle session) +{ + mState = ConnectionState::SecureConnected; + mSecureSession.SetValue(session); + + // Reset the message counters here because this is the first time we get a handle to the secure session. + // Since CHIPDevices can be serialized/deserialized in the middle of what is conceptually a single PASE session + // we need to restore the session counters along with the session information. + Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); + VerifyOrReturn(secureSession != nullptr); + MessageCounter & localCounter = secureSession->GetSessionMessageCounter().GetLocalMessageCounter(); + if (localCounter.SetCounter(mLocalMessageCounter) != CHIP_NO_ERROR) + { + ChipLogError(Controller, "Unable to restore local counter to %" PRIu32, mLocalMessageCounter); + } + Transport::PeerMessageCounter & peerCounter = secureSession->GetSessionMessageCounter().GetPeerMessageCounter(); + peerCounter.SetCounter(mPeerMessageCounter); +} + +void CommissioneeDeviceProxy::OnConnectionExpired(SessionHandle session) +{ + VerifyOrReturn(mSecureSession.HasValue() && mSecureSession.Value() == session, + ChipLogDetail(Controller, "Connection expired, but it doesn't match the current session")); + mState = ConnectionState::NotConnected; + mSecureSession.ClearValue(); +} + +CHIP_ERROR CommissioneeDeviceProxy::OnMessageReceived(Messaging::ExchangeContext * exchange, const PayloadHeader & payloadHeader, + System::PacketBufferHandle && msgBuf) +{ + if (mState == ConnectionState::SecureConnected) + { + if (mStatusDelegate != nullptr) + { + mStatusDelegate->OnMessage(std::move(msgBuf)); + } + else + { + HandleDataModelMessage(exchange, std::move(msgBuf)); + } + } + return CHIP_NO_ERROR; +} + +void CommissioneeDeviceProxy::OnResponseTimeout(Messaging::ExchangeContext * ec) {} + +CHIP_ERROR CommissioneeDeviceProxy::CloseSession() +{ + ReturnErrorCodeIf(mState != ConnectionState::SecureConnected, CHIP_ERROR_INCORRECT_STATE); + if (mSecureSession.HasValue()) + { + mSessionManager->ExpirePairing(mSecureSession.Value()); + } + mState = ConnectionState::NotConnected; + mPairing.Clear(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommissioneeDeviceProxy::UpdateDeviceData(const Transport::PeerAddress & addr, uint32_t mrpIdleInterval, + uint32_t mrpActiveInterval) +{ + bool didLoad; + + mDeviceAddress = addr; + + mMrpIdleInterval = mrpIdleInterval; + mMrpActiveInterval = mrpActiveInterval; + + ReturnErrorOnFailure(LoadSecureSessionParametersIfNeeded(didLoad)); + + if (!mSecureSession.HasValue()) + { + // Nothing needs to be done here. It's not an error to not have a + // secureSession. For one thing, we could have gotten an different + // UpdateAddress already and that caused connections to be torn down and + // whatnot. + return CHIP_NO_ERROR; + } + + Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); + secureSession->SetPeerAddress(addr); + secureSession->SetMRPIntervals(mrpIdleInterval, mrpActiveInterval); + + return CHIP_NO_ERROR; +} + +void CommissioneeDeviceProxy::Reset() +{ + SetActive(false); + + mState = ConnectionState::NotConnected; + mSessionManager = nullptr; + mStatusDelegate = nullptr; + mInetLayer = nullptr; +#if CONFIG_NETWORK_LAYER_BLE + mBleLayer = nullptr; +#endif + if (mExchangeMgr) + { + // Ensure that any exchange contexts we have open get closed now, + // because we don't want them to call back in to us after this + // point. + mExchangeMgr->CloseAllContextsForDelegate(this); + } + mExchangeMgr = nullptr; + + ReleaseDAC(); + ReleasePAI(); +} + +CHIP_ERROR CommissioneeDeviceProxy::LoadSecureSessionParameters() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mSessionManager == nullptr || mState == ConnectionState::SecureConnected) + { + ExitNow(err = CHIP_ERROR_INCORRECT_STATE); + } + + if (mState == ConnectionState::Connecting) + { + ExitNow(err = CHIP_NO_ERROR); + } + + err = mSessionManager->NewPairing(Optional::Value(mDeviceAddress), mDeviceId, &mPairing, + CryptoContext::SessionRole::kInitiator, mFabricIndex); + SuccessOrExit(err); + +exit: + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "LoadSecureSessionParameters returning error %" CHIP_ERROR_FORMAT, err.Format()); + } + return err; +} + +bool CommissioneeDeviceProxy::GetAddress(Inet::IPAddress & addr, uint16_t & port) const +{ + if (mState == ConnectionState::NotConnected) + return false; + + addr = mDeviceAddress.GetIPAddress(); + port = mDeviceAddress.GetPort(); + return true; +} + +void CommissioneeDeviceProxy::ReleaseDAC() +{ + if (mDAC != nullptr) + { + Platform::MemoryFree(mDAC); + } + mDACLen = 0; + mDAC = nullptr; +} + +CHIP_ERROR CommissioneeDeviceProxy::SetDAC(const ByteSpan & dac) +{ + if (dac.size() == 0) + { + ReleaseDAC(); + return CHIP_NO_ERROR; + } + + VerifyOrReturnError(dac.size() <= Credentials::kMaxDERCertLength, CHIP_ERROR_INVALID_ARGUMENT); + if (mDACLen != 0) + { + ReleaseDAC(); + } + + VerifyOrReturnError(CanCastTo(dac.size()), CHIP_ERROR_INVALID_ARGUMENT); + if (mDAC == nullptr) + { + mDAC = static_cast(chip::Platform::MemoryAlloc(dac.size())); + } + VerifyOrReturnError(mDAC != nullptr, CHIP_ERROR_NO_MEMORY); + mDACLen = static_cast(dac.size()); + memcpy(mDAC, dac.data(), mDACLen); + + return CHIP_NO_ERROR; +} + +void CommissioneeDeviceProxy::ReleasePAI() +{ + if (mPAI != nullptr) + { + chip::Platform::MemoryFree(mPAI); + } + mPAILen = 0; + mPAI = nullptr; +} + +CHIP_ERROR CommissioneeDeviceProxy::SetPAI(const chip::ByteSpan & pai) +{ + if (pai.size() == 0) + { + ReleasePAI(); + return CHIP_NO_ERROR; + } + + VerifyOrReturnError(pai.size() <= Credentials::kMaxDERCertLength, CHIP_ERROR_INVALID_ARGUMENT); + if (mPAILen != 0) + { + ReleasePAI(); + } + + VerifyOrReturnError(CanCastTo(pai.size()), CHIP_ERROR_INVALID_ARGUMENT); + if (mPAI == nullptr) + { + mPAI = static_cast(chip::Platform::MemoryAlloc(pai.size())); + } + VerifyOrReturnError(mPAI != nullptr, CHIP_ERROR_NO_MEMORY); + mPAILen = static_cast(pai.size()); + memcpy(mPAI, pai.data(), mPAILen); + + return CHIP_NO_ERROR; +} + +CommissioneeDeviceProxy::~CommissioneeDeviceProxy() +{ + if (mExchangeMgr) + { + // Ensure that any exchange contexts we have open get closed now, + // because we don't want them to call back in to us after this + // point. + mExchangeMgr->CloseAllContextsForDelegate(this); + } + + ReleaseDAC(); + ReleasePAI(); +} + +CHIP_ERROR CommissioneeDeviceProxy::SetNOCCertBufferSize(size_t new_size) +{ + ReturnErrorCodeIf(new_size > sizeof(mNOCCertBuffer), CHIP_ERROR_INVALID_ARGUMENT); + mNOCCertBufferSize = new_size; + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommissioneeDeviceProxy::SetICACertBufferSize(size_t new_size) +{ + ReturnErrorCodeIf(new_size > sizeof(mICACertBuffer), CHIP_ERROR_INVALID_ARGUMENT); + mICACertBufferSize = new_size; + return CHIP_NO_ERROR; +} + +} // namespace chip diff --git a/src/controller/CommissioneeDeviceProxy.h b/src/controller/CommissioneeDeviceProxy.h new file mode 100644 index 00000000000000..81b59820c1f223 --- /dev/null +++ b/src/controller/CommissioneeDeviceProxy.h @@ -0,0 +1,394 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains definitions for DeviceProxy for a device that's undergoing + * commissioning process. The objects of this will be used by Controller applications + * to interact with the device. The class provides mechanism to construct, send and receive + * messages to and from the corresponding CHIP devices. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if CONFIG_NETWORK_LAYER_BLE +#include +#include +#endif + +namespace chip { + +class DeviceStatusDelegate; + +constexpr size_t kOpCSRNonceLength = 32; +constexpr size_t kAttestationNonceLength = 32; + +using DeviceIPTransportMgr = TransportMgr; + +struct ControllerDeviceInitParams +{ + DeviceTransportMgr * transportMgr = nullptr; + SessionManager * sessionManager = nullptr; + Messaging::ExchangeManager * exchangeMgr = nullptr; + Inet::InetLayer * inetLayer = nullptr; + PersistentStorageDelegate * storageDelegate = nullptr; + SessionIDAllocator * idAllocator = nullptr; +#if CONFIG_NETWORK_LAYER_BLE + Ble::BleLayer * bleLayer = nullptr; +#endif + FabricTable * fabricsTable = nullptr; + + Controller::DeviceControllerInteractionModelDelegate * imDelegate = nullptr; +}; + +class CommissioneeDeviceProxy : public DeviceProxy, Messaging::ExchangeDelegate +{ +public: + ~CommissioneeDeviceProxy(); + CommissioneeDeviceProxy() {} + CommissioneeDeviceProxy(const CommissioneeDeviceProxy &) = delete; + + /** + * @brief + * Set the delegate object which will be called when a message is received. + * The user of this Device object must reset the delegate (by calling + * SetDelegate(nullptr)) before releasing their delegate object. + * + * @param[in] delegate The pointer to the delegate object. + */ + void SetDelegate(DeviceStatusDelegate * delegate) { mStatusDelegate = delegate; } + + /** + * @brief + * Send the command in internal command sender. + */ + CHIP_ERROR SendCommands(app::CommandSender * commandObj) override; + + /** + * @brief Get the IP address and port assigned to the device. + * + * @param[out] addr IP address of the device. + * @param[out] port Port number of the device. + * + * @return true, if the IP address and port were filled in the out parameters, false otherwise + */ + bool GetAddress(Inet::IPAddress & addr, uint16_t & port) const override; + + /** + * @brief + * Initialize the device object with secure session manager and inet layer object + * references. This variant of function is typically used when the device object + * is created from a serialized device information. The other parameters (address, port, + * interface etc) are part of the serialized device, so those are not required to be + * initialized. + * + * Note: The lifetime of session manager and inet layer objects must be longer than + * that of this device object. If these objects are freed, while the device object is + * still using them, it can lead to unknown behavior and crashes. + * + * @param[in] params Wrapper object for transport manager etc. + * @param[in] fabric Local administrator that's initializing this device object + */ + void Init(ControllerDeviceInitParams params, FabricIndex fabric) + { + mSessionManager = params.sessionManager; + mExchangeMgr = params.exchangeMgr; + mInetLayer = params.inetLayer; + mFabricIndex = fabric; + mIDAllocator = params.idAllocator; + mpIMDelegate = params.imDelegate; +#if CONFIG_NETWORK_LAYER_BLE + mBleLayer = params.bleLayer; +#endif + } + + /** + * @brief + * Initialize a new device object with secure session manager, inet layer object, + * and other device specific parameters. This variant of function is typically used when + * a new device is paired, and the corresponding device object needs to updated with + * all device specifc parameters (address, port, interface etc). + * + * This is not done as part of constructor so that the controller can have a list of + * uninitialized/unpaired device objects. The object is initialized only when the device + * is actually paired. + * + * @param[in] params Wrapper object for transport manager etc. + * @param[in] deviceId Node ID of the device + * @param[in] peerAddress The location of the peer. MUST be of type Transport::Type::kUdp + * @param[in] fabric Local administrator that's initializing this device object + */ + void Init(ControllerDeviceInitParams params, NodeId deviceId, const Transport::PeerAddress & peerAddress, FabricIndex fabric) + { + Init(params, fabric); + mDeviceId = deviceId; + mState = ConnectionState::Connecting; + + mDeviceAddress = peerAddress; + } + + /** + * @brief + * Called when a new pairing is being established + * + * @param session A handle to the secure session + */ + void OnNewConnection(SessionHandle session); + + /** + * @brief + * Called when a connection is closing. + * + * The receiver should release all resources associated with the connection. + * + * @param session A handle to the secure session + */ + void OnConnectionExpired(SessionHandle session) override; + + /** + * @brief + * This function is called when a message is received from the corresponding CHIP + * device. The message ownership is transferred to the function, and it is expected + * to release the message buffer before returning. + * + * @param[in] exchange The exchange context the message was received + * on. The Device guarantees that it will call + * Close() on exchange when it's done processing + * the message. + * @param[in] payloadHeader Reference to payload header in the message + * @param[in] msgBuf The message buffer + */ + CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * exchange, const PayloadHeader & payloadHeader, + System::PacketBufferHandle && msgBuf) override; + + /** + * @brief ExchangeDelegate implementation of OnResponseTimeout. + */ + void OnResponseTimeout(Messaging::ExchangeContext * exchange) override; + + /** + * In case there exists an open session to the device, mark it as expired. + */ + CHIP_ERROR CloseSession(); + + CHIP_ERROR Disconnect() override { return CloseSession(); } + + /** + * @brief + * Update data of the device. + * + * This function will set new IP address, port and MRP retransmission intervals of the device. + * Since the device settings might have been moved from RAM to the persistent storage, the function + * will load the device settings first, before making the changes. + * + * @param[in] addr Address of the device to be set. + * @param[in] mrpIdleInterval MRP idle retransmission interval of the device to be set. + * @param[in] mrpActiveInterval MRP active retransmision interval of the device to be set. + * + * @return CHIP_NO_ERROR if the data has been updated, an error code otherwise. + */ + CHIP_ERROR UpdateDeviceData(const Transport::PeerAddress & addr, uint32_t mrpIdleInterval, uint32_t mrpActiveInterval); + /** + * @brief + * Return whether the current device object is actively associated with a paired CHIP + * device. An active object can be used to communicate with the corresponding device. + */ + bool IsActive() const override { return mActive; } + + void SetActive(bool active) { mActive = active; } + + bool IsSecureConnected() const override { return IsActive() && mState == ConnectionState::SecureConnected; } + + bool IsSessionSetupInProgress() const { return IsActive() && mState == ConnectionState::Connecting; } + + void Reset(); + + NodeId GetDeviceId() const override { return mDeviceId; } + + bool MatchesSession(SessionHandle session) const { return mSecureSession.HasValue() && mSecureSession.Value() == session; } + + chip::Optional GetSecureSession() const override { return mSecureSession; } + + Messaging::ExchangeManager * GetExchangeManager() const override { return mExchangeMgr; } + + void SetAddress(const Inet::IPAddress & deviceAddr) { mDeviceAddress.SetIPAddress(deviceAddr); } + + PASESession & GetPairing() { return mPairing; } + + uint8_t GetNextSequenceNumber() override { return mSequenceNumber++; }; + + CHIP_ERROR LoadSecureSessionParametersIfNeeded() + { + bool loadedSecureSession = false; + return LoadSecureSessionParametersIfNeeded(loadedSecureSession); + }; + + CHIP_ERROR SetCSRNonce(ByteSpan csrNonce) + { + VerifyOrReturnError(csrNonce.size() == sizeof(mCSRNonce), CHIP_ERROR_INVALID_ARGUMENT); + memcpy(mCSRNonce, csrNonce.data(), csrNonce.size()); + return CHIP_NO_ERROR; + } + + ByteSpan GetCSRNonce() const { return ByteSpan(mCSRNonce, sizeof(mCSRNonce)); } + + CHIP_ERROR SetAttestationNonce(ByteSpan attestationNonce) + { + VerifyOrReturnError(attestationNonce.size() == sizeof(mAttestationNonce), CHIP_ERROR_INVALID_ARGUMENT); + memcpy(mAttestationNonce, attestationNonce.data(), attestationNonce.size()); + return CHIP_NO_ERROR; + } + + ByteSpan GetAttestationNonce() const { return ByteSpan(mAttestationNonce, sizeof(mAttestationNonce)); } + + bool AreCredentialsAvailable() const { return (mDAC != nullptr && mDACLen != 0); } + + ByteSpan GetDAC() const { return ByteSpan(mDAC, mDACLen); } + ByteSpan GetPAI() const { return ByteSpan(mPAI, mPAILen); } + + CHIP_ERROR SetDAC(const ByteSpan & dac); + CHIP_ERROR SetPAI(const ByteSpan & pai); + + MutableByteSpan GetMutableNOCCert() { return MutableByteSpan(mNOCCertBuffer, sizeof(mNOCCertBuffer)); } + + CHIP_ERROR SetNOCCertBufferSize(size_t new_size); + + ByteSpan GetNOCCert() const { return ByteSpan(mNOCCertBuffer, mNOCCertBufferSize); } + + MutableByteSpan GetMutableICACert() { return MutableByteSpan(mICACertBuffer, sizeof(mICACertBuffer)); } + + CHIP_ERROR SetICACertBufferSize(size_t new_size); + + ByteSpan GetICACert() const { return ByteSpan(mICACertBuffer, mICACertBufferSize); } + + Controller::DeviceControllerInteractionModelDelegate * GetInteractionModelDelegate() override { return mpIMDelegate; }; + +private: + enum class ConnectionState + { + NotConnected, + Connecting, + SecureConnected, + }; + + enum class ResetTransport + { + kYes, + kNo, + }; + /* Node ID assigned to the CHIP device */ + NodeId mDeviceId; + + /** Address used to communicate with the device. + */ + Transport::PeerAddress mDeviceAddress = Transport::PeerAddress::UDP(Inet::IPAddress::Any); + + Inet::InetLayer * mInetLayer = nullptr; + + bool mActive = false; + ConnectionState mState = ConnectionState::NotConnected; + +#if CONFIG_NETWORK_LAYER_BLE + Ble::BleLayer * mBleLayer = nullptr; +#endif + + PASESession mPairing; + + DeviceStatusDelegate * mStatusDelegate = nullptr; + + SessionManager * mSessionManager = nullptr; + + Messaging::ExchangeManager * mExchangeMgr = nullptr; + + Optional mSecureSession = Optional::Missing(); + + Controller::DeviceControllerInteractionModelDelegate * mpIMDelegate = nullptr; + + uint8_t mSequenceNumber = 0; + + uint32_t mLocalMessageCounter = 0; + uint32_t mPeerMessageCounter = 0; + + /** + * @brief + * This function loads the secure session object from the serialized operational + * credentials corresponding to the device. This is typically done when the device + * does not have an active secure channel. + */ + CHIP_ERROR LoadSecureSessionParameters(); + + /** + * @brief + * This function loads the secure session object from the serialized operational + * credentials corresponding if needed, based on the current state of the device and + * underlying transport object. + * + * @param[out] didLoad Were the secure session params loaded by the call to this function. + */ + CHIP_ERROR LoadSecureSessionParametersIfNeeded(bool & didLoad); + + void ReleaseDAC(); + void ReleasePAI(); + + FabricIndex mFabricIndex = kUndefinedFabricIndex; + + // TODO: Offload Nonces and DAC/PAI into a new struct + uint8_t mCSRNonce[kOpCSRNonceLength]; + uint8_t mAttestationNonce[kAttestationNonceLength]; + + uint8_t * mDAC = nullptr; + uint16_t mDACLen = 0; + uint8_t * mPAI = nullptr; + uint16_t mPAILen = 0; + + uint8_t mNOCCertBuffer[Credentials::kMaxCHIPCertLength]; + size_t mNOCCertBufferSize = 0; + + uint8_t mICACertBuffer[Credentials::kMaxCHIPCertLength]; + size_t mICACertBufferSize = 0; + + SessionIDAllocator * mIDAllocator = nullptr; +}; + +} // namespace chip diff --git a/src/controller/WriteInteraction.h b/src/controller/WriteInteraction.h index f16ea085b4dbbc..5db943846a7228 100644 --- a/src/controller/WriteInteraction.h +++ b/src/controller/WriteInteraction.h @@ -78,9 +78,15 @@ class WriteCallback final : public app::WriteClient::Callback OnDoneCallbackType mOnDone; }; -template -CHIP_ERROR WriteAttribute(Messaging::ExchangeManager * aExchangeMgr, SessionHandle sessionHandle, chip::EndpointId endpointId, - const typename AttributeInfo::Type & requestCommandData, WriteCallback::OnSuccessCallbackType onSuccessCb, +/** + * Functions for writing attributes. We have lots of different AttributeInfo + * but a fairly small set of types that get written. So we want to keep the + * template on AttributeInfo very small, and put all the work in the template + * with a small number of instantiations (one per type). + */ +template +CHIP_ERROR WriteAttribute(SessionHandle sessionHandle, chip::EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, + const AttrType & requestData, WriteCallback::OnSuccessCallbackType onSuccessCb, WriteCallback::OnErrorCallbackType onErrorCb) { app::WriteClientHandle handle; @@ -91,14 +97,22 @@ CHIP_ERROR WriteAttribute(Messaging::ExchangeManager * aExchangeMgr, SessionHand VerifyOrReturnError(callback != nullptr, CHIP_ERROR_NO_MEMORY); ReturnErrorOnFailure(app::InteractionModelEngine::GetInstance()->NewWriteClient(handle, callback.get())); - ReturnErrorOnFailure(handle.EncodeAttributeWritePayload( - chip::app::AttributePathParams(endpointId, AttributeInfo::GetClusterId(), AttributeInfo::GetAttributeId()), - requestCommandData)); + ReturnErrorOnFailure( + handle.EncodeAttributeWritePayload(chip::app::AttributePathParams(endpointId, clusterId, attributeId), requestData)); ReturnErrorOnFailure(handle.SendWriteRequest(sessionHandle)); callback.release(); return CHIP_NO_ERROR; } +template +CHIP_ERROR WriteAttribute(SessionHandle sessionHandle, chip::EndpointId endpointId, + const typename AttributeInfo::Type & requestData, WriteCallback::OnSuccessCallbackType onSuccessCb, + WriteCallback::OnErrorCallbackType onErrorCb) +{ + return WriteAttribute(sessionHandle, endpointId, AttributeInfo::GetClusterId(), AttributeInfo::GetAttributeId(), requestData, + onSuccessCb, onErrorCb); +} + } // namespace Controller } // namespace chip diff --git a/src/controller/data_model/BUILD.gn b/src/controller/data_model/BUILD.gn index 48fb1a9fd6d4e6..22548afecd4531 100644 --- a/src/controller/data_model/BUILD.gn +++ b/src/controller/data_model/BUILD.gn @@ -22,12 +22,7 @@ chip_data_model("data_model") { zap_pregenerated_dir = "${chip_root}/zzz_generated/controller-clusters/zap-generated" - # On Android, we don't really need the tests APIs, and the compiler has - # trouble compiling some of those files anyway. - # - # TODO: This should default to false and consumers should opt in to it - # as needed. - use_tests_apis = current_os != "android" + use_tests_apis = true use_default_client_callbacks = true allow_circular_includes_from = [ "${chip_root}/src/controller" ] } diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index c5f76f9998266c..c498c802b187d6 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -44,7 +44,7 @@ GetConnectedDeviceCallback::~GetConnectedDeviceCallback() env->DeleteGlobalRef(mJavaCallbackRef); } -void GetConnectedDeviceCallback::OnDeviceConnectedFn(void * context, Device * device) +void GetConnectedDeviceCallback::OnDeviceConnectedFn(void * context, DeviceProxy * device) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); auto * self = static_cast(context); diff --git a/src/controller/java/AndroidCallbacks.h b/src/controller/java/AndroidCallbacks.h index 5c415c9519b5c7..123c2fdb10aeb9 100644 --- a/src/controller/java/AndroidCallbacks.h +++ b/src/controller/java/AndroidCallbacks.h @@ -28,7 +28,7 @@ struct GetConnectedDeviceCallback GetConnectedDeviceCallback(jobject javaCallback); ~GetConnectedDeviceCallback(); - static void OnDeviceConnectedFn(void * context, Device * device); + static void OnDeviceConnectedFn(void * context, DeviceProxy * device); static void OnDeviceConnectionFailureFn(void * context, NodeId nodeId, CHIP_ERROR error); Callback::Callback mOnSuccess; diff --git a/src/controller/java/AndroidDeviceControllerWrapper.h b/src/controller/java/AndroidDeviceControllerWrapper.h index 3c1ef3f663596e..83f35ba06cb60c 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.h +++ b/src/controller/java/AndroidDeviceControllerWrapper.h @@ -35,7 +35,7 @@ * Generally it contains the DeviceController class itself, plus any related delegates/callbacks. */ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDelegate, - public chip::Controller::DeviceStatusDelegate, + public chip::DeviceStatusDelegate, public chip::Controller::OperationalCredentialsDelegate, public chip::PersistentStorageDelegate, public chip::FabricStorage diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 1b9c073df72636..c708f843f619fa 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -293,14 +293,14 @@ JNI_METHOD(void, disconnectDevice)(JNIEnv * env, jobject self, jlong handle, jlo AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); ChipLogProgress(Controller, "disconnectDevice() called with deviceId"); - wrapper->Controller()->ReleaseDeviceById(deviceId); + wrapper->Controller()->ReleaseOperationalDevice(deviceId); } JNI_METHOD(jboolean, isActive)(JNIEnv * env, jobject self, jlong handle) { chip::DeviceLayer::StackLock lock; - Device * chipDevice = reinterpret_cast(handle); + DeviceProxy * chipDevice = reinterpret_cast(handle); return chipDevice->IsActive(); } @@ -308,7 +308,7 @@ JNI_METHOD(void, shutdownSubscriptions)(JNIEnv * env, jobject self, jlong handle { chip::DeviceLayer::StackLock lock; - Device * device = reinterpret_cast(devicePtr); + DeviceProxy * device = reinterpret_cast(devicePtr); device->ShutdownSubscriptions(); } @@ -366,15 +366,15 @@ JNI_METHOD(jboolean, openPairingWindow)(JNIEnv * env, jobject self, jlong handle CHIP_ERROR err = CHIP_NO_ERROR; chip::SetupPayload setupPayload; - Device * chipDevice = reinterpret_cast(devicePtr); + DeviceProxy * chipDevice = reinterpret_cast(devicePtr); if (chipDevice == nullptr) { ChipLogProgress(Controller, "Could not cast device pointer to Device object"); return false; } - err = chipDevice->OpenPairingWindow(duration, chip::Controller::Device::CommissioningWindowOption::kOriginalSetupCode, - setupPayload); + AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); + err = wrapper->Controller()->OpenCommissioningWindow(chipDevice->GetDeviceId(), duration, 0, 0, 0, setupPayload); if (err != CHIP_NO_ERROR) { @@ -394,15 +394,15 @@ JNI_METHOD(jboolean, openPairingWindowWithPIN) setupPayload.discriminator = discriminator; setupPayload.setUpPINCode = setupPinCode; - Device * chipDevice = reinterpret_cast(devicePtr); + DeviceProxy * chipDevice = reinterpret_cast(devicePtr); if (chipDevice == nullptr) { ChipLogProgress(Controller, "Could not cast device pointer to Device object"); return false; } - err = chipDevice->OpenPairingWindow(duration, chip::Controller::Device::CommissioningWindowOption::kTokenWithRandomPIN, - setupPayload); + AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); + err = wrapper->Controller()->OpenCommissioningWindow(chipDevice->GetDeviceId(), duration, 1000, discriminator, 1, setupPayload); if (err != CHIP_NO_ERROR) { @@ -431,8 +431,7 @@ JNI_METHOD(jobject, computePaseVerifier) { chip::DeviceLayer::StackLock lock; - Device * chipDevice = nullptr; - CHIP_ERROR err = CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; jobject params; jbyteArray verifierBytes; uint32_t passcodeId; @@ -441,10 +440,8 @@ JNI_METHOD(jobject, computePaseVerifier) ChipLogProgress(Controller, "computePaseVerifier() called"); - chipDevice = reinterpret_cast(devicePtr); - VerifyOrExit(chipDevice != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - - err = chipDevice->ComputePASEVerifier(iterations, setupPincode, jniSalt.byteSpan(), verifier, passcodeId); + AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); + err = wrapper->Controller()->ComputePASEVerifier(iterations, setupPincode, jniSalt.byteSpan(), verifier, passcodeId); SuccessOrExit(err); uint8_t serializedVerifier[sizeof(verifier.mW0) + sizeof(verifier.mL)]; diff --git a/src/controller/java/templates/CHIPClusters-JNI.zapt b/src/controller/java/templates/CHIPClusters-JNI.zapt index de32ed3b0642c8..2359c43aaa8cbc 100644 --- a/src/controller/java/templates/CHIPClusters-JNI.zapt +++ b/src/controller/java/templates/CHIPClusters-JNI.zapt @@ -141,7 +141,7 @@ JNI_METHOD(jlong, {{asUpperCamelCase name}}Cluster, initWithDevice)(JNIEnv * env chip::DeviceLayer::StackLock lock; {{asUpperCamelCase name}}Cluster * cppCluster = new {{asUpperCamelCase name}}Cluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index b81db6da78a7c4..6e0e2defc8b83b 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -5435,7 +5435,7 @@ JNI_METHOD(jlong, AccountLoginCluster, initWithDevice)(JNIEnv * env, jobject sel chip::DeviceLayer::StackLock lock; AccountLoginCluster * cppCluster = new AccountLoginCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -5550,7 +5550,7 @@ JNI_METHOD(jlong, AdministratorCommissioningCluster, initWithDevice)(JNIEnv * en chip::DeviceLayer::StackLock lock; AdministratorCommissioningCluster * cppCluster = new AdministratorCommissioningCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -5710,7 +5710,7 @@ JNI_METHOD(jlong, ApplicationBasicCluster, initWithDevice)(JNIEnv * env, jobject chip::DeviceLayer::StackLock lock; ApplicationBasicCluster * cppCluster = new ApplicationBasicCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -5766,7 +5766,7 @@ JNI_METHOD(jlong, ApplicationLauncherCluster, initWithDevice)(JNIEnv * env, jobj chip::DeviceLayer::StackLock lock; ApplicationLauncherCluster * cppCluster = new ApplicationLauncherCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -5829,7 +5829,7 @@ JNI_METHOD(jlong, AudioOutputCluster, initWithDevice)(JNIEnv * env, jobject self chip::DeviceLayer::StackLock lock; AudioOutputCluster * cppCluster = new AudioOutputCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -5936,7 +5936,7 @@ JNI_METHOD(jlong, BarrierControlCluster, initWithDevice)(JNIEnv * env, jobject s chip::DeviceLayer::StackLock lock; BarrierControlCluster * cppCluster = new BarrierControlCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -6040,7 +6040,7 @@ JNI_METHOD(jlong, BasicCluster, initWithDevice)(JNIEnv * env, jobject self, jlon chip::DeviceLayer::StackLock lock; BasicCluster * cppCluster = new BasicCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -6193,7 +6193,7 @@ JNI_METHOD(jlong, BinaryInputBasicCluster, initWithDevice)(JNIEnv * env, jobject chip::DeviceLayer::StackLock lock; BinaryInputBasicCluster * cppCluster = new BinaryInputBasicCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -6375,7 +6375,7 @@ JNI_METHOD(jlong, BindingCluster, initWithDevice)(JNIEnv * env, jobject self, jl chip::DeviceLayer::StackLock lock; BindingCluster * cppCluster = new BindingCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -6480,7 +6480,7 @@ JNI_METHOD(jlong, BooleanStateCluster, initWithDevice)(JNIEnv * env, jobject sel chip::DeviceLayer::StackLock lock; BooleanStateCluster * cppCluster = new BooleanStateCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -6543,7 +6543,7 @@ JNI_METHOD(jlong, BridgedActionsCluster, initWithDevice)(JNIEnv * env, jobject s chip::DeviceLayer::StackLock lock; BridgedActionsCluster * cppCluster = new BridgedActionsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -7128,7 +7128,7 @@ JNI_METHOD(jlong, BridgedDeviceBasicCluster, initWithDevice)(JNIEnv * env, jobje chip::DeviceLayer::StackLock lock; BridgedDeviceBasicCluster * cppCluster = new BridgedDeviceBasicCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -7169,7 +7169,7 @@ JNI_METHOD(jlong, ColorControlCluster, initWithDevice)(JNIEnv * env, jobject sel chip::DeviceLayer::StackLock lock; ColorControlCluster * cppCluster = new ColorControlCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -8803,7 +8803,7 @@ JNI_METHOD(jlong, ContentLauncherCluster, initWithDevice)(JNIEnv * env, jobject chip::DeviceLayer::StackLock lock; ContentLauncherCluster * cppCluster = new ContentLauncherCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -8920,7 +8920,7 @@ JNI_METHOD(jlong, DescriptorCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; DescriptorCluster * cppCluster = new DescriptorCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -8929,7 +8929,7 @@ JNI_METHOD(jlong, DiagnosticLogsCluster, initWithDevice)(JNIEnv * env, jobject s chip::DeviceLayer::StackLock lock; DiagnosticLogsCluster * cppCluster = new DiagnosticLogsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -8993,7 +8993,7 @@ JNI_METHOD(jlong, DoorLockCluster, initWithDevice)(JNIEnv * env, jobject self, j chip::DeviceLayer::StackLock lock; DoorLockCluster * cppCluster = new DoorLockCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10205,7 +10205,7 @@ JNI_METHOD(jlong, ElectricalMeasurementCluster, initWithDevice)(JNIEnv * env, jo chip::DeviceLayer::StackLock lock; ElectricalMeasurementCluster * cppCluster = new ElectricalMeasurementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10214,7 +10214,7 @@ JNI_METHOD(jlong, EthernetNetworkDiagnosticsCluster, initWithDevice)(JNIEnv * en chip::DeviceLayer::StackLock lock; EthernetNetworkDiagnosticsCluster * cppCluster = new EthernetNetworkDiagnosticsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10270,7 +10270,7 @@ JNI_METHOD(jlong, FixedLabelCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; FixedLabelCluster * cppCluster = new FixedLabelCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10279,7 +10279,7 @@ JNI_METHOD(jlong, FlowMeasurementCluster, initWithDevice)(JNIEnv * env, jobject chip::DeviceLayer::StackLock lock; FlowMeasurementCluster * cppCluster = new FlowMeasurementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10288,7 +10288,7 @@ JNI_METHOD(jlong, GeneralCommissioningCluster, initWithDevice)(JNIEnv * env, job chip::DeviceLayer::StackLock lock; GeneralCommissioningCluster * cppCluster = new GeneralCommissioningCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10482,7 +10482,7 @@ JNI_METHOD(jlong, GeneralDiagnosticsCluster, initWithDevice)(JNIEnv * env, jobje chip::DeviceLayer::StackLock lock; GeneralDiagnosticsCluster * cppCluster = new GeneralDiagnosticsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10491,7 +10491,7 @@ JNI_METHOD(jlong, GroupKeyManagementCluster, initWithDevice)(JNIEnv * env, jobje chip::DeviceLayer::StackLock lock; GroupKeyManagementCluster * cppCluster = new GroupKeyManagementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10500,7 +10500,7 @@ JNI_METHOD(jlong, GroupsCluster, initWithDevice)(JNIEnv * env, jobject self, jlo chip::DeviceLayer::StackLock lock; GroupsCluster * cppCluster = new GroupsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10805,7 +10805,7 @@ JNI_METHOD(jlong, IdentifyCluster, initWithDevice)(JNIEnv * env, jobject self, j chip::DeviceLayer::StackLock lock; IdentifyCluster * cppCluster = new IdentifyCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -10989,7 +10989,7 @@ JNI_METHOD(jlong, IlluminanceMeasurementCluster, initWithDevice)(JNIEnv * env, j chip::DeviceLayer::StackLock lock; IlluminanceMeasurementCluster * cppCluster = new IlluminanceMeasurementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -11053,7 +11053,7 @@ JNI_METHOD(jlong, KeypadInputCluster, initWithDevice)(JNIEnv * env, jobject self chip::DeviceLayer::StackLock lock; KeypadInputCluster * cppCluster = new KeypadInputCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -11110,7 +11110,7 @@ JNI_METHOD(jlong, LevelControlCluster, initWithDevice)(JNIEnv * env, jobject sel chip::DeviceLayer::StackLock lock; LevelControlCluster * cppCluster = new LevelControlCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -11779,7 +11779,7 @@ JNI_METHOD(jlong, LowPowerCluster, initWithDevice)(JNIEnv * env, jobject self, j chip::DeviceLayer::StackLock lock; LowPowerCluster * cppCluster = new LowPowerCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -11835,7 +11835,7 @@ JNI_METHOD(jlong, MediaInputCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; MediaInputCluster * cppCluster = new MediaInputCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -12036,7 +12036,7 @@ JNI_METHOD(jlong, MediaPlaybackCluster, initWithDevice)(JNIEnv * env, jobject se chip::DeviceLayer::StackLock lock; MediaPlaybackCluster * cppCluster = new MediaPlaybackCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -12586,7 +12586,7 @@ JNI_METHOD(jlong, ModeSelectCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; ModeSelectCluster * cppCluster = new ModeSelectCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -12728,7 +12728,7 @@ JNI_METHOD(jlong, NetworkCommissioningCluster, initWithDevice)(JNIEnv * env, job chip::DeviceLayer::StackLock lock; NetworkCommissioningCluster * cppCluster = new NetworkCommissioningCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -13172,7 +13172,7 @@ JNI_METHOD(jlong, OtaSoftwareUpdateProviderCluster, initWithDevice)(JNIEnv * env chip::DeviceLayer::StackLock lock; OtaSoftwareUpdateProviderCluster * cppCluster = new OtaSoftwareUpdateProviderCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -13344,7 +13344,7 @@ JNI_METHOD(jlong, OtaSoftwareUpdateRequestorCluster, initWithDevice)(JNIEnv * en chip::DeviceLayer::StackLock lock; OtaSoftwareUpdateRequestorCluster * cppCluster = new OtaSoftwareUpdateRequestorCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -13439,7 +13439,7 @@ JNI_METHOD(jlong, OccupancySensingCluster, initWithDevice)(JNIEnv * env, jobject chip::DeviceLayer::StackLock lock; OccupancySensingCluster * cppCluster = new OccupancySensingCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -13502,7 +13502,7 @@ JNI_METHOD(jlong, OnOffCluster, initWithDevice)(JNIEnv * env, jobject self, jlon chip::DeviceLayer::StackLock lock; OnOffCluster * cppCluster = new OnOffCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -13943,7 +13943,7 @@ JNI_METHOD(jlong, OnOffSwitchConfigurationCluster, initWithDevice)(JNIEnv * env, chip::DeviceLayer::StackLock lock; OnOffSwitchConfigurationCluster * cppCluster = new OnOffSwitchConfigurationCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -13982,7 +13982,7 @@ JNI_METHOD(jlong, OperationalCredentialsCluster, initWithDevice)(JNIEnv * env, j chip::DeviceLayer::StackLock lock; OperationalCredentialsCluster * cppCluster = new OperationalCredentialsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -14467,7 +14467,7 @@ JNI_METHOD(jlong, PowerSourceCluster, initWithDevice)(JNIEnv * env, jobject self chip::DeviceLayer::StackLock lock; PowerSourceCluster * cppCluster = new PowerSourceCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -14476,7 +14476,7 @@ JNI_METHOD(jlong, PressureMeasurementCluster, initWithDevice)(JNIEnv * env, jobj chip::DeviceLayer::StackLock lock; PressureMeasurementCluster * cppCluster = new PressureMeasurementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -14540,7 +14540,7 @@ JNI_METHOD(jlong, PumpConfigurationAndControlCluster, initWithDevice)(JNIEnv * e chip::DeviceLayer::StackLock lock; PumpConfigurationAndControlCluster * cppCluster = new PumpConfigurationAndControlCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -14722,7 +14722,7 @@ JNI_METHOD(jlong, RelativeHumidityMeasurementCluster, initWithDevice)(JNIEnv * e chip::DeviceLayer::StackLock lock; RelativeHumidityMeasurementCluster * cppCluster = new RelativeHumidityMeasurementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -14842,7 +14842,7 @@ JNI_METHOD(jlong, ScenesCluster, initWithDevice)(JNIEnv * env, jobject self, jlo chip::DeviceLayer::StackLock lock; ScenesCluster * cppCluster = new ScenesCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -15196,7 +15196,7 @@ JNI_METHOD(jlong, SoftwareDiagnosticsCluster, initWithDevice)(JNIEnv * env, jobj chip::DeviceLayer::StackLock lock; SoftwareDiagnosticsCluster * cppCluster = new SoftwareDiagnosticsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -15252,7 +15252,7 @@ JNI_METHOD(jlong, SwitchCluster, initWithDevice)(JNIEnv * env, jobject self, jlo chip::DeviceLayer::StackLock lock; SwitchCluster * cppCluster = new SwitchCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -15315,7 +15315,7 @@ JNI_METHOD(jlong, TvChannelCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; TvChannelCluster * cppCluster = new TvChannelCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -15471,7 +15471,7 @@ JNI_METHOD(jlong, TargetNavigatorCluster, initWithDevice)(JNIEnv * env, jobject chip::DeviceLayer::StackLock lock; TargetNavigatorCluster * cppCluster = new TargetNavigatorCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -15533,7 +15533,7 @@ JNI_METHOD(jlong, TemperatureMeasurementCluster, initWithDevice)(JNIEnv * env, j chip::DeviceLayer::StackLock lock; TemperatureMeasurementCluster * cppCluster = new TemperatureMeasurementCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -15653,7 +15653,7 @@ JNI_METHOD(jlong, TestClusterCluster, initWithDevice)(JNIEnv * env, jobject self chip::DeviceLayer::StackLock lock; TestClusterCluster * cppCluster = new TestClusterCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -16930,7 +16930,7 @@ JNI_METHOD(jlong, ThermostatCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; ThermostatCluster * cppCluster = new ThermostatCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -17515,7 +17515,7 @@ JNI_METHOD(jlong, ThermostatUserInterfaceConfigurationCluster, initWithDevice) chip::DeviceLayer::StackLock lock; ThermostatUserInterfaceConfigurationCluster * cppCluster = new ThermostatUserInterfaceConfigurationCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -17620,7 +17620,7 @@ JNI_METHOD(jlong, ThreadNetworkDiagnosticsCluster, initWithDevice)(JNIEnv * env, chip::DeviceLayer::StackLock lock; ThreadNetworkDiagnosticsCluster * cppCluster = new ThreadNetworkDiagnosticsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -17676,7 +17676,7 @@ JNI_METHOD(jlong, WakeOnLanCluster, initWithDevice)(JNIEnv * env, jobject self, chip::DeviceLayer::StackLock lock; WakeOnLanCluster * cppCluster = new WakeOnLanCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -17685,7 +17685,7 @@ JNI_METHOD(jlong, WiFiNetworkDiagnosticsCluster, initWithDevice)(JNIEnv * env, j chip::DeviceLayer::StackLock lock; WiFiNetworkDiagnosticsCluster * cppCluster = new WiFiNetworkDiagnosticsCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } @@ -17741,7 +17741,7 @@ JNI_METHOD(jlong, WindowCoveringCluster, initWithDevice)(JNIEnv * env, jobject s chip::DeviceLayer::StackLock lock; WindowCoveringCluster * cppCluster = new WindowCoveringCluster(); - cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); + cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } diff --git a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp index c802ded0a16bb2..5c2b76296b7e61 100644 --- a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp +++ b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp @@ -86,6 +86,7 @@ void pychip_CommissionableNodeController_PrintDiscoveredCommissioners( Encoding::BytesToUppercaseHexString(dnsSdInfo->rotatingId, dnsSdInfo->rotatingIdLen, rotatingId, sizeof(rotatingId)); ChipLogProgress(Discovery, "Commissioner %d", i); + ChipLogProgress(Discovery, "\tInstance name:\t\t%s", dnsSdInfo->instanceName); ChipLogProgress(Discovery, "\tHost name:\t\t%s", dnsSdInfo->hostName); ChipLogProgress(Discovery, "\tPort:\t\t\t%u", dnsSdInfo->port); ChipLogProgress(Discovery, "\tLong discriminator:\t%u", dnsSdInfo->longDiscriminator); @@ -96,7 +97,7 @@ void pychip_CommissionableNodeController_PrintDiscoveredCommissioners( ChipLogProgress(Discovery, "\tDevice Name\t\t%s", dnsSdInfo->deviceName); ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->pairingInstruction); - ChipLogProgress(Discovery, "\tPairing Hint\t\t0x%x", dnsSdInfo->pairingHint); + ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->pairingHint); if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) { ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", dnsSdInfo->GetMrpRetryIntervalIdle().Value()); diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index d94d8a9cfbf464..c38373d1c5fa52 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -47,9 +47,9 @@ #include "chip/interaction_model/Delegate.h" #include +#include #include #include -#include #include #include #include @@ -77,7 +77,7 @@ static_assert(std::is_same::value, "python ass extern "C" { typedef void (*ConstructBytesArrayFunct)(const uint8_t * dataBuf, uint32_t dataLen); typedef void (*LogMessageFunct)(uint64_t time, uint64_t timeUS, const char * moduleName, uint8_t category, const char * msg); -typedef void (*DeviceAvailableFunc)(Device * device, ChipError::StorageType err); +typedef void (*DeviceAvailableFunc)(DeviceProxy * device, ChipError::StorageType err); typedef void (*ChipThreadTaskRunnerFunct)(intptr_t context); } @@ -163,7 +163,7 @@ void pychip_Stack_SetLogFunct(LogMessageFunct logFunct); ChipError::StorageType pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId, DeviceAvailableFunc callback); -uint64_t pychip_GetCommandSenderHandle(chip::Controller::Device * device); +uint64_t pychip_GetCommandSenderHandle(chip::DeviceProxy * device); // CHIP Stack objects ChipError::StorageType pychip_BLEMgrImpl_ConfigureBle(uint32_t bluetoothAdapterId); @@ -326,11 +326,11 @@ ChipError::StorageType pychip_DeviceController_ConnectIP(chip::Controller::Devic return devCtrl->PairDevice(nodeid, params).AsInteger(); } -void CloseSessionCallback(Device * device, ChipError::StorageType err) +void CloseSessionCallback(DeviceProxy * device, ChipError::StorageType err) { if (device != nullptr) { - device->CloseSession(); + device->Disconnect(); } if (!ChipError::IsSuccess(err)) { @@ -390,7 +390,8 @@ ChipError::StorageType pychip_DeviceController_OpenCommissioningWindow(chip::Con chip::NodeId nodeid, uint16_t timeout, uint16_t iteration, uint16_t discriminator, uint8_t option) { - return devCtrl->OpenCommissioningWindow(nodeid, timeout, iteration, discriminator, option).AsInteger(); + SetupPayload payload; + return devCtrl->OpenCommissioningWindow(nodeid, timeout, iteration, discriminator, option, payload).AsInteger(); } void pychip_DeviceController_PrintDiscoveredDevices(chip::Controller::DeviceCommissioner * devCtrl) @@ -406,6 +407,7 @@ void pychip_DeviceController_PrintDiscoveredDevices(chip::Controller::DeviceComm Encoding::BytesToUppercaseHexString(dnsSdInfo->rotatingId, dnsSdInfo->rotatingIdLen, rotatingId, sizeof(rotatingId)); ChipLogProgress(Discovery, "Commissionable Node %d", i); + ChipLogProgress(Discovery, "\tInstance name:\t\t%s", dnsSdInfo->instanceName); ChipLogProgress(Discovery, "\tHost name:\t\t%s", dnsSdInfo->hostName); ChipLogProgress(Discovery, "\tPort:\t\t\t%u", dnsSdInfo->port); ChipLogProgress(Discovery, "\tLong discriminator:\t%u", dnsSdInfo->longDiscriminator); @@ -416,7 +418,7 @@ void pychip_DeviceController_PrintDiscoveredDevices(chip::Controller::DeviceComm ChipLogProgress(Discovery, "\tDevice Name\t\t%s", dnsSdInfo->deviceName); ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->pairingInstruction); - ChipLogProgress(Discovery, "\tPairing Hint\t\t0x%x", dnsSdInfo->pairingHint); + ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->pairingHint); if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) { ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", dnsSdInfo->GetMrpRetryIntervalIdle().Value()); @@ -530,7 +532,7 @@ struct GetDeviceCallbacks mOnSuccess(OnDeviceConnectedFn, this), mOnFailure(OnConnectionFailureFn, this), mCallback(callback) {} - static void OnDeviceConnectedFn(void * context, Device * device) + static void OnDeviceConnectedFn(void * context, DeviceProxy * device) { auto * self = static_cast(context); self->mCallback(device, CHIP_NO_ERROR.AsInteger()); @@ -567,7 +569,7 @@ ChipError::StorageType pychip_DeviceCommissioner_CloseBleConnection(chip::Contro #endif } -uint64_t pychip_GetCommandSenderHandle(chip::Controller::Device * device) +uint64_t pychip_GetCommandSenderHandle(chip::DeviceProxy * device) { return 0; } diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 07bb2fd3a1e11c..5d5d36eb9d97cb 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -1776,7 +1776,7 @@ void chip_ime_SetFailureResponseDelegate(FailureResponseDelegate delegate) // Cluster AccountLogin -chip::ChipError::StorageType chip_ime_AppendCommand_AccountLogin_GetSetupPIN(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_AccountLogin_GetSetupPIN(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * tempAccountIdentifier, uint32_t tempAccountIdentifier_Len) @@ -1789,9 +1789,8 @@ chip::ChipError::StorageType chip_ime_AppendCommand_AccountLogin_GetSetupPIN(chi chip::CharSpan(reinterpret_cast(tempAccountIdentifier), tempAccountIdentifier_Len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_AccountLogin_Login(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - const uint8_t * tempAccountIdentifier, +chip::ChipError::StorageType chip_ime_AppendCommand_AccountLogin_Login(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * tempAccountIdentifier, uint32_t tempAccountIdentifier_Len, const uint8_t * setupPIN, uint32_t setupPIN_Len) { @@ -1804,7 +1803,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_AccountLogin_Login(chip::Con .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_AccountLogin_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_AccountLogin_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1818,7 +1817,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AccountLogin_ClusterRevision // Cluster AdministratorCommissioning chip::ChipError::StorageType chip_ime_AppendCommand_AdministratorCommissioning_OpenBasicCommissioningWindow( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t commissioningTimeout) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t commissioningTimeout) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AdministratorCommissioningCluster cluster; @@ -1826,7 +1825,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_AdministratorCommissioning_O return cluster.OpenBasicCommissioningWindow(nullptr, nullptr, commissioningTimeout).AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_AdministratorCommissioning_OpenCommissioningWindow( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t commissioningTimeout, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t commissioningTimeout, const uint8_t * PAKEVerifier, uint32_t PAKEVerifier_Len, uint16_t discriminator, uint32_t iterations, const uint8_t * salt, uint32_t salt_Len, uint16_t passcodeID) { @@ -1838,9 +1837,9 @@ chip::ChipError::StorageType chip_ime_AppendCommand_AdministratorCommissioning_O discriminator, iterations, chip::ByteSpan(salt, salt_Len), passcodeID) .AsInteger(); } -chip::ChipError::StorageType -chip_ime_AppendCommand_AdministratorCommissioning_RevokeCommissioning(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId) +chip::ChipError::StorageType chip_ime_AppendCommand_AdministratorCommissioning_RevokeCommissioning(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::AdministratorCommissioningCluster cluster; @@ -1848,7 +1847,7 @@ chip_ime_AppendCommand_AdministratorCommissioning_RevokeCommissioning(chip::Cont return cluster.RevokeCommissioning(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_AdministratorCommissioning_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_AdministratorCommissioning_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1861,7 +1860,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AdministratorCommissioning_C // End of Cluster AdministratorCommissioning // Cluster ApplicationBasic -chip::ChipError::StorageType chip_ime_AppendCommand_ApplicationBasic_ChangeStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ApplicationBasic_ChangeStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t status) { @@ -1871,7 +1870,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ApplicationBasic_ChangeStatu return cluster.ChangeStatus(nullptr, nullptr, status).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorName(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1881,7 +1880,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorName( return cluster.ReadAttributeVendorName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1891,7 +1890,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_VendorId(ch return cluster.ReadAttributeVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ApplicationName(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ApplicationName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1902,7 +1901,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_Application .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ProductId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ProductId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1912,7 +1911,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ProductId(c return cluster.ReadAttributeProductId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ApplicationId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ApplicationId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1922,7 +1921,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_Application return cluster.ReadAttributeApplicationId(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_CatalogVendorId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_CatalogVendorId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1932,7 +1931,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_CatalogVend return cluster.ReadAttributeCatalogVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ApplicationStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ApplicationStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1942,7 +1941,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_Application return cluster.ReadAttributeApplicationStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1955,9 +1954,10 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationBasic_ClusterRevi // End of Cluster ApplicationBasic // Cluster ApplicationLauncher -chip::ChipError::StorageType chip_ime_AppendCommand_ApplicationLauncher_LaunchApp( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * data, uint32_t data_Len, - uint16_t catalogVendorId, const uint8_t * applicationId, uint32_t applicationId_Len) +chip::ChipError::StorageType +chip_ime_AppendCommand_ApplicationLauncher_LaunchApp(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * data, uint32_t data_Len, uint16_t catalogVendorId, + const uint8_t * applicationId, uint32_t applicationId_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ApplicationLauncherCluster cluster; @@ -1968,7 +1968,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ApplicationLauncher_LaunchAp .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ApplicationLauncherList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ApplicationLauncherList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1981,7 +1981,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_Applicat .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_CatalogVendorId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_CatalogVendorId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -1991,7 +1991,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_CatalogV return cluster.ReadAttributeCatalogVendorId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ApplicationId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ApplicationId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2001,7 +2001,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_Applicat return cluster.ReadAttributeApplicationId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2014,7 +2014,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ApplicationLauncher_ClusterR // End of Cluster ApplicationLauncher // Cluster AudioOutput -chip::ChipError::StorageType chip_ime_AppendCommand_AudioOutput_RenameOutput(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_AudioOutput_RenameOutput(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t index, const uint8_t * name, uint32_t name_Len) { @@ -2024,7 +2024,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_AudioOutput_RenameOutput(chi return cluster.RenameOutput(nullptr, nullptr, index, chip::CharSpan(reinterpret_cast(name), name_Len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_AudioOutput_SelectOutput(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_AudioOutput_SelectOutput(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t index) { @@ -2034,7 +2034,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_AudioOutput_SelectOutput(chi return cluster.SelectOutput(nullptr, nullptr, index).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_AudioOutputList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_AudioOutputList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2046,7 +2046,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_AudioOutputList( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutput(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutput(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2056,7 +2056,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutp return cluster.ReadAttributeCurrentAudioOutput(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2069,7 +2069,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_AudioOutput_ClusterRevision( // End of Cluster AudioOutput // Cluster BarrierControl -chip::ChipError::StorageType chip_ime_AppendCommand_BarrierControl_BarrierControlGoToPercent(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BarrierControl_BarrierControlGoToPercent(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t percentOpen) { @@ -2078,7 +2078,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BarrierControl_BarrierContro cluster.Associate(device, ZCLendpointId); return cluster.BarrierControlGoToPercent(nullptr, nullptr, percentOpen).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BarrierControl_BarrierControlStop(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BarrierControl_BarrierControlStop(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2087,7 +2087,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BarrierControl_BarrierContro return cluster.BarrierControlStop(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierMovingState(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierMovingState(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2097,7 +2097,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierMoving return cluster.ReadAttributeBarrierMovingState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierSafetyStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierSafetyStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2108,7 +2108,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierSafety .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierCapabilities(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierCapabilities(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2118,7 +2118,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierCapabi return cluster.ReadAttributeBarrierCapabilities(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierPosition(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierPosition(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2128,7 +2128,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_BarrierPositi return cluster.ReadAttributeBarrierPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2141,7 +2141,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BarrierControl_ClusterRevisi // End of Cluster BarrierControl // Cluster Basic -chip::ChipError::StorageType chip_ime_AppendCommand_Basic_MfgSpecificPing(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Basic_MfgSpecificPing(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2150,7 +2150,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Basic_MfgSpecificPing(chip:: return cluster.MfgSpecificPing(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_InteractionModelVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_InteractionModelVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2161,8 +2161,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_InteractionModelVersio .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorName(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2170,8 +2170,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorName(chip::Contr return cluster.ReadAttributeVendorName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorID(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorID(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2179,8 +2179,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_VendorID(chip::Control return cluster.ReadAttributeVendorID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductName(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2189,8 +2188,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductName(chip::Cont return cluster.ReadAttributeProductName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductID(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductID(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2198,8 +2197,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductID(chip::Contro return cluster.ReadAttributeProductID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_UserLabel(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_UserLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2207,9 +2206,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_UserLabel(chip::Contro return cluster.ReadAttributeUserLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_UserLabel(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, - size_t len) +chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_UserLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t * value, size_t len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2219,8 +2217,8 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_UserLabel(chip::Contr chip::CharSpan(reinterpret_cast(value), len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Location(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Location(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2228,9 +2226,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Location(chip::Control return cluster.ReadAttributeLocation(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_Location(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, - size_t len) +chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_Location(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t * value, size_t len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2240,7 +2237,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_Location(chip::Contro chip::CharSpan(reinterpret_cast(value), len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2250,7 +2247,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersion(chip:: return cluster.ReadAttributeHardwareVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersionString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersionString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2261,7 +2258,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_HardwareVersionString( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2271,7 +2268,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersion(chip:: return cluster.ReadAttributeSoftwareVersion(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersionString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersionString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2282,7 +2279,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SoftwareVersionString( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ManufacturingDate(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ManufacturingDate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2293,8 +2290,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ManufacturingDate(chip .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_PartNumber(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_PartNumber(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2302,8 +2299,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_PartNumber(chip::Contr return cluster.ReadAttributePartNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductURL(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductURL(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2311,8 +2308,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductURL(chip::Contr return cluster.ReadAttributeProductURL(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductLabel(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2321,8 +2317,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ProductLabel(chip::Con return cluster.ReadAttributeProductLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SerialNumber(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SerialNumber(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2331,7 +2326,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_SerialNumber(chip::Con return cluster.ReadAttributeSerialNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_LocalConfigDisabled(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_LocalConfigDisabled(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2342,7 +2337,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_LocalConfigDisabled(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_LocalConfigDisabled(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_LocalConfigDisabled(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, bool value) { @@ -2352,8 +2347,8 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Basic_LocalConfigDisabled(c return cluster.WriteAttributeLocalConfigDisabled(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Reachable(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Reachable(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::BasicCluster cluster; @@ -2361,7 +2356,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_Reachable(chip::Contro return cluster.ReadAttributeReachable(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2374,7 +2369,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Basic_ClusterRevision(chip:: // End of Cluster Basic // Cluster BinaryInputBasic -chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_OutOfService(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_OutOfService(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2384,7 +2379,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_OutOfServic return cluster.ReadAttributeOutOfService(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_BinaryInputBasic_OutOfService(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_BinaryInputBasic_OutOfService(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, bool value) { @@ -2394,7 +2389,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_BinaryInputBasic_OutOfServi return cluster.WriteAttributeOutOfService(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_PresentValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_PresentValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2404,7 +2399,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_PresentValu return cluster.ReadAttributePresentValue(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_BinaryInputBasic_PresentValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_BinaryInputBasic_PresentValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -2417,7 +2412,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_BinaryInputBasic_Presen .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_BinaryInputBasic_PresentValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_BinaryInputBasic_PresentValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, bool value) { @@ -2427,7 +2422,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_BinaryInputBasic_PresentVal return cluster.WriteAttributePresentValue(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2437,7 +2432,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_StatusFlags return cluster.ReadAttributeStatusFlags(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_BinaryInputBasic_StatusFlags(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_BinaryInputBasic_StatusFlags(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -2449,7 +2444,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_BinaryInputBasic_Status .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2462,7 +2457,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BinaryInputBasic_ClusterRevi // End of Cluster BinaryInputBasic // Cluster Binding -chip::ChipError::StorageType chip_ime_AppendCommand_Binding_Bind(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_AppendCommand_Binding_Bind(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::NodeId nodeId, chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId) { @@ -2471,9 +2466,8 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Binding_Bind(chip::Controlle cluster.Associate(device, ZCLendpointId); return cluster.Bind(nullptr, nullptr, nodeId, groupId, endpointId, clusterId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Binding_Unbind(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - chip::NodeId nodeId, chip::GroupId groupId, +chip::ChipError::StorageType chip_ime_AppendCommand_Binding_Unbind(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, chip::NodeId nodeId, chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2482,7 +2476,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Binding_Unbind(chip::Control return cluster.Unbind(nullptr, nullptr, nodeId, groupId, endpointId, clusterId).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Binding_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Binding_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2495,7 +2489,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Binding_ClusterRevision(chip // End of Cluster Binding // Cluster BooleanState -chip::ChipError::StorageType chip_ime_ReadAttribute_BooleanState_StateValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BooleanState_StateValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2505,7 +2499,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BooleanState_StateValue(chip return cluster.ReadAttributeStateValue(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_BooleanState_StateValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_BooleanState_StateValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -2518,7 +2512,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_BooleanState_StateValue .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BooleanState_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BooleanState_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2531,7 +2525,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BooleanState_ClusterRevision // End of Cluster BooleanState // Cluster BridgedActions -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_DisableAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_DisableAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2540,7 +2534,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_DisableAction cluster.Associate(device, ZCLendpointId); return cluster.DisableAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_DisableActionWithDuration(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_DisableActionWithDuration(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID, uint32_t duration) @@ -2550,7 +2544,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_DisableAction cluster.Associate(device, ZCLendpointId); return cluster.DisableActionWithDuration(nullptr, nullptr, actionID, invokeID, duration).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_EnableAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_EnableAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2559,7 +2553,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_EnableAction( cluster.Associate(device, ZCLendpointId); return cluster.EnableAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_EnableActionWithDuration(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_EnableActionWithDuration(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID, uint32_t duration) @@ -2569,7 +2563,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_EnableActionW cluster.Associate(device, ZCLendpointId); return cluster.EnableActionWithDuration(nullptr, nullptr, actionID, invokeID, duration).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_InstantAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_InstantAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2578,7 +2572,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_InstantAction cluster.Associate(device, ZCLendpointId); return cluster.InstantAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_InstantActionWithTransition(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_InstantActionWithTransition(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID, @@ -2589,7 +2583,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_InstantAction cluster.Associate(device, ZCLendpointId); return cluster.InstantActionWithTransition(nullptr, nullptr, actionID, invokeID, transitionTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_PauseAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_PauseAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2598,7 +2592,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_PauseAction(c cluster.Associate(device, ZCLendpointId); return cluster.PauseAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_PauseActionWithDuration(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_PauseActionWithDuration(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID, uint32_t duration) @@ -2608,7 +2602,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_PauseActionWi cluster.Associate(device, ZCLendpointId); return cluster.PauseActionWithDuration(nullptr, nullptr, actionID, invokeID, duration).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_ResumeAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_ResumeAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2617,7 +2611,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_ResumeAction( cluster.Associate(device, ZCLendpointId); return cluster.ResumeAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StartAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StartAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2626,7 +2620,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StartAction(c cluster.Associate(device, ZCLendpointId); return cluster.StartAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StartActionWithDuration(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StartActionWithDuration(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID, uint32_t duration) @@ -2636,7 +2630,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StartActionWi cluster.Associate(device, ZCLendpointId); return cluster.StartActionWithDuration(nullptr, nullptr, actionID, invokeID, duration).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StopAction(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StopAction(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t actionID, uint32_t invokeID) { @@ -2646,7 +2640,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_BridgedActions_StopAction(ch return cluster.StopAction(nullptr, nullptr, actionID, invokeID).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_ActionList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_ActionList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2658,7 +2652,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_ActionList(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_EndpointList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_EndpointList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2670,7 +2664,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_EndpointList( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_SetupUrl(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_SetupUrl(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2680,7 +2674,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_SetupUrl(chip return cluster.ReadAttributeSetupUrl(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2693,7 +2687,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedActions_ClusterRevisi // End of Cluster BridgedActions // Cluster BridgedDeviceBasic -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorName(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2703,7 +2697,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorNam return cluster.ReadAttributeVendorName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorID(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorID(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2713,7 +2707,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_VendorID( return cluster.ReadAttributeVendorID(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductName(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2723,7 +2717,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductNa return cluster.ReadAttributeProductName(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_UserLabel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_UserLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2733,7 +2727,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_UserLabel return cluster.ReadAttributeUserLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_BridgedDeviceBasic_UserLabel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_BridgedDeviceBasic_UserLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, size_t len) { @@ -2745,7 +2739,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_BridgedDeviceBasic_UserLabe chip::CharSpan(reinterpret_cast(value), len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2755,7 +2749,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareV return cluster.ReadAttributeHardwareVersion(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareVersionString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareVersionString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2766,7 +2760,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_HardwareV .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2776,7 +2770,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareV return cluster.ReadAttributeSoftwareVersion(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareVersionString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareVersionString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2787,7 +2781,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SoftwareV .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ManufacturingDate(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ManufacturingDate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2798,7 +2792,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_Manufactu .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_PartNumber(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_PartNumber(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2808,7 +2802,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_PartNumbe return cluster.ReadAttributePartNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductURL(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductURL(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2818,7 +2812,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductUR return cluster.ReadAttributeProductURL(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductLabel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2828,7 +2822,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ProductLa return cluster.ReadAttributeProductLabel(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SerialNumber(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SerialNumber(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2838,7 +2832,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_SerialNum return cluster.ReadAttributeSerialNumber(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_Reachable(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_Reachable(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2848,7 +2842,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_Reachable return cluster.ReadAttributeReachable(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2861,7 +2855,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_BridgedDeviceBasic_ClusterRe // End of Cluster BridgedDeviceBasic // Cluster ColorControl -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_ColorLoopSet(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_ColorLoopSet(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t updateFlags, uint8_t action, uint8_t direction, uint16_t time, uint16_t startHue, @@ -2873,7 +2867,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_ColorLoopSet(ch return cluster.ColorLoopSet(nullptr, nullptr, updateFlags, action, direction, time, startHue, optionsMask, optionsOverride) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride) @@ -2883,7 +2877,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveHue cluster.Associate(device, ZCLendpointId); return cluster.EnhancedMoveHue(nullptr, nullptr, moveMode, rate, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveToHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveToHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t enhancedHue, uint8_t direction, uint16_t transitionTime, uint8_t optionsMask, @@ -2896,7 +2890,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveToH .AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveToHueAndSaturation( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t enhancedHue, uint8_t saturation, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t enhancedHue, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2906,7 +2900,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedMoveToH .EnhancedMoveToHueAndSaturation(nullptr, nullptr, enhancedHue, saturation, transitionTime, optionsMask, optionsOverride) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedStepHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedStepHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask, @@ -2917,7 +2911,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_EnhancedStepHue cluster.Associate(device, ZCLendpointId); return cluster.EnhancedStepHue(nullptr, nullptr, stepMode, stepSize, transitionTime, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveColor(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveColor(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t rateX, int16_t rateY, uint8_t optionsMask, uint8_t optionsOverride) @@ -2928,7 +2922,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveColor(chip: return cluster.MoveColor(nullptr, nullptr, rateX, rateY, optionsMask, optionsOverride).AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveColorTemperature( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t moveMode, uint16_t rate, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t moveMode, uint16_t rate, uint16_t colorTemperatureMinimum, uint16_t colorTemperatureMaximum, uint8_t optionsMask, uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -2939,17 +2933,16 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveColorTemper optionsOverride) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveHue(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t moveMode, uint8_t rate, uint8_t optionsMask, - uint8_t optionsOverride) +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t moveMode, uint8_t rate, + uint8_t optionsMask, uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.MoveHue(nullptr, nullptr, moveMode, rate, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveSaturation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveSaturation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t moveMode, uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride) @@ -2959,7 +2952,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveSaturation( cluster.Associate(device, ZCLendpointId); return cluster.MoveSaturation(nullptr, nullptr, moveMode, rate, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToColor(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToColor(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t colorX, uint16_t colorY, uint16_t transitionTime, uint8_t optionsMask, @@ -2971,7 +2964,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToColor(chi return cluster.MoveToColor(nullptr, nullptr, colorX, colorY, transitionTime, optionsMask, optionsOverride).AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_ColorControl_MoveToColorTemperature(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip_ime_AppendCommand_ColorControl_MoveToColorTemperature(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t colorTemperature, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { @@ -2981,7 +2974,7 @@ chip_ime_AppendCommand_ColorControl_MoveToColorTemperature(chip::Controller::Dev return cluster.MoveToColorTemperature(nullptr, nullptr, colorTemperature, transitionTime, optionsMask, optionsOverride) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t hue, uint8_t direction, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) @@ -2992,7 +2985,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToHue(chip: return cluster.MoveToHue(nullptr, nullptr, hue, direction, transitionTime, optionsMask, optionsOverride).AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_ColorControl_MoveToHueAndSaturation(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip_ime_AppendCommand_ColorControl_MoveToHueAndSaturation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t hue, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) { @@ -3002,7 +2995,7 @@ chip_ime_AppendCommand_ColorControl_MoveToHueAndSaturation(chip::Controller::Dev return cluster.MoveToHueAndSaturation(nullptr, nullptr, hue, saturation, transitionTime, optionsMask, optionsOverride) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToSaturation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToSaturation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) @@ -3012,7 +3005,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_MoveToSaturatio cluster.Associate(device, ZCLendpointId); return cluster.MoveToSaturation(nullptr, nullptr, saturation, transitionTime, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepColor(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepColor(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t stepX, int16_t stepY, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride) @@ -3022,10 +3015,11 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepColor(chip: cluster.Associate(device, ZCLendpointId); return cluster.StepColor(nullptr, nullptr, stepX, stepY, transitionTime, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepColorTemperature( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t stepMode, uint16_t stepSize, - uint16_t transitionTime, uint16_t colorTemperatureMinimum, uint16_t colorTemperatureMaximum, uint8_t optionsMask, - uint8_t optionsOverride) +chip::ChipError::StorageType +chip_ime_AppendCommand_ColorControl_StepColorTemperature(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, + uint8_t stepMode, uint16_t stepSize, uint16_t transitionTime, + uint16_t colorTemperatureMinimum, uint16_t colorTemperatureMaximum, + uint8_t optionsMask, uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; @@ -3035,17 +3029,17 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepColorTemper colorTemperatureMaximum, optionsMask, optionsOverride) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepHue(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride) +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t stepMode, uint8_t stepSize, + uint8_t transitionTime, uint8_t optionsMask, + uint8_t optionsOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ColorControlCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.StepHue(nullptr, nullptr, stepMode, stepSize, transitionTime, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepSaturation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepSaturation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, @@ -3056,7 +3050,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StepSaturation( cluster.Associate(device, ZCLendpointId); return cluster.StepSaturation(nullptr, nullptr, stepMode, stepSize, transitionTime, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StopMoveStep(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StopMoveStep(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t optionsMask, uint8_t optionsOverride) { @@ -3066,7 +3060,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ColorControl_StopMoveStep(ch return cluster.StopMoveStep(nullptr, nullptr, optionsMask, optionsOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3076,7 +3070,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentHue(chip return cluster.ReadAttributeCurrentHue(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -3088,7 +3082,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentHue .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentSaturation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentSaturation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3098,7 +3092,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentSaturati return cluster.ReadAttributeCurrentSaturation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentSaturation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentSaturation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -3111,7 +3105,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentSat .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_RemainingTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_RemainingTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3121,7 +3115,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_RemainingTime(c return cluster.ReadAttributeRemainingTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3131,7 +3125,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentX(chip:: return cluster.ReadAttributeCurrentX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -3143,7 +3137,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentX(c .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3153,7 +3147,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CurrentY(chip:: return cluster.ReadAttributeCurrentY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -3165,7 +3159,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_CurrentY(c .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_DriftCompensation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_DriftCompensation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3175,7 +3169,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_DriftCompensati return cluster.ReadAttributeDriftCompensation(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CompensationText(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CompensationText(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3186,7 +3180,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CompensationTex .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTemperature(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTemperature(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3196,7 +3190,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTemperatur return cluster.ReadAttributeColorTemperature(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_ColorTemperature(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_ColorTemperature(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -3209,7 +3203,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_ColorControl_ColorTempe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3219,7 +3213,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorMode(chip: return cluster.ReadAttributeColorMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorControlOptions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorControlOptions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3229,7 +3223,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorControlOpt return cluster.ReadAttributeColorControlOptions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorControlOptions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorControlOptions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -3239,7 +3233,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorControlOp return cluster.WriteAttributeColorControlOptions(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_NumberOfPrimaries(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_NumberOfPrimaries(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3249,7 +3243,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_NumberOfPrimari return cluster.ReadAttributeNumberOfPrimaries(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1X(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1X(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3259,7 +3253,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1X(chip: return cluster.ReadAttributePrimary1X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Y(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Y(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3269,7 +3263,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Y(chip: return cluster.ReadAttributePrimary1Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Intensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Intensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3279,7 +3273,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary1Intensi return cluster.ReadAttributePrimary1Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2X(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2X(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3289,7 +3283,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2X(chip: return cluster.ReadAttributePrimary2X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Y(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Y(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3299,7 +3293,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Y(chip: return cluster.ReadAttributePrimary2Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Intensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Intensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3309,7 +3303,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary2Intensi return cluster.ReadAttributePrimary2Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3X(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3X(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3319,7 +3313,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3X(chip: return cluster.ReadAttributePrimary3X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Y(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Y(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3329,7 +3323,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Y(chip: return cluster.ReadAttributePrimary3Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Intensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Intensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3339,7 +3333,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary3Intensi return cluster.ReadAttributePrimary3Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4X(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4X(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3349,7 +3343,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4X(chip: return cluster.ReadAttributePrimary4X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Y(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Y(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3359,7 +3353,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Y(chip: return cluster.ReadAttributePrimary4Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Intensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Intensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3369,7 +3363,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary4Intensi return cluster.ReadAttributePrimary4Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5X(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5X(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3379,7 +3373,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5X(chip: return cluster.ReadAttributePrimary5X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Y(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Y(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3389,7 +3383,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Y(chip: return cluster.ReadAttributePrimary5Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Intensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Intensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3399,7 +3393,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary5Intensi return cluster.ReadAttributePrimary5Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6X(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6X(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3409,7 +3403,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6X(chip: return cluster.ReadAttributePrimary6X(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Y(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Y(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3419,7 +3413,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Y(chip: return cluster.ReadAttributePrimary6Y(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Intensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Intensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3429,7 +3423,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_Primary6Intensi return cluster.ReadAttributePrimary6Intensity(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3439,7 +3433,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointX(chi return cluster.ReadAttributeWhitePointX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_WhitePointX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_WhitePointX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3448,7 +3442,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_WhitePointX(ch cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeWhitePointX(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3458,7 +3452,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_WhitePointY(chi return cluster.ReadAttributeWhitePointY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_WhitePointY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_WhitePointY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3467,7 +3461,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_WhitePointY(ch cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeWhitePointY(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3477,7 +3471,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRX(ch return cluster.ReadAttributeColorPointRX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3487,7 +3481,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRX(c return cluster.WriteAttributeColorPointRX(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3497,7 +3491,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRY(ch return cluster.ReadAttributeColorPointRY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3507,7 +3501,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRY(c return cluster.WriteAttributeColorPointRY(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRIntensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRIntensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3518,7 +3512,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointRInte .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRIntensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRIntensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -3528,7 +3522,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointRInt return cluster.WriteAttributeColorPointRIntensity(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3538,7 +3532,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGX(ch return cluster.ReadAttributeColorPointGX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3548,7 +3542,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGX(c return cluster.WriteAttributeColorPointGX(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3558,7 +3552,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGY(ch return cluster.ReadAttributeColorPointGY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3568,7 +3562,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGY(c return cluster.WriteAttributeColorPointGY(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGIntensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGIntensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3579,7 +3573,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointGInte .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGIntensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGIntensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -3589,7 +3583,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointGInt return cluster.WriteAttributeColorPointGIntensity(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3599,7 +3593,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBX(ch return cluster.ReadAttributeColorPointBX(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBX(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBX(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3609,7 +3603,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBX(c return cluster.WriteAttributeColorPointBX(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3619,7 +3613,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBY(ch return cluster.ReadAttributeColorPointBY(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBY(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBY(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3629,7 +3623,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBY(c return cluster.WriteAttributeColorPointBY(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBIntensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBIntensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3640,7 +3634,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorPointBInte .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBIntensity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBIntensity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -3650,7 +3644,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_ColorPointBInt return cluster.WriteAttributeColorPointBIntensity(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedCurrentHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedCurrentHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3660,7 +3654,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedCurrent return cluster.ReadAttributeEnhancedCurrentHue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedColorMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedColorMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3670,7 +3664,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_EnhancedColorMo return cluster.ReadAttributeEnhancedColorMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopActive(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopActive(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3680,7 +3674,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopActive return cluster.ReadAttributeColorLoopActive(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopDirection(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopDirection(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3690,7 +3684,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopDirect return cluster.ReadAttributeColorLoopDirection(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3700,7 +3694,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopTime(c return cluster.ReadAttributeColorLoopTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStartEnhancedHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStartEnhancedHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3711,7 +3705,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStartE .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStoredEnhancedHue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStoredEnhancedHue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3722,7 +3716,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorLoopStored .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorCapabilities(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorCapabilities(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3732,7 +3726,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorCapabiliti return cluster.ReadAttributeColorCapabilities(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysicalMin(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysicalMin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3743,7 +3737,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysic .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysicalMax(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysicalMax(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3754,7 +3748,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ColorTempPhysic .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CoupleColorTempToLevelMinMireds(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CoupleColorTempToLevelMinMireds(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3765,7 +3759,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_CoupleColorTemp .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_StartUpColorTemperatureMireds(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_StartUpColorTemperatureMireds(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3776,7 +3770,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_StartUpColorTem .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_StartUpColorTemperatureMireds(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_StartUpColorTemperatureMireds(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -3787,7 +3781,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ColorControl_StartUpColorTe .WriteAttributeStartUpColorTemperatureMireds(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3800,7 +3794,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ColorControl_ClusterRevision // End of Cluster ColorControl // Cluster ContentLauncher -chip::ChipError::StorageType chip_ime_AppendCommand_ContentLauncher_LaunchContent(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ContentLauncher_LaunchContent(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, bool autoPlay, const uint8_t * data, uint32_t data_Len) @@ -3811,7 +3805,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ContentLauncher_LaunchConten return cluster.LaunchContent(nullptr, nullptr, autoPlay, chip::CharSpan(reinterpret_cast(data), data_Len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_ContentLauncher_LaunchURL(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ContentLauncher_LaunchURL(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * contentURL, uint32_t contentURL_Len, const uint8_t * displayString, @@ -3826,7 +3820,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ContentLauncher_LaunchURL(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_AcceptsHeaderList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_AcceptsHeaderList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3839,7 +3833,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_AcceptsHeade .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_SupportedStreamingTypes(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_SupportedStreamingTypes(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3852,7 +3846,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_SupportedStr .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3865,7 +3859,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ContentLauncher_ClusterRevis // End of Cluster ContentLauncher // Cluster Descriptor -chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_DeviceList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_DeviceList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3876,7 +3870,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_DeviceList(chip:: .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ServerList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ServerList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3887,7 +3881,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ServerList(chip:: .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClientList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClientList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3898,8 +3892,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClientList(chip:: .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_PartsList(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_PartsList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -3909,7 +3902,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_PartsList(chip::C .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -3923,7 +3916,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Descriptor_ClusterRevision(c // Cluster DiagnosticLogs chip::ChipError::StorageType chip_ime_AppendCommand_DiagnosticLogs_RetrieveLogsRequest( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t intent, uint8_t requestedProtocol, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t intent, uint8_t requestedProtocol, const uint8_t * transferFileDesignator, uint32_t transferFileDesignator_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -3938,7 +3931,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DiagnosticLogs_RetrieveLogsR // End of Cluster DiagnosticLogs // Cluster DoorLock -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearAllPins(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearAllPins(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -3946,7 +3939,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearAllPins(chip:: cluster.Associate(device, ZCLendpointId); return cluster.ClearAllPins(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearAllRfids(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearAllRfids(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -3954,7 +3947,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearAllRfids(chip: cluster.Associate(device, ZCLendpointId); return cluster.ClearAllRfids(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearHolidaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearHolidaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId) { @@ -3963,25 +3956,23 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearHolidaySchedul cluster.Associate(device, ZCLendpointId); return cluster.ClearHolidaySchedule(nullptr, nullptr, scheduleId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearPin(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t userId) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearPin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.ClearPin(nullptr, nullptr, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearRfid(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t userId) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearRfid(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.ClearRfid(nullptr, nullptr, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearWeekdaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearWeekdaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint16_t userId) { @@ -3990,7 +3981,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearWeekdaySchedul cluster.Associate(device, ZCLendpointId); return cluster.ClearWeekdaySchedule(nullptr, nullptr, scheduleId, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearYeardaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearYeardaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint16_t userId) { @@ -3999,7 +3990,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_ClearYeardaySchedul cluster.Associate(device, ZCLendpointId); return cluster.ClearYeardaySchedule(nullptr, nullptr, scheduleId, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetHolidaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetHolidaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId) { @@ -4008,7 +3999,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetHolidaySchedule( cluster.Associate(device, ZCLendpointId); return cluster.GetHolidaySchedule(nullptr, nullptr, scheduleId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetLogRecord(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetLogRecord(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t logIndex) { @@ -4017,32 +4008,31 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetLogRecord(chip:: cluster.Associate(device, ZCLendpointId); return cluster.GetLogRecord(nullptr, nullptr, logIndex).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetPin(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t userId) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetPin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.GetPin(nullptr, nullptr, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetRfid(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t userId) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetRfid(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.GetRfid(nullptr, nullptr, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetUserType(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t userId) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetUserType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.GetUserType(nullptr, nullptr, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetWeekdaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetWeekdaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint16_t userId) { @@ -4051,7 +4041,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetWeekdaySchedule( cluster.Associate(device, ZCLendpointId); return cluster.GetWeekdaySchedule(nullptr, nullptr, scheduleId, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetYeardaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetYeardaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint16_t userId) { @@ -4060,16 +4050,15 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_GetYeardaySchedule( cluster.Associate(device, ZCLendpointId); return cluster.GetYeardaySchedule(nullptr, nullptr, scheduleId, userId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_LockDoor(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - const uint8_t * pin, uint32_t pin_Len) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_LockDoor(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * pin, uint32_t pin_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.LockDoor(nullptr, nullptr, chip::ByteSpan(pin, pin_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetHolidaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetHolidaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint32_t localStartTime, uint32_t localEndTime, @@ -4081,29 +4070,26 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetHolidaySchedule( return cluster.SetHolidaySchedule(nullptr, nullptr, scheduleId, localStartTime, localEndTime, operatingModeDuringHoliday) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetPin(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t userId, - uint8_t userStatus, uint8_t userType, const uint8_t * pin, - uint32_t pin_Len) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetPin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId, uint8_t userStatus, + uint8_t userType, const uint8_t * pin, uint32_t pin_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.SetPin(nullptr, nullptr, userId, userStatus, userType, chip::ByteSpan(pin, pin_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetRfid(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t userId, - uint8_t userStatus, uint8_t userType, const uint8_t * id, - uint32_t id_Len) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetRfid(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId, uint8_t userStatus, + uint8_t userType, const uint8_t * id, uint32_t id_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.SetRfid(nullptr, nullptr, userId, userStatus, userType, chip::ByteSpan(id, id_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetUserType(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t userId, uint8_t userType) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetUserType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t userId, uint8_t userType) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; @@ -4111,7 +4097,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetUserType(chip::C return cluster.SetUserType(nullptr, nullptr, userId, userType).AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_DoorLock_SetWeekdaySchedule(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, +chip_ime_AppendCommand_DoorLock_SetWeekdaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint16_t userId, uint8_t daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute) { @@ -4121,7 +4107,7 @@ chip_ime_AppendCommand_DoorLock_SetWeekdaySchedule(chip::Controller::Device * de return cluster.SetWeekdaySchedule(nullptr, nullptr, scheduleId, userId, daysMask, startHour, startMinute, endHour, endMinute) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetYeardaySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetYeardaySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t scheduleId, uint16_t userId, uint32_t localStartTime, uint32_t localEndTime) @@ -4131,16 +4117,15 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_SetYeardaySchedule( cluster.Associate(device, ZCLendpointId); return cluster.SetYeardaySchedule(nullptr, nullptr, scheduleId, userId, localStartTime, localEndTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_UnlockDoor(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - const uint8_t * pin, uint32_t pin_Len) +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_UnlockDoor(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * pin, uint32_t pin_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::DoorLockCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.UnlockDoor(nullptr, nullptr, chip::ByteSpan(pin, pin_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_UnlockWithTimeout(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_UnlockWithTimeout(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t timeoutInSeconds, const uint8_t * pin, uint32_t pin_Len) @@ -4151,8 +4136,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_DoorLock_UnlockWithTimeout(c return cluster.UnlockWithTimeout(nullptr, nullptr, timeoutInSeconds, chip::ByteSpan(pin, pin_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockState(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockState(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -4161,7 +4145,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockState(chip::Con return cluster.ReadAttributeLockState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_DoorLock_LockState(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_DoorLock_LockState(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -4173,8 +4157,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_DoorLock_LockState(chip .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockType(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -4183,7 +4166,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_LockType(chip::Cont return cluster.ReadAttributeLockType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ActuatorEnabled(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ActuatorEnabled(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4193,7 +4176,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ActuatorEnabled(chi return cluster.ReadAttributeActuatorEnabled(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4206,7 +4189,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_DoorLock_ClusterRevision(chi // End of Cluster DoorLock // Cluster ElectricalMeasurement -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_MeasurementType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_MeasurementType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4216,7 +4199,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Measur return cluster.ReadAttributeMeasurementType(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_TotalActivePower(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_TotalActivePower(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4226,7 +4209,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_TotalA return cluster.ReadAttributeTotalActivePower(gInt32sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVoltage(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVoltage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4236,7 +4219,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVol return cluster.ReadAttributeRmsVoltage(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVoltageMin(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVoltageMin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4246,7 +4229,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVol return cluster.ReadAttributeRmsVoltageMin(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVoltageMax(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVoltageMax(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4256,7 +4239,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsVol return cluster.ReadAttributeRmsVoltageMax(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCurrent(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCurrent(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4266,7 +4249,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCur return cluster.ReadAttributeRmsCurrent(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCurrentMin(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCurrentMin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4276,7 +4259,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCur return cluster.ReadAttributeRmsCurrentMin(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCurrentMax(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCurrentMax(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4286,7 +4269,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_RmsCur return cluster.ReadAttributeRmsCurrentMax(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ActivePower(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ActivePower(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4296,7 +4279,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Active return cluster.ReadAttributeActivePower(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ActivePowerMin(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ActivePowerMin(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4306,7 +4289,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Active return cluster.ReadAttributeActivePowerMin(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ActivePowerMax(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ActivePowerMax(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4316,7 +4299,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Active return cluster.ReadAttributeActivePowerMax(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4329,7 +4312,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ElectricalMeasurement_Cluste // End of Cluster ElectricalMeasurement // Cluster EthernetNetworkDiagnostics -chip::ChipError::StorageType chip_ime_AppendCommand_EthernetNetworkDiagnostics_ResetCounts(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_EthernetNetworkDiagnostics_ResetCounts(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { @@ -4339,7 +4322,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_EthernetNetworkDiagnostics_R return cluster.ResetCounts(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_PHYRate(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_PHYRate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4349,7 +4332,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_P return cluster.ReadAttributePHYRate(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_FullDuplex(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_FullDuplex(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4359,7 +4342,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_F return cluster.ReadAttributeFullDuplex(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_PacketRxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_PacketRxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4369,7 +4352,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_P return cluster.ReadAttributePacketRxCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_PacketTxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_PacketTxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4379,7 +4362,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_P return cluster.ReadAttributePacketTxCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_TxErrCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_TxErrCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4389,7 +4372,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_T return cluster.ReadAttributeTxErrCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_CollisionCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_CollisionCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4399,7 +4382,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_C return cluster.ReadAttributeCollisionCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_OverrunCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_OverrunCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4409,7 +4392,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_O return cluster.ReadAttributeOverrunCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_CarrierDetect(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_CarrierDetect(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4419,7 +4402,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_C return cluster.ReadAttributeCarrierDetect(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_TimeSinceReset(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_TimeSinceReset(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4429,7 +4412,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_T return cluster.ReadAttributeTimeSinceReset(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4442,8 +4425,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_EthernetNetworkDiagnostics_C // End of Cluster EthernetNetworkDiagnostics // Cluster FixedLabel -chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_LabelList(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_LabelList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -4453,7 +4435,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_LabelList(chip::C .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4466,7 +4448,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FixedLabel_ClusterRevision(c // End of Cluster FixedLabel // Cluster FlowMeasurement -chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4476,7 +4458,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MeasuredValu return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MinMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MinMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4486,7 +4468,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MinMeasuredV return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MaxMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MaxMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4496,7 +4478,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_MaxMeasuredV return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_Tolerance(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_Tolerance(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4506,7 +4488,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_Tolerance(ch return cluster.ReadAttributeTolerance(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4519,7 +4501,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_FlowMeasurement_ClusterRevis // End of Cluster FlowMeasurement // Cluster GeneralCommissioning -chip::ChipError::StorageType chip_ime_AppendCommand_GeneralCommissioning_ArmFailSafe(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_GeneralCommissioning_ArmFailSafe(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t expiryLengthSeconds, uint64_t breadcrumb, uint32_t timeoutMs) @@ -4529,7 +4511,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_GeneralCommissioning_ArmFail cluster.Associate(device, ZCLendpointId); return cluster.ArmFailSafe(nullptr, nullptr, expiryLengthSeconds, breadcrumb, timeoutMs).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_GeneralCommissioning_CommissioningComplete(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_GeneralCommissioning_CommissioningComplete(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { @@ -4539,7 +4521,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_GeneralCommissioning_Commiss return cluster.CommissioningComplete(nullptr, nullptr).AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_GeneralCommissioning_SetRegulatoryConfig(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip_ime_AppendCommand_GeneralCommissioning_SetRegulatoryConfig(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t location, const uint8_t * countryCode, uint32_t countryCode_Len, uint64_t breadcrumb, uint32_t timeoutMs) { @@ -4552,7 +4534,7 @@ chip_ime_AppendCommand_GeneralCommissioning_SetRegulatoryConfig(chip::Controller .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_Breadcrumb(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_Breadcrumb(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4562,7 +4544,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_Breadcr return cluster.ReadAttributeBreadcrumb(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_GeneralCommissioning_Breadcrumb(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_GeneralCommissioning_Breadcrumb(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint64_t value) { @@ -4571,8 +4553,9 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_GeneralCommissioning_Breadc cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeBreadcrumb(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_BasicCommissioningInfoList( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_BasicCommissioningInfoList(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GeneralCommissioningCluster cluster; @@ -4583,7 +4566,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_BasicCo .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4596,7 +4579,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralCommissioning_Cluster // End of Cluster GeneralCommissioning // Cluster GeneralDiagnostics -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_NetworkInterfaces(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_NetworkInterfaces(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4609,7 +4592,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_NetworkIn .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_RebootCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_RebootCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4619,7 +4602,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_RebootCou return cluster.ReadAttributeRebootCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_UpTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_UpTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4629,7 +4612,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_UpTime(ch return cluster.ReadAttributeUpTime(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_TotalOperationalHours(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_TotalOperationalHours(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4640,7 +4623,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_TotalOper .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_BootReasons(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_BootReasons(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4650,7 +4633,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_BootReaso return cluster.ReadAttributeBootReasons(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4663,7 +4646,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GeneralDiagnostics_ClusterRe // End of Cluster GeneralDiagnostics // Cluster GroupKeyManagement -chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_Groups(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_Groups(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4674,7 +4657,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_Groups(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_GroupKeys(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_GroupKeys(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4686,7 +4669,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_GroupKeys .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4699,9 +4682,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_GroupKeyManagement_ClusterRe // End of Cluster GroupKeyManagement // Cluster Groups -chip::ChipError::StorageType chip_ime_AppendCommand_Groups_AddGroup(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t groupId, - const uint8_t * groupName, uint32_t groupName_Len) +chip::ChipError::StorageType chip_ime_AppendCommand_Groups_AddGroup(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, const uint8_t * groupName, + uint32_t groupName_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupsCluster cluster; @@ -4709,7 +4692,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Groups_AddGroup(chip::Contro return cluster.AddGroup(nullptr, nullptr, groupId, chip::CharSpan(reinterpret_cast(groupName), groupName_Len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Groups_AddGroupIfIdentifying(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Groups_AddGroupIfIdentifying(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t groupId, const uint8_t * groupName, uint32_t groupName_Len) @@ -4721,7 +4704,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Groups_AddGroupIfIdentifying .AddGroupIfIdentifying(nullptr, nullptr, groupId, chip::CharSpan(reinterpret_cast(groupName), groupName_Len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Groups_GetGroupMembership(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Groups_GetGroupMembership(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t groupCount, uint16_t groupList) { @@ -4730,7 +4713,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Groups_GetGroupMembership(ch cluster.Associate(device, ZCLendpointId); return cluster.GetGroupMembership(nullptr, nullptr, groupCount, groupList).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Groups_RemoveAllGroups(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Groups_RemoveAllGroups(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -4738,18 +4721,16 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Groups_RemoveAllGroups(chip: cluster.Associate(device, ZCLendpointId); return cluster.RemoveAllGroups(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Groups_RemoveGroup(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t groupId) +chip::ChipError::StorageType chip_ime_AppendCommand_Groups_RemoveGroup(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupsCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.RemoveGroup(nullptr, nullptr, groupId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Groups_ViewGroup(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t groupId) +chip::ChipError::StorageType chip_ime_AppendCommand_Groups_ViewGroup(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::GroupsCluster cluster; @@ -4757,8 +4738,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Groups_ViewGroup(chip::Contr return cluster.ViewGroup(nullptr, nullptr, groupId).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_NameSupport(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_NameSupport(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -4767,7 +4747,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_NameSupport(chip::Con return cluster.ReadAttributeNameSupport(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4780,16 +4760,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Groups_ClusterRevision(chip: // End of Cluster Groups // Cluster Identify -chip::ChipError::StorageType chip_ime_AppendCommand_Identify_Identify(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t identifyTime) +chip::ChipError::StorageType chip_ime_AppendCommand_Identify_Identify(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t identifyTime) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::IdentifyCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.Identify(nullptr, nullptr, identifyTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Identify_IdentifyQuery(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Identify_IdentifyQuery(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -4797,7 +4776,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Identify_IdentifyQuery(chip: cluster.Associate(device, ZCLendpointId); return cluster.IdentifyQuery(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Identify_TriggerEffect(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Identify_TriggerEffect(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t effectIdentifier, uint8_t effectVariant) { @@ -4807,7 +4786,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Identify_TriggerEffect(chip: return cluster.TriggerEffect(nullptr, nullptr, effectIdentifier, effectVariant).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4817,7 +4796,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyTime(chip:: return cluster.ReadAttributeIdentifyTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Identify_IdentifyTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Identify_IdentifyTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -4827,7 +4806,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Identify_IdentifyTime(chip: return cluster.WriteAttributeIdentifyTime(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4837,7 +4816,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_IdentifyType(chip:: return cluster.ReadAttributeIdentifyType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4850,7 +4829,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Identify_ClusterRevision(chi // End of Cluster Identify // Cluster IlluminanceMeasurement -chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4860,7 +4839,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_Measu return cluster.ReadAttributeMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_IlluminanceMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_IlluminanceMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -4874,7 +4853,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_IlluminanceMeasurement_ .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MinMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MinMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4884,7 +4863,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MinMe return cluster.ReadAttributeMinMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MaxMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MaxMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4894,7 +4873,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_MaxMe return cluster.ReadAttributeMaxMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_Tolerance(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_Tolerance(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4904,7 +4883,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_Toler return cluster.ReadAttributeTolerance(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_LightSensorType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_LightSensorType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4914,7 +4893,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_Light return cluster.ReadAttributeLightSensorType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4927,9 +4906,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_IlluminanceMeasurement_Clust // End of Cluster IlluminanceMeasurement // Cluster KeypadInput -chip::ChipError::StorageType chip_ime_AppendCommand_KeypadInput_SendKey(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t keyCode) +chip::ChipError::StorageType chip_ime_AppendCommand_KeypadInput_SendKey(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t keyCode) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::KeypadInputCluster cluster; @@ -4937,7 +4915,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_KeypadInput_SendKey(chip::Co return cluster.SendKey(nullptr, nullptr, keyCode).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_KeypadInput_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_KeypadInput_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -4950,17 +4928,16 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_KeypadInput_ClusterRevision( // End of Cluster KeypadInput // Cluster LevelControl -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_Move(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t moveMode, uint8_t rate, uint8_t optionMask, - uint8_t optionOverride) +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_Move(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t moveMode, uint8_t rate, + uint8_t optionMask, uint8_t optionOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LevelControlCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.Move(nullptr, nullptr, moveMode, rate, optionMask, optionOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveToLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveToLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t level, uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride) @@ -4970,7 +4947,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveToLevel(chi cluster.Associate(device, ZCLendpointId); return cluster.MoveToLevel(nullptr, nullptr, level, transitionTime, optionMask, optionOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveToLevelWithOnOff(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveToLevelWithOnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t level, uint16_t transitionTime) { @@ -4979,7 +4956,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveToLevelWith cluster.Associate(device, ZCLendpointId); return cluster.MoveToLevelWithOnOff(nullptr, nullptr, level, transitionTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveWithOnOff(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveWithOnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t moveMode, uint8_t rate) { @@ -4988,17 +4965,17 @@ chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_MoveWithOnOff(c cluster.Associate(device, ZCLendpointId); return cluster.MoveWithOnOff(nullptr, nullptr, moveMode, rate).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_Step(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, - uint8_t optionMask, uint8_t optionOverride) +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_Step(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t stepMode, uint8_t stepSize, + uint16_t transitionTime, uint8_t optionMask, + uint8_t optionOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LevelControlCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.Step(nullptr, nullptr, stepMode, stepSize, transitionTime, optionMask, optionOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_StepWithOnOff(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_StepWithOnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime) @@ -5008,16 +4985,15 @@ chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_StepWithOnOff(c cluster.Associate(device, ZCLendpointId); return cluster.StepWithOnOff(nullptr, nullptr, stepMode, stepSize, transitionTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_Stop(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t optionMask, uint8_t optionOverride) +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_Stop(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t optionMask, uint8_t optionOverride) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LevelControlCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.Stop(nullptr, nullptr, optionMask, optionOverride).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_StopWithOnOff(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_StopWithOnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5026,7 +5002,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_LevelControl_StopWithOnOff(c return cluster.StopWithOnOff(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5036,7 +5012,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentLevel(ch return cluster.ReadAttributeCurrentLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_LevelControl_CurrentLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_LevelControl_CurrentLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -5049,7 +5025,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_LevelControl_CurrentLev .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_RemainingTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_RemainingTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5059,7 +5035,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_RemainingTime(c return cluster.ReadAttributeRemainingTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MinLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MinLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5069,7 +5045,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MinLevel(chip:: return cluster.ReadAttributeMinLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MaxLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MaxLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5079,7 +5055,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MaxLevel(chip:: return cluster.ReadAttributeMaxLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentFrequency(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentFrequency(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5089,7 +5065,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_CurrentFrequenc return cluster.ReadAttributeCurrentFrequency(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MinFrequency(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MinFrequency(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5099,7 +5075,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MinFrequency(ch return cluster.ReadAttributeMinFrequency(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MaxFrequency(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MaxFrequency(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5109,8 +5085,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_MaxFrequency(ch return cluster.ReadAttributeMaxFrequency(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_Options(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_Options(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5119,7 +5094,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_Options(chip::C return cluster.ReadAttributeOptions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_Options(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_Options(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -5128,7 +5103,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_Options(chip:: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeOptions(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnOffTransitionTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnOffTransitionTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5139,7 +5114,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnOffTransition .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnOffTransitionTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnOffTransitionTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -5149,8 +5124,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnOffTransitio return cluster.WriteAttributeOnOffTransitionTime(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnLevel(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5159,7 +5133,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnLevel(chip::C return cluster.ReadAttributeOnLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -5168,7 +5142,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnLevel(chip:: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeOnLevel(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnTransitionTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnTransitionTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5178,7 +5152,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OnTransitionTim return cluster.ReadAttributeOnTransitionTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnTransitionTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnTransitionTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -5188,7 +5162,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OnTransitionTi return cluster.WriteAttributeOnTransitionTime(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OffTransitionTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OffTransitionTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5198,7 +5172,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_OffTransitionTi return cluster.ReadAttributeOffTransitionTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OffTransitionTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OffTransitionTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -5208,7 +5182,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_OffTransitionT return cluster.WriteAttributeOffTransitionTime(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_DefaultMoveRate(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_DefaultMoveRate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5218,7 +5192,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_DefaultMoveRate return cluster.ReadAttributeDefaultMoveRate(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_DefaultMoveRate(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_DefaultMoveRate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -5228,7 +5202,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_DefaultMoveRat return cluster.WriteAttributeDefaultMoveRate(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_StartUpCurrentLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_StartUpCurrentLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5238,7 +5212,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_StartUpCurrentL return cluster.ReadAttributeStartUpCurrentLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_StartUpCurrentLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_StartUpCurrentLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -5248,7 +5222,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_LevelControl_StartUpCurrent return cluster.WriteAttributeStartUpCurrentLevel(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5261,8 +5235,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LevelControl_ClusterRevision // End of Cluster LevelControl // Cluster LowPower -chip::ChipError::StorageType chip_ime_AppendCommand_LowPower_Sleep(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId) +chip::ChipError::StorageType chip_ime_AppendCommand_LowPower_Sleep(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::LowPowerCluster cluster; @@ -5270,7 +5244,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_LowPower_Sleep(chip::Control return cluster.Sleep(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_LowPower_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_LowPower_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5283,7 +5257,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_LowPower_ClusterRevision(chi // End of Cluster LowPower // Cluster MediaInput -chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_HideInputStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_HideInputStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5291,7 +5265,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_HideInputStatus(c cluster.Associate(device, ZCLendpointId); return cluster.HideInputStatus(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_RenameInput(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_RenameInput(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t index, const uint8_t * name, uint32_t name_Len) { @@ -5300,7 +5274,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_RenameInput(chip: cluster.Associate(device, ZCLendpointId); return cluster.RenameInput(nullptr, nullptr, index, chip::CharSpan(reinterpret_cast(name), name_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_SelectInput(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_SelectInput(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t index) { @@ -5309,7 +5283,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_SelectInput(chip: cluster.Associate(device, ZCLendpointId); return cluster.SelectInput(nullptr, nullptr, index).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_ShowInputStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_ShowInputStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5318,7 +5292,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaInput_ShowInputStatus(c return cluster.ShowInputStatus(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_MediaInputList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_MediaInputList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5330,7 +5304,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_MediaInputList(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_CurrentMediaInput(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_CurrentMediaInput(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5340,7 +5314,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_CurrentMediaInput return cluster.ReadAttributeCurrentMediaInput(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5353,7 +5327,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaInput_ClusterRevision(c // End of Cluster MediaInput // Cluster MediaPlayback -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaFastForward(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaFastForward(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5361,7 +5335,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaFastForwa cluster.Associate(device, ZCLendpointId); return cluster.MediaFastForward(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaNext(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaNext(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5369,7 +5343,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaNext(chip cluster.Associate(device, ZCLendpointId); return cluster.MediaNext(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPause(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPause(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5377,7 +5351,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPause(chi cluster.Associate(device, ZCLendpointId); return cluster.MediaPause(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPlay(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPlay(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5385,7 +5359,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPlay(chip cluster.Associate(device, ZCLendpointId); return cluster.MediaPlay(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPrevious(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPrevious(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5393,7 +5367,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaPrevious( cluster.Associate(device, ZCLendpointId); return cluster.MediaPrevious(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaRewind(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaRewind(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5401,7 +5375,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaRewind(ch cluster.Associate(device, ZCLendpointId); return cluster.MediaRewind(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSeek(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSeek(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint64_t position) { @@ -5410,7 +5384,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSeek(chip cluster.Associate(device, ZCLendpointId); return cluster.MediaSeek(nullptr, nullptr, position).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSkipBackward(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSkipBackward(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint64_t deltaPositionMilliseconds) { @@ -5419,7 +5393,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSkipBackw cluster.Associate(device, ZCLendpointId); return cluster.MediaSkipBackward(nullptr, nullptr, deltaPositionMilliseconds).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSkipForward(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSkipForward(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint64_t deltaPositionMilliseconds) { @@ -5428,7 +5402,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaSkipForwa cluster.Associate(device, ZCLendpointId); return cluster.MediaSkipForward(nullptr, nullptr, deltaPositionMilliseconds).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaStartOver(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaStartOver(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5436,7 +5410,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaStartOver cluster.Associate(device, ZCLendpointId); return cluster.MediaStartOver(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaStop(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaStop(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5445,7 +5419,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_MediaPlayback_MediaStop(chip return cluster.MediaStop(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PlaybackState(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PlaybackState(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5455,7 +5429,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PlaybackState( return cluster.ReadAttributePlaybackState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_StartTime(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_StartTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5465,7 +5439,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_StartTime(chip return cluster.ReadAttributeStartTime(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_Duration(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_Duration(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5475,7 +5449,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_Duration(chip: return cluster.ReadAttributeDuration(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PositionUpdatedAt(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PositionUpdatedAt(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5485,7 +5459,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PositionUpdate return cluster.ReadAttributePositionUpdatedAt(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_Position(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_Position(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5495,7 +5469,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_Position(chip: return cluster.ReadAttributePosition(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PlaybackSpeed(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PlaybackSpeed(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5505,7 +5479,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_PlaybackSpeed( return cluster.ReadAttributePlaybackSpeed(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_SeekRangeEnd(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_SeekRangeEnd(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5515,7 +5489,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_SeekRangeEnd(c return cluster.ReadAttributeSeekRangeEnd(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_SeekRangeStart(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_SeekRangeStart(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5525,7 +5499,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_SeekRangeStart return cluster.ReadAttributeSeekRangeStart(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5538,7 +5512,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_MediaPlayback_ClusterRevisio // End of Cluster MediaPlayback // Cluster ModeSelect -chip::ChipError::StorageType chip_ime_AppendCommand_ModeSelect_ChangeToMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ModeSelect_ChangeToMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t newMode) { @@ -5548,7 +5522,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ModeSelect_ChangeToMode(chip return cluster.ChangeToMode(nullptr, nullptr, newMode).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_CurrentMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_CurrentMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5558,7 +5532,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_CurrentMode(chip: return cluster.ReadAttributeCurrentMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_ModeSelect_CurrentMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_ModeSelect_CurrentMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -5570,7 +5544,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_ModeSelect_CurrentMode( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_SupportedModes(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_SupportedModes(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5582,8 +5556,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_SupportedModes(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_OnMode(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_OnMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5592,15 +5565,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_OnMode(chip::Cont return cluster.ReadAttributeOnMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_ModeSelect_OnMode(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_ModeSelect_OnMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeOnMode(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_StartUpMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_StartUpMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5610,7 +5583,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_StartUpMode(chip: return cluster.ReadAttributeStartUpMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_Description(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_Description(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5620,7 +5593,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_Description(chip: return cluster.ReadAttributeDescription(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5634,7 +5607,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ModeSelect_ClusterRevision(c // Cluster NetworkCommissioning chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_AddThreadNetwork( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * operationalDataset, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * operationalDataset, uint32_t operationalDataset_Len, uint64_t breadcrumb, uint32_t timeoutMs) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5645,7 +5618,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_AddThre .AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_AddWiFiNetwork( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * ssid, uint32_t ssid_Len, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * ssid, uint32_t ssid_Len, const uint8_t * credentials, uint32_t credentials_Len, uint64_t breadcrumb, uint32_t timeoutMs) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5656,7 +5629,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_AddWiFi timeoutMs) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_DisableNetwork(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_DisableNetwork(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * networkID, uint32_t networkID_Len, uint64_t breadcrumb, @@ -5667,7 +5640,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_Disable cluster.Associate(device, ZCLendpointId); return cluster.DisableNetwork(nullptr, nullptr, chip::ByteSpan(networkID, networkID_Len), breadcrumb, timeoutMs).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_EnableNetwork(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_EnableNetwork(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * networkID, uint32_t networkID_Len, uint64_t breadcrumb, @@ -5678,7 +5651,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_EnableN cluster.Associate(device, ZCLendpointId); return cluster.EnableNetwork(nullptr, nullptr, chip::ByteSpan(networkID, networkID_Len), breadcrumb, timeoutMs).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_RemoveNetwork(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_RemoveNetwork(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * networkID, uint32_t networkID_Len, uint64_t breadcrumb, @@ -5689,7 +5662,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_RemoveN cluster.Associate(device, ZCLendpointId); return cluster.RemoveNetwork(nullptr, nullptr, chip::ByteSpan(networkID, networkID_Len), breadcrumb, timeoutMs).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_ScanNetworks(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_ScanNetworks(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * ssid, uint32_t ssid_Len, uint64_t breadcrumb, uint32_t timeoutMs) @@ -5700,7 +5673,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_ScanNet return cluster.ScanNetworks(nullptr, nullptr, chip::ByteSpan(ssid, ssid_Len), breadcrumb, timeoutMs).AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_UpdateThreadNetwork( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * operationalDataset, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * operationalDataset, uint32_t operationalDataset_Len, uint64_t breadcrumb, uint32_t timeoutMs) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5711,7 +5684,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_UpdateT .AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_UpdateWiFiNetwork( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * ssid, uint32_t ssid_Len, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * ssid, uint32_t ssid_Len, const uint8_t * credentials, uint32_t credentials_Len, uint64_t breadcrumb, uint32_t timeoutMs) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5723,7 +5696,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_NetworkCommissioning_UpdateW .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_FeatureMap(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5733,7 +5706,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_Feature return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5746,18 +5719,20 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_NetworkCommissioning_Cluster // End of Cluster NetworkCommissioning // Cluster OtaSoftwareUpdateProvider -chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_ApplyUpdateRequest( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * updateToken, - uint32_t updateToken_Len, uint32_t newVersion) +chip::ChipError::StorageType +chip_ime_AppendCommand_OtaSoftwareUpdateProvider_ApplyUpdateRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * updateToken, + uint32_t updateToken_Len, uint32_t newVersion) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.ApplyUpdateRequest(nullptr, nullptr, chip::ByteSpan(updateToken, updateToken_Len), newVersion).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_NotifyUpdateApplied( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * updateToken, - uint32_t updateToken_Len, uint32_t softwareVersion) +chip::ChipError::StorageType +chip_ime_AppendCommand_OtaSoftwareUpdateProvider_NotifyUpdateApplied(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * updateToken, + uint32_t updateToken_Len, uint32_t softwareVersion) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OtaSoftwareUpdateProviderCluster cluster; @@ -5765,7 +5740,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_No return cluster.NotifyUpdateApplied(nullptr, nullptr, chip::ByteSpan(updateToken, updateToken_Len), softwareVersion).AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_QueryImage( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::VendorId vendorId, uint16_t productId, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::VendorId vendorId, uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, uint16_t hardwareVersion, const uint8_t * location, uint32_t location_Len, bool requestorCanConsent, const uint8_t * metadataForProvider, uint32_t metadataForProvider_Len) { @@ -5779,7 +5754,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_Qu .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateProvider_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateProvider_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5793,7 +5768,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateProvider_Cl // Cluster OtaSoftwareUpdateRequestor chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateRequestor_AnnounceOtaProvider( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::NodeId providerLocation, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::NodeId providerLocation, chip::VendorId vendorId, uint8_t announcementReason, const uint8_t * metadataForNode, uint32_t metadataForNode_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5805,7 +5780,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateRequestor_A .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_DefaultOtaProvider(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_DefaultOtaProvider(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5816,8 +5791,10 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_D .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_OtaSoftwareUpdateRequestor_DefaultOtaProvider( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, size_t len) +chip::ChipError::StorageType chip_ime_WriteAttribute_OtaSoftwareUpdateRequestor_DefaultOtaProvider(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t * value, + size_t len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OtaSoftwareUpdateRequestorCluster cluster; @@ -5827,7 +5804,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_OtaSoftwareUpdateRequestor_ chip::ByteSpan(value, len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_UpdatePossible(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_UpdatePossible(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5837,7 +5814,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_U return cluster.ReadAttributeUpdatePossible(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5850,7 +5827,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OtaSoftwareUpdateRequestor_C // End of Cluster OtaSoftwareUpdateRequestor // Cluster OccupancySensing -chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_Occupancy(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_Occupancy(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5860,7 +5837,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_Occupancy(c return cluster.ReadAttributeOccupancy(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_OccupancySensing_Occupancy(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_OccupancySensing_Occupancy(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -5872,7 +5849,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_OccupancySensing_Occupa .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySensorType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySensorType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5882,7 +5859,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySe return cluster.ReadAttributeOccupancySensorType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySensorTypeBitmap(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySensorTypeBitmap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5893,7 +5870,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_OccupancySe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5906,7 +5883,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OccupancySensing_ClusterRevi // End of Cluster OccupancySensing // Cluster OnOff -chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_Off(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_Off(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5914,16 +5891,15 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_Off(chip::Controller:: cluster.Associate(device, ZCLendpointId); return cluster.Off(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OffWithEffect(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t effectId, uint8_t effectVariant) +chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OffWithEffect(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t effectId, uint8_t effectVariant) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.OffWithEffect(nullptr, nullptr, effectId, effectVariant).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_On(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_On(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5931,7 +5907,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_On(chip::Controller::D cluster.Associate(device, ZCLendpointId); return cluster.On(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OnWithRecallGlobalScene(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OnWithRecallGlobalScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5939,9 +5915,8 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OnWithRecallGlobalScen cluster.Associate(device, ZCLendpointId); return cluster.OnWithRecallGlobalScene(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OnWithTimedOff(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t onOffControl, uint16_t onTime, +chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OnWithTimedOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t onOffControl, uint16_t onTime, uint16_t offWaitTime) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5949,7 +5924,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_OnWithTimedOff(chip::C cluster.Associate(device, ZCLendpointId); return cluster.OnWithTimedOff(nullptr, nullptr, onOffControl, onTime, offWaitTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_Toggle(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_Toggle(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5958,7 +5933,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OnOff_Toggle(chip::Controlle return cluster.Toggle(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnOff(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5967,9 +5942,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnOff(chip::Controller return cluster.ReadAttributeOnOff(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_OnOff_OnOff(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, uint16_t minInterval, - uint16_t maxInterval) +chip::ChipError::StorageType chip_ime_SubscribeAttribute_OnOff_OnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; @@ -5979,7 +5953,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_OnOff_OnOff(chip::Contr .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_GlobalSceneControl(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_GlobalSceneControl(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -5990,7 +5964,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_GlobalSceneControl(chi .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnTime(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -5999,7 +5973,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OnTime(chip::Controlle return cluster.ReadAttributeOnTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_OnTime(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_OnTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6007,8 +5981,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_OnTime(chip::Controll cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeOnTime(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OffWaitTime(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OffWaitTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6017,17 +5990,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_OffWaitTime(chip::Cont return cluster.ReadAttributeOffWaitTime(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_OffWaitTime(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_OffWaitTime(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeOffWaitTime(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_StartUpOnOff(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_StartUpOnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6036,9 +6007,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_StartUpOnOff(chip::Con return cluster.ReadAttributeStartUpOnOff(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_StartUpOnOff(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_StartUpOnOff(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; @@ -6046,8 +6016,8 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_OnOff_StartUpOnOff(chip::Co return cluster.WriteAttributeStartUpOnOff(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_FeatureMap(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OnOffCluster cluster; @@ -6055,7 +6025,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_FeatureMap(chip::Contr return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6068,7 +6038,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOff_ClusterRevision(chip:: // End of Cluster OnOff // Cluster OnOffSwitchConfiguration -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_SwitchType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_SwitchType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6078,7 +6048,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_Swi return cluster.ReadAttributeSwitchType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_SwitchActions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_SwitchActions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6088,7 +6058,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_Swi return cluster.ReadAttributeSwitchActions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_OnOffSwitchConfiguration_SwitchActions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_OnOffSwitchConfiguration_SwitchActions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -6098,7 +6068,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_OnOffSwitchConfiguration_Sw return cluster.WriteAttributeSwitchActions(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6112,10 +6082,10 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OnOffSwitchConfiguration_Clu // Cluster OperationalCredentials chip::ChipError::StorageType -chip_ime_AppendCommand_OperationalCredentials_AddNOC(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, - chip::GroupId, const uint8_t * NOCValue, uint32_t NOCValue_Len, - const uint8_t * ICACValue, uint32_t ICACValue_Len, const uint8_t * IPKValue, - uint32_t IPKValue_Len, chip::NodeId caseAdminNode, uint16_t adminVendorId) +chip_ime_AppendCommand_OperationalCredentials_AddNOC(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * NOCValue, uint32_t NOCValue_Len, const uint8_t * ICACValue, + uint32_t ICACValue_Len, const uint8_t * IPKValue, uint32_t IPKValue_Len, + chip::NodeId caseAdminNode, uint16_t adminVendorId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; @@ -6125,16 +6095,17 @@ chip_ime_AppendCommand_OperationalCredentials_AddNOC(chip::Controller::Device * chip::ByteSpan(IPKValue, IPKValue_Len), caseAdminNode, adminVendorId) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_AddTrustedRootCertificate( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * rootCertificate, - uint32_t rootCertificate_Len) +chip::ChipError::StorageType +chip_ime_AppendCommand_OperationalCredentials_AddTrustedRootCertificate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, const uint8_t * rootCertificate, + uint32_t rootCertificate_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.AddTrustedRootCertificate(nullptr, nullptr, chip::ByteSpan(rootCertificate, rootCertificate_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_AttestationRequest(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_AttestationRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * attestationNonce, @@ -6145,15 +6116,17 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_Attes cluster.Associate(device, ZCLendpointId); return cluster.AttestationRequest(nullptr, nullptr, chip::ByteSpan(attestationNonce, attestationNonce_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_CertificateChainRequest( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t certificateType) +chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_CertificateChainRequest(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId, + uint8_t certificateType) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.CertificateChainRequest(nullptr, nullptr, certificateType).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_OpCSRRequest(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_OpCSRRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * CSRNonce, uint32_t CSRNonce_Len) @@ -6163,7 +6136,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_OpCSR cluster.Associate(device, ZCLendpointId); return cluster.OpCSRRequest(nullptr, nullptr, chip::ByteSpan(CSRNonce, CSRNonce_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_RemoveFabric(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_RemoveFabric(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t fabricIndex) { @@ -6173,7 +6146,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_Remov return cluster.RemoveFabric(nullptr, nullptr, fabricIndex).AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_RemoveTrustedRootCertificate( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * trustedRootIdentifier, + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * trustedRootIdentifier, uint32_t trustedRootIdentifier_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6182,7 +6155,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_Remov return cluster.RemoveTrustedRootCertificate(nullptr, nullptr, chip::ByteSpan(trustedRootIdentifier, trustedRootIdentifier_Len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_UpdateFabricLabel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_UpdateFabricLabel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * label, uint32_t label_Len) @@ -6194,9 +6167,9 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OperationalCredentials_Updat .AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_OperationalCredentials_UpdateNOC(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, - chip::GroupId, const uint8_t * NOCValue, uint32_t NOCValue_Len, - const uint8_t * ICACValue, uint32_t ICACValue_Len) +chip_ime_AppendCommand_OperationalCredentials_UpdateNOC(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, + const uint8_t * NOCValue, uint32_t NOCValue_Len, const uint8_t * ICACValue, + uint32_t ICACValue_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; @@ -6205,7 +6178,7 @@ chip_ime_AppendCommand_OperationalCredentials_UpdateNOC(chip::Controller::Device .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_FabricsList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_FabricsList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6218,7 +6191,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Fabri .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_SupportedFabrics(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_SupportedFabrics(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6228,7 +6201,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Suppo return cluster.ReadAttributeSupportedFabrics(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_CommissionedFabrics(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_CommissionedFabrics(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6238,8 +6211,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Commi return cluster.ReadAttributeCommissionedFabrics(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_TrustedRootCertificates( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_TrustedRootCertificates(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OperationalCredentialsCluster cluster; @@ -6250,7 +6224,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Trust .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_CurrentFabricIndex(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_CurrentFabricIndex(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6260,7 +6234,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Curre return cluster.ReadAttributeCurrentFabricIndex(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6273,8 +6247,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_OperationalCredentials_Clust // End of Cluster OperationalCredentials // Cluster PowerSource -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Status(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Status(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6283,8 +6256,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Status(chip::Con return cluster.ReadAttributeStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Order(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Order(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6293,7 +6265,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Order(chip::Cont return cluster.ReadAttributeOrder(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Description(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Description(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6303,7 +6275,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_Description(chip return cluster.ReadAttributeDescription(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryVoltage(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryVoltage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6313,7 +6285,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryVoltage(c return cluster.ReadAttributeBatteryVoltage(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryPercentRemaining(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryPercentRemaining(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6324,7 +6296,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryPercentRe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryTimeRemaining(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryTimeRemaining(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6335,7 +6307,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryTimeRemai .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryChargeLevel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryChargeLevel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6345,7 +6317,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryChargeLev return cluster.ReadAttributeBatteryChargeLevel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_ActiveBatteryFaults(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_ActiveBatteryFaults(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6358,7 +6330,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_ActiveBatteryFau .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryChargeState(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryChargeState(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6368,7 +6340,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_BatteryChargeSta return cluster.ReadAttributeBatteryChargeState(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_FeatureMap(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6378,7 +6350,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_FeatureMap(chip: return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6391,7 +6363,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PowerSource_ClusterRevision( // End of Cluster PowerSource // Cluster PressureMeasurement -chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6401,7 +6373,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_Measured return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_PressureMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_PressureMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -6415,7 +6387,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_PressureMeasurement_Mea .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MinMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MinMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6425,7 +6397,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MinMeasu return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MaxMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MaxMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6435,7 +6407,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_MaxMeasu return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6448,7 +6420,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PressureMeasurement_ClusterR // End of Cluster PressureMeasurement // Cluster PumpConfigurationAndControl -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxPressure(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxPressure(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6458,7 +6430,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxSpeed(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxSpeed(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6468,7 +6440,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxSpeed(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxFlow(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxFlow(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6478,7 +6450,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxFlow(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstPressure(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstPressure(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6488,7 +6460,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMinConstPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstPressure(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstPressure(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6498,7 +6470,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxConstPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinCompPressure(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinCompPressure(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6508,7 +6480,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMinCompPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxCompPressure(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxCompPressure(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6518,7 +6490,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxCompPressure(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstSpeed(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstSpeed(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6528,7 +6500,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMinConstSpeed(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstSpeed(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstSpeed(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6538,7 +6510,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxConstSpeed(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstFlow(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstFlow(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6548,7 +6520,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMinConstFlow(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstFlow(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstFlow(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6558,7 +6530,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxConstFlow(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstTemp(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MinConstTemp(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6568,7 +6540,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMinConstTemp(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstTemp(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_MaxConstTemp(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6578,7 +6550,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeMaxConstTemp(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_PumpStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_PumpStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6588,7 +6560,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributePumpStatus(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_PumpConfigurationAndControl_PumpStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_PumpConfigurationAndControl_PumpStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -6602,7 +6574,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_PumpConfigurationAndCon } chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_EffectiveOperationMode( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; @@ -6611,8 +6583,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_EffectiveControlMode( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_EffectiveControlMode(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; @@ -6621,7 +6594,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_Capacity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_Capacity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6631,7 +6604,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeCapacity(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_PumpConfigurationAndControl_Capacity(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_PumpConfigurationAndControl_Capacity(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -6644,7 +6617,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_PumpConfigurationAndCon .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_Speed(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_Speed(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6655,7 +6628,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ } chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_LifetimeEnergyConsumed( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::PumpConfigurationAndControlCluster cluster; @@ -6664,7 +6637,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_OperationMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_OperationMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6674,7 +6647,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeOperationMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_PumpConfigurationAndControl_OperationMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_PumpConfigurationAndControl_OperationMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -6684,7 +6657,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_PumpConfigurationAndControl return cluster.WriteAttributeOperationMode(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ControlMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ControlMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6694,7 +6667,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeControlMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_PumpConfigurationAndControl_ControlMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_PumpConfigurationAndControl_ControlMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -6703,7 +6676,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_PumpConfigurationAndControl cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeControlMode(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_AlarmMask(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_AlarmMask(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6713,7 +6686,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeAlarmMask(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_FeatureMap(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6723,7 +6696,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6736,7 +6709,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_PumpConfigurationAndControl_ // End of Cluster PumpConfigurationAndControl // Cluster RelativeHumidityMeasurement -chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6746,8 +6719,10 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ return cluster.ReadAttributeMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_RelativeHumidityMeasurement_MeasuredValue( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) +chip::ChipError::StorageType chip_ime_SubscribeAttribute_RelativeHumidityMeasurement_MeasuredValue(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + uint16_t minInterval, + uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::RelativeHumidityMeasurementCluster cluster; @@ -6758,7 +6733,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_RelativeHumidityMeasure .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_MinMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_MinMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6768,7 +6743,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ return cluster.ReadAttributeMinMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_MaxMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_MaxMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6778,7 +6753,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ return cluster.ReadAttributeMaxMeasuredValue(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_Tolerance(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_Tolerance(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6788,7 +6763,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ return cluster.ReadAttributeTolerance(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_RelativeHumidityMeasurement_Tolerance(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_RelativeHumidityMeasurement_Tolerance(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -6801,7 +6776,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_RelativeHumidityMeasure .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6814,11 +6789,11 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_RelativeHumidityMeasurement_ // End of Cluster RelativeHumidityMeasurement // Cluster Scenes -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_AddScene(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t groupId, - uint8_t sceneId, uint16_t transitionTime, - const uint8_t * sceneName, uint32_t sceneName_Len, - chip::ClusterId clusterId, uint8_t length, uint8_t value) +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_AddScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId, + uint16_t transitionTime, const uint8_t * sceneName, + uint32_t sceneName_Len, chip::ClusterId clusterId, + uint8_t length, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; @@ -6828,7 +6803,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_AddScene(chip::Contro chip::CharSpan(reinterpret_cast(sceneName), sceneName_Len), clusterId, length, value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_GetSceneMembership(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_GetSceneMembership(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t groupId) { @@ -6837,16 +6812,16 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_GetSceneMembership(ch cluster.Associate(device, ZCLendpointId); return cluster.GetSceneMembership(nullptr, nullptr, groupId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RecallScene(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t groupId, uint8_t sceneId, uint16_t transitionTime) +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RecallScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId, + uint16_t transitionTime) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.RecallScene(nullptr, nullptr, groupId, sceneId, transitionTime).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RemoveAllScenes(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RemoveAllScenes(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t groupId) { @@ -6855,27 +6830,24 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RemoveAllScenes(chip: cluster.Associate(device, ZCLendpointId); return cluster.RemoveAllScenes(nullptr, nullptr, groupId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RemoveScene(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t groupId, uint8_t sceneId) +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_RemoveScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.RemoveScene(nullptr, nullptr, groupId, sceneId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_StoreScene(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t groupId, uint8_t sceneId) +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_StoreScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.StoreScene(nullptr, nullptr, groupId, sceneId).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_ViewScene(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t groupId, uint8_t sceneId) +chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_ViewScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t groupId, uint8_t sceneId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ScenesCluster cluster; @@ -6883,8 +6855,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Scenes_ViewScene(chip::Contr return cluster.ViewScene(nullptr, nullptr, groupId, sceneId).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneCount(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6893,8 +6864,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneCount(chip::Cont return cluster.ReadAttributeSceneCount(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentScene(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentScene(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6903,8 +6873,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentScene(chip::Co return cluster.ReadAttributeCurrentScene(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentGroup(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentGroup(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6913,8 +6882,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_CurrentGroup(chip::Co return cluster.ReadAttributeCurrentGroup(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneValid(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneValid(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6923,8 +6891,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_SceneValid(chip::Cont return cluster.ReadAttributeSceneValid(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_NameSupport(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_NameSupport(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -6933,7 +6900,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_NameSupport(chip::Con return cluster.ReadAttributeNameSupport(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6946,7 +6913,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Scenes_ClusterRevision(chip: // End of Cluster Scenes // Cluster SoftwareDiagnostics -chip::ChipError::StorageType chip_ime_AppendCommand_SoftwareDiagnostics_ResetWatermarks(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_SoftwareDiagnostics_ResetWatermarks(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { @@ -6956,7 +6923,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_SoftwareDiagnostics_ResetWat return cluster.ResetWatermarks(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentHeapFree(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentHeapFree(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6966,7 +6933,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentH return cluster.ReadAttributeCurrentHeapFree(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentHeapUsed(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentHeapUsed(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6976,7 +6943,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentH return cluster.ReadAttributeCurrentHeapUsed(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentHeapHighWatermark(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentHeapHighWatermark(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -6987,7 +6954,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_CurrentH .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7000,7 +6967,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_SoftwareDiagnostics_ClusterR // End of Cluster SoftwareDiagnostics // Cluster Switch -chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_NumberOfPositions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_NumberOfPositions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7010,7 +6977,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_NumberOfPositions(chi return cluster.ReadAttributeNumberOfPositions(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_CurrentPosition(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_CurrentPosition(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7020,7 +6987,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_CurrentPosition(chip: return cluster.ReadAttributeCurrentPosition(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_Switch_CurrentPosition(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_Switch_CurrentPosition(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -7033,8 +7000,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_Switch_CurrentPosition( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_MultiPressMax(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_MultiPressMax(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7043,8 +7009,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_MultiPressMax(chip::C return cluster.ReadAttributeMultiPressMax(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_FeatureMap(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7053,7 +7018,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_FeatureMap(chip::Cont return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7066,7 +7031,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Switch_ClusterRevision(chip: // End of Cluster Switch // Cluster TvChannel -chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_ChangeChannel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_ChangeChannel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, const uint8_t * match, uint32_t match_Len) { @@ -7075,7 +7040,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_ChangeChannel(chip cluster.Associate(device, ZCLendpointId); return cluster.ChangeChannel(nullptr, nullptr, chip::CharSpan(reinterpret_cast(match), match_Len)).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_ChangeChannelByNumber(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_ChangeChannelByNumber(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t majorNumber, uint16_t minorNumber) { @@ -7084,7 +7049,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_ChangeChannelByNum cluster.Associate(device, ZCLendpointId); return cluster.ChangeChannelByNumber(nullptr, nullptr, majorNumber, minorNumber).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_SkipChannel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_SkipChannel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t count) { @@ -7094,7 +7059,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TvChannel_SkipChannel(chip:: return cluster.SkipChannel(nullptr, nullptr, count).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7106,7 +7071,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelList(chip .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelLineup(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelLineup(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7117,7 +7082,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_TvChannelLineup(ch .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_CurrentTvChannel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_CurrentTvChannel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7128,7 +7093,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_CurrentTvChannel(c .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7141,7 +7106,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TvChannel_ClusterRevision(ch // End of Cluster TvChannel // Cluster TargetNavigator -chip::ChipError::StorageType chip_ime_AppendCommand_TargetNavigator_NavigateTarget(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TargetNavigator_NavigateTarget(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t target, const uint8_t * data, uint32_t data_Len) @@ -7153,7 +7118,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TargetNavigator_NavigateTarg .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_TargetNavigatorList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_TargetNavigatorList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7166,7 +7131,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_TargetNaviga .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7179,7 +7144,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TargetNavigator_ClusterRevis // End of Cluster TargetNavigator // Cluster TemperatureMeasurement -chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7189,7 +7154,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Measu return cluster.ReadAttributeMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_TemperatureMeasurement_MeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_TemperatureMeasurement_MeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -7203,7 +7168,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_TemperatureMeasurement_ .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MinMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MinMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7213,7 +7178,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MinMe return cluster.ReadAttributeMinMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MaxMeasuredValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MaxMeasuredValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7223,7 +7188,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_MaxMe return cluster.ReadAttributeMaxMeasuredValue(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Tolerance(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Tolerance(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7233,7 +7198,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Toler return cluster.ReadAttributeTolerance(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_TemperatureMeasurement_Tolerance(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_TemperatureMeasurement_Tolerance(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -7246,7 +7211,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_TemperatureMeasurement_ .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7259,15 +7224,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TemperatureMeasurement_Clust // End of Cluster TemperatureMeasurement // Cluster TestCluster -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_Test(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId) +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_Test(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.Test(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestAddArguments(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestAddArguments(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t arg1, uint8_t arg2) { @@ -7276,7 +7241,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestAddArguments cluster.Associate(device, ZCLendpointId); return cluster.TestAddArguments(nullptr, nullptr, arg1, arg2).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestEnumsRequest(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestEnumsRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::VendorId arg1, uint8_t arg2) { @@ -7285,7 +7250,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestEnumsRequest cluster.Associate(device, ZCLendpointId); return cluster.TestEnumsRequest(nullptr, nullptr, arg1, arg2).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestListInt8UArgumentRequest(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestListInt8UArgumentRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t arg1) { @@ -7294,7 +7259,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestListInt8UArg cluster.Associate(device, ZCLendpointId); return cluster.TestListInt8UArgumentRequest(nullptr, nullptr, arg1).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestListInt8UReverseRequest(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestListInt8UReverseRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t arg1) { @@ -7304,7 +7269,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestListInt8URev return cluster.TestListInt8UReverseRequest(nullptr, nullptr, arg1).AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_TestCluster_TestListStructArgumentRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip_ime_AppendCommand_TestCluster_TestListStructArgumentRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t a, bool b, uint8_t c, const uint8_t * d, uint32_t d_Len, const uint8_t * e, uint32_t e_Len, uint8_t f) { @@ -7316,7 +7281,7 @@ chip_ime_AppendCommand_TestCluster_TestListStructArgumentRequest(chip::Controlle chip::CharSpan(reinterpret_cast(e), e_Len), f) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestNotHandled(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestNotHandled(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7324,7 +7289,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestNotHandled(c cluster.Associate(device, ZCLendpointId); return cluster.TestNotHandled(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestNullableOptionalRequest(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestNullableOptionalRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t arg1) { @@ -7333,7 +7298,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestNullableOpti cluster.Associate(device, ZCLendpointId); return cluster.TestNullableOptionalRequest(nullptr, nullptr, arg1).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestSpecific(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestSpecific(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7342,7 +7307,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestSpecific(chi return cluster.TestSpecific(nullptr, nullptr).AsInteger(); } chip::ChipError::StorageType -chip_ime_AppendCommand_TestCluster_TestStructArgumentRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, +chip_ime_AppendCommand_TestCluster_TestStructArgumentRequest(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t a, bool b, uint8_t c, const uint8_t * d, uint32_t d_Len, const uint8_t * e, uint32_t e_Len, uint8_t f) { @@ -7354,7 +7319,7 @@ chip_ime_AppendCommand_TestCluster_TestStructArgumentRequest(chip::Controller::D chip::CharSpan(reinterpret_cast(e), e_Len), f) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestUnknownCommand(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestUnknownCommand(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7363,8 +7328,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_TestCluster_TestUnknownComma return cluster.TestUnknownCommand(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Boolean(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Boolean(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7373,16 +7337,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Boolean(chip::Co return cluster.ReadAttributeBoolean(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Boolean(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, bool value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Boolean(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, bool value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeBoolean(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap8(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap8(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7391,17 +7354,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap8(chip::Co return cluster.ReadAttributeBitmap8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap8(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap8(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeBitmap8(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap16(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap16(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7410,7 +7371,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap16(chip::C return cluster.ReadAttributeBitmap16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap16(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap16(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t value) { @@ -7419,8 +7380,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap16(chip:: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeBitmap16(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap32(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap32(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7429,7 +7389,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap32(chip::C return cluster.ReadAttributeBitmap32(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap32(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap32(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint32_t value) { @@ -7438,8 +7398,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap32(chip:: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeBitmap32(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap64(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap64(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7448,7 +7407,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Bitmap64(chip::C return cluster.ReadAttributeBitmap64(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap64(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap64(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint64_t value) { @@ -7457,8 +7416,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Bitmap64(chip:: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeBitmap64(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7467,16 +7425,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8u(chip::Cont return cluster.ReadAttributeInt8u(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int8u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int8u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt8u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7485,17 +7442,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16u(chip::Con return cluster.ReadAttributeInt16u(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int16u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int16u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt16u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7504,17 +7459,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32u(chip::Con return cluster.ReadAttributeInt32u(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int32u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint32_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int32u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint32_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt32u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7523,17 +7476,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64u(chip::Con return cluster.ReadAttributeInt64u(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int64u(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint64_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int64u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint64_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt64u(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7542,16 +7493,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int8s(chip::Cont return cluster.ReadAttributeInt8s(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int8s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, int8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int8s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, int8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt8s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7560,17 +7510,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int16s(chip::Con return cluster.ReadAttributeInt16s(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int16s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - int16_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int16s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, int16_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt16s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7579,17 +7527,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int32s(chip::Con return cluster.ReadAttributeInt32s(gInt32sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int32s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - int32_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int32s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, int32_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt32s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7598,17 +7544,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Int64s(chip::Con return cluster.ReadAttributeInt64s(gInt64sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int64s(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - int64_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Int64s(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, int64_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeInt64s(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum8(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum8(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7617,16 +7561,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum8(chip::Cont return cluster.ReadAttributeEnum8(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Enum8(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Enum8(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeEnum8(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum16(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum16(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7635,16 +7578,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Enum16(chip::Con return cluster.ReadAttributeEnum16(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Enum16(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint16_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Enum16(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint16_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeEnum16(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_OctetString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_OctetString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7654,7 +7596,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_OctetString(chip return cluster.ReadAttributeOctetString(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_OctetString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_OctetString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, size_t len) { @@ -7665,7 +7607,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_OctetString(chi .WriteAttributeOctetString(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), chip::ByteSpan(value, len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListInt8u(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListInt8u(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7676,7 +7618,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListInt8u(chip:: .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListOctetString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListOctetString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7688,7 +7630,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListOctetString( .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListStructOctetString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListStructOctetString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7701,7 +7643,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListStructOctetS .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongOctetString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongOctetString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7712,7 +7654,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongOctetString( .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongOctetString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongOctetString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, size_t len) { @@ -7724,7 +7666,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongOctetString chip::ByteSpan(value, len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_CharString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_CharString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7734,7 +7676,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_CharString(chip: return cluster.ReadAttributeCharString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_CharString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_CharString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, size_t len) { @@ -7746,7 +7688,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_CharString(chip chip::CharSpan(reinterpret_cast(value), len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongCharString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongCharString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7756,7 +7698,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_LongCharString(c return cluster.ReadAttributeLongCharString(gCharStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongCharString(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongCharString(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t * value, size_t len) { @@ -7768,8 +7710,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_LongCharString( chip::CharSpan(reinterpret_cast(value), len)) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_EpochUs(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_EpochUs(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7778,17 +7719,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_EpochUs(chip::Co return cluster.ReadAttributeEpochUs(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_EpochUs(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint64_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_EpochUs(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint64_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeEpochUs(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_EpochS(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_EpochS(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7797,17 +7736,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_EpochS(chip::Con return cluster.ReadAttributeEpochS(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_EpochS(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint32_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_EpochS(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint32_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::TestClusterCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeEpochS(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_VendorId(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_VendorId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7816,7 +7753,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_VendorId(chip::C return cluster.ReadAttributeVendorId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_VendorId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_VendorId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::VendorId value) { @@ -7825,7 +7762,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_VendorId(chip:: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeVendorId(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListNullablesAndOptionalsStruct(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListNullablesAndOptionalsStruct(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7838,7 +7775,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ListNullablesAnd .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Unsupported(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Unsupported(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7848,7 +7785,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_Unsupported(chip return cluster.ReadAttributeUnsupported(gBooleanAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Unsupported(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Unsupported(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, bool value) { @@ -7857,7 +7794,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_TestCluster_Unsupported(chi cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeUnsupported(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7870,7 +7807,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_TestCluster_ClusterRevision( // End of Cluster TestCluster // Cluster Thermostat -chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_ClearWeeklySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_ClearWeeklySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7878,7 +7815,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_ClearWeeklySchedu cluster.Associate(device, ZCLendpointId); return cluster.ClearWeeklySchedule(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_GetRelayStatusLog(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_GetRelayStatusLog(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -7886,7 +7823,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_GetRelayStatusLog cluster.Associate(device, ZCLendpointId); return cluster.GetRelayStatusLog(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_GetWeeklySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_GetWeeklySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t daysToReturn, uint8_t modeToReturn) { @@ -7895,7 +7832,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_GetWeeklySchedule cluster.Associate(device, ZCLendpointId); return cluster.GetWeeklySchedule(nullptr, nullptr, daysToReturn, modeToReturn).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_SetWeeklySchedule(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_SetWeeklySchedule(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, @@ -7908,7 +7845,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_SetWeeklySchedule .SetWeeklySchedule(nullptr, nullptr, numberOfTransitionsForSequence, dayOfWeekForSequence, modeForSequence, payload) .AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_SetpointRaiseLower(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_SetpointRaiseLower(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t mode, int8_t amount) { @@ -7918,7 +7855,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_Thermostat_SetpointRaiseLowe return cluster.SetpointRaiseLower(nullptr, nullptr, mode, amount).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_LocalTemperature(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_LocalTemperature(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7928,7 +7865,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_LocalTemperature( return cluster.ReadAttributeLocalTemperature(gInt16sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_Thermostat_LocalTemperature(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_Thermostat_LocalTemperature(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -7941,7 +7878,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_Thermostat_LocalTempera .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinHeatSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinHeatSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7952,7 +7889,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinHeatSetpoin .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxHeatSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxHeatSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7963,7 +7900,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxHeatSetpoin .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinCoolSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinCoolSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7974,7 +7911,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMinCoolSetpoin .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxCoolSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxCoolSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7985,7 +7922,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_AbsMaxCoolSetpoin .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedCoolingSetpoint(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedCoolingSetpoint(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -7996,7 +7933,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedCoolingSe .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_OccupiedCoolingSetpoint(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_OccupiedCoolingSetpoint(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t value) { @@ -8006,7 +7943,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_OccupiedCoolingS return cluster.WriteAttributeOccupiedCoolingSetpoint(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedHeatingSetpoint(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedHeatingSetpoint(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8017,7 +7954,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_OccupiedHeatingSe .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_OccupiedHeatingSetpoint(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_OccupiedHeatingSetpoint(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t value) { @@ -8027,7 +7964,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_OccupiedHeatingS return cluster.WriteAttributeOccupiedHeatingSetpoint(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinHeatSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinHeatSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8038,7 +7975,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinHeatSetpointLi .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinHeatSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinHeatSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t value) { @@ -8048,7 +7985,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinHeatSetpointL return cluster.WriteAttributeMinHeatSetpointLimit(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxHeatSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxHeatSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8059,7 +7996,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxHeatSetpointLi .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MaxHeatSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MaxHeatSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t value) { @@ -8069,7 +8006,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MaxHeatSetpointL return cluster.WriteAttributeMaxHeatSetpointLimit(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinCoolSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinCoolSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8080,7 +8017,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinCoolSetpointLi .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinCoolSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinCoolSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t value) { @@ -8090,7 +8027,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinCoolSetpointL return cluster.WriteAttributeMinCoolSetpointLimit(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxCoolSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxCoolSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8101,7 +8038,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MaxCoolSetpointLi .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MaxCoolSetpointLimit(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MaxCoolSetpointLimit(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int16_t value) { @@ -8111,7 +8048,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MaxCoolSetpointL return cluster.WriteAttributeMaxCoolSetpointLimit(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinSetpointDeadBand(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinSetpointDeadBand(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8121,7 +8058,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_MinSetpointDeadBa return cluster.ReadAttributeMinSetpointDeadBand(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinSetpointDeadBand(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinSetpointDeadBand(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, int8_t value) { @@ -8131,7 +8068,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_MinSetpointDeadB return cluster.WriteAttributeMinSetpointDeadBand(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ControlSequenceOfOperation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ControlSequenceOfOperation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8142,7 +8079,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ControlSequenceOf .AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_ControlSequenceOfOperation(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_ControlSequenceOfOperation(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -8153,7 +8090,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_ControlSequenceO .WriteAttributeControlSequenceOfOperation(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value) .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_SystemMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_SystemMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8163,7 +8100,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_SystemMode(chip:: return cluster.ReadAttributeSystemMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_SystemMode(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_SystemMode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { @@ -8172,7 +8109,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_Thermostat_SystemMode(chip: cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeSystemMode(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_StartOfWeek(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_StartOfWeek(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8182,7 +8119,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_StartOfWeek(chip: return cluster.ReadAttributeStartOfWeek(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfWeeklyTransitions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfWeeklyTransitions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8193,7 +8130,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfWeeklyTra .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfDailyTransitions(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfDailyTransitions(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8204,7 +8141,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_NumberOfDailyTran .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_FeatureMap(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8214,7 +8151,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_FeatureMap(chip:: return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8228,7 +8165,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_Thermostat_ClusterRevision(c // Cluster ThermostatUserInterfaceConfiguration chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfiguration_TemperatureDisplayMode( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8238,7 +8175,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi } chip::ChipError::StorageType chip_ime_WriteAttribute_ThermostatUserInterfaceConfiguration_TemperatureDisplayMode( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8247,7 +8184,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ThermostatUserInterfaceConf .AsInteger(); } chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfiguration_KeypadLockout( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8256,7 +8193,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi } chip::ChipError::StorageType chip_ime_WriteAttribute_ThermostatUserInterfaceConfiguration_KeypadLockout( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8265,7 +8202,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ThermostatUserInterfaceConf .AsInteger(); } chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfiguration_ScheduleProgrammingVisibility( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8275,7 +8212,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi } chip::ChipError::StorageType chip_ime_WriteAttribute_ThermostatUserInterfaceConfiguration_ScheduleProgrammingVisibility( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8285,7 +8222,7 @@ chip::ChipError::StorageType chip_ime_WriteAttribute_ThermostatUserInterfaceConf .AsInteger(); } chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfiguration_ClusterRevision( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; @@ -8296,7 +8233,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThermostatUserInterfaceConfi // End of Cluster ThermostatUserInterfaceConfiguration // Cluster ThreadNetworkDiagnostics -chip::ChipError::StorageType chip_ime_AppendCommand_ThreadNetworkDiagnostics_ResetCounts(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_ThreadNetworkDiagnostics_ResetCounts(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { @@ -8306,7 +8243,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_ThreadNetworkDiagnostics_Res return cluster.ResetCounts(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Channel(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Channel(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8316,7 +8253,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Cha return cluster.ReadAttributeChannel(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RoutingRole(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RoutingRole(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8326,7 +8263,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Rou return cluster.ReadAttributeRoutingRole(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_NetworkName(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_NetworkName(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8336,7 +8273,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Net return cluster.ReadAttributeNetworkName(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PanId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PanId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8346,7 +8283,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Pan return cluster.ReadAttributePanId(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ExtendedPanId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ExtendedPanId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8356,7 +8293,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Ext return cluster.ReadAttributeExtendedPanId(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_MeshLocalPrefix(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_MeshLocalPrefix(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8367,7 +8304,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Mes .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_OverrunCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_OverrunCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8377,7 +8314,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Ove return cluster.ReadAttributeOverrunCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_NeighborTableList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_NeighborTableList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8390,7 +8327,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Nei .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RouteTableList(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RouteTableList(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8403,7 +8340,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Rou .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PartitionId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PartitionId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8413,7 +8350,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Par return cluster.ReadAttributePartitionId(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Weighting(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Weighting(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8423,7 +8360,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Wei return cluster.ReadAttributeWeighting(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_DataVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_DataVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8433,7 +8370,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Dat return cluster.ReadAttributeDataVersion(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_StableDataVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_StableDataVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8443,7 +8380,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Sta return cluster.ReadAttributeStableDataVersion(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_LeaderRouterId(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_LeaderRouterId(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8453,7 +8390,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Lea return cluster.ReadAttributeLeaderRouterId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_DetachedRoleCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_DetachedRoleCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8463,7 +8400,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Det return cluster.ReadAttributeDetachedRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ChildRoleCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ChildRoleCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8473,7 +8410,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Chi return cluster.ReadAttributeChildRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RouterRoleCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RouterRoleCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8483,7 +8420,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Rou return cluster.ReadAttributeRouterRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_LeaderRoleCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_LeaderRoleCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8493,7 +8430,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Lea return cluster.ReadAttributeLeaderRoleCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_AttachAttemptCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_AttachAttemptCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8503,8 +8440,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Att return cluster.ReadAttributeAttachAttemptCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PartitionIdChangeCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PartitionIdChangeCount(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8514,7 +8452,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Par } chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_BetterPartitionAttachAttemptCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8524,7 +8462,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Bet .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ParentChangeCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ParentChangeCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8534,7 +8472,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Par return cluster.ReadAttributeParentChangeCount(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxTotalCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxTotalCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8544,7 +8482,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxT return cluster.ReadAttributeTxTotalCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxUnicastCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxUnicastCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8554,7 +8492,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxU return cluster.ReadAttributeTxUnicastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxBroadcastCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxBroadcastCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8564,7 +8502,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxB return cluster.ReadAttributeTxBroadcastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxAckRequestedCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxAckRequestedCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8575,7 +8513,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxA .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxAckedCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxAckedCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8585,8 +8523,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxA return cluster.ReadAttributeTxAckedCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxNoAckRequestedCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxNoAckRequestedCount(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8595,7 +8534,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxN .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxDataCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxDataCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8605,7 +8544,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxD return cluster.ReadAttributeTxDataCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxDataPollCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxDataPollCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8615,7 +8554,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxD return cluster.ReadAttributeTxDataPollCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxBeaconCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxBeaconCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8625,7 +8564,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxB return cluster.ReadAttributeTxBeaconCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxBeaconRequestCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxBeaconRequestCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8636,7 +8575,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxB .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxOtherCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxOtherCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8646,7 +8585,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxO return cluster.ReadAttributeTxOtherCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxRetryCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxRetryCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8657,7 +8596,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxR } chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxDirectMaxRetryExpiryCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8667,7 +8606,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxD } chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxIndirectMaxRetryExpiryCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8676,7 +8615,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxI .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxErrCcaCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxErrCcaCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8686,7 +8625,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxE return cluster.ReadAttributeTxErrCcaCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxErrAbortCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxErrAbortCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8696,8 +8635,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxE return cluster.ReadAttributeTxErrAbortCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxErrBusyChannelCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxErrBusyChannelCount(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8706,7 +8646,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_TxE .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxTotalCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxTotalCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8716,7 +8656,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxT return cluster.ReadAttributeRxTotalCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxUnicastCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxUnicastCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8726,7 +8666,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxU return cluster.ReadAttributeRxUnicastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxBroadcastCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxBroadcastCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8736,7 +8676,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxB return cluster.ReadAttributeRxBroadcastCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDataCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDataCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8746,7 +8686,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD return cluster.ReadAttributeRxDataCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDataPollCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDataPollCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8756,7 +8696,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD return cluster.ReadAttributeRxDataPollCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxBeaconCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxBeaconCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8766,7 +8706,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxB return cluster.ReadAttributeRxBeaconCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxBeaconRequestCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxBeaconRequestCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8777,7 +8717,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxB .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxOtherCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxOtherCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8787,8 +8727,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxO return cluster.ReadAttributeRxOtherCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxAddressFilteredCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxAddressFilteredCount(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8797,8 +8738,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxA .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDestAddrFilteredCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDestAddrFilteredCount(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8807,7 +8749,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDuplicatedCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxDuplicatedCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8817,7 +8759,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxD return cluster.ReadAttributeRxDuplicatedCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrNoFrameCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrNoFrameCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8828,7 +8770,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE } chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrUnknownNeighborCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8837,8 +8779,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrInvalidSrcAddrCount( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType +chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrInvalidSrcAddrCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8847,7 +8790,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrSecCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrSecCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8857,7 +8800,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE return cluster.ReadAttributeRxErrSecCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrFcsCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrFcsCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8867,7 +8810,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE return cluster.ReadAttributeRxErrFcsCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrOtherCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxErrOtherCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8877,7 +8820,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_RxE return cluster.ReadAttributeRxErrOtherCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ActiveTimestamp(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ActiveTimestamp(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8887,7 +8830,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Act return cluster.ReadAttributeActiveTimestamp(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PendingTimestamp(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_PendingTimestamp(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8897,7 +8840,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Pen return cluster.ReadAttributePendingTimestamp(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Delay(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Delay(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8907,7 +8850,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Del return cluster.ReadAttributeDelay(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_SecurityPolicy(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_SecurityPolicy(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8920,7 +8863,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Sec .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ChannelMask(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ChannelMask(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8931,7 +8874,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Cha } chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_OperationalDatasetComponents( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8942,8 +8885,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Ope .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ActiveNetworkFaultsList( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ActiveNetworkFaultsList(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::ThreadNetworkDiagnosticsCluster cluster; @@ -8954,7 +8898,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Act .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8967,7 +8911,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_ThreadNetworkDiagnostics_Clu // End of Cluster ThreadNetworkDiagnostics // Cluster WakeOnLan -chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_WakeOnLanMacAddress(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_WakeOnLanMacAddress(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8978,7 +8922,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_WakeOnLanMacAddres .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -8991,9 +8935,8 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WakeOnLan_ClusterRevision(ch // End of Cluster WakeOnLan // Cluster WiFiNetworkDiagnostics -chip::ChipError::StorageType chip_ime_AppendCommand_WiFiNetworkDiagnostics_ResetCounts(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, - chip::GroupId) +chip::ChipError::StorageType +chip_ime_AppendCommand_WiFiNetworkDiagnostics_ResetCounts(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WiFiNetworkDiagnosticsCluster cluster; @@ -9001,7 +8944,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WiFiNetworkDiagnostics_Reset return cluster.ResetCounts(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Bssid(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Bssid(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9011,7 +8954,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Bssid return cluster.ReadAttributeBssid(gOctetStringAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_SecurityType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_SecurityType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9021,7 +8964,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Secur return cluster.ReadAttributeSecurityType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_WiFiVersion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_WiFiVersion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9031,7 +8974,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_WiFiV return cluster.ReadAttributeWiFiVersion(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_ChannelNumber(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_ChannelNumber(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9041,7 +8984,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Chann return cluster.ReadAttributeChannelNumber(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Rssi(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Rssi(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9051,7 +8994,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Rssi( return cluster.ReadAttributeRssi(gInt8sAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_BeaconLostCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_BeaconLostCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9061,7 +9004,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Beaco return cluster.ReadAttributeBeaconLostCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_BeaconRxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_BeaconRxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9071,7 +9014,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Beaco return cluster.ReadAttributeBeaconRxCount(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketMulticastRxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketMulticastRxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9082,7 +9025,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Packe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketMulticastTxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketMulticastTxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9093,7 +9036,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Packe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketUnicastRxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketUnicastRxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9104,7 +9047,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Packe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketUnicastTxCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_PacketUnicastTxCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9115,7 +9058,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Packe .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_CurrentMaxRate(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_CurrentMaxRate(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9125,7 +9068,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Curre return cluster.ReadAttributeCurrentMaxRate(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_OverrunCount(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_OverrunCount(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9135,7 +9078,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Overr return cluster.ReadAttributeOverrunCount(gInt64uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9148,7 +9091,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WiFiNetworkDiagnostics_Clust // End of Cluster WiFiNetworkDiagnostics // Cluster WindowCovering -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_DownOrClose(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_DownOrClose(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -9156,7 +9099,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_DownOrClose(c cluster.Associate(device, ZCLendpointId); return cluster.DownOrClose(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToLiftPercentage(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToLiftPercentage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t liftPercentageValue, uint16_t liftPercent100thsValue) @@ -9166,7 +9109,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToLiftPerce cluster.Associate(device, ZCLendpointId); return cluster.GoToLiftPercentage(nullptr, nullptr, liftPercentageValue, liftPercent100thsValue).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToLiftValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToLiftValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t liftValue) { @@ -9175,7 +9118,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToLiftValue cluster.Associate(device, ZCLendpointId); return cluster.GoToLiftValue(nullptr, nullptr, liftValue).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToTiltPercentage(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToTiltPercentage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint8_t tiltPercentageValue, uint16_t tiltPercent100thsValue) @@ -9185,7 +9128,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToTiltPerce cluster.Associate(device, ZCLendpointId); return cluster.GoToTiltPercentage(nullptr, nullptr, tiltPercentageValue, tiltPercent100thsValue).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToTiltValue(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToTiltValue(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t tiltValue) { @@ -9194,7 +9137,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_GoToTiltValue cluster.Associate(device, ZCLendpointId); return cluster.GoToTiltValue(nullptr, nullptr, tiltValue).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_StopMotion(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_StopMotion(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -9202,7 +9145,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_StopMotion(ch cluster.Associate(device, ZCLendpointId); return cluster.StopMotion(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_UpOrOpen(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_UpOrOpen(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -9211,8 +9154,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_WindowCovering_UpOrOpen(chip return cluster.UpOrOpen(nullptr, nullptr).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Type(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Type(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -9221,7 +9163,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Type(chip::Co return cluster.ReadAttributeType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionLift(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionLift(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9232,7 +9174,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionTilt(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionTilt(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9243,7 +9185,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ConfigStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ConfigStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9253,7 +9195,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ConfigStatus( return cluster.ReadAttributeConfigStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionLiftPercentage(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionLiftPercentage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9264,8 +9206,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi .AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentPositionLiftPercentage( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) +chip::ChipError::StorageType +chip_ime_SubscribeAttribute_WindowCovering_CurrentPositionLiftPercentage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9276,7 +9219,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentP .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionTiltPercentage(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionTiltPercentage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9287,8 +9230,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi .AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentPositionTiltPercentage( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) +chip::ChipError::StorageType +chip_ime_SubscribeAttribute_WindowCovering_CurrentPositionTiltPercentage(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9299,7 +9243,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentP .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_OperationalStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_OperationalStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9309,7 +9253,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_OperationalSt return cluster.ReadAttributeOperationalStatus(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_OperationalStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_OperationalStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) @@ -9323,8 +9267,9 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_Operatio .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositionLiftPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositionLiftPercent100ths(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9334,7 +9279,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositio } chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_TargetPositionLiftPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9345,8 +9290,9 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_TargetPo .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositionTiltPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositionTiltPercent100ths(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9356,7 +9302,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_TargetPositio } chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_TargetPositionTiltPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9367,7 +9313,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_TargetPo .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_EndProductType(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_EndProductType(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9377,8 +9323,9 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_EndProductTyp return cluster.ReadAttributeEndProductType(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionLiftPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionLiftPercent100ths(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9389,7 +9336,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi } chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentPositionLiftPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9400,8 +9347,9 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentP .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionTiltPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositionTiltPercent100ths(chip::DeviceProxy * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9412,7 +9360,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_CurrentPositi } chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentPositionTiltPercent100ths( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) + chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; @@ -9423,7 +9371,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_CurrentP .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpenLimitLift(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpenLimitLift(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9434,7 +9382,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpen .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClosedLimitLift(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClosedLimitLift(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9445,7 +9393,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClos .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpenLimitTilt(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpenLimitTilt(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9456,7 +9404,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledOpen .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClosedLimitTilt(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClosedLimitTilt(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9467,8 +9415,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_InstalledClos .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Mode(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Mode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); @@ -9477,16 +9424,15 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_Mode(chip::Co return cluster.ReadAttributeMode(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_WriteAttribute_WindowCovering_Mode(chip::Controller::Device * device, - chip::EndpointId ZCLendpointId, chip::GroupId, - uint8_t value) +chip::ChipError::StorageType chip_ime_WriteAttribute_WindowCovering_Mode(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, + chip::GroupId, uint8_t value) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster.WriteAttributeMode(gDefaultSuccessCallback.Cancel(), gDefaultFailureCallback.Cancel(), value).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_SafetyStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_SafetyStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9496,7 +9442,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_SafetyStatus( return cluster.ReadAttributeSafetyStatus(gInt16uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_SafetyStatus(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_SafetyStatus(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { @@ -9509,7 +9455,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_WindowCovering_SafetySt .AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_FeatureMap(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_FeatureMap(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -9519,7 +9465,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_FeatureMap(ch return cluster.ReadAttributeFeatureMap(gInt32uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()).AsInteger(); } -chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ClusterRevision(chip::Controller::Device * device, +chip::ChipError::StorageType chip_ime_ReadAttribute_WindowCovering_ClusterRevision(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { diff --git a/src/controller/python/chip/clusters/command.cpp b/src/controller/python/chip/clusters/command.cpp index 7ba28684ef1794..b2ecd1a30fb59e 100644 --- a/src/controller/python/chip/clusters/command.cpp +++ b/src/controller/python/chip/clusters/command.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -32,9 +32,9 @@ using namespace chip::app; using PyObject = void *; extern "C" { -chip::ChipError::StorageType pychip_CommandSender_SendCommand(void * appContext, Controller::Device * device, - chip::EndpointId endpointId, chip::ClusterId clusterId, - chip::CommandId commandId, const uint8_t * payload, size_t length); +chip::ChipError::StorageType pychip_CommandSender_SendCommand(void * appContext, DeviceProxy * device, chip::EndpointId endpointId, + chip::ClusterId clusterId, chip::CommandId commandId, + const uint8_t * payload, size_t length); } namespace chip { @@ -121,9 +121,9 @@ void pychip_CommandSender_InitCallbacks(OnCommandSenderResponseCallback onComman gOnCommandSenderDoneCallback = onCommandSenderDoneCallback; } -chip::ChipError::StorageType pychip_CommandSender_SendCommand(void * appContext, Controller::Device * device, - chip::EndpointId endpointId, chip::ClusterId clusterId, - chip::CommandId commandId, const uint8_t * payload, size_t length) +chip::ChipError::StorageType pychip_CommandSender_SendCommand(void * appContext, DeviceProxy * device, chip::EndpointId endpointId, + chip::ClusterId clusterId, chip::CommandId commandId, + const uint8_t * payload, size_t length) { CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/controller/python/chip/clusters/write.cpp b/src/controller/python/chip/clusters/write.cpp index b6e2afb1e58be6..9d5549c1164cc4 100644 --- a/src/controller/python/chip/clusters/write.cpp +++ b/src/controller/python/chip/clusters/write.cpp @@ -19,8 +19,8 @@ #include #include +#include #include -#include #include #include @@ -33,7 +33,7 @@ using PyObject = void *; extern "C" { // Encodes n attribute write requests, follows 3 * n arguments, in the (AttributeWritePath*=void *, uint8_t*, size_t) order. -chip::ChipError::StorageType pychip_WriteClient_WriteAttributes(void * appContext, Controller::Device * device, size_t n, ...); +chip::ChipError::StorageType pychip_WriteClient_WriteAttributes(void * appContext, DeviceProxy * device, size_t n, ...); } namespace chip { @@ -97,7 +97,7 @@ void pychip_WriteClient_InitCallbacks(OnWriteResponseCallback onWriteResponseCal gOnWriteDoneCallback = onWriteDoneCallback; } -chip::ChipError::StorageType pychip_WriteClient_WriteAttributes(void * appContext, Controller::Device * device, size_t n, ...) +chip::ChipError::StorageType pychip_WriteClient_WriteAttributes(void * appContext, DeviceProxy * device, size_t n, ...) { CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/controller/python/templates/python-CHIPClusters-cpp.zapt b/src/controller/python/templates/python-CHIPClusters-cpp.zapt index 7a64abacf92363..dbae1f02d41a3d 100644 --- a/src/controller/python/templates/python-CHIPClusters-cpp.zapt +++ b/src/controller/python/templates/python-CHIPClusters-cpp.zapt @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -206,7 +206,7 @@ void chip_ime_SetFailureResponseDelegate(FailureResponseDelegate delegate) // Cluster {{asUpperCamelCase name}} {{#chip_cluster_commands}} -chip::ChipError::StorageType chip_ime_AppendCommand_{{asUpperCamelCase clusterName}}_{{asUpperCamelCase name}}(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId{{#chip_cluster_command_arguments_with_structs_expanded}}, {{#if (isString type)}}const uint8_t * {{asLowerCamelCase label}}, uint32_t {{asLowerCamelCase label}}_Len{{else}}{{chipType}} {{asLowerCamelCase label}}{{/if}}{{/chip_cluster_command_arguments_with_structs_expanded}}) +chip::ChipError::StorageType chip_ime_AppendCommand_{{asUpperCamelCase clusterName}}_{{asUpperCamelCase name}}(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId{{#chip_cluster_command_arguments_with_structs_expanded}}, {{#if (isString type)}}const uint8_t * {{asLowerCamelCase label}}, uint32_t {{asLowerCamelCase label}}_Len{{else}}{{chipType}} {{asLowerCamelCase label}}{{/if}}{{/chip_cluster_command_arguments_with_structs_expanded}}) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::{{asUpperCamelCase clusterName}}Cluster cluster; @@ -216,7 +216,7 @@ chip::ChipError::StorageType chip_ime_AppendCommand_{{asUpperCamelCase clusterNa {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} -chip::ChipError::StorageType chip_ime_ReadAttribute_{{asUpperCamelCase parent.name}}_{{asUpperCamelCase name}}(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +chip::ChipError::StorageType chip_ime_ReadAttribute_{{asUpperCamelCase parent.name}}_{{asUpperCamelCase name}}(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::{{asUpperCamelCase parent.name}}Cluster cluster; @@ -229,7 +229,7 @@ chip::ChipError::StorageType chip_ime_ReadAttribute_{{asUpperCamelCase parent.na } {{#if isReportableAttribute}} -chip::ChipError::StorageType chip_ime_SubscribeAttribute_{{asUpperCamelCase parent.name}}_{{asUpperCamelCase name}}(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) +chip::ChipError::StorageType chip_ime_SubscribeAttribute_{{asUpperCamelCase parent.name}}_{{asUpperCamelCase name}}(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, uint16_t minInterval, uint16_t maxInterval) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::{{asUpperCamelCase parent.name}}Cluster cluster; @@ -244,7 +244,7 @@ chip::ChipError::StorageType chip_ime_SubscribeAttribute_{{asUpperCamelCase pare {{/if}} {{#if isWritableAttribute}} -chip::ChipError::StorageType chip_ime_WriteAttribute_{{asUpperCamelCase parent.name}}_{{asUpperCamelCase name}}(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, {{#if (isString type)}} uint8_t * value, size_t len{{else}}{{chipType}} value{{/if}}) +chip::ChipError::StorageType chip_ime_WriteAttribute_{{asUpperCamelCase parent.name}}_{{asUpperCamelCase name}}(chip::DeviceProxy * device, chip::EndpointId ZCLendpointId, chip::GroupId, {{#if (isString type)}} uint8_t * value, size_t len{{else}}{{chipType}} value{{/if}}) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::{{asUpperCamelCase parent.name}}Cluster cluster; diff --git a/src/controller/tests/BUILD.gn b/src/controller/tests/BUILD.gn index 084633fe94f4fd..f944124b504fcd 100644 --- a/src/controller/tests/BUILD.gn +++ b/src/controller/tests/BUILD.gn @@ -23,12 +23,15 @@ chip_test_suite("tests") { test_sources = [ "TestCommissionableNodeController.cpp" ] - test_sources += [ "TestDevice.cpp" ] + if (chip_device_platform != "mbed" && chip_device_platform != "efr32") { + test_sources += [ "TestServerCommandDispatch.cpp" ] + } cflags = [ "-Wconversion" ] public_deps = [ "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/tests:helpers", "${chip_root}/src/controller", "${chip_root}/src/controller/tests/data_model:interaction-tests", "${chip_root}/src/messaging/tests:helpers", diff --git a/src/controller/tests/TestDevice.cpp b/src/controller/tests/TestDevice.cpp index 71c202d2c369cb..fe4cd909a0efe6 100644 --- a/src/controller/tests/TestDevice.cpp +++ b/src/controller/tests/TestDevice.cpp @@ -18,12 +18,13 @@ #if CONFIG_NETWORK_LAYER_BLE #include #endif // CONFIG_NETWORK_LAYER_BLE -#include +#include #include #include #include #include #include +#include #include #include #include @@ -44,6 +45,7 @@ using TestTransportMgr = TransportMgr; void TestDevice_EstablishSessionDirectly(nlTestSuite * inSuite, void * inContext) { Platform::MemoryInit(); + chip::DeviceLayer::SetConfigurationMgr(&chip::DeviceLayer::ConfigurationManagerImpl::GetDefaultInstance()); DeviceTransportMgr transportMgr; SessionManager sessionManager; ExchangeManager exchangeMgr; @@ -83,7 +85,7 @@ void TestDevice_EstablishSessionDirectly(nlTestSuite * inSuite, void * inContext .idAllocator = &idAllocator, .fabricsTable = fabrics, }; - Device device; + CommissioneeDeviceProxy device; NodeId mockNodeId = 1; FabricIndex mockFabricIndex = 1; Inet::IPAddress mockAddr; diff --git a/src/controller/tests/TestServerCommandDispatch.cpp b/src/controller/tests/TestServerCommandDispatch.cpp new file mode 100644 index 00000000000000..ae30c6fb73dbce --- /dev/null +++ b/src/controller/tests/TestServerCommandDispatch.cpp @@ -0,0 +1,261 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file implements unit tests for CHIP Interaction Model Command Interaction + * + */ + +#include "app-common/zap-generated/ids/Attributes.h" +#include "app-common/zap-generated/ids/Clusters.h" +#include "protocols/interaction_model/Constants.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using TestContext = chip::Test::AppContext; + +using namespace chip; +using namespace chip::app::Clusters; + +namespace { +constexpr EndpointId kTestEndpointId = 1; + +enum ResponseDirective +{ + kSendDataResponse, + kSendSuccessStatusCode, + kSendError, + kSendSuccessStatusCodeWithClusterStatus, + kSendErrorWithClusterStatus, +}; + +ResponseDirective responseDirective; + +class TestClusterCommandHandler : public chip::app::CommandHandlerInterface +{ +public: + TestClusterCommandHandler() : chip::app::CommandHandlerInterface(Optional::Missing(), TestCluster::Id) + { + chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this); + } + + ~TestClusterCommandHandler() { chip::app::InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); } + +private: + void InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext & handlerContext) final; +}; + +void TestClusterCommandHandler::InvokeCommand(chip::app::CommandHandlerInterface::HandlerContext & handlerContext) +{ + HandleCommand( + handlerContext, [](chip::app::CommandHandlerInterface::HandlerContext & ctx, const auto & requestPayload) { + if (responseDirective == kSendDataResponse) + { + TestCluster::Commands::TestStructArrayArgumentResponse::Type dataResponse; + TestCluster::Structs::NestedStructList::Type nestedStructList[4]; + + uint8_t i = 0; + for (auto & item : nestedStructList) + { + item.a = i; + item.b = false; + item.c.a = i; + item.c.b = true; + i++; + } + + dataResponse.arg1 = nestedStructList; + dataResponse.arg6 = true; + + ctx.mCommandHandler.AddResponseData(ctx.mRequestPath, dataResponse); + } + + return CHIP_NO_ERROR; + }); +} + +} // namespace + +namespace { + +class TestCommandInteraction +{ +public: + TestCommandInteraction() {} + static void TestNoHandler(nlTestSuite * apSuite, void * apContext); + static void TestDataResponse(nlTestSuite * apSuite, void * apContext); + +private: +}; + +void TestCommandInteraction::TestNoHandler(nlTestSuite * apSuite, void * apContext) +{ + TestContext & ctx = *static_cast(apContext); + TestCluster::Commands::TestSimpleArgumentRequest::Type request; + auto sessionHandle = ctx.GetSessionBobToAlice(); + + request.arg1 = true; + + // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's + // not safe to do so. + auto onSuccessCb = [apSuite](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, + const auto & dataResponse) { + // + // We shouldn't be arriving here, since we don't have a command handler installed. + // + NL_TEST_ASSERT(apSuite, false); + }; + + // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's + // not safe to do so. + auto onFailureCb = [apSuite](const app::StatusIB & aStatus, CHIP_ERROR aError) { + NL_TEST_ASSERT(apSuite, aStatus.mStatus == Protocols::InteractionModel::Status::InvalidCommand); + }; + + responseDirective = kSendDataResponse; + + ctx.EnableAsyncDispatch(); + + chip::Controller::InvokeCommandRequest( + &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); + + ctx.DrainAndServiceIO(); + + NL_TEST_ASSERT(apSuite, ctx.GetExchangeManager().GetNumActiveExchanges() == 0); +} + +static const int kDescriptorAttributeArraySize = 254; + +// Declare Descriptor cluster attributes +DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(descriptorAttrs) +DECLARE_DYNAMIC_ATTRIBUTE(chip::app::Clusters::Descriptor::Attributes::DeviceList::Id, ARRAY, kDescriptorAttributeArraySize, + 0), /* device list */ + DECLARE_DYNAMIC_ATTRIBUTE(chip::app::Clusters::Descriptor::Attributes::ServerList::Id, ARRAY, kDescriptorAttributeArraySize, + 0), /* server list */ + DECLARE_DYNAMIC_ATTRIBUTE(chip::app::Clusters::Descriptor::Attributes::ClientList::Id, ARRAY, kDescriptorAttributeArraySize, + 0), /* client list */ + DECLARE_DYNAMIC_ATTRIBUTE(chip::app::Clusters::Descriptor::Attributes::PartsList::Id, ARRAY, kDescriptorAttributeArraySize, + 0), /* parts list */ + DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); + +DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(testClusterAttrs) +DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); + +DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(testEndpointClusters) +DECLARE_DYNAMIC_CLUSTER(chip::app::Clusters::TestCluster::Id, testClusterAttrs), + DECLARE_DYNAMIC_CLUSTER(chip::app::Clusters::Descriptor::Id, descriptorAttrs), DECLARE_DYNAMIC_CLUSTER_LIST_END; + +DECLARE_DYNAMIC_ENDPOINT(testEndpoint, testEndpointClusters); + +void TestCommandInteraction::TestDataResponse(nlTestSuite * apSuite, void * apContext) +{ + TestContext & ctx = *static_cast(apContext); + TestCluster::Commands::TestSimpleArgumentRequest::Type request; + auto sessionHandle = ctx.GetSessionBobToAlice(); + TestClusterCommandHandler commandHandler; + + bool onSuccessWasCalled = false; + bool onFailureWasCalled = false; + + request.arg1 = true; + + // + // Register descriptors for this endpoint since they are needed + // at command validation time to ensure the command actually exists on that endpoint. + // + emberAfSetDynamicEndpoint(0, kTestEndpointId, &testEndpoint, 0, 0); + + // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's + // not safe to do so. + auto onSuccessCb = [apSuite, &onSuccessWasCalled](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, + const auto & dataResponse) { + uint8_t i = 0; + auto iter = dataResponse.arg1.begin(); + while (iter.Next()) + { + auto & item = iter.GetValue(); + + NL_TEST_ASSERT(apSuite, item.a == i); + NL_TEST_ASSERT(apSuite, item.b == false); + NL_TEST_ASSERT(apSuite, item.c.a == i); + NL_TEST_ASSERT(apSuite, item.c.b == true); + i++; + } + + NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); + NL_TEST_ASSERT(apSuite, dataResponse.arg6 == true); + + onSuccessWasCalled = true; + }; + + // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's + // not safe to do so. + auto onFailureCb = [&onFailureWasCalled](const app::StatusIB & aStatus, CHIP_ERROR aError) { onFailureWasCalled = true; }; + + responseDirective = kSendDataResponse; + + chip::Controller::InvokeCommandRequest( + &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); + + ctx.DrainAndServiceIO(); + + NL_TEST_ASSERT(apSuite, onSuccessWasCalled && !onFailureWasCalled); + NL_TEST_ASSERT(apSuite, ctx.GetExchangeManager().GetNumActiveExchanges() == 0); +} + +// clang-format off +const nlTest sTests[] = +{ + NL_TEST_DEF("TestNoHandler", TestCommandInteraction::TestNoHandler), + NL_TEST_DEF("TestDataResponse", TestCommandInteraction::TestDataResponse), + NL_TEST_SENTINEL() +}; + +// clang-format on + +// clang-format off +nlTestSuite sSuite = +{ + "TestCommands", + &sTests[0], + TestContext::InitializeAsync, + TestContext::Finalize +}; +// clang-format on + +} // namespace + +int TestCommandInteractionTest() +{ + TestContext gContext; + nlTestRunner(&sSuite, &gContext); + return (nlTestRunnerStats(&sSuite)); +} + +CHIP_REGISTER_TEST_SUITE(TestCommandInteractionTest) diff --git a/src/controller/tests/data_model/TestWrite.cpp b/src/controller/tests/data_model/TestWrite.cpp index d18cf767f99710..0b97160f73490b 100644 --- a/src/controller/tests/data_model/TestWrite.cpp +++ b/src/controller/tests/data_model/TestWrite.cpp @@ -148,8 +148,8 @@ void TestWriteInteraction::TestDataResponse(nlTestSuite * apSuite, void * apCont auto onFailureCb = [&onFailureCbInvoked](const app::ConcreteAttributePath * attributePath, app::StatusIB status, CHIP_ERROR aError) { onFailureCbInvoked = true; }; - chip::Controller::WriteAttribute( - &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb); + chip::Controller::WriteAttribute(sessionHandle, kTestEndpointId, + value, onSuccessCb, onFailureCb); ctx.DrainAndServiceIO(); @@ -189,8 +189,8 @@ void TestWriteInteraction::TestAttributeError(nlTestSuite * apSuite, void * apCo onFailureCbInvoked = true; }; - chip::Controller::WriteAttribute( - &ctx.GetExchangeManager(), sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb); + chip::Controller::WriteAttribute(sessionHandle, kTestEndpointId, + value, onSuccessCb, onFailureCb); ctx.DrainAndServiceIO(); diff --git a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj index 946852cb2076a5..ec119db4bb5ebf 100644 --- a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj +++ b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj @@ -478,7 +478,7 @@ GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - HAVE_CONFIG_H, + CHIP_HAVE_CONFIG_H, "DEBUG=1", "$(inherited)", ); @@ -536,7 +536,10 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H; + GCC_PREPROCESSOR_DEFINITIONS = ( + CHIP_HAVE_CONFIG_H, + "$(inherited)", + ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/MultiAdmin/MultiAdminViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/MultiAdmin/MultiAdminViewController.m index 821baaf611a9dd..acac3092056ab2 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/MultiAdmin/MultiAdminViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/MultiAdmin/MultiAdminViewController.m @@ -211,6 +211,7 @@ - (IBAction)openPairingWindow:(id)sender NSString * output; NSError * error; + CHIPDeviceController * controller = InitializeCHIP(); if ([self.useOnboardingTokenSwitch isOn]) { NSString * discriminatorStr = [self.discriminatorField text]; if (discriminatorStr.length == 0) { @@ -218,7 +219,8 @@ - (IBAction)openPairingWindow:(id)sender } NSInteger discriminator = [discriminatorStr intValue]; - output = [chipDevice openPairingWindowWithPIN:timeout + output = [controller openPairingWindowWithPIN:deviceId + duration:timeout discriminator:discriminator setupPIN:setupPIN error:&error]; @@ -230,7 +232,7 @@ - (IBAction)openPairingWindow:(id)sender [self updateResult:@"Failed in opening the pairing window"]; } } else { - BOOL didSend = [chipDevice openPairingWindow:timeout error:&error]; + BOOL didSend = [controller openPairingWindow:deviceId duration:timeout error:&error]; if (didSend) { [self updateResult:@"Scan the QR code on the device"]; } else { diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m index 8b016895154492..3b96e61e5f9555 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Temperature Sensor/TemperatureSensorViewController.m @@ -203,7 +203,8 @@ - (void)reportFromUserEnteredSettings if (chipDevice) { CHIPTemperatureMeasurement * cluster = [[CHIPTemperatureMeasurement alloc] initWithDevice:chipDevice endpoint:1 queue:dispatch_get_main_queue()]; - + // TODO - Fix temperature reporting in iOS CHIPTool + /* [cluster subscribeAttributeMeasuredValueWithMinInterval:minIntervalSeconds maxInterval:maxIntervalSeconds @@ -220,6 +221,7 @@ - (void)reportFromUserEnteredSettings NSNumber * value = values[@"value"]; [self updateTempInUI:value.shortValue]; }]; + */ } else { NSLog(@"Status: Failed to establish a connection with the device"); } diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index db9a78c3d7dc4f..e3415b970cc8fd 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -55,7 +55,6 @@ 2F79A67726CE6672006377B0 /* im-client-callbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2F79A67626CE6672006377B0 /* im-client-callbacks.cpp */; }; 2FD775552695557E00FF4B12 /* error-mapping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD775542695557E00FF4B12 /* error-mapping.cpp */; }; 5129BCFD26A9EE3300122DDF /* CHIPError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5129BCFC26A9EE3300122DDF /* CHIPError.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 515CCFD227351183002A3C82 /* CHIPClustersTestWrite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515CCFD127351183002A3C82 /* CHIPClustersTestWrite.cpp */; }; 991DC0842475F45400C13860 /* CHIPDeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = 991DC0822475F45400C13860 /* CHIPDeviceController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 991DC0892475F47D00C13860 /* CHIPDeviceController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 991DC0872475F47D00C13860 /* CHIPDeviceController.mm */; }; 991DC08B247704DC00C13860 /* CHIPLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 991DC08A247704DC00C13860 /* CHIPLogging.h */; }; @@ -142,7 +141,6 @@ 2F79A67626CE6672006377B0 /* im-client-callbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "im-client-callbacks.cpp"; path = "../../../app/util/im-client-callbacks.cpp"; sourceTree = ""; }; 2FD775542695557E00FF4B12 /* error-mapping.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "error-mapping.cpp"; path = "../../../app/util/error-mapping.cpp"; sourceTree = ""; }; 5129BCFC26A9EE3300122DDF /* CHIPError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CHIPError.h; path = CHIP/CHIPError.h; sourceTree = ""; }; - 515CCFD127351183002A3C82 /* CHIPClustersTestWrite.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CHIPClustersTestWrite.cpp; path = "../../../zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTestWrite.cpp"; sourceTree = ""; }; 991DC0822475F45400C13860 /* CHIPDeviceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceController.h; sourceTree = ""; }; 991DC0872475F47D00C13860 /* CHIPDeviceController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPDeviceController.mm; sourceTree = ""; }; 991DC08A247704DC00C13860 /* CHIPLogging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPLogging.h; sourceTree = ""; }; @@ -242,7 +240,6 @@ B20252832459E34F00F97062 = { isa = PBXGroup; children = ( - 515CCFD127351183002A3C82 /* CHIPClustersTestWrite.cpp */, 5129BCFC26A9EE3300122DDF /* CHIPError.h */, BA107AEE2470CFBB004287EB /* chip_xcode_build_connector.sh */, B202528F2459E34F00F97062 /* CHIP */, @@ -481,7 +478,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 515CCFD227351183002A3C82 /* CHIPClustersTestWrite.cpp in Sources */, 2C8C8FC2253E0C2100797F05 /* CHIPPersistentStorageDelegateBridge.mm in Sources */, 2CB7163C252E8A7C0026E2BB /* CHIPDevicePairingDelegateBridge.mm in Sources */, 997DED162695343400975E97 /* CHIPThreadOperationalDataset.mm in Sources */, @@ -624,19 +620,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( - "CHIP_PROJECT_CONFIG_INCLUDE=", - "CHIP_PLATFORM_CONFIG_INCLUDE=", - "CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE=", - CONFIG_NETWORK_LAYER_INET, - CONFIG_NETWORK_LAYER_BLE, - "CHIP_DEVICE_LAYER_TARGET=Darwin", - "CHIP_DEVICE_LAYER_TARGET_DARWIN=1", - "CHIP_DEVICE_LAYER_TARGET_LINUX=0", - "CHIP_DEVICE_LAYER_TARGET_NRF5=0", - "CHIP_DEVICE_LAYER_TARGET_EFR32=0", - "CHIP_SYSTEM_CONFIG_USE_SOCKETS=1", - "CHIP_SYSTEM_CONFIG_POSIX_LOCKING=0", - "CHIP_SYSTEM_CONFIG_NO_LOCKING=1", + CHIP_HAVE_CONFIG_H, "$(inherited)", ); HEADER_SEARCH_PATHS = ( @@ -769,19 +753,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( - "CHIP_PROJECT_CONFIG_INCLUDE=", - "CHIP_PLATFORM_CONFIG_INCLUDE=", - "CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE=", - CONFIG_NETWORK_LAYER_INET, - CONFIG_NETWORK_LAYER_BLE, - "CHIP_DEVICE_LAYER_TARGET=Darwin", - "CHIP_DEVICE_LAYER_TARGET_DARWIN=1", - "CHIP_DEVICE_LAYER_TARGET_LINUX=0", - "CHIP_DEVICE_LAYER_TARGET_NRF5=0", - "CHIP_DEVICE_LAYER_TARGET_EFR32=0", - "CHIP_SYSTEM_CONFIG_USE_SOCKETS=1", - "CHIP_SYSTEM_CONFIG_POSIX_LOCKING=0", - "CHIP_SYSTEM_CONFIG_NO_LOCKING=1", + CHIP_HAVE_CONFIG_H, "$(inherited)", ); HEADER_SEARCH_PATHS = ( diff --git a/src/darwin/Framework/CHIP/CHIPDevice.h b/src/darwin/Framework/CHIP/CHIPDevice.h index 55419e90173deb..f2384c4322eda7 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.h +++ b/src/darwin/Framework/CHIP/CHIPDevice.h @@ -24,13 +24,6 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPDevice : NSObject -- (BOOL)openPairingWindow:(NSUInteger)duration error:(NSError * __autoreleasing *)error; -- (nullable NSString *)openPairingWindowWithPIN:(NSUInteger)duration - discriminator:(NSUInteger)discriminator - setupPIN:(NSUInteger)setupPIN - error:(NSError * __autoreleasing *)error; -- (BOOL)isActive; - - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/CHIPDevice.mm b/src/darwin/Framework/CHIP/CHIPDevice.mm index ab027f5b1621da..ae1d86a2597f08 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.mm +++ b/src/darwin/Framework/CHIP/CHIPDevice.mm @@ -18,13 +18,11 @@ #import "CHIPDevice_Internal.h" #import "CHIPError_Internal.h" #import "CHIPLogging.h" -#import -#import @interface CHIPDevice () @property (nonatomic, readonly, strong, nonnull) NSRecursiveLock * lock; -@property (readonly) chip::Controller::Device * cppDevice; +@property (readonly) chip::DeviceProxy * cppDevice; @end @@ -38,7 +36,7 @@ - (instancetype)init return self; } -- (instancetype)initWithDevice:(chip::Controller::Device *)device +- (instancetype)initWithDevice:(chip::DeviceProxy *)device { if (self = [super init]) { _cppDevice = device; @@ -46,105 +44,9 @@ - (instancetype)initWithDevice:(chip::Controller::Device *)device return self; } -- (chip::Controller::Device *)internalDevice +- (chip::DeviceProxy *)internalDevice { return _cppDevice; } -- (BOOL)openPairingWindow:(NSUInteger)duration error:(NSError * __autoreleasing *)error -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - chip::SetupPayload setupPayload; - - if (duration > UINT16_MAX) { - CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX); - if (error) { - *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; - } - return NO; - } - - [self.lock lock]; - err = self.cppDevice->OpenPairingWindow( - (uint16_t) duration, chip::Controller::Device::CommissioningWindowOption::kOriginalSetupCode, setupPayload); - [self.lock unlock]; - - if (err != CHIP_NO_ERROR) { - CHIP_LOG_ERROR("Error(%s): Open Pairing Window failed", chip::ErrorStr(err)); - if (error) { - *error = [CHIPError errorForCHIPErrorCode:err]; - } - return NO; - } - - return YES; -} - -- (NSString *)openPairingWindowWithPIN:(NSUInteger)duration - discriminator:(NSUInteger)discriminator - setupPIN:(NSUInteger)setupPIN - error:(NSError * __autoreleasing *)error -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - chip::SetupPayload setupPayload; - - if (duration > UINT16_MAX) { - CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX); - if (error) { - *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; - } - return nil; - } - - if (discriminator > 0xfff) { - CHIP_LOG_ERROR("Error: Discriminator %tu is too large. Max value %d", discriminator, 0xfff); - if (error) { - *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; - } - return nil; - } else { - setupPayload.discriminator = (uint16_t) discriminator; - } - - setupPIN &= ((1 << chip::kSetupPINCodeFieldLengthInBits) - 1); - setupPayload.setUpPINCode = (uint32_t) setupPIN; - - [self.lock lock]; - err = self.cppDevice->OpenPairingWindow( - (uint16_t) duration, chip::Controller::Device::CommissioningWindowOption::kTokenWithProvidedPIN, setupPayload); - [self.lock unlock]; - - if (err != CHIP_NO_ERROR) { - CHIP_LOG_ERROR("Error(%s): Open Pairing Window failed", chip::ErrorStr(err)); - if (error) { - *error = [CHIPError errorForCHIPErrorCode:err]; - } - return nil; - } - - chip::ManualSetupPayloadGenerator generator(setupPayload); - std::string outCode; - - if (generator.payloadDecimalStringRepresentation(outCode) == CHIP_NO_ERROR) { - CHIP_LOG_ERROR("Setup code is %s", outCode.c_str()); - } else { - CHIP_LOG_ERROR("Failed to get decimal setup code"); - return nil; - } - - return [NSString stringWithCString:outCode.c_str() encoding:[NSString defaultCStringEncoding]]; -} - -- (BOOL)isActive -{ - bool isActive = false; - - [self.lock lock]; - isActive = self.cppDevice->IsActive(); - [self.lock unlock]; - - return isActive ? YES : NO; -} @end diff --git a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h index bfbb96b4dad5ea..240dab2523629c 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h @@ -45,10 +45,10 @@ class CHIPDeviceConnectionBridge : public chip::ReferenceCounted mOnConnected; - chip::Callback::Callback mOnConnectFailed; + chip::Callback::Callback mOnConnected; + chip::Callback::Callback mOnConnectFailed; - static void OnConnected(void * context, chip::Controller::Device * device); + static void OnConnected(void * context, chip::DeviceProxy * device); static void OnConnectionFailure(void * context, chip::NodeId deviceId, CHIP_ERROR error); }; diff --git a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm index ac1adc8fe97311..24e49d325908dc 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm @@ -19,7 +19,7 @@ #import "CHIPDevice_Internal.h" #import "CHIPError_Internal.h" -void CHIPDeviceConnectionBridge::OnConnected(void * context, chip::Controller::Device * device) +void CHIPDeviceConnectionBridge::OnConnected(void * context, chip::DeviceProxy * device) { auto * object = static_cast(context); CHIPDevice * chipDevice = [[CHIPDevice alloc] initWithDevice:device]; diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.h b/src/darwin/Framework/CHIP/CHIPDeviceController.h index e9848dada27d5c..88fe674663030a 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.h @@ -60,6 +60,13 @@ typedef void (^CHIPDeviceConnectionCallback)(CHIPDevice * _Nullable device, NSEr queue:(dispatch_queue_t)queue completionHandler:(CHIPDeviceConnectionCallback)completionHandler; +- (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error:(NSError * __autoreleasing *)error; +- (nullable NSString *)openPairingWindowWithPIN:(uint64_t)deviceID + duration:(NSUInteger)duration + discriminator:(NSUInteger)discriminator + setupPIN:(NSUInteger)setupPIN + error:(NSError * __autoreleasing *)error; + - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.mm b/src/darwin/Framework/CHIP/CHIPDeviceController.mm index 873d3511b264ac..213b605c951a43 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.mm @@ -25,6 +25,8 @@ #import "CHIPP256KeypairBridge.h" #import "CHIPPersistentStorageDelegateBridge.h" #import "CHIPSetupPayload.h" +#import +#import #import #import "CHIPDeviceConnectionBridge.h" @@ -432,6 +434,87 @@ - (BOOL)getConnectedDevice:(uint64_t)deviceID return YES; } +- (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error:(NSError * __autoreleasing *)error +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (duration > UINT16_MAX) { + CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX); + if (error) { + *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; + } + return NO; + } + + chip::SetupPayload setupPayload; + err = self.cppCommissioner->OpenCommissioningWindow(deviceID, (uint16_t) duration, 0, 0, 0, setupPayload); + + if (err != CHIP_NO_ERROR) { + CHIP_LOG_ERROR("Error(%s): Open Pairing Window failed", chip::ErrorStr(err)); + if (error) { + *error = [CHIPError errorForCHIPErrorCode:err]; + } + return NO; + } + + return YES; +} + +- (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID + duration:(NSUInteger)duration + discriminator:(NSUInteger)discriminator + setupPIN:(NSUInteger)setupPIN + error:(NSError * __autoreleasing *)error +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + chip::SetupPayload setupPayload; + + if (duration > UINT16_MAX) { + CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX); + if (error) { + *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; + } + return nil; + } + + if (discriminator > 0xfff) { + CHIP_LOG_ERROR("Error: Discriminator %tu is too large. Max value %d", discriminator, 0xfff); + if (error) { + *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; + } + return nil; + } else { + setupPayload.discriminator = (uint16_t) discriminator; + } + + setupPIN &= ((1 << chip::kSetupPINCodeFieldLengthInBits) - 1); + setupPayload.setUpPINCode = (uint32_t) setupPIN; + + err = self.cppCommissioner->OpenCommissioningWindow( + deviceID, (uint16_t) duration, 1000, (uint16_t) discriminator, 2, setupPayload); + + if (err != CHIP_NO_ERROR) { + CHIP_LOG_ERROR("Error(%s): Open Pairing Window failed", chip::ErrorStr(err)); + if (error) { + *error = [CHIPError errorForCHIPErrorCode:err]; + } + return nil; + } + + chip::ManualSetupPayloadGenerator generator(setupPayload); + std::string outCode; + + if (generator.payloadDecimalStringRepresentation(outCode) == CHIP_NO_ERROR) { + CHIP_LOG_ERROR("Setup code is %s", outCode.c_str()); + } else { + CHIP_LOG_ERROR("Failed to get decimal setup code"); + return nil; + } + + return [NSString stringWithCString:outCode.c_str() encoding:[NSString defaultCStringEncoding]]; +} + - (void)setListenPort:(uint16_t)port { _listenPort = port; diff --git a/src/darwin/Framework/CHIP/CHIPDevice_Internal.h b/src/darwin/Framework/CHIP/CHIPDevice_Internal.h index 713dffa2b570a2..e00dd5ead2f4cc 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice_Internal.h +++ b/src/darwin/Framework/CHIP/CHIPDevice_Internal.h @@ -21,14 +21,14 @@ #import "CHIPDevice.h" #import -#include +#include NS_ASSUME_NONNULL_BEGIN @interface CHIPDevice () -- (instancetype)initWithDevice:(chip::Controller::Device *)device; -- (chip::Controller::Device *)internalDevice; +- (instancetype)initWithDevice:(chip::DeviceProxy *)device; +- (chip::DeviceProxy *)internalDevice; @end diff --git a/src/darwin/Framework/CHIP/templates/tests.js b/src/darwin/Framework/CHIP/templates/tests.js index d0e73c1180f70b..1e92e9cf8d6623 100644 --- a/src/darwin/Framework/CHIP/templates/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests.js @@ -48,6 +48,7 @@ function getTests() 'Test_TC_CC_7_3', 'Test_TC_CC_7_4', 'Test_TC_CC_8_1', + 'Test_TC_CC_9_1', 'Test_TC_CC_9_2', 'Test_TC_CC_9_3', ]; @@ -101,6 +102,7 @@ function getTests() 'Test_TC_OO_1_1', 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', + 'Test_TC_OO_2_3', ]; const PressureMeasurement = [ @@ -144,6 +146,7 @@ function getTests() const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', + 'Test_TC_WNCV_2_2', 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index b8fd559dd8641a..450c41139ba5bd 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -6437,9 +6437,9 @@ - (void)testSendClusterTest_TC_CC_8_1_000015_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000000_On +- (void)testSendClusterTest_TC_CC_9_1_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition : Turn on light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6447,7 +6447,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000000_On XCTAssertNotNil(cluster); [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); + NSLog(@"Precondition : Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6456,10 +6456,9 @@ - (void)testSendClusterTest_TC_CC_9_2_000000_On [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000001_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6467,7 +6466,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6478,7 +6477,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000002_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; @@ -6487,11 +6486,11 @@ - (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 15; + uint8_t updateFlagsArgument = 1; uint8_t actionArgument = 0; uint8_t directionArgument = 0; - uint16_t timeArgument = 30U; - uint16_t startHueArgument = 160U; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster colorLoopSet:updateFlagsArgument @@ -6511,7 +6510,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; @@ -6532,9 +6531,42 @@ - (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000004_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 2; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6542,7 +6574,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6553,62 +6585,74 @@ - (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000006_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 4; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 30U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000008_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 1; - uint8_t actionArgument = 1; + uint8_t updateFlagsArgument = 8; + uint8_t actionArgument = 0; uint8_t directionArgument = 0; uint16_t timeArgument = 0U; - uint16_t startHueArgument = 0U; + uint16_t startHueArgument = 160U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster colorLoopSet:updateFlagsArgument @@ -6619,7 +6663,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6628,39 +6672,39 @@ - (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000010_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 2; - uint8_t actionArgument = 0; - uint8_t directionArgument = 1; + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; @@ -6673,7 +6717,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6682,17 +6726,17 @@ - (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6703,9 +6747,9 @@ - (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000012_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6727,7 +6771,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6736,7 +6780,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; @@ -6757,68 +6801,115 @@ - (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000013_Off +- (void)testSendClusterTest_TC_CC_9_1_000014_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"Turn off light for color control tests Error: %@", err); + uint8_t updateFlagsArgument = 2; + uint8_t actionArgument = 0; + uint8_t directionArgument = 1; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_CC_9_3_000000_On +- (void)testSendClusterTest_TC_CC_9_1_000015_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000016_ColorLoopSet { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000017_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000018_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; @@ -6827,11 +6918,11 @@ - (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 15; + uint8_t updateFlagsArgument = 1; uint8_t actionArgument = 0; uint8_t directionArgument = 0; - uint16_t timeArgument = 30U; - uint16_t startHueArgument = 160U; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster colorLoopSet:updateFlagsArgument @@ -6851,7 +6942,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000019_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; @@ -6872,72 +6963,121 @@ - (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000004_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000020_EnhancedMoveToHue { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command 10"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + uint16_t enhancedHueArgument = 40960U; + uint8_t directionArgument = 0; + uint16_t transitionTimeArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster enhancedMoveToHue:enhancedHueArgument + direction:directionArgument + transitionTime:transitionTimeArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Enhanced Move To Hue command 10 Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; + }]; - [expectation fulfill]; - }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000021_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 2000ms"]; + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 2000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000022_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + [cluster readAttributeEnhancedCurrentHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + XCTAssertEqual([values[@"value"] unsignedShortValue], 40960U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000023_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + uint8_t updateFlagsArgument = 2; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000024_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000025_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6945,7 +7085,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet XCTAssertNotNil(cluster); uint8_t updateFlagsArgument = 1; - uint8_t actionArgument = 1; + uint8_t actionArgument = 2; uint8_t directionArgument = 0; uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; @@ -6959,7 +7099,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6968,9 +7108,9 @@ - (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000026_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6978,7 +7118,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6989,19 +7129,19 @@ - (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000027_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 4; + uint8_t updateFlagsArgument = 1; uint8_t actionArgument = 0; uint8_t directionArgument = 0; - uint16_t timeArgument = 60U; + uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; @@ -7013,7 +7153,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7022,39 +7162,39 @@ - (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000010_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000028_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 60U); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000029_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 1; + uint8_t updateFlagsArgument = 2; uint8_t actionArgument = 0; - uint8_t directionArgument = 0; + uint8_t directionArgument = 1; uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; @@ -7067,7 +7207,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7076,138 +7216,166 @@ - (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000012_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000030_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000013_Off +- (void)testSendClusterTest_TC_CC_9_1_000031_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"Turn off light for color control tests Error: %@", err); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 2; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000032_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeInteractionModelVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Interaction Model Version Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000033_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeVendorNameWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Vendor Name Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000034_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeVendorIDWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query VendorID Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000035_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn Off light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeProductNameWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Product Name Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn Off light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute + +- (void)testSendClusterTest_TC_CC_9_2_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeProductIDWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductID Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7216,301 +7384,318 @@ - (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Label"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeUserLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query User Label Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Location"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeLocationWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query User Location Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 15; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 30U; + uint16_t startHueArgument = 160U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertLessThanOrEqual([values[@"value"] length], 2); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersion"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeHardwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query HardwareVersion Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersionString"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeHardwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query HardwareVersionString Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); - XCTAssertLessThanOrEqual([values[@"value"] length], 64); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersion"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSoftwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query SoftwareVersion Error: %@", err); + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersionString"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSoftwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query SoftwareVersionString Error: %@", err); + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); - XCTAssertLessThanOrEqual([values[@"value"] length], 64); + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ManufacturingDate"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeManufacturingDateWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ManufacturingDate Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); - XCTAssertGreaterThanOrEqual([values[@"value"] length], 8); - XCTAssertLessThanOrEqual([values[@"value"] length], 16); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query PartNumber"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributePartNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query PartNumber Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductURL"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeProductURLWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductURL Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 2; + uint8_t actionArgument = 0; + uint8_t directionArgument = 1; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - XCTAssertLessThanOrEqual([values[@"value"] length], 256); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductLabel"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeProductLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductLabel Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 64); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SerialNumber"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSerialNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query SerialNumber Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query LocalConfigDisabled"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeLocalConfigDisabledWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query LocalConfigDisabled Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000013_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Reachable"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeReachableWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Reachable Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7520,1057 +7705,2721 @@ - (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_EMR_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 3U); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_EMR_1_1_000001_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000001_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t clusterRevisionArgument = 1U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_EMR_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 3U); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_FLW_1_1_000000_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 2U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + uint8_t updateFlagsArgument = 15; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 30U; + uint16_t startHueArgument = 160U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_FLW_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000003_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000006_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MinMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - int16_t minMeasuredValueArgument = 0; - [cluster writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to optional attribute: MinMeasuredValue Error: %@", err); + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000004_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MaxMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - int16_t maxMeasuredValueArgument = 0; - [cluster writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to optional attribute: MaxMeasuredValue Error: %@", err); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + uint8_t updateFlagsArgument = 4; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 60U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 60U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_FLW_2_2_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_LVL_1_1_000000_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000013_Off { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 4U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light for color control tests Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeInteractionModelVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Interaction Model Version Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000001_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 64; - uint16_t transitionTimeArgument = 0U; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeVendorNameWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Vendor Name Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertLessThanOrEqual([values[@"value"] length], 32); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeVendorIDWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query VendorID Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 64); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000004_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 128; - uint16_t transitionTimeArgument = 1U; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeProductNameWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Product Name Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertLessThanOrEqual([values[@"value"] length], 32); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 200ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 200); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeProductIDWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductID Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 128); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Label"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffTransitionTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + [cluster readAttributeUserLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query User Label Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000008_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Location"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 254; - uint16_t transitionTimeArgument = 65535U; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeLocationWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query User Location Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertLessThanOrEqual([values[@"value"] length], 2); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000009_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 10); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersion"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeHardwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query HardwareVersion Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 254); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000011_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 0"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersionString"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 0; - uint16_t transitionTimeArgument = 0U; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reset level to 0 Error: %@", err); + [cluster readAttributeHardwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query HardwareVersionString Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); + XCTAssertLessThanOrEqual([values[@"value"] length], 64); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000012_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_LVL_3_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersion"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeSoftwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query SoftwareVersion Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersionString"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads max level attribute from DUT Error: %@", err); + [cluster readAttributeSoftwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query SoftwareVersionString Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); + XCTAssertLessThanOrEqual([values[@"value"] length], 64); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000002_Move +- (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ManufacturingDate"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 0; - uint8_t rateArgument = 200; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster move:moveModeArgument - rate:rateArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move up command Error: %@", err); - - XCTAssertEqual(err.code, 0); + [cluster readAttributeManufacturingDateWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ManufacturingDate Error: %@", err); + if (err.code == CHIPErrorCodeUnsupportedAttribute) { [expectation fulfill]; - }]; + return; + } - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000003_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTAssertEqual(err.code, 0); + + XCTAssertGreaterThanOrEqual([values[@"value"] length], 8); + XCTAssertLessThanOrEqual([values[@"value"] length], 16); + + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query PartNumber"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributePartNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query PartNumber Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductURL"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + [cluster readAttributeProductURLWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductURL Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 256); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductLabel"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeProductLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductLabel Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 64); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query SerialNumber"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeSerialNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query SerialNumber Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query LocalConfigDisabled"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeLocalConfigDisabledWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query LocalConfigDisabled Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Reachable"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeReachableWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Reachable Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_EMR_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 3U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_EMR_1_1_000001_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 1U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_EMR_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 3U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_FLW_1_1_000000_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 2U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_FLW_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000003_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default value to optional attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + int16_t minMeasuredValueArgument = 0; + [cluster writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to optional attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000004_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default value to optional attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + int16_t maxMeasuredValueArgument = 0; + [cluster writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to optional attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_FLW_2_2_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_1_1_000000_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 4U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current Level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000001_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t levelArgument = 64; + uint16_t transitionTimeArgument = 0U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000002_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current Level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 64); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000004_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t levelArgument = 128; + uint16_t transitionTimeArgument = 1U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000005_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 200ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 200); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current Level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 128); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnOffTransitionTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000008_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t levelArgument = 254; + uint16_t transitionTimeArgument = 65535U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000009_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 10); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current Level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 254); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000011_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 0"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t levelArgument = 0; + uint16_t transitionTimeArgument = 0U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reset level to 0 Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000012_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_3_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads max level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000002_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 0; + uint8_t rateArgument = 200; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move up command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000003_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"reads min level attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000006_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 1; + uint8_t rateArgument = 250; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move down command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000007_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000009_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t defaultMoveRateArgument = 20; + [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write default move rate attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeDefaultMoveRateWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads default move rate attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 20); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000011_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 1; + uint8_t rateArgument = 255; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move up command at default move rate Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertNotEqual([values[@"value"] unsignedCharValue], 255); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_4_1_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending on command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000001_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t stepModeArgument = 0; + uint8_t stepSizeArgument = 128; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000002_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 128); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000004_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t stepModeArgument = 1; + uint8_t stepSizeArgument = 64; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends step down command to DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000005_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 64); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000007_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t stepModeArgument = 0; + uint8_t stepSizeArgument = 64; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends a Step up command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 128); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000010_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending off command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_5_1_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending on command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000001_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t stepModeArgument = 0; + uint8_t stepSizeArgument = 128; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000002_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000003_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 0; + uint8_t rateArgument = 1; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends a move up command to DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000004_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000005_Stop +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster stop:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends stop command to DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000006_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending off command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_1_1_000000_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 1U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_2_1_000000_Sleep +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster sleep:^(NSError * err, NSDictionary * values) { + NSLog(@"Put the device into low power mode Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 2U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_1_1_000001_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 2U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OCC_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads mandatory attribute constrains: Occupancy"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads mandatory attribute constrains: Occupancy Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000001_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: Occupancy"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t occupancyArgument = 0; + [cluster writeAttributeOccupancyWithValue:occupancyArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes the respective default value to mandatory attribute: Occupancy Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: Occupancy"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: Occupancy Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorType"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads mandatory attribute constrains: OccupancySensorType Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 3); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000004_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorType"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t occupancySensorTypeArgument = 0; + [cluster writeAttributeOccupancySensorTypeWithValue:occupancySensorTypeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes the respective default value to mandatory attribute: " + @"OccupancySensorType Error: %@", + err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorType"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertGreaterThanOrEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 7); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000007_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t occupancySensorTypeBitmapArgument = 1; + [cluster writeAttributeOccupancySensorTypeBitmapWithValue:occupancySensorTypeBitmapArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes the respective default value to mandatory attribute: " + @"OccupancySensorTypeBitmap Error: %@", + err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorTypeBitmap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OCC_2_2_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 4U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_1_1_000001_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 3U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 4U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000006_Move +- (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 1; - uint8_t rateArgument = 250; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster move:moveModeArgument - rate:rateArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move down command Error: %@", err); + [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000007_WaitForMs +- (void)testSendClusterTest_TC_OO_1_1_000004_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint32_t featureMapArgument = 0UL; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_OO_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000009_WriteAttribute + +- (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: OnOff"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t defaultMoveRateArgument = 20; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Write default move rate attribute from DUT Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: OnOff Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back mandatory attribute: OnOff"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeDefaultMoveRateWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads default move rate attribute from DUT Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back mandatory attribute: OnOff Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 20); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000011_Move +- (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: GlobalSceneControl"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 1; - uint8_t rateArgument = 255; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster move:moveModeArgument - rate:rateArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move up command at default move rate Error: %@", err); + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs +- (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OnTime"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: OnTime Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OffWaitTime"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertNotEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: StartUpOnOff"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OnTime"]; -- (void)testSendClusterTest_TC_LVL_4_1_000000_On + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t onTimeArgument = 0U; + [cluster writeAttributeOnTimeWithValue:onTimeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to LT attribute: OnTime Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OffWaitTime"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t offWaitTimeArgument = 0U; + [cluster writeAttributeOffWaitTimeWithValue:offWaitTimeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to LT attribute: OffWaitTime Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: StartUpOnOff"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Sending on command Error: %@", err); + uint8_t startUpOnOffArgument = 0; + [cluster writeAttributeStartUpOnOffWithValue:startUpOnOffArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to LT attribute: StartUpOnOff Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000001_Step +- (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OnTime"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t stepModeArgument = 0; - uint8_t stepSizeArgument = 128; - uint16_t transitionTimeArgument = 20U; - uint8_t optionMaskArgument = 0; - uint8_t optionOverrideArgument = 0; - [cluster step:stepModeArgument - stepSize:stepSizeArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back LT attribute: OnTime Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OffWaitTime"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 128); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000004_Step +- (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: StartUpOnOff"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t stepModeArgument = 1; - uint8_t stepSizeArgument = 64; - uint16_t transitionTimeArgument = 20U; - uint8_t optionMaskArgument = 0; - uint8_t optionOverrideArgument = 0; - [cluster step:stepModeArgument - stepSize:stepSizeArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Sends step down command to DUT Error: %@", err); + [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back LT attribute: StartUpOnOff Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute + +- (void)testSendClusterTest_TC_OO_2_2_000000_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 64); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000007_Step +- (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t stepModeArgument = 0; - uint8_t stepSizeArgument = 64; - uint16_t transitionTimeArgument = 20U; - uint8_t optionMaskArgument = 0; - uint8_t optionOverrideArgument = 0; - [cluster step:stepModeArgument - stepSize:stepSizeArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Sends a Step up command Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_2_000002_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 128); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000010_Off +- (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"Sending off command Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_LVL_5_1_000000_On +- (void)testSendClusterTest_TC_OO_2_2_000004_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Sending on command Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8579,112 +10428,79 @@ - (void)testSendClusterTest_TC_LVL_5_1_000000_On [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000001_Step +- (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t stepModeArgument = 0; - uint8_t stepSizeArgument = 128; - uint16_t transitionTimeArgument = 20U; - uint8_t optionMaskArgument = 0; - uint8_t optionOverrideArgument = 0; - [cluster step:stepModeArgument - stepSize:stepSizeArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000003_Move +- (void)testSendClusterTest_TC_OO_2_2_000006_Toggle { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 0; - uint8_t rateArgument = 1; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster move:moveModeArgument - rate:rateArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Sends a move up command to DUT Error: %@", err); - - XCTAssertEqual(err.code, 0); + [cluster toggle:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Toggle Command Error: %@", err); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000004_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000005_Stop +- (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Check on/off attribute value is true after toggle command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t optionMaskArgument = 0; - uint8_t optionOverrideArgument = 0; - [cluster stop:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Sends stop command to DUT Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000006_Off +- (void)testSendClusterTest_TC_OO_2_2_000008_Toggle { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"Sending off command Error: %@", err); + [cluster toggle:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Toggle Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8693,43 +10509,39 @@ - (void)testSendClusterTest_TC_LVL_5_1_000006_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_1_1_000000_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + [self expectationWithDescription:@"Check on/off attribute value is false after toggle command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 1U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_2_1_000000_Sleep +- (void)testSendClusterTest_TC_OO_2_2_000010_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster sleep:^(NSError * err, NSDictionary * values) { - NSLog(@"Put the device into low power mode Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8738,440 +10550,463 @@ - (void)testSendClusterTest_TC_MC_2_1_000000_Sleep [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 2U); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_1_1_000001_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_2_000012_Off { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 2U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OCC_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads mandatory attribute constrains: Occupancy"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads mandatory attribute constrains: Occupancy Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000001_WriteAttribute + +- (void)testSendClusterTest_TC_OO_2_3_000000_On { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: Occupancy"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t occupancyArgument = 0; - [cluster writeAttributeOccupancyWithValue:occupancyArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Writes the respective default value to mandatory attribute: Occupancy Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000001_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: Occupancy"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads back mandatory attribute: Occupancy Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000003_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorType"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorType Error: %@", err); + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 3); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000004_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000004_On { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorType"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t occupancySensorTypeArgument = 0; - [cluster writeAttributeOccupancySensorTypeWithValue:occupancySensorTypeArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Writes the respective default value to mandatory attribute: " - @"OccupancySensorType Error: %@", - err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000005_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorType"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000007_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertGreaterThanOrEqual([values[@"value"] unsignedCharValue], 1); - XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 7); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000007_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000008_On { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t occupancySensorTypeBitmapArgument = 1; - [cluster writeAttributeOccupancySensorTypeBitmapWithValue:occupancySensorTypeBitmapArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Writes the respective default value to mandatory attribute: " - @"OccupancySensorTypeBitmap Error: %@", - err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000009_WaitForMs { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorTypeBitmap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_OO_2_3_000011_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; -- (void)testSendClusterTest_TC_OCC_2_2_000000_ReadAttribute + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000014_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 4U); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000001_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000015_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 3U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000016_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 4U); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000017_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000004_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000018_Off { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint32_t featureMapArgument = 0UL; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000019_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000020_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: OnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: OnOff Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000021_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back mandatory attribute: OnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9179,7 +11014,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back mandatory attribute: OnOff Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9190,38 +11025,38 @@ - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000022_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: GlobalSceneControl"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000023_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OnTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: OnTime Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9232,114 +11067,110 @@ - (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000024_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OffWaitTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: OffWaitTime Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000025_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: StartUpOnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000026_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OnTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t onTimeArgument = 0U; - [cluster writeAttributeOnTimeWithValue:onTimeArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to LT attribute: OnTime Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000027_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OffWaitTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t offWaitTimeArgument = 0U; - [cluster writeAttributeOffWaitTimeWithValue:offWaitTimeArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to LT attribute: OffWaitTime Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000028_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: StartUpOnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t startUpOnOffArgument = 0; - [cluster writeAttributeStartUpOnOffWithValue:startUpOnOffArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to LT attribute: StartUpOnOff Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000029_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OnTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9347,7 +11178,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back LT attribute: OnTime Error: %@", err); + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9358,60 +11189,59 @@ - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000030_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OffWaitTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back LT attribute: OffWaitTime Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000031_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: StartUpOnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back LT attribute: StartUpOnOff Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OO_2_2_000000_Off +- (void)testSendClusterTest_TC_OO_2_3_000032_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Off Command Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9420,9 +11250,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000000_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000033_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9430,58 +11260,60 @@ - (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000002_On +- (void)testSendClusterTest_TC_OO_2_3_000034_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Send On Command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000035_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000004_Off +- (void)testSendClusterTest_TC_OO_2_3_000036_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; @@ -9500,9 +11332,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000004_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000037_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9510,7 +11342,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9521,29 +11353,30 @@ - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000006_Toggle +- (void)testSendClusterTest_TC_OO_2_3_000038_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster toggle:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Toggle Command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000039_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Check on/off attribute value is true after toggle command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9551,133 +11384,136 @@ - (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000008_Toggle +- (void)testSendClusterTest_TC_OO_2_3_000040_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster toggle:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Toggle Command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000041_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Check on/off attribute value is false after toggle command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000010_On +- (void)testSendClusterTest_TC_OO_2_3_000042_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Send On Command Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000043_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000012_Off +- (void)testSendClusterTest_TC_OO_2_3_000044_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster off:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Off Command Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000045_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); - [expectation fulfill]; }]; diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh index 514443fd605d4a..0b5d884f7fae33 100755 --- a/src/darwin/Framework/chip_xcode_build_connector.sh +++ b/src/darwin/Framework/chip_xcode_build_connector.sh @@ -52,19 +52,7 @@ for define in "${defines[@]}"; do # skip over those that GN does for us case "$define" in - CHIP_DEVICE_LAYER*) - continue - ;; - CHIP_*_CONFIG_INCLUDE) - continue - ;; - CHIP_SYSTEM_CONFIG_*) - continue - ;; - CONFIG_NETWORK_LAYER*) - continue - ;; - CHIP_CRYPTO_*) + CHIP_HAVE_CONFIG_H) continue ;; esac @@ -108,10 +96,6 @@ declare -a args=( 'chip_crypto="mbedtls"' 'chip_build_tools=false' 'chip_build_tests=false' - 'chip_ble_project_config_include=""' - 'chip_device_project_config_include=""' - 'chip_inet_project_config_include=""' - 'chip_system_project_config_include=""' 'target_cpu="'"$target_cpu"'"' 'target_defines='"$target_defines" 'target_cflags=['"$target_cflags"']' @@ -129,8 +113,6 @@ declare -a args=( [[ $PLATFORM_FAMILY_NAME == macOS ]] && { args+=( 'target_os="mac"' - 'import("//config/standalone/args.gni")' - 'chip_project_config_include_dirs=["'"$CHIP_ROOT"'/config/standalone"]' ) } diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index 579250666a6254..18ffe60efb7beb 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -100,6 +100,12 @@ class ConfigurationManager virtual CHIP_ERROR StoreRegulatoryLocation(uint32_t location) = 0; virtual CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) = 0; virtual CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) = 0; + virtual CHIP_ERROR GetRebootCount(uint32_t & rebootCount) = 0; + virtual CHIP_ERROR StoreRebootCount(uint32_t rebootCount) = 0; + virtual CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) = 0; + virtual CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) = 0; + virtual CHIP_ERROR GetBootReasons(uint32_t & bootReasons) = 0; + virtual CHIP_ERROR StoreBootReasons(uint32_t bootReasons) = 0; virtual CHIP_ERROR GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo) = 0; @@ -151,20 +157,19 @@ class ConfigurationManager }; /** - * Returns a reference to the public interface of the ConfigurationManager singleton object. + * Returns a reference to a ConfigurationManager object. * - * chip application should use this to access features of the ConfigurationManager object - * that are common to all platforms. + * Applications should use this to access the features of the ConfigurationManager. */ extern ConfigurationManager & ConfigurationMgr(); /** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. + * Sets a reference to a ConfigurationManager object. * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the selected platform. + * This must be called before any calls to ConfigurationMgr. If a nullptr is passed in, + * no changes will be made. */ -extern ConfigurationManagerImpl & ConfigurationMgrImpl(); +extern void SetConfigurationMgr(ConfigurationManager * configurationManager); } // namespace DeviceLayer } // namespace chip diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index 1d2ebbbe78ee51..88ce7bd11159d3 100644 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -216,7 +216,22 @@ class ConnectivityManager // Sleepy end device methods #if CHIP_DEVICE_CONFIG_ENABLE_SED CHIP_ERROR GetSEDPollingConfig(SEDPollingConfig & pollingConfig); + + /** + * Sets Sleepy End Device polling configuration and posts kSEDPollingIntervalChange event to inform other software + * modules about the change. + * + * @param[in] pollingConfig polling intervals configuration to be set + */ CHIP_ERROR SetSEDPollingConfig(const SEDPollingConfig & pollingConfig); + + /** + * Requests setting Sleepy End Device fast polling interval on or off. + * Every method call with onOff parameter set to true or false results in incrementing or decrementing the fast polling + * consumers counter. Fast polling mode is set if the consumers counter is bigger than 0. + * + * @param[in] onOff true if fast polling should be enabled and false otherwise. + */ CHIP_ERROR RequestSEDFastPollingMode(bool onOff); #endif diff --git a/src/include/platform/ThreadStackManager.h b/src/include/platform/ThreadStackManager.h index a80f6ca5bfa887..80a03478e9f09f 100644 --- a/src/include/platform/ThreadStackManager.h +++ b/src/include/platform/ThreadStackManager.h @@ -153,7 +153,22 @@ class ThreadStackManager #if CHIP_DEVICE_CONFIG_ENABLE_SED CHIP_ERROR GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); + + /** + * Sets Sleepy End Device polling configuration and posts kSEDPollingIntervalChange event to inform other software + * modules about the change. + * + * @param[in] pollingConfig polling intervals configuration to be set + */ CHIP_ERROR SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig); + + /** + * Requests setting Sleepy End Device fast polling interval on or off. + * Every method call with onOff parameter set to true or false results in incrementing or decrementing the fast polling + * consumers counter. Fast polling mode is set if the consumers counter is bigger than 0. + * + * @param[in] onOff true if fast polling should be enabled and false otherwise. + */ CHIP_ERROR RequestSEDFastPollingMode(bool onOff); #endif diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp b/src/include/platform/internal/GenericConfigurationManagerImpl.cpp index ae9068179d7e11..ef8f91f08742eb 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.cpp @@ -343,6 +343,42 @@ CHIP_ERROR GenericConfigurationManagerImpl::StoreBreadcrumb(uint64_t return Impl()->WriteConfigValue(ImplClass::kConfigKey_Breadcrumb, breadcrumb); } +template +CHIP_ERROR GenericConfigurationManagerImpl::GetRebootCount(uint32_t & rebootCount) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreRebootCount(uint32_t rebootCount) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +template +CHIP_ERROR GenericConfigurationManagerImpl::GetTotalOperationalHours(uint32_t & totalOperationalHours) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreTotalOperationalHours(uint32_t totalOperationalHours) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +template +CHIP_ERROR GenericConfigurationManagerImpl::GetBootReasons(uint32_t & bootReasons) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreBootReasons(uint32_t bootReasons) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + #if CHIP_ENABLE_ROTATING_DEVICE_ID template CHIP_ERROR GenericConfigurationManagerImpl::GetLifetimeCounter(uint16_t & lifetimeCounter) diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.h b/src/include/platform/internal/GenericConfigurationManagerImpl.h index 380b9540d0f86f..42a64c7781a32f 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.h +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.h @@ -97,6 +97,12 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override; CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) override; CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) override; + CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override; + CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override; + CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override; + CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override; + CHIP_ERROR GetBootReasons(uint32_t & bootReasons) override; + CHIP_ERROR StoreBootReasons(uint32_t bootReasons) override; #if !defined(NDEBUG) CHIP_ERROR RunUnitTests(void) override; #endif diff --git a/src/inet/BUILD.gn b/src/inet/BUILD.gn index 3c2caced20f164..ebffb373509ae3 100644 --- a/src/inet/BUILD.gn +++ b/src/inet/BUILD.gn @@ -49,6 +49,8 @@ buildconfig_header("inet_buildconfig") { defines += [ "INET_PLATFORM_CONFIG_INCLUDE=${chip_inet_platform_config_include}" ] } + + defines += [ "CHIP_INET_END_POINT_IMPL_CONFIG_FILE=" ] } source_set("inet_config_header") { @@ -66,8 +68,8 @@ static_library("inet") { output_name = "libInetLayer" sources = [ - "EndPointBasis.cpp", "EndPointBasis.h", + "EndPointBasisImpl${chip_system_config_inet}.h", "IANAConstants.h", "IPAddress-StringFuncts.cpp", "IPAddress.cpp", diff --git a/src/inet/EndPointBasis.cpp b/src/inet/EndPointBasis.cpp deleted file mode 100644 index a4a457bad41b9a..00000000000000 --- a/src/inet/EndPointBasis.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * Copyright (c) 2015-2017 Nest Labs, Inc. - * - * 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 - * This file contains the external implementations of methods in - * the basis class for all the various transport endpoint classes - * in the Inet layer, i.e. TCP, UDP, Raw and Tun. - */ - -#include - -#include - -namespace chip { -namespace Inet { - -#if CHIP_SYSTEM_CONFIG_USE_LWIP - -void EndPointBasis::InitEndPointBasis(InetLayer & aInetLayer, void * aAppState) -{ - AppState = aAppState; - mInetLayer = &aInetLayer; - mLwIPEndPointType = LwIPEndPointType::Unknown; -} - -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP - -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS - -void EndPointBasis::InitEndPointBasis(InetLayer & aInetLayer, void * aAppState) -{ - AppState = aAppState; - mInetLayer = &aInetLayer; - mSocket = kInvalidSocketFd; -} - -#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS - -#if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK - -void EndPointBasis::InitEndPointBasis(InetLayer & aInetLayer, void * aAppState) -{ - AppState = aAppState; - mInetLayer = &aInetLayer; -} - -#endif // CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK - -} // namespace Inet -} // namespace chip diff --git a/src/inet/EndPointBasis.h b/src/inet/EndPointBasis.h index 0a68bf5c29924a..d7791815052732 100644 --- a/src/inet/EndPointBasis.h +++ b/src/inet/EndPointBasis.h @@ -19,29 +19,14 @@ /** * @file * This file contains the basis class for all the various transport - * endpoint classes in the Inet layer, i.e. TCP, UDP, Raw and Tun. + * endpoint classes in the Inet layer, i.e. TCP and UDP. */ #pragma once #include - -#include #include -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS -#include -#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS - -#if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK -#include -#endif // CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK - -#if CHIP_SYSTEM_CONFIG_USE_LWIP -struct udp_pcb; -struct tcp_pcb; -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP - namespace chip { namespace Inet { @@ -50,65 +35,28 @@ class InetLayer; /** * Basis of internet transport endpoint classes. */ -class DLL_EXPORT EndPointBasis +class DLL_EXPORT EndPointBase { public: - /** - * Returns a reference to the Inet layer object that owns this basis object. - */ - InetLayer & Layer() const { return *mInetLayer; } + EndPointBase(InetLayer & aInetLayer, void * aAppState = nullptr) : mAppState(aAppState), mInetLayer(aInetLayer) {} + virtual ~EndPointBase() = default; /** - * Returns \c true if the basis object was obtained by the specified Inet layer instance. - * - * @note - * Does not check whether the object is actually obtained by the system layer instance associated with the Inet layer - * instance. It merely tests whether \c aInetLayer is the Inet layer instance that was provided to \c InitInetLayerBasis. + * Returns a reference to the Inet layer object that owns this basis object. */ - bool IsCreatedByInetLayer(const InetLayer & aInetLayer) const { return mInetLayer == &aInetLayer; } + InetLayer & Layer() const { return mInetLayer; } - void * AppState; + void * mAppState; private: - InetLayer * mInetLayer; /**< Pointer to the InetLayer object that owns this object. */ - -protected: - void InitEndPointBasis(InetLayer & aInetLayer, void * aAppState = nullptr); - -#if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK - nw_parameters_t mParameters; - IPAddressType mAddrType; /**< Protocol family, i.e. IPv4 or IPv6. */ -#endif - -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS - static constexpr int kInvalidSocketFd = -1; - int mSocket; /**< Encapsulated socket descriptor. */ - IPAddressType mAddrType; /**< Protocol family, i.e. IPv4 or IPv6. */ - System::SocketWatchToken mWatch; /**< Socket event watcher */ -#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS - -#if CHIP_SYSTEM_CONFIG_USE_LWIP - /** Encapsulated LwIP protocol control block */ - union - { -#if INET_CONFIG_ENABLE_UDP_ENDPOINT - udp_pcb * mUDP; /**< User datagram protocol (UDP) control */ -#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT -#if INET_CONFIG_ENABLE_TCP_ENDPOINT - tcp_pcb * mTCP; /**< Transmission control protocol (TCP) control */ -#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT - }; - - enum class LwIPEndPointType : uint8_t - { - Unknown = 0, - Raw = 1, - UDP = 2, - UCP = 3, - TCP = 4 - } mLwIPEndPointType; -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP + InetLayer & mInetLayer; /**< InetLayer object that owns this object. */ }; } // namespace Inet } // namespace chip + +#ifdef CHIP_INET_END_POINT_IMPL_CONFIG_FILE +#include CHIP_INET_END_POINT_IMPL_CONFIG_FILE +#else // CHIP_INET_END_POINT_IMPL_CONFIG_FILE +#include +#endif // CHIP_INET_END_POINT_IMPL_CONFIG_FILE diff --git a/src/inet/EndPointBasisImplLwIP.h b/src/inet/EndPointBasisImplLwIP.h new file mode 100644 index 00000000000000..9d398c2bf182d2 --- /dev/null +++ b/src/inet/EndPointBasisImplLwIP.h @@ -0,0 +1,65 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * + * 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. + */ + +/** + * LwIP implementation of EndPointBase. + */ + +#pragma once + +#include + +#include + +struct udp_pcb; +struct tcp_pcb; + +namespace chip { +namespace Inet { + +class DLL_EXPORT EndPointImplLwIP : public EndPointBase +{ +protected: + EndPointImplLwIP(InetLayer & inetLayer, void * appState = nullptr) : + EndPointBase(inetLayer, appState), mLwIPEndPointType(LwIPEndPointType::Unknown) + {} + + /** Encapsulated LwIP protocol control block */ + union + { + const void * mVoid; /**< An untyped protocol control buffer reference */ +#if INET_CONFIG_ENABLE_UDP_ENDPOINT + udp_pcb * mUDP; /**< User datagram protocol (UDP) control */ +#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + tcp_pcb * mTCP; /**< Transmission control protocol (TCP) control */ +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + }; + + enum class LwIPEndPointType : uint8_t + { + Unknown = 0, + UDP = 1, + TCP = 2 + } mLwIPEndPointType; +}; + +using EndPointBasis = EndPointImplLwIP; + +} // namespace Inet +} // namespace chip diff --git a/src/inet/EndPointBasisImplNetworkFramework.h b/src/inet/EndPointBasisImplNetworkFramework.h new file mode 100644 index 00000000000000..8b72c18442fc44 --- /dev/null +++ b/src/inet/EndPointBasisImplNetworkFramework.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * + * 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. + */ + +/** + * Network Framework implementation of EndPointBase. + */ + +#pragma once + +#include + +#include + +#include + +namespace chip { +namespace Inet { + +class DLL_EXPORT EndPointImplNetworkFramework : public EndPointBase +{ +protected: + EndPointImplNetworkFramework(InetLayer & inetLayer, void * appState = nullptr) : EndPointBase(inetLayer, appState) {} + + nw_parameters_t mParameters; + IPAddressType mAddrType; /**< Protocol family, i.e. IPv4 or IPv6. */ +}; + +using EndPointBasis = EndPointImplNetworkFramework; + +} // namespace Inet +} // namespace chip diff --git a/src/inet/EndPointBasisImplSockets.h b/src/inet/EndPointBasisImplSockets.h new file mode 100644 index 00000000000000..f6c4c474541d57 --- /dev/null +++ b/src/inet/EndPointBasisImplSockets.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * + * 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. + */ + +/** + * Sockets implementation of EndPointBase. + */ + +#pragma once + +#include + +#include +#include + +namespace chip { +namespace Inet { + +class DLL_EXPORT EndPointImplSockets : public EndPointBase +{ +protected: + EndPointImplSockets(InetLayer & inetLayer, void * appState = nullptr) : + EndPointBase(inetLayer, appState), mSocket(kInvalidSocketFd) + {} + + static constexpr int kInvalidSocketFd = -1; + int mSocket; /**< Encapsulated socket descriptor. */ + IPAddressType mAddrType; /**< Protocol family, i.e. IPv4 or IPv6. */ + System::SocketWatchToken mWatch; /**< Socket event watcher */ +}; + +using EndPointBasis = EndPointImplSockets; + +} // namespace Inet +} // namespace chip diff --git a/src/inet/InetLayer.cpp b/src/inet/InetLayer.cpp index f5e282d37a62e8..54436d62e87d8a 100644 --- a/src/inet/InetLayer.cpp +++ b/src/inet/InetLayer.cpp @@ -250,7 +250,7 @@ CHIP_ERROR InetLayer::Shutdown() #if INET_CONFIG_ENABLE_TCP_ENDPOINT // Abort all TCP endpoints owned by this instance. TCPEndPoint::sPool.ForEachActiveObject([&](TCPEndPoint * lEndPoint) { - if ((lEndPoint != nullptr) && lEndPoint->IsCreatedByInetLayer(*this)) + if ((lEndPoint != nullptr) && &lEndPoint->Layer() == this) { lEndPoint->Abort(); } @@ -261,7 +261,7 @@ CHIP_ERROR InetLayer::Shutdown() #if INET_CONFIG_ENABLE_UDP_ENDPOINT // Close all UDP endpoints owned by this instance. UDPEndPoint::sPool.ForEachActiveObject([&](UDPEndPoint * lEndPoint) { - if ((lEndPoint != nullptr) && lEndPoint->IsCreatedByInetLayer(*this)) + if ((lEndPoint != nullptr) && &lEndPoint->Layer() == this) { lEndPoint->Close(); } @@ -429,14 +429,13 @@ CHIP_ERROR InetLayer::NewTCPEndPoint(TCPEndPoint ** retEndPoint) VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - *retEndPoint = TCPEndPoint::sPool.CreateObject(); + *retEndPoint = TCPEndPoint::sPool.CreateObject(*this); if (*retEndPoint == nullptr) { ChipLogError(Inet, "%s endpoint pool FULL", "TCP"); return CHIP_ERROR_ENDPOINT_POOL_FULL; } - (*retEndPoint)->Init(this); SYSTEM_STATS_INCREMENT(chip::System::Stats::kInetLayer_NumTCPEps); return CHIP_NO_ERROR; @@ -469,14 +468,13 @@ CHIP_ERROR InetLayer::NewUDPEndPoint(UDPEndPoint ** retEndPoint) VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - *retEndPoint = UDPEndPoint::sPool.CreateObject(); + *retEndPoint = UDPEndPoint::sPool.CreateObject(*this); if (*retEndPoint == nullptr) { ChipLogError(Inet, "%s endpoint pool FULL", "UDP"); return CHIP_ERROR_ENDPOINT_POOL_FULL; } - (*retEndPoint)->Init(this); SYSTEM_STATS_INCREMENT(chip::System::Stats::kInetLayer_NumUDPEps); return CHIP_NO_ERROR; @@ -558,7 +556,7 @@ void InetLayer::HandleTCPInactivityTimer(chip::System::Layer * aSystemLayer, voi bool lTimerRequired = lInetLayer.IsIdleTimerRunning(); TCPEndPoint::sPool.ForEachActiveObject([&](TCPEndPoint * lEndPoint) { - if (!lEndPoint->IsCreatedByInetLayer(lInetLayer)) + if (&lEndPoint->Layer() != &lInetLayer) return true; if (!lEndPoint->IsConnected()) return true; diff --git a/src/inet/TCPEndPoint.cpp b/src/inet/TCPEndPoint.cpp index f0b5fb207fad71..f93f68805c5d71 100644 --- a/src/inet/TCPEndPoint.cpp +++ b/src/inet/TCPEndPoint.cpp @@ -2594,35 +2594,6 @@ bool TCPEndPoint::IsConnected(State state) state == State::kClosing; } -void TCPEndPoint::Init(InetLayer * inetLayer) -{ - InitEndPointBasis(*inetLayer); - - mReceiveEnabled = true; - - // Initialize to zero for using system defaults. - mConnectTimeoutMsecs = 0; - -#if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT - mUserTimeoutMillis = INET_CONFIG_DEFAULT_TCP_USER_TIMEOUT_MSEC; - - mUserTimeoutTimerRunning = false; - -#if INET_CONFIG_ENABLE_TCP_SEND_IDLE_CALLBACKS - mIsTCPSendIdle = true; - - mTCPSendQueuePollPeriodMillis = INET_CONFIG_TCP_SEND_QUEUE_POLL_INTERVAL_MSEC; - - mTCPSendQueueRemainingPollCount = MaxTCPSendQueuePolls(); - - OnTCPSendIdleChanged = NULL; -#endif // INET_CONFIG_ENABLE_TCP_SEND_IDLE_CALLBACKS - -#endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT - - InitImpl(); -} - CHIP_ERROR TCPEndPoint::DriveSending() { CHIP_ERROR err = DriveSendingImpl(); diff --git a/src/inet/TCPEndPoint.h b/src/inet/TCPEndPoint.h index a6f05744df2685..41244c669dd5c2 100644 --- a/src/inet/TCPEndPoint.h +++ b/src/inet/TCPEndPoint.h @@ -74,7 +74,24 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis, public ReferenceCounted mTCPSendQueuePollPeriodMillis) ? (mUserTimeoutMillis / mTCPSendQueuePollPeriodMillis) : 1; + return (userTimeout > pollPeriod) ? (userTimeout / pollPeriod) : 1; } + uint16_t MaxTCPSendQueuePolls(void) { return MaxTCPSendQueuePolls(mUserTimeoutMillis, mTCPSendQueuePollPeriodMillis); } #endif // INET_CONFIG_ENABLE_TCP_SEND_IDLE_CALLBACKS #if CHIP_SYSTEM_CONFIG_USE_SOCKETS @@ -666,7 +684,6 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis, public ReferenceCounted { public: - UDPEndPoint() = default; + UDPEndPoint(InetLayer & inetLayer, void * appState = nullptr) : + EndPointBasis(inetLayer, appState), mState(State::kReady), OnMessageReceived(nullptr), OnReceiveError(nullptr) + { + InitImpl(); + } UDPEndPoint(const UDPEndPoint &) = delete; UDPEndPoint(UDPEndPoint &&) = delete; @@ -81,19 +85,21 @@ class DLL_EXPORT UDPEndPoint : public EndPointBasis, public ReferenceCounted(context); DiscoveredNodeData data; Platform::CopyString(data.hostName, result->mHostName); + Platform::CopyString(data.instanceName, result->mName); if (result->mAddress.HasValue() && data.numIPs < DiscoveredNodeData::kMaxIPAddresses) { diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index 24d0f1a27e821c..73ab5120f39024 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -126,6 +126,7 @@ struct DiscoveredNodeData } DiscoveredNodeData() { Reset(); } bool IsHost(const char * host) const { return strcmp(host, hostName) == 0; } + bool IsInstanceName(const char * instance) const { return strcmp(instance, instanceName) == 0; } bool IsValid() const { return !IsHost("") && ipAddress[0] != chip::Inet::IPAddress::Any; } Optional GetMrpRetryIntervalIdle() const @@ -175,12 +176,16 @@ struct DiscoveredNodeData } if (pairingHint > 0) { - ChipLogDetail(Discovery, "\tPairing Hint: 0x%x", pairingHint); + ChipLogDetail(Discovery, "\tPairing Hint: %u", pairingHint); } if (!IsHost("")) { ChipLogDetail(Discovery, "\tHostname: %s", hostName); } + if (!IsInstanceName("")) + { + ChipLogDetail(Discovery, "\tInstance Name: %s", instanceName); + } for (int j = 0; j < numIPs; j++) { #if CHIP_DETAIL_LOGGING diff --git a/src/lib/dnssd/minimal_mdns/Server.cpp b/src/lib/dnssd/minimal_mdns/Server.cpp index 9800240ea30ca1..1942a6f250be9c 100644 --- a/src/lib/dnssd/minimal_mdns/Server.cpp +++ b/src/lib/dnssd/minimal_mdns/Server.cpp @@ -343,7 +343,7 @@ CHIP_ERROR ServerBase::BroadcastSend(chip::System::PacketBufferHandle && data, u void ServerBase::OnUdpPacketReceived(chip::Inet::UDPEndPoint * endPoint, chip::System::PacketBufferHandle && buffer, const chip::Inet::IPPacketInfo * info) { - ServerBase * srv = static_cast(endPoint->AppState); + ServerBase * srv = static_cast(endPoint->mAppState); if (!srv->mDelegate) { return; diff --git a/src/lib/support/logging/CHIPLogging.cpp b/src/lib/support/logging/CHIPLogging.cpp index df5439bd952697..57dacbe3f1b9f0 100644 --- a/src/lib/support/logging/CHIPLogging.cpp +++ b/src/lib/support/logging/CHIPLogging.cpp @@ -95,6 +95,7 @@ static const char ModuleNames[] = "-\0\0" // None "IM\0" // InteractionModel "TST" // Test "ODP" // OperationalDeviceProxy + "ATM" // Automation ; #define ModuleNamesCount ((sizeof(ModuleNames) - 1) / chip::Logging::kMaxModuleNameLen) diff --git a/src/lib/support/logging/CHIPLogging.h b/src/lib/support/logging/CHIPLogging.h index ac8f6820b2701f..8dfffd21288d1e 100644 --- a/src/lib/support/logging/CHIPLogging.h +++ b/src/lib/support/logging/CHIPLogging.h @@ -29,6 +29,7 @@ * - #CHIP_ERROR_LOGGING * - #CHIP_PROGRESS_LOGGING * - #CHIP_DETAIL_LOGGING + * - #CHIP_AUTOMATION_LOGGING * */ @@ -62,6 +63,7 @@ * - #CHIP_ERROR_LOGGING * - #CHIP_PROGRESS_LOGGING * - #CHIP_DETAIL_LOGGING + * - #CHIP_AUTOMATION_LOGGING * */ @@ -174,11 +176,32 @@ void SetLogFilter(uint8_t category); #define ChipLogByteSpan(MOD, DATA) ((void) 0) #endif -#if CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING +#ifndef CHIP_AUTOMATION_LOGGING +#define CHIP_AUTOMATION_LOGGING 1 +#endif + +#if CHIP_AUTOMATION_LOGGING +/** + * @def ChipLogAutomation(MSG, ...) + * + * @brief + * Log a chip message for the specified module in the 'Automation' + * category. + * + */ +#ifndef ChipLogAutomation +#define ChipLogAutomation(MSG, ...) \ + chip::Logging::Log(chip::Logging::kLogModule_Automation, chip::Logging::kLogCategory_Automation, MSG, ##__VA_ARGS__) +#endif +#else +#define ChipLogAutomation(MOD, MSG, ...) ((void) 0) +#endif + +#if CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING || CHIP_AUTOMATION_LOGGING #define _CHIP_USE_LOGGING 1 #else #define _CHIP_USE_LOGGING 0 -#endif /* CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING */ +#endif /* CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING || CHIP_AUTOMATION_LOGGING */ #if _CHIP_USE_LOGGING diff --git a/src/lib/support/logging/Constants.h b/src/lib/support/logging/Constants.h index ddc6beacbbf28e..0214fcaa2dbab8 100644 --- a/src/lib/support/logging/Constants.h +++ b/src/lib/support/logging/Constants.h @@ -57,6 +57,7 @@ enum LogModule kLogModule_InteractionModel, kLogModule_Test, kLogModule_OperationalDeviceProxy, + kLogModule_Automation, kLogModule_Max }; @@ -125,7 +126,16 @@ enum LogCategory */ kLogCategory_Detail = 3, - kLogCategory_Max = kLogCategory_Detail + /*!< + * Indicates a category of log message that describes automation + * information about an event or the state of the system. + * + * Such messages can be used by automation for test validation. + * + */ + kLogCategory_Automation = 4, + + kLogCategory_Max = kLogCategory_Automation }; } // namespace Logging diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index d86c001907d30d..257537017eb32b 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -84,9 +84,9 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout) } #if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED -void ExchangeContext::UpdateSEDPollingMode(Transport::Type transportType) +void ExchangeContext::UpdateSEDPollingMode() { - if (transportType != Transport::Type::kBle) + if (GetSessionHandle().GetPeerAddress(mExchangeMgr->GetSessionManager())->GetTransportType() != Transport::Type::kBle) { if (!IsResponseExpected() && !IsSendExpected() && (mExchangeMgr->GetNumActiveExchanges() == 1)) { @@ -488,8 +488,7 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload void ExchangeContext::MessageHandled() { #if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED - const Transport::PeerAddress * peerAddress = GetSessionHandle().GetPeerAddress(mExchangeMgr->GetSessionManager()); - UpdateSEDPollingMode(peerAddress->GetTransportType()); + UpdateSEDPollingMode(); #endif if (mFlags.Has(Flags::kFlagClosed) || IsResponseExpected() || IsSendExpected()) diff --git a/src/messaging/ExchangeContext.h b/src/messaging/ExchangeContext.h index 6a8c03cb89a55b..1494056191e420 100644 --- a/src/messaging/ExchangeContext.h +++ b/src/messaging/ExchangeContext.h @@ -244,15 +244,11 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext, public Referen * - set IDLE polling mode if all conditions are met: * - device doesn't expect getting response nor sending message * - there is no other active exchange than the current one - * - active state is not forced (commissioning window is not opened) * - set ACTIVE polling mode if any of the conditions is met: * - device expects getting response or sending message * - there is another active exchange - * - active state is forced (commissioning window is currently open) - * - * @param[in] transportType transport used by the exchange */ - void UpdateSEDPollingMode(Transport::Type transportType); + void UpdateSEDPollingMode(); }; } // namespace Messaging diff --git a/src/messaging/tests/MessagingContext.cpp b/src/messaging/tests/MessagingContext.cpp index f680c40586a0dc..fa09f93cefcd4a 100644 --- a/src/messaging/tests/MessagingContext.cpp +++ b/src/messaging/tests/MessagingContext.cpp @@ -65,6 +65,11 @@ SessionHandle MessagingContext::GetSessionAliceToBob() return SessionHandle(GetBobNodeId(), GetAliceKeyId(), GetBobKeyId(), mDestFabricIndex); } +SessionHandle MessagingContext::GetSessionBobToFriends() +{ + return SessionHandle(GetBobKeyId(), GetFriendsGroupId(), GetFabricIndex()); +} + Messaging::ExchangeContext * MessagingContext::NewUnauthenticatedExchangeToAlice(Messaging::ExchangeDelegate * delegate) { return mExchangeManager.NewContext(mSessionManager.CreateUnauthenticatedSession(mAliceAddress).Value(), delegate); diff --git a/src/messaging/tests/MessagingContext.h b/src/messaging/tests/MessagingContext.h index 4c8e9755fb02b1..0e9159648fd135 100644 --- a/src/messaging/tests/MessagingContext.h +++ b/src/messaging/tests/MessagingContext.h @@ -61,6 +61,7 @@ class MessagingContext uint16_t GetBobKeyId() const { return mBobKeyId; } uint16_t GetAliceKeyId() const { return mAliceKeyId; } + GroupId GetFriendsGroupId() const { return mFriendsGroupId; } void SetBobKeyId(uint16_t id) { mBobKeyId = id; } void SetAliceKeyId(uint16_t id) { mAliceKeyId = id; } @@ -78,6 +79,7 @@ class MessagingContext SessionHandle GetSessionBobToAlice(); SessionHandle GetSessionAliceToBob(); + SessionHandle GetSessionBobToFriends(); Messaging::ExchangeContext * NewUnauthenticatedExchangeToAlice(Messaging::ExchangeDelegate * delegate); Messaging::ExchangeContext * NewUnauthenticatedExchangeToBob(Messaging::ExchangeDelegate * delegate); @@ -94,10 +96,11 @@ class MessagingContext secure_channel::MessageCounterManager mMessageCounterManager; IOContext * mIOContext; - NodeId mBobNodeId = 123654; - NodeId mAliceNodeId = 111222333; - uint16_t mBobKeyId = 1; - uint16_t mAliceKeyId = 2; + NodeId mBobNodeId = 123654; + NodeId mAliceNodeId = 111222333; + uint16_t mBobKeyId = 1; + uint16_t mAliceKeyId = 2; + GroupId mFriendsGroupId = 517; Transport::PeerAddress mAliceAddress; Transport::PeerAddress mBobAddress; SecurePairingUsingTestSecret mPairingAliceToBob; diff --git a/src/platform/Ameba/AmebaConfig.cpp b/src/platform/Ameba/AmebaConfig.cpp index b0dbab66c91a6b..cf7bdf87faa65b 100644 --- a/src/platform/Ameba/AmebaConfig.cpp +++ b/src/platform/Ameba/AmebaConfig.cpp @@ -74,6 +74,12 @@ const AmebaConfig::Key AmebaConfig::kConfigKey_RegulatoryLocation = { k const AmebaConfig::Key AmebaConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; const AmebaConfig::Key AmebaConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; +// Keys stored in the Chip-counters namespace +const AmebaConfig::Key AmebaConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; +const AmebaConfig::Key AmebaConfig::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; +const AmebaConfig::Key AmebaConfig::kCounterKey_TotalOperationalHours = { kConfigNamespace_ChipCounters, "total-hours" }; +const AmebaConfig::Key AmebaConfig::kCounterKey_BootReason = { kConfigNamespace_ChipCounters, "boot-reason" }; + CHIP_ERROR AmebaConfig::ReadConfigValue(Key key, bool & val) { uint32_t intVal; diff --git a/src/platform/Ameba/AmebaConfig.h b/src/platform/Ameba/AmebaConfig.h index 67b4f510be55b6..1f8b323a257f49 100755 --- a/src/platform/Ameba/AmebaConfig.h +++ b/src/platform/Ameba/AmebaConfig.h @@ -67,6 +67,10 @@ class AmebaConfig static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; static const Key kConfigKey_Breadcrumb; + static const Key kCounterKey_RebootCount; + static const Key kCounterKey_UpTime; + static const Key kCounterKey_TotalOperationalHours; + static const Key kCounterKey_BootReason; static const char kGroupKeyNamePrefix[]; diff --git a/src/platform/Ameba/BUILD.gn b/src/platform/Ameba/BUILD.gn index 15849c83b426f0..2626ec984d0b0b 100755 --- a/src/platform/Ameba/BUILD.gn +++ b/src/platform/Ameba/BUILD.gn @@ -21,6 +21,7 @@ assert(chip_device_platform == "ameba") static_library("Ameba") { sources = [ "../FreeRTOS/SystemTimeSupport.cpp", + "../SingletonConfigurationManager.cpp", "AmebaConfig.cpp", "AmebaConfig.h", "BLEManagerImpl.cpp", diff --git a/src/platform/Ameba/ConfigurationManagerImpl.cpp b/src/platform/Ameba/ConfigurationManagerImpl.cpp index 1728f578f7c8ac..9e5525322536b9 100644 --- a/src/platform/Ameba/ConfigurationManagerImpl.cpp +++ b/src/platform/Ameba/ConfigurationManagerImpl.cpp @@ -36,13 +36,16 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { CHIP_ERROR err; + uint32_t rebootCount; bool failSafeArmed; // Force initialization of NVS namespaces if they doesn't already exist. @@ -53,6 +56,33 @@ CHIP_ERROR ConfigurationManagerImpl::Init() err = EnsureNamespace(kConfigNamespace_ChipCounters); SuccessOrExit(err); + if (ConfigValueExists(kCounterKey_RebootCount)) + { + err = GetRebootCount(rebootCount); + SuccessOrExit(err); + + err = StoreRebootCount(rebootCount + 1); + SuccessOrExit(err); + } + else + { + // The first boot after factory reset of the Node. + err = StoreRebootCount(1); + SuccessOrExit(err); + } + + if (!ConfigValueExists(kCounterKey_TotalOperationalHours)) + { + err = StoreTotalOperationalHours(0); + SuccessOrExit(err); + } + + if (!ConfigValueExists(kCounterKey_BootReason)) + { + err = StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_UNSPECIFIED); + SuccessOrExit(err); + } + // Initialize the generic implementation base class. err = Internal::GenericConfigurationManagerImpl::Init(); SuccessOrExit(err); @@ -69,6 +99,36 @@ CHIP_ERROR ConfigurationManagerImpl::Init() return err; } +CHIP_ERROR ConfigurationManagerImpl::GetRebootCount(uint32_t & rebootCount) +{ + return ReadConfigValue(kCounterKey_RebootCount, rebootCount); +} + +CHIP_ERROR ConfigurationManagerImpl::StoreRebootCount(uint32_t rebootCount) +{ + return WriteConfigValue(kCounterKey_RebootCount, rebootCount); +} + +CHIP_ERROR ConfigurationManagerImpl::GetTotalOperationalHours(uint32_t & totalOperationalHours) +{ + return ReadConfigValue(kCounterKey_TotalOperationalHours, totalOperationalHours); +} + +CHIP_ERROR ConfigurationManagerImpl::StoreTotalOperationalHours(uint32_t totalOperationalHours) +{ + return WriteConfigValue(kCounterKey_TotalOperationalHours, totalOperationalHours); +} + +CHIP_ERROR ConfigurationManagerImpl::GetBootReasons(uint32_t & bootReasons) +{ + return ReadConfigValue(kCounterKey_BootReason, bootReasons); +} + +CHIP_ERROR ConfigurationManagerImpl::StoreBootReasons(uint32_t bootReasons) +{ + return WriteConfigValue(kCounterKey_BootReason, bootReasons); +} + CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { char temp[32]; diff --git a/src/platform/Ameba/ConfigurationManagerImpl.h b/src/platform/Ameba/ConfigurationManagerImpl.h index 8e1d02c55fc8c9..c51ea2eb30175d 100644 --- a/src/platform/Ameba/ConfigurationManagerImpl.h +++ b/src/platform/Ameba/ConfigurationManagerImpl.h @@ -34,12 +34,12 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Ameba platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::AmebaConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::AmebaConfig { - // Allow the ConfigurationManager interface class to delegate method calls to - // the implementation methods provided by this class. - friend class ConfigurationManager; +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); private: // Allow the GenericConfigurationManagerImpl base class to access helper methods and types @@ -56,42 +56,19 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana void InitiateFactoryReset(void) override; CHIP_ERROR ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value) override; CHIP_ERROR WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value) override; + CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override; + CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override; + CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override; + CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override; + CHIP_ERROR GetBootReasons(uint32_t & bootReasons) override; + CHIP_ERROR StoreBootReasons(uint32_t bootReasons) override; // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the Ameba platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Ameba/ConnectivityManagerImpl.cpp b/src/platform/Ameba/ConnectivityManagerImpl.cpp index 22179e0004c5a6..579122441349a3 100644 --- a/src/platform/Ameba/ConnectivityManagerImpl.cpp +++ b/src/platform/Ameba/ConnectivityManagerImpl.cpp @@ -18,6 +18,8 @@ /* this file behaves like a config.h, comes first */ #include +#include + #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #include #endif @@ -26,7 +28,10 @@ #include #endif -#include +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI +#include +#endif + #include #include #include @@ -49,6 +54,100 @@ namespace DeviceLayer { ConnectivityManagerImpl ConnectivityManagerImpl::sInstance; +// ==================== ConnectivityManager Platform Internal Methods ==================== + +CHIP_ERROR ConnectivityManagerImpl::_Init() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + mLastStationConnectFailTime = System::Clock::kZero; + mLastAPDemandTime = System::Clock::kZero; + mWiFiStationMode = kWiFiStationMode_Disabled; + mWiFiStationState = kWiFiStationState_NotConnected; + mWiFiAPMode = kWiFiAPMode_Disabled; + mWiFiAPState = kWiFiAPState_NotActive; + mWiFiStationReconnectInterval = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL); + mWiFiAPIdleTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_AP_IDLE_TIMEOUT); + mFlags.SetRaw(0); + + // Ensure that station mode is enabled. + wifi_on(RTW_MODE_STA); + + // Ensure that station mode is enabled in the WiFi layer. + wifi_set_mode(RTW_MODE_STA); + ; + + // If there is no persistent station provision... + if (!IsWiFiStationProvisioned()) + { + // If the code has been compiled with a default WiFi station provision, configure that now. +#if !defined(CONFIG_DEFAULT_WIFI_SSID) + printf("%s %d pls define CONFIG_DEFAULT_WIFI_SSID\r\n", __func__, __LINE__); +#else + if (CONFIG_DEFAULT_WIFI_SSID[0] != 0) + { + ChipLogProgress(DeviceLayer, "Setting default WiFi station configuration (SSID: %s)", CONFIG_DEFAULT_WIFI_SSID); + + // Set a default station configuration. + rtw_wifi_setting_t wifiConfig; + + // Set the wifi configuration + memset(&wifiConfig, 0, sizeof(wifiConfig)); + memcpy(wifiConfig.ssid, CONFIG_DEFAULT_WIFI_SSID, strlen(CONFIG_DEFAULT_WIFI_SSID) + 1); + memcpy(wifiConfig.password, CONFIG_DEFAULT_WIFI_PASSWORD, strlen(CONFIG_DEFAULT_WIFI_PASSWORD) + 1); + wifiConfig.mode = RTW_MODE_STA; + + // Configure the WiFi interface. + int err = CHIP_SetWiFiConfig(&wifiConfig); + if (err != 0) + { + ChipLogError(DeviceLayer, "_Init _SetWiFiConfig() failed: %d", err); + } + + // Enable WiFi station mode. + ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Enabled)); + } + + // Otherwise, ensure WiFi station mode is disabled. + else + { + ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Disabled)); + } +#endif + } + + // Force AP mode off for now. + + // Queue work items to bootstrap the AP and station state machines once the Chip event loop is running. + ReturnErrorOnFailure(DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL)); + ReturnErrorOnFailure(DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL)); + +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI + + return CHIP_NO_ERROR; +} + +void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) +{ + // Forward the event to the generic base classes as needed. +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(event); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI + if (event->Type == DeviceEventType::kRtkWiFiStationConnectedEvent) + { + ChipLogProgress(DeviceLayer, "WIFI_EVENT_STA_CONNECTED"); + if (mWiFiStationState == kWiFiStationState_Connecting) + { + ChangeWiFiStationState(kWiFiStationState_Connecting_Succeeded); + } + DriveStationState(); + DHCPProcess(); + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI +} + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMode(void) { if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled) @@ -330,94 +429,6 @@ CHIP_ERROR ConnectivityManagerImpl::_GetAndLogWifiStatsCounters(void) return CHIP_NO_ERROR; } -// ==================== ConnectivityManager Platform Internal Methods ==================== - -CHIP_ERROR ConnectivityManagerImpl::_Init() -{ - mLastStationConnectFailTime = System::Clock::kZero; - mLastAPDemandTime = System::Clock::kZero; - mWiFiStationMode = kWiFiStationMode_Disabled; - mWiFiStationState = kWiFiStationState_NotConnected; - mWiFiAPMode = kWiFiAPMode_Disabled; - mWiFiAPState = kWiFiAPState_NotActive; - mWiFiStationReconnectInterval = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL); - mWiFiAPIdleTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_AP_IDLE_TIMEOUT); - mFlags.SetRaw(0); - - // Ensure that station mode is enabled. - wifi_on(RTW_MODE_STA); - - // Ensure that station mode is enabled in the WiFi layer. - wifi_set_mode(RTW_MODE_STA); - ; - - // If there is no persistent station provision... - if (!IsWiFiStationProvisioned()) - { - // If the code has been compiled with a default WiFi station provision, configure that now. -#if !defined(CONFIG_DEFAULT_WIFI_SSID) - printf("%s %d pls define CONFIG_DEFAULT_WIFI_SSID\r\n", __func__, __LINE__); -#else - if (CONFIG_DEFAULT_WIFI_SSID[0] != 0) - { - ChipLogProgress(DeviceLayer, "Setting default WiFi station configuration (SSID: %s)", CONFIG_DEFAULT_WIFI_SSID); - - // Set a default station configuration. - rtw_wifi_setting_t wifiConfig; - - // Set the wifi configuration - memset(&wifiConfig, 0, sizeof(wifiConfig)); - memcpy(wifiConfig.ssid, CONFIG_DEFAULT_WIFI_SSID, strlen(CONFIG_DEFAULT_WIFI_SSID) + 1); - memcpy(wifiConfig.password, CONFIG_DEFAULT_WIFI_PASSWORD, strlen(CONFIG_DEFAULT_WIFI_PASSWORD) + 1); - wifiConfig.mode = RTW_MODE_STA; - - // Configure the WiFi interface. - int err = CHIP_SetWiFiConfig(&wifiConfig); - if (err != 0) - { - ChipLogError(DeviceLayer, "_Init _SetWiFiConfig() failed: %d", err); - } - - // Enable WiFi station mode. - ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Enabled)); - } - - // Otherwise, ensure WiFi station mode is disabled. - else - { - ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Disabled)); - } -#endif - } - - // Force AP mode off for now. - - // Queue work items to bootstrap the AP and station state machines once the Chip event loop is running. - ReturnErrorOnFailure(DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL)); - ReturnErrorOnFailure(DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL)); - - return CHIP_NO_ERROR; -} - -void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) -{ - // Forward the event to the generic base classes as needed. -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD - GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(event); -#else - if (event->Type == DeviceEventType::kRtkWiFiStationConnectedEvent) - { - ChipLogProgress(DeviceLayer, "WIFI_EVENT_STA_CONNECTED"); - if (mWiFiStationState == kWiFiStationState_Connecting) - { - ChangeWiFiStationState(kWiFiStationState_Connecting_Succeeded); - } - DriveStationState(); - DHCPProcess(); - } -#endif -} - void ConnectivityManagerImpl::_OnWiFiScanDone() { // Schedule a call to DriveStationState method in case a station connect attempt was @@ -787,5 +798,66 @@ void ConnectivityManagerImpl::DHCPProcess(void) xTaskCreate(DHCPProcessThread, "DHCPProcess", 4096 / sizeof(StackType_t), this, 1, NULL); } +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiSecurityType(uint8_t & securityType) +{ + securityType = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiChannelNumber(uint16_t & channelNumber) +{ + channelNumber = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiRssi(int8_t & rssi) +{ + rssi = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiBeaconLostCount(uint32_t & beaconLostCount) +{ + beaconLostCount = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiCurrentMaxRate(uint64_t & currentMaxRate) +{ + currentMaxRate = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount) +{ + packetMulticastRxCount = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount) +{ + packetMulticastTxCount = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount) +{ + packetUnicastRxCount = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiPacketUnicastTxCount(uint32_t & packetUnicastTxCount) +{ + packetUnicastTxCount = 0; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_GetWiFiOverrunCount(uint64_t & overrunCount) +{ + overrunCount = 0; + return CHIP_NO_ERROR; +} +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Ameba/ConnectivityManagerImpl.h b/src/platform/Ameba/ConnectivityManagerImpl.h index aaace4eda3f0cc..253c4744797d9d 100644 --- a/src/platform/Ameba/ConnectivityManagerImpl.h +++ b/src/platform/Ameba/ConnectivityManagerImpl.h @@ -20,39 +20,66 @@ #include #include + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI #include +#else +#include +#endif + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#include +#else +#include +#endif + #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #include #else #include #endif + #include -#include #include +namespace chip { + namespace Inet { class IPAddress; } // namespace Inet -namespace chip { namespace DeviceLayer { +class PlatformManagerImpl; + class ConnectivityManagerImpl final : public ConnectivityManager, public Internal::GenericConnectivityManagerImpl, +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI public Internal::GenericConnectivityManagerImpl_WiFi, +#else + public Internal::GenericConnectivityManagerImpl_NoWiFi, +#endif #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE public Internal::GenericConnectivityManagerImpl_BLE, #else public Internal::GenericConnectivityManagerImpl_NoBLE, #endif +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + public Internal::GenericConnectivityManagerImpl_Thread +#else public Internal::GenericConnectivityManagerImpl_NoThread +#endif { // Allow the ConnectivityManager interface class to delegate method calls to // the implementation methods provided by this class. friend class ConnectivityManager; private: + CHIP_ERROR _Init(void); + void _OnPlatformEvent(const ChipDeviceEvent * event); + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI using Flags = GenericConnectivityManagerImpl_WiFi::ConnectivityFlags; // ===== Members that implement the ConnectivityManager abstract interface. @@ -75,18 +102,20 @@ class ConnectivityManagerImpl final : public ConnectivityManager, System::Clock::Timeout _GetWiFiAPIdleTimeout(void); void _SetWiFiAPIdleTimeout(System::Clock::Timeout val); CHIP_ERROR _GetAndLogWifiStatsCounters(void); - CHIP_ERROR _Init(void); - void _OnPlatformEvent(const ChipDeviceEvent * event); bool _CanStartWiFiScan(); void _OnWiFiScanDone(); void _OnWiFiStationProvisionChange(); - // ===== Members for internal use by the following friends. - - friend ConnectivityManager & ConnectivityMgr(void); - friend ConnectivityManagerImpl & ConnectivityMgrImpl(void); - - static ConnectivityManagerImpl sInstance; + CHIP_ERROR _GetWiFiSecurityType(uint8_t & securityType); + CHIP_ERROR _GetWiFiChannelNumber(uint16_t & channelNumber); + CHIP_ERROR _GetWiFiRssi(int8_t & rssi); + CHIP_ERROR _GetWiFiBeaconLostCount(uint32_t & beaconLostCount); + CHIP_ERROR _GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount); + CHIP_ERROR _GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount); + CHIP_ERROR _GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount); + CHIP_ERROR _GetWiFiPacketUnicastTxCount(uint32_t & packetUnicastTxCount); + CHIP_ERROR _GetWiFiCurrentMaxRate(uint64_t & currentMaxRate); + CHIP_ERROR _GetWiFiOverrunCount(uint64_t & overrunCount); // ===== Private members reserved for use by this class only. @@ -116,12 +145,21 @@ class ConnectivityManagerImpl final : public ConnectivityManager, void OnStationIPv4AddressLost(void); void OnIPv6AddressAvailable(void); +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI + + // ===== Members for internal use by the following friends. + + friend ConnectivityManager & ConnectivityMgr(void); + friend ConnectivityManagerImpl & ConnectivityMgrImpl(void); + + static ConnectivityManagerImpl sInstance; static void RefreshMessageLayer(void); static void RtkWiFiStationConnectedHandler(char * buf, int buf_len, int flags, void * userdata); void DHCPProcess(void); static void DHCPProcessThread(void * param); }; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI inline bool ConnectivityManagerImpl::_IsWiFiStationApplicationControlled(void) { return mWiFiStationMode == kWiFiStationMode_ApplicationControlled; @@ -161,6 +199,7 @@ inline bool ConnectivityManagerImpl::_CanStartWiFiScan() { return mWiFiStationState != kWiFiStationState_Connecting; } +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI /** * Returns the public interface of the ConnectivityManager singleton object. diff --git a/src/platform/Ameba/PlatformManagerImpl.cpp b/src/platform/Ameba/PlatformManagerImpl.cpp index 07981d2ade2231..000824271da1d2 100644 --- a/src/platform/Ameba/PlatformManagerImpl.cpp +++ b/src/platform/Ameba/PlatformManagerImpl.cpp @@ -57,11 +57,15 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) CHIP_ERROR err; + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); + // Make sure the LwIP core lock has been initialized err = Internal::InitLwIPCoreLock(); SuccessOrExit(err); + mStartTime = System::SystemClock().GetMonotonicTimestamp(); + // TODO Wi-Fi Initialzation currently done through the example app needs to be moved into here. // for now we will let this happen that way and assume all is OK @@ -76,6 +80,31 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) return err; } +CHIP_ERROR PlatformManagerImpl::_Shutdown() +{ + uint64_t upTime = 0; + + if (_GetUpTime(upTime) == CHIP_NO_ERROR) + { + uint32_t totalOperationalHours = 0; + + if (ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) + { + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + static_cast(upTime / 3600)); + } + else + { + ChipLogError(DeviceLayer, "Failed to get total operational hours of the Node"); + } + } + else + { + ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot"); + } + + return Internal::GenericPlatformManagerImpl_FreeRTOS::_Shutdown(); +} + CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapFree(uint64_t & currentHeapFree) { currentHeapFree = xPortGetFreeHeapSize(); @@ -93,5 +122,66 @@ CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapHighWatermark(uint64_t & currentH currentHeapHighWatermark = xPortGetTotalHeapSize() - xPortGetMinimumEverFreeHeapSize(); return CHIP_NO_ERROR; } +CHIP_ERROR PlatformManagerImpl::_GetRebootCount(uint16_t & rebootCount) +{ + uint32_t count = 0; + + CHIP_ERROR err = ConfigurationMgr().GetRebootCount(count); + + if (err == CHIP_NO_ERROR) + { + VerifyOrReturnError(count <= UINT16_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE); + rebootCount = static_cast(count); + } + + return err; +} + +CHIP_ERROR PlatformManagerImpl::_GetUpTime(uint64_t & upTime) +{ + System::Clock::Timestamp currentTime = System::SystemClock().GetMonotonicTimestamp(); + + if (currentTime >= mStartTime) + { + upTime = std::chrono::duration_cast(currentTime - mStartTime).count(); + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_INVALID_TIME; +} + +CHIP_ERROR PlatformManagerImpl::_GetTotalOperationalHours(uint32_t & totalOperationalHours) +{ + uint64_t upTime = 0; + + if (_GetUpTime(upTime) == CHIP_NO_ERROR) + { + uint32_t totalHours = 0; + if (ConfigurationMgr().GetTotalOperationalHours(totalHours) == CHIP_NO_ERROR) + { + VerifyOrReturnError(upTime / 3600 <= UINT32_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE); + totalOperationalHours = totalHours + static_cast(upTime / 3600); + return CHIP_NO_ERROR; + } + } + + return CHIP_ERROR_INVALID_TIME; +} + +CHIP_ERROR PlatformManagerImpl::_GetBootReasons(uint8_t & bootReasons) +{ + uint32_t reason = 0; + + CHIP_ERROR err = ConfigurationMgr().GetBootReasons(reason); + + if (err == CHIP_NO_ERROR) + { + VerifyOrReturnError(reason <= UINT8_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE); + bootReasons = static_cast(reason); + } + + return err; +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Ameba/PlatformManagerImpl.h b/src/platform/Ameba/PlatformManagerImpl.h index ba4839ec6e5217..86f46b170cb616 100644 --- a/src/platform/Ameba/PlatformManagerImpl.h +++ b/src/platform/Ameba/PlatformManagerImpl.h @@ -53,15 +53,23 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener // ===== Methods that implement the PlatformManager abstract interface. CHIP_ERROR _InitChipStack(void); + CHIP_ERROR _Shutdown(); CHIP_ERROR _GetCurrentHeapFree(uint64_t & currentHeapFree); CHIP_ERROR _GetCurrentHeapUsed(uint64_t & currentHeapUsed); CHIP_ERROR _GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark); + CHIP_ERROR _GetRebootCount(uint16_t & rebootCount); + CHIP_ERROR _GetUpTime(uint64_t & upTime); + CHIP_ERROR _GetTotalOperationalHours(uint32_t & totalOperationalHours); + CHIP_ERROR _GetBootReasons(uint8_t & bootReasons); + // ===== Members for internal use by the following friends. friend PlatformManager & PlatformMgr(void); friend PlatformManagerImpl & PlatformMgrImpl(void); + chip::System::Clock::Timestamp mStartTime = System::Clock::kZero; + static PlatformManagerImpl sInstance; using Internal::GenericPlatformManagerImpl_FreeRTOS::PostEventFromISR; diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index f9d3660dde3dc8..a1986be488c038 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -208,6 +208,7 @@ if (chip_device_platform != "none") { defines += [ "CHIP_DEVICE_LAYER_TARGET_AMEBA=1", "CHIP_DEVICE_LAYER_TARGET=Ameba", + "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", ] } } diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index d54717826a997e..4e9f4f3220a3ad 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -34,6 +34,7 @@ static_library("Darwin") { sources = [ "../DeviceSafeQueue.cpp", "../DeviceSafeQueue.h", + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "BlePlatformConfig.h", diff --git a/src/platform/Darwin/ConfigurationManagerImpl.cpp b/src/platform/Darwin/ConfigurationManagerImpl.cpp index 5bcf9057759515..1b904ffdb1b304 100644 --- a/src/platform/Darwin/ConfigurationManagerImpl.cpp +++ b/src/platform/Darwin/ConfigurationManagerImpl.cpp @@ -128,9 +128,11 @@ CHIP_ERROR GetMACAddressFromInterfaces(io_iterator_t primaryInterfaceIterator, u } #endif // TARGET_OS_OSX -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/Darwin/ConfigurationManagerImpl.h b/src/platform/Darwin/ConfigurationManagerImpl.h index c2732af625b423..193155cbc3cf9f 100644 --- a/src/platform/Darwin/ConfigurationManagerImpl.h +++ b/src/platform/Darwin/ConfigurationManagerImpl.h @@ -33,8 +33,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Darwin platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::PosixConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::PosixConfig { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -42,6 +42,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -53,36 +57,7 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana CHIP_ERROR WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value) override; // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the ESP32 platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp index 348ef48a21221a..ea11e5afc95b35 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -43,6 +43,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() // Initialize the configuration system. err = Internal::PosixConfig::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); mRunLoopSem = dispatch_semaphore_create(0); diff --git a/src/platform/EFR32/BUILD.gn b/src/platform/EFR32/BUILD.gn index f18643f914f647..26652ffd3ee60e 100644 --- a/src/platform/EFR32/BUILD.gn +++ b/src/platform/EFR32/BUILD.gn @@ -26,6 +26,7 @@ if (chip_enable_openthread) { static_library("EFR32") { sources = [ "../FreeRTOS/SystemTimeSupport.cpp", + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "BlePlatformConfig.h", diff --git a/src/platform/EFR32/ConfigurationManagerImpl.cpp b/src/platform/EFR32/ConfigurationManagerImpl.cpp index 506f593ef06b14..c8564cd9f1b4f5 100644 --- a/src/platform/EFR32/ConfigurationManagerImpl.cpp +++ b/src/platform/EFR32/ConfigurationManagerImpl.cpp @@ -34,9 +34,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/EFR32/ConfigurationManagerImpl.h b/src/platform/EFR32/ConfigurationManagerImpl.h index 3ee8754f8fbcb8..5e88832e761076 100644 --- a/src/platform/EFR32/ConfigurationManagerImpl.h +++ b/src/platform/EFR32/ConfigurationManagerImpl.h @@ -34,8 +34,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the EFR32 platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::EFR32Config +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::EFR32Config { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -43,6 +43,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -55,40 +59,11 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the ESP32 platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - inline CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; diff --git a/src/platform/EFR32/PlatformManagerImpl.cpp b/src/platform/EFR32/PlatformManagerImpl.cpp index 61fe7b2954489d..e1c3af86181520 100644 --- a/src/platform/EFR32/PlatformManagerImpl.cpp +++ b/src/platform/EFR32/PlatformManagerImpl.cpp @@ -44,6 +44,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) // Initialize the configuration system. err = Internal::EFR32Config::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); // Initialize LwIP. tcpip_init(NULL, NULL); diff --git a/src/platform/ESP32/BUILD.gn b/src/platform/ESP32/BUILD.gn index 175b83e29267ed..4c481560c2d84f 100644 --- a/src/platform/ESP32/BUILD.gn +++ b/src/platform/ESP32/BUILD.gn @@ -21,6 +21,7 @@ assert(chip_device_platform == "esp32") static_library("ESP32") { sources = [ "../FreeRTOS/SystemTimeSupport.cpp", + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.h", "CHIPDevicePlatformConfig.h", "CHIPDevicePlatformEvent.h", diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 649f65c6c796fd..0254d8504d7990 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -50,9 +50,11 @@ enum // TODO: Define a Singleton instance of CHIP Group Key Store here (#1266) -/** Singleton instance of the ConfigurationManager implementation object for the ESP32. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/ESP32/ConfigurationManagerImpl.h b/src/platform/ESP32/ConfigurationManagerImpl.h index 2c143b90976bd3..445783f05e15ac 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.h +++ b/src/platform/ESP32/ConfigurationManagerImpl.h @@ -41,19 +41,20 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the ESP32 platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - public Internal::GenericConnectivityManagerImpl_BLE, + public Internal::GenericConnectivityManagerImpl_BLE, #else - public Internal::GenericConnectivityManagerImpl_NoBLE, + public Internal::GenericConnectivityManagerImpl_NoBLE, #endif - private Internal::ESP32Config + private Internal::ESP32Config { public: - CHIP_ERROR GetRebootCount(uint32_t & rebootCount); - CHIP_ERROR StoreRebootCount(uint32_t rebootCount); - CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours); - CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours); + CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override; + CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override; + CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override; + CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override; + static ConfigurationManagerImpl & GetDefaultInstance(); private: // Allow the GenericConfigurationManagerImpl base class to access helper methods and types @@ -74,39 +75,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the ESP32 platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp index 9236f51ee98d4a..0d290acef5aecd 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp @@ -57,6 +57,8 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) { + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); + esp_err_t err; // Arrange for CHIP-encapsulated ESP32 errors to be translated to text Internal::ESP32Utils::RegisterESP32ErrorFormatter(); @@ -131,9 +133,9 @@ CHIP_ERROR PlatformManagerImpl::_Shutdown() { uint32_t totalOperationalHours = 0; - if (ConfigurationMgrImpl().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) + if (ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) { - ConfigurationMgrImpl().StoreTotalOperationalHours(totalOperationalHours + static_cast(upTime / 3600)); + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + static_cast(upTime / 3600)); } else { @@ -170,7 +172,7 @@ CHIP_ERROR PlatformManagerImpl::_GetRebootCount(uint16_t & rebootCount) { uint32_t count = 0; - CHIP_ERROR err = ConfigurationMgrImpl().GetRebootCount(count); + CHIP_ERROR err = ConfigurationMgr().GetRebootCount(count); if (err == CHIP_NO_ERROR) { @@ -201,7 +203,7 @@ CHIP_ERROR PlatformManagerImpl::_GetTotalOperationalHours(uint32_t & totalOperat if (_GetUpTime(upTime) == CHIP_NO_ERROR) { uint32_t totalHours = 0; - if (ConfigurationMgrImpl().GetTotalOperationalHours(totalHours) == CHIP_NO_ERROR) + if (ConfigurationMgr().GetTotalOperationalHours(totalHours) == CHIP_NO_ERROR) { VerifyOrReturnError(upTime / 3600 <= UINT32_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE); totalOperationalHours = totalHours + static_cast(upTime / 3600); diff --git a/src/platform/Entropy.cpp b/src/platform/Entropy.cpp index 8ac050d1628a1b..c12236dabd1636 100644 --- a/src/platform/Entropy.cpp +++ b/src/platform/Entropy.cpp @@ -16,61 +16,12 @@ * limitations under the License. */ -/** - * @file - * Provides implementations for the chip entropy sourcing functions - * on the Linux platforms. - */ - #include #include #include -// Temporary includes for TemporaryAuditRandomPerformance() -// TODO: remove once https://github.com/project-chip/connectedhomeip/issues/10454 is done. -#include - namespace chip { -namespace { - -// Audit random number generator proper initialization with prints. -// TODO: remove once https://github.com/project-chip/connectedhomeip/issues/10454 is done. -void TemporaryAuditRandomNumberGenerator() -{ - uint8_t buf1[16] = { 0 }; - uint8_t buf2[16] = { 0 }; - - VerifyOrDie(Crypto::DRBG_get_bytes(&buf1[0], sizeof(buf1)) == CHIP_NO_ERROR); - VerifyOrDie(Crypto::DRBG_get_bytes(&buf2[0], sizeof(buf2)) == CHIP_NO_ERROR); - - char hex_buf[sizeof(buf1) * 2 + 1]; - - ChipLogProgress(DeviceLayer, "AUDIT: ===== RANDOM NUMBER GENERATOR AUDIT START ===="); - ChipLogProgress(DeviceLayer, "AUDIT: * Validate buf1 and buf2 are <<>>"); - ChipLogProgress(DeviceLayer, "AUDIT: * Validate r1 and r2 are <<>>"); - - memset(&hex_buf[0], 0, sizeof(hex_buf)); - VerifyOrDie(Encoding::BytesToUppercaseHexString(&buf1[0], sizeof(buf1), &hex_buf[0], sizeof(hex_buf)) == CHIP_NO_ERROR); - ChipLogProgress(DeviceLayer, "AUDIT: * buf1: %s", &hex_buf[0]); - - memset(&hex_buf[0], 0, sizeof(hex_buf)); - VerifyOrDie(Encoding::BytesToUppercaseHexString(&buf2[0], sizeof(buf2), &hex_buf[0], sizeof(hex_buf)) == CHIP_NO_ERROR); - ChipLogProgress(DeviceLayer, "AUDIT: * buf2: %s", &hex_buf[0]); - - VerifyOrDieWithMsg(memcmp(&buf1[0], &buf2[0], sizeof(buf1)) != 0, DeviceLayer, - "AUDIT: FAILED: buf1, buf2 are equal: DRBG_get_bytes() does not function!"); - - uint32_t r1 = Crypto::GetRandU32(); - uint32_t r2 = Crypto::GetRandU32(); - - ChipLogProgress(DeviceLayer, "AUDIT: * r1: 0x%08" PRIX32 " r2: 0x%08" PRIX32, r1, r2); - VerifyOrDieWithMsg(r1 != r2, DeviceLayer, "AUDIT: FAILED: r1, r2 are equal: random number generator does not function!"); - ChipLogProgress(DeviceLayer, "AUDIT: ===== RANDOM NUMBER GENERATOR AUDIT END ===="); -} - -} // namespace - namespace DeviceLayer { namespace Internal { @@ -80,8 +31,6 @@ CHIP_ERROR InitEntropy() ReturnErrorOnFailure(Crypto::DRBG_get_bytes((uint8_t *) &seed, sizeof(seed))); srand(seed); - // TODO: remove once https://github.com/project-chip/connectedhomeip/issues/10454 is done. - TemporaryAuditRandomNumberGenerator(); return CHIP_NO_ERROR; } diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index 5c7516bc56119c..2c39c68668afcf 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -36,6 +36,7 @@ static_library("Linux") { sources = [ "../DeviceSafeQueue.cpp", "../DeviceSafeQueue.h", + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "BlePlatformConfig.h", diff --git a/src/platform/Linux/ConfigurationManagerImpl.cpp b/src/platform/Linux/ConfigurationManagerImpl.cpp index fde80ab6dfb5fe..1e542084216b93 100644 --- a/src/platform/Linux/ConfigurationManagerImpl.cpp +++ b/src/platform/Linux/ConfigurationManagerImpl.cpp @@ -40,9 +40,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/Linux/ConfigurationManagerImpl.h b/src/platform/Linux/ConfigurationManagerImpl.h index e0fc2188bd7c3f..2ce06c5b213655 100644 --- a/src/platform/Linux/ConfigurationManagerImpl.h +++ b/src/platform/Linux/ConfigurationManagerImpl.h @@ -34,16 +34,17 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Linux platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::PosixConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::PosixConfig { public: - CHIP_ERROR GetRebootCount(uint32_t & rebootCount); - CHIP_ERROR StoreRebootCount(uint32_t rebootCount); - CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours); - CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours); - CHIP_ERROR GetBootReasons(uint32_t & bootReasons); - CHIP_ERROR StoreBootReasons(uint32_t bootReasons); + CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override; + CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override; + CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override; + CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override; + CHIP_ERROR GetBootReasons(uint32_t & bootReasons) override; + CHIP_ERROR StoreBootReasons(uint32_t bootReasons) override; + static ConfigurationManagerImpl & GetDefaultInstance(); private: // Allow the GenericConfigurationManagerImpl base class to access helper methods and types @@ -68,39 +69,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr() -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the ESP32 platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl() -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index a4231fa396d4b6..39d00ff2da9950 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -60,27 +60,27 @@ void SignalHandler(int signum) switch (signum) { case SIGINT: - ConfigurationMgrImpl().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_RESET); + ConfigurationMgr().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_RESET); err = CHIP_ERROR_REBOOT_SIGNAL_RECEIVED; break; case SIGHUP: - ConfigurationMgrImpl().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_BROWN_OUT_RESET); + ConfigurationMgr().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_BROWN_OUT_RESET); err = CHIP_ERROR_REBOOT_SIGNAL_RECEIVED; break; case SIGTERM: - ConfigurationMgrImpl().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_POWER_ON_REBOOT); + ConfigurationMgr().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_POWER_ON_REBOOT); err = CHIP_ERROR_REBOOT_SIGNAL_RECEIVED; break; case SIGUSR1: - ConfigurationMgrImpl().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_HARDWARE_WATCHDOG_RESET); + ConfigurationMgr().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_HARDWARE_WATCHDOG_RESET); err = CHIP_ERROR_REBOOT_SIGNAL_RECEIVED; break; case SIGUSR2: - ConfigurationMgrImpl().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_WATCHDOG_RESET); + ConfigurationMgr().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_WATCHDOG_RESET); err = CHIP_ERROR_REBOOT_SIGNAL_RECEIVED; break; case SIGTSTP: - ConfigurationMgrImpl().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_UPDATE_COMPLETED); + ConfigurationMgr().StoreBootReasons(EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_UPDATE_COMPLETED); err = CHIP_ERROR_REBOOT_SIGNAL_RECEIVED; break; default: @@ -209,6 +209,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() // Initialize the configuration system. err = Internal::PosixConfig::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); // Call _InitChipStack() on the generic implementation base class // to finish the initialization process. err = Internal::GenericPlatformManagerImpl_POSIX::_InitChipStack(); @@ -230,9 +231,9 @@ CHIP_ERROR PlatformManagerImpl::_Shutdown() { uint32_t totalOperationalHours = 0; - if (ConfigurationMgrImpl().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) + if (ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) { - ConfigurationMgrImpl().StoreTotalOperationalHours(totalOperationalHours + static_cast(upTime / 3600)); + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + static_cast(upTime / 3600)); } else { @@ -289,7 +290,7 @@ CHIP_ERROR PlatformManagerImpl::_GetRebootCount(uint16_t & rebootCount) { uint32_t count = 0; - CHIP_ERROR err = ConfigurationMgrImpl().GetRebootCount(count); + CHIP_ERROR err = ConfigurationMgr().GetRebootCount(count); if (err == CHIP_NO_ERROR) { @@ -320,7 +321,7 @@ CHIP_ERROR PlatformManagerImpl::_GetTotalOperationalHours(uint32_t & totalOperat if (_GetUpTime(upTime) == CHIP_NO_ERROR) { uint32_t totalHours = 0; - if (ConfigurationMgrImpl().GetTotalOperationalHours(totalHours) == CHIP_NO_ERROR) + if (ConfigurationMgr().GetTotalOperationalHours(totalHours) == CHIP_NO_ERROR) { VerifyOrReturnError(upTime / 3600 <= UINT32_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE); totalOperationalHours = totalHours + static_cast(upTime / 3600); @@ -334,7 +335,7 @@ CHIP_ERROR PlatformManagerImpl::_GetBootReasons(uint8_t & bootReasons) { uint32_t reason = 0; - CHIP_ERROR err = ConfigurationMgrImpl().GetBootReasons(reason); + CHIP_ERROR err = ConfigurationMgr().GetBootReasons(reason); if (err == CHIP_NO_ERROR) { diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index 15e4638f670121..02ad1997c46faa 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -1468,7 +1468,7 @@ template CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_RequestSEDFastPollingMode(bool onOff) { CHIP_ERROR err = CHIP_NO_ERROR; - uint32_t interval; + ConnectivityManager::SEDPollingMode mode; if (onOff) { @@ -1480,14 +1480,10 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_RequestSEDFastP mFastPollingConsumers--; } - if (mFastPollingConsumers > 0) - { - err = SetSEDPollingMode(ConnectivityManager::SEDPollingMode::Active); - } - else - { - err = SetSEDPollingMode(ConnectivityManager::SEDPollingMode::Idle); - } + mode = mFastPollingConsumers > 0 ? ConnectivityManager::SEDPollingMode::Active : ConnectivityManager::SEDPollingMode::Idle; + + if (mPollingMode != mode) + err = SetSEDPollingMode(mode); return err; } diff --git a/src/platform/P6/BUILD.gn b/src/platform/P6/BUILD.gn index 7269cd9a817f7b..4ee27012f2ac3e 100644 --- a/src/platform/P6/BUILD.gn +++ b/src/platform/P6/BUILD.gn @@ -26,6 +26,7 @@ if (chip_enable_openthread) { static_library("P6") { sources = [ "../FreeRTOS/SystemTimeSupport.cpp", + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "BlePlatformConfig.h", diff --git a/src/platform/P6/ConfigurationManagerImpl.cpp b/src/platform/P6/ConfigurationManagerImpl.cpp index 7d90c3696432c4..b17e84fcb23d45 100644 --- a/src/platform/P6/ConfigurationManagerImpl.cpp +++ b/src/platform/P6/ConfigurationManagerImpl.cpp @@ -36,9 +36,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object for the PSoC6. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/P6/ConfigurationManagerImpl.h b/src/platform/P6/ConfigurationManagerImpl.h index f7f136420cc5c2..da07d8d4904212 100644 --- a/src/platform/P6/ConfigurationManagerImpl.h +++ b/src/platform/P6/ConfigurationManagerImpl.h @@ -35,8 +35,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the PSoC6 platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::P6Config +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::P6Config { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -44,6 +44,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -56,37 +60,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; + // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the PSoC6 platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/P6/PlatformManagerImpl.cpp b/src/platform/P6/PlatformManagerImpl.cpp index 168cc7560231c1..c9503f243e1da7 100644 --- a/src/platform/P6/PlatformManagerImpl.cpp +++ b/src/platform/P6/PlatformManagerImpl.cpp @@ -42,6 +42,8 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) { CHIP_ERROR err; + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); + // Make sure the LwIP core lock has been initialized err = Internal::InitLwIPCoreLock(); SuccessOrExit(err); diff --git a/src/platform/fake/ConfigurationManagerImpl.cpp b/src/platform/SingletonConfigurationManager.cpp similarity index 55% rename from src/platform/fake/ConfigurationManagerImpl.cpp rename to src/platform/SingletonConfigurationManager.cpp index f0176a55738348..0658ebfbc776bc 100644 --- a/src/platform/fake/ConfigurationManagerImpl.cpp +++ b/src/platform/SingletonConfigurationManager.cpp @@ -1,7 +1,6 @@ /* * * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +15,39 @@ * limitations under the License. */ -#include +/** + * @file + * Implements a getter and setter for a singleton ConfigurationManager object. + */ + +#include namespace chip { namespace DeviceLayer { -/** Singleton instance of the ConfigurationManager implementation object. +class ConfigurationManager; + +namespace { + +/** Singleton pointer to the ConfigurationManager implementation. */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManager * gInstance = nullptr; + +} // namespace + +ConfigurationManager & ConfigurationMgr() +{ + VerifyOrDie(gInstance != nullptr); + return *gInstance; +} + +void SetConfigurationMgr(ConfigurationManager * configurationManager) +{ + if (configurationManager != nullptr) + { + gInstance = configurationManager; + } +} } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Tizen/BUILD.gn b/src/platform/Tizen/BUILD.gn index 6c3a046ad052d1..f066f8892819b5 100644 --- a/src/platform/Tizen/BUILD.gn +++ b/src/platform/Tizen/BUILD.gn @@ -26,6 +26,7 @@ static_library("Tizen") { sources = [ "../DeviceSafeQueue.cpp", "../DeviceSafeQueue.h", + "../SingletonConfigurationManager.cpp", "AppPreference.cpp", "AppPreference.h", "BLEManagerImpl.cpp", diff --git a/src/platform/Tizen/ConfigurationManagerImpl.cpp b/src/platform/Tizen/ConfigurationManagerImpl.cpp index 5a940cadda1c5b..237d114ca56e9f 100644 --- a/src/platform/Tizen/ConfigurationManagerImpl.cpp +++ b/src/platform/Tizen/ConfigurationManagerImpl.cpp @@ -37,9 +37,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init(void) { diff --git a/src/platform/Tizen/ConfigurationManagerImpl.h b/src/platform/Tizen/ConfigurationManagerImpl.h index 73c0002b815d33..88fb2d7001c969 100644 --- a/src/platform/Tizen/ConfigurationManagerImpl.h +++ b/src/platform/Tizen/ConfigurationManagerImpl.h @@ -34,8 +34,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Tizen platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::PosixConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::PosixConfig { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -43,6 +43,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -54,36 +58,7 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana CHIP_ERROR WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value) override; // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the Tizen platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Tizen/PlatformManagerImpl.cpp b/src/platform/Tizen/PlatformManagerImpl.cpp index f4a1dc50d08328..bd4abfa8c75b0d 100644 --- a/src/platform/Tizen/PlatformManagerImpl.cpp +++ b/src/platform/Tizen/PlatformManagerImpl.cpp @@ -36,6 +36,7 @@ PlatformManagerImpl PlatformManagerImpl::sInstance; CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) { ReturnErrorOnFailure(Internal::PosixConfig::Init()); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); return Internal::GenericPlatformManagerImpl_POSIX::_InitChipStack(); } diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.cpp b/src/platform/Zephyr/ConfigurationManagerImpl.cpp index 397f9eca54fdd9..a6a743cf1588e9 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.cpp +++ b/src/platform/Zephyr/ConfigurationManagerImpl.cpp @@ -43,9 +43,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.h b/src/platform/Zephyr/ConfigurationManagerImpl.h index bad5c73cc7b4aa..92a8aff3c5771e 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.h +++ b/src/platform/Zephyr/ConfigurationManagerImpl.h @@ -33,8 +33,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Zephyr platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::ZephyrConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::ZephyrConfig { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -42,6 +42,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -54,40 +58,11 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the nRF Connect SDK platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - inline bool ConfigurationManagerImpl::CanFactoryReset() { return true; diff --git a/src/platform/Zephyr/PlatformManagerImpl.cpp b/src/platform/Zephyr/PlatformManagerImpl.cpp index 6ced08cff90f32..09f388058c0c03 100644 --- a/src/platform/Zephyr/PlatformManagerImpl.cpp +++ b/src/platform/Zephyr/PlatformManagerImpl.cpp @@ -72,6 +72,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) // Initialize the configuration system. err = Internal::ZephyrConfig::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); #if !CONFIG_NORDIC_SECURITY_BACKEND // Add entropy source based on Zephyr entropy driver diff --git a/src/platform/android/AndroidChipPlatform-JNI.cpp b/src/platform/android/AndroidChipPlatform-JNI.cpp index 785ed89cb42638..fd2cbd20dd7f8b 100644 --- a/src/platform/android/AndroidChipPlatform-JNI.cpp +++ b/src/platform/android/AndroidChipPlatform-JNI.cpp @@ -207,7 +207,12 @@ JNI_METHOD(void, setKeyValueStoreManager)(JNIEnv * env, jclass self, jobject man JNI_METHOD(void, setConfigurationManager)(JNIEnv * env, jclass self, jobject manager) { chip::DeviceLayer::StackLock lock; - chip::DeviceLayer::ConfigurationMgrImpl().InitializeWithObject(manager); + chip::DeviceLayer::ConfigurationManagerImpl * configurationManagerImpl = + reinterpret_cast(&chip::DeviceLayer::ConfigurationMgr()); + if (configurationManagerImpl != nullptr) + { + configurationManagerImpl->InitializeWithObject(manager); + } } // for ServiceResolver diff --git a/src/platform/android/BUILD.gn b/src/platform/android/BUILD.gn index a12d6aa55e9108..1b6cc5ea3313eb 100644 --- a/src/platform/android/BUILD.gn +++ b/src/platform/android/BUILD.gn @@ -28,6 +28,7 @@ static_library("android") { sources = [ "../DeviceSafeQueue.cpp", "../DeviceSafeQueue.h", + "../SingletonConfigurationManager.cpp", "AndroidChipPlatform-JNI.cpp", "AndroidConfig.cpp", "AndroidConfig.h", diff --git a/src/platform/android/ConfigurationManagerImpl.cpp b/src/platform/android/ConfigurationManagerImpl.cpp index 6303bb5b8e5a0f..0b9c37b55515dd 100644 --- a/src/platform/android/ConfigurationManagerImpl.cpp +++ b/src/platform/android/ConfigurationManagerImpl.cpp @@ -42,9 +42,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} void ConfigurationManagerImpl::InitializeWithObject(jobject managerObject) { diff --git a/src/platform/android/ConfigurationManagerImpl.h b/src/platform/android/ConfigurationManagerImpl.h index 7135deb968fcaf..91b048cb3301af 100644 --- a/src/platform/android/ConfigurationManagerImpl.h +++ b/src/platform/android/ConfigurationManagerImpl.h @@ -35,8 +35,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Android platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::AndroidConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::AndroidConfig { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -46,6 +46,7 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana public: void InitializeWithObject(jobject managerObject); + static ConfigurationManagerImpl & GetDefaultInstance(); private: // ===== Members that implement the ConfigurationManager public interface. @@ -64,13 +65,6 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); @@ -78,27 +72,5 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana jobject mConfigurationManagerObject = nullptr; }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr() -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the Android platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl() -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/android/PlatformManagerImpl.cpp b/src/platform/android/PlatformManagerImpl.cpp index 21b3509807426e..50f5d04be48420 100644 --- a/src/platform/android/PlatformManagerImpl.cpp +++ b/src/platform/android/PlatformManagerImpl.cpp @@ -43,6 +43,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() // Initialize the configuration system. err = Internal::AndroidConfig::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); // Call _InitChipStack() on the generic implementation base class // to finish the initialization process. diff --git a/src/platform/cc13x2_26x2/BUILD.gn b/src/platform/cc13x2_26x2/BUILD.gn index 346f1c2718601b..db40cfb1918db3 100644 --- a/src/platform/cc13x2_26x2/BUILD.gn +++ b/src/platform/cc13x2_26x2/BUILD.gn @@ -25,6 +25,7 @@ if (chip_enable_openthread) { static_library("cc13x2_26x2") { sources = [ "../FreeRTOS/SystemTimeSupport.cpp", + "../SingletonConfigurationManager.cpp", "BlePlatformConfig.h", "CC13X2_26X2Config.cpp", "CC13X2_26X2Config.h", diff --git a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp index e2048bde305401..d7a22577288411 100644 --- a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp @@ -54,9 +54,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.h b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.h index b892304ad70227..febdb5d11adfb7 100644 --- a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.h +++ b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.h @@ -33,13 +33,17 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the CC13X2_26X2 platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::CC13X2_26X2Config +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::CC13X2_26X2Config { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. friend class Internal::GenericConfigurationManagerImpl; +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -52,40 +56,11 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the CC1352 SoC - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - inline CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; diff --git a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp index dea57bed5800b5..07178e46e3c866 100644 --- a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp @@ -106,6 +106,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) // Initialize the configuration system. err = Internal::CC13X2_26X2Config::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); // DMM Addition DMMPolicy_Params dmmPolicyParams; diff --git a/src/platform/fake/BUILD.gn b/src/platform/fake/BUILD.gn index 9c4d008f11300f..93d4425e604f66 100644 --- a/src/platform/fake/BUILD.gn +++ b/src/platform/fake/BUILD.gn @@ -21,7 +21,6 @@ assert(chip_device_platform == "fake") static_library("fake") { sources = [ "CHIPDevicePlatformEvent.h", - "ConfigurationManagerImpl.cpp", "ConfigurationManagerImpl.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", diff --git a/src/platform/fake/ConfigurationManagerImpl.h b/src/platform/fake/ConfigurationManagerImpl.h index af8ac5c6c2bbfb..cee37e551605a1 100644 --- a/src/platform/fake/ConfigurationManagerImpl.h +++ b/src/platform/fake/ConfigurationManagerImpl.h @@ -25,8 +25,9 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the fake platform. */ -class ConfigurationManagerImpl final : public ConfigurationManager +class ConfigurationManagerImpl : public ConfigurationManager { +public: virtual ~ConfigurationManagerImpl() = default; private: @@ -79,6 +80,12 @@ class ConfigurationManagerImpl final : public ConfigurationManager CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR GetBootReasons(uint32_t & bootReasons) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreBootReasons(uint32_t bootReasons) override { return CHIP_ERROR_NOT_IMPLEMENTED; } #if !defined(NDEBUG) CHIP_ERROR RunUnitTests(void) override { return CHIP_ERROR_NOT_IMPLEMENTED; } #endif @@ -96,35 +103,15 @@ class ConfigurationManagerImpl final : public ConfigurationManager } // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) +ConfigurationManager & ConfigurationMgr() { - return ConfigurationManagerImpl::sInstance; + static ConfigurationManagerImpl sInstance; + return sInstance; } -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the ESP32 platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} +void SetConfigurationMgr(ConfigurationManagerImpl * configurationManager) {} } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/mbed/BUILD.gn b/src/platform/mbed/BUILD.gn index 138cc3e6bc0cfc..beee849ddc7f41 100644 --- a/src/platform/mbed/BUILD.gn +++ b/src/platform/mbed/BUILD.gn @@ -20,6 +20,7 @@ assert(chip_device_platform == "mbed") static_library("mbed") { sources = [ + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "ConfigurationManagerImpl.cpp", diff --git a/src/platform/mbed/ConfigurationManagerImpl.cpp b/src/platform/mbed/ConfigurationManagerImpl.cpp index f6e7c387c05dfe..bd78fb8e27573c 100644 --- a/src/platform/mbed/ConfigurationManagerImpl.cpp +++ b/src/platform/mbed/ConfigurationManagerImpl.cpp @@ -42,9 +42,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/mbed/ConfigurationManagerImpl.h b/src/platform/mbed/ConfigurationManagerImpl.h index ca60444f3c0f5f..7acc0c2ab5e068 100644 --- a/src/platform/mbed/ConfigurationManagerImpl.h +++ b/src/platform/mbed/ConfigurationManagerImpl.h @@ -32,8 +32,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the Zephyr platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::MbedConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::MbedConfig { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -41,6 +41,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -53,39 +57,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the nRF Connect SDK platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/mbed/PlatformManagerImpl.cpp b/src/platform/mbed/PlatformManagerImpl.cpp index 0dc462ccca1659..a76ea42dda9138 100644 --- a/src/platform/mbed/PlatformManagerImpl.cpp +++ b/src/platform/mbed/PlatformManagerImpl.cpp @@ -91,6 +91,8 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) tcpip_init(NULL, NULL); #endif + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); + // Call up to the base class _InitChipStack() to perform the bulk of the initialization. auto err = GenericPlatformManagerImpl::_InitChipStack(); SuccessOrExit(err); diff --git a/src/platform/nrfconnect/BUILD.gn b/src/platform/nrfconnect/BUILD.gn index 7f6cb034e92174..83f00cf1d82e30 100644 --- a/src/platform/nrfconnect/BUILD.gn +++ b/src/platform/nrfconnect/BUILD.gn @@ -20,6 +20,7 @@ assert(chip_device_platform == "nrfconnect") static_library("nrfconnect") { sources = [ + "../SingletonConfigurationManager.cpp", "../Zephyr/BLEManagerImpl.cpp", "../Zephyr/ConfigurationManagerImpl.cpp", "../Zephyr/KeyValueStoreManagerImpl.cpp", diff --git a/src/platform/nxp/k32w/k32w0/BUILD.gn b/src/platform/nxp/k32w/k32w0/BUILD.gn index 10628fd4466e5c..0a37f9caf71408 100644 --- a/src/platform/nxp/k32w/k32w0/BUILD.gn +++ b/src/platform/nxp/k32w/k32w0/BUILD.gn @@ -25,6 +25,7 @@ if (chip_enable_openthread) { static_library("k32w0") { sources = [ "../../../FreeRTOS/SystemTimeSupport.cpp", + "../../../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "CHIPDevicePlatformConfig.h", diff --git a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp index a5bbaffcecd011..9c17cc1290c09b 100644 --- a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp @@ -39,9 +39,11 @@ using namespace ::chip::DeviceLayer::Internal; // TODO: Define a Singleton instance of CHIP Group Key Store here -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.h b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.h index 14ea2c923f8d3b..c6443c52e6c798 100644 --- a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.h +++ b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.h @@ -43,6 +43,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -55,40 +59,11 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * Chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * Chio applications can use this to gain access to features of the ConfigurationManager - * that are specific to the K32W platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - inline CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; diff --git a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp index cfcc6ad007e264..567274e3052ca8 100644 --- a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp @@ -58,6 +58,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) // Initialize the configuration system. err = Internal::K32WConfig::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); // Initialize LwIP. tcpip_init(NULL, NULL); diff --git a/src/platform/qpg/BUILD.gn b/src/platform/qpg/BUILD.gn index a4abfeb93e0284..c3526b4756b838 100644 --- a/src/platform/qpg/BUILD.gn +++ b/src/platform/qpg/BUILD.gn @@ -25,6 +25,7 @@ if (chip_enable_openthread) { static_library("qpg") { sources = [ "../FreeRTOS/SystemTimeSupport.cpp", + "../SingletonConfigurationManager.cpp", "BLEManagerImpl.cpp", "BLEManagerImpl.h", "BlePlatformConfig.h", diff --git a/src/platform/qpg/ConfigurationManagerImpl.cpp b/src/platform/qpg/ConfigurationManagerImpl.cpp index 5a85e537c6be5c..c8c059017d7cb4 100644 --- a/src/platform/qpg/ConfigurationManagerImpl.cpp +++ b/src/platform/qpg/ConfigurationManagerImpl.cpp @@ -41,9 +41,11 @@ namespace DeviceLayer { using namespace ::chip::DeviceLayer::Internal; -/** Singleton instance of the ConfigurationManager implementation object. - */ -ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; +ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() +{ + static ConfigurationManagerImpl sInstance; + return sInstance; +} CHIP_ERROR ConfigurationManagerImpl::Init() { diff --git a/src/platform/qpg/ConfigurationManagerImpl.h b/src/platform/qpg/ConfigurationManagerImpl.h index b3e57733347a67..c6f08abe227850 100644 --- a/src/platform/qpg/ConfigurationManagerImpl.h +++ b/src/platform/qpg/ConfigurationManagerImpl.h @@ -32,8 +32,8 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, - private Internal::QPGConfig +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl, + private Internal::QPGConfig { // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. @@ -41,6 +41,10 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana friend class Internal::GenericConfigurationManagerImpl; #endif +public: + // This returns an instance of this class. + static ConfigurationManagerImpl & GetDefaultInstance(); + private: // ===== Members that implement the ConfigurationManager public interface. @@ -53,40 +57,11 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>. - // ===== Members for internal use by the following friends. - - friend ConfigurationManager & ConfigurationMgr(void); - friend ConfigurationManagerImpl & ConfigurationMgrImpl(void); - - static ConfigurationManagerImpl sInstance; - // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); }; -/** - * Returns the public interface of the ConfigurationManager singleton object. - * - * chip applications should use this to access features of the ConfigurationManager object - * that are common to all platforms. - */ -inline ConfigurationManager & ConfigurationMgr(void) -{ - return ConfigurationManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the ConfigurationManager singleton object. - * - * chip applications can use this to gain access to features of the ConfigurationManager - * that are specific to the platform. - */ -inline ConfigurationManagerImpl & ConfigurationMgrImpl(void) -{ - return ConfigurationManagerImpl::sInstance; -} - inline CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; diff --git a/src/platform/qpg/PlatformManagerImpl.cpp b/src/platform/qpg/PlatformManagerImpl.cpp index 4397237f528d13..ff6e38aafc853d 100644 --- a/src/platform/qpg/PlatformManagerImpl.cpp +++ b/src/platform/qpg/PlatformManagerImpl.cpp @@ -40,6 +40,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) // Initialize the configuration system. err = Internal::QPGConfig::Init(); SuccessOrExit(err); + SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); // Initialize LwIP. tcpip_init(NULL, NULL); diff --git a/src/platform/qpg/args.gni b/src/platform/qpg/args.gni index 28525a023d8256..a051e30b87bbbc 100644 --- a/src/platform/qpg/args.gni +++ b/src/platform/qpg/args.gni @@ -31,6 +31,7 @@ chip_inet_config_enable_tcp_endpoint = false # Size opt's #chip_progress_logging = false chip_detail_logging = false +chip_automation_logging = false # Use -Os is_debug = false diff --git a/src/platform/telink/BUILD.gn b/src/platform/telink/BUILD.gn index 77e03b15879532..539a8d93775747 100644 --- a/src/platform/telink/BUILD.gn +++ b/src/platform/telink/BUILD.gn @@ -20,6 +20,7 @@ assert(chip_device_platform == "telink") static_library("telink") { sources = [ + "../SingletonConfigurationManager.cpp", "../Zephyr/BLEManagerImpl.cpp", "../Zephyr/ConfigurationManagerImpl.cpp", "../Zephyr/KeyValueStoreManagerImpl.cpp", diff --git a/src/protocols/bdx/BdxMessages.cpp b/src/protocols/bdx/BdxMessages.cpp index b9770a0bbad2f6..9c0e24c273f07e 100644 --- a/src/protocols/bdx/BdxMessages.cpp +++ b/src/protocols/bdx/BdxMessages.cpp @@ -31,7 +31,8 @@ #include namespace { -constexpr uint8_t kVersionMask = 0x0F; +constexpr uint8_t kVersionMask = 0x0F; +constexpr uint8_t kMaxFileDesignatorLen = 32; } // namespace using namespace chip; @@ -99,17 +100,16 @@ CHIP_ERROR TransferInit::Parse(System::PacketBufferHandle aBuffer) uint32_t tmpUint32Value = 0; // Used for reading non-wide length and offset fields uint8_t * bufStart = aBuffer->Start(); Reader bufReader(bufStart, aBuffer->DataLength()); - BitFlags rangeCtlFlags; - SuccessOrExit(bufReader.Read8(&proposedTransferCtl).Read8(rangeCtlFlags.RawStorage()).Read16(&MaxBlockSize).StatusCode()); + SuccessOrExit(bufReader.Read8(&proposedTransferCtl).Read8(mRangeCtlFlags.RawStorage()).Read16(&MaxBlockSize).StatusCode()); Version = proposedTransferCtl & kVersionMask; TransferCtlOptions.SetRaw(static_cast(proposedTransferCtl & ~kVersionMask)); StartOffset = 0; - if (rangeCtlFlags.Has(RangeControlFlags::kStartOffset)) + if (mRangeCtlFlags.Has(RangeControlFlags::kStartOffset)) { - if (rangeCtlFlags.Has(RangeControlFlags::kWiderange)) + if (mRangeCtlFlags.Has(RangeControlFlags::kWiderange)) { SuccessOrExit(bufReader.Read64(&StartOffset).StatusCode()); } @@ -121,9 +121,9 @@ CHIP_ERROR TransferInit::Parse(System::PacketBufferHandle aBuffer) } MaxLength = 0; - if (rangeCtlFlags.Has(RangeControlFlags::kDefLen)) + if (mRangeCtlFlags.Has(RangeControlFlags::kDefLen)) { - if (rangeCtlFlags.Has(RangeControlFlags::kWiderange)) + if (mRangeCtlFlags.Has(RangeControlFlags::kWiderange)) { SuccessOrExit(bufReader.Read64(&MaxLength).StatusCode()); } @@ -166,6 +166,34 @@ size_t TransferInit::MessageSize() const return WriteToBuffer(emptyBuf).Needed(); } +#if CHIP_AUTOMATION_LOGGING +void TransferInit::LogMessage(bdx::MessageType messageType) const +{ + char fd[kMaxFileDesignatorLen]; + snprintf(fd, sizeof(fd), "%s", FileDesignator); + + switch (messageType) + { + case MessageType::SendInit: + ChipLogAutomation("SendInit"); + break; + case MessageType::ReceiveInit: + ChipLogAutomation("ReceiveInit"); + break; + default: + break; + } + + ChipLogAutomation(" Proposed Transfer Control: 0x%X", static_cast(TransferCtlOptions.Raw() | Version)); + ChipLogAutomation(" Range Control: 0x%X", static_cast(mRangeCtlFlags.Raw())); + ChipLogAutomation(" Proposed Max Block Size: %" PRIu16, MaxBlockSize); + ChipLogAutomation(" Start Offset: 0x" ChipLogFormatX64, ChipLogValueX64(StartOffset)); + ChipLogAutomation(" Proposed Max Length: 0x" ChipLogFormatX64, ChipLogValueX64(MaxLength)); + ChipLogAutomation(" File Designator Length: %" PRIu16, FileDesLength); + ChipLogAutomation(" File Designator: %s", fd); +} +#endif // CHIP_AUTOMATION_LOGGING + bool TransferInit::operator==(const TransferInit & another) const { if ((MetadataLength != another.MetadataLength) || (FileDesLength != another.FileDesLength)) @@ -246,6 +274,16 @@ size_t SendAccept::MessageSize() const return WriteToBuffer(emptyBuf).Needed(); } +#if CHIP_AUTOMATION_LOGGING +void SendAccept::LogMessage(bdx::MessageType messageType) const +{ + (void) messageType; + ChipLogAutomation("SendAccept"); + ChipLogAutomation(" Transfer Control: 0x%X", static_cast(TransferCtlFlags.Raw() | Version)); + ChipLogAutomation(" Max Block Size: %" PRIu16, MaxBlockSize); +} +#endif // CHIP_AUTOMATION_LOGGING + bool SendAccept::operator==(const SendAccept & another) const { if (MetadataLength != another.MetadataLength) @@ -317,9 +355,8 @@ CHIP_ERROR ReceiveAccept::Parse(System::PacketBufferHandle aBuffer) uint32_t tmpUint32Value = 0; // Used for reading non-wide length and offset fields uint8_t * bufStart = aBuffer->Start(); Reader bufReader(bufStart, aBuffer->DataLength()); - BitFlags rangeCtlFlags; - SuccessOrExit(bufReader.Read8(&transferCtl).Read8(rangeCtlFlags.RawStorage()).Read16(&MaxBlockSize).StatusCode()); + SuccessOrExit(bufReader.Read8(&transferCtl).Read8(mRangeCtlFlags.RawStorage()).Read16(&MaxBlockSize).StatusCode()); Version = transferCtl & kVersionMask; @@ -327,9 +364,9 @@ CHIP_ERROR ReceiveAccept::Parse(System::PacketBufferHandle aBuffer) TransferCtlFlags.SetRaw(static_cast(transferCtl & ~kVersionMask)); StartOffset = 0; - if (rangeCtlFlags.Has(RangeControlFlags::kStartOffset)) + if (mRangeCtlFlags.Has(RangeControlFlags::kStartOffset)) { - if (rangeCtlFlags.Has(RangeControlFlags::kWiderange)) + if (mRangeCtlFlags.Has(RangeControlFlags::kWiderange)) { SuccessOrExit(bufReader.Read64(&StartOffset).StatusCode()); } @@ -341,9 +378,9 @@ CHIP_ERROR ReceiveAccept::Parse(System::PacketBufferHandle aBuffer) } Length = 0; - if (rangeCtlFlags.Has(RangeControlFlags::kDefLen)) + if (mRangeCtlFlags.Has(RangeControlFlags::kDefLen)) { - if (rangeCtlFlags.Has(RangeControlFlags::kWiderange)) + if (mRangeCtlFlags.Has(RangeControlFlags::kWiderange)) { SuccessOrExit(bufReader.Read64(&Length).StatusCode()); } @@ -380,6 +417,18 @@ size_t ReceiveAccept::MessageSize() const return WriteToBuffer(emptyBuf).Needed(); } +#if CHIP_AUTOMATION_LOGGING +void ReceiveAccept::LogMessage(bdx::MessageType messageType) const +{ + (void) messageType; + ChipLogAutomation("ReceiveAccept"); + ChipLogAutomation(" Transfer Control: 0x%X", TransferCtlFlags.Raw() | Version); + ChipLogAutomation(" Range Control: 0x%X", mRangeCtlFlags.Raw()); + ChipLogAutomation(" Max Block Size: %" PRIu16, MaxBlockSize); + ChipLogAutomation(" Length: 0x" ChipLogFormatX64, ChipLogValueX64(Length)); +} +#endif // CHIP_AUTOMATION_LOGGING + bool ReceiveAccept::operator==(const ReceiveAccept & another) const { if (MetadataLength != another.MetadataLength) @@ -423,6 +472,28 @@ bool CounterMessage::operator==(const CounterMessage & another) const return (BlockCounter == another.BlockCounter); } +#if CHIP_AUTOMATION_LOGGING +void CounterMessage::LogMessage(bdx::MessageType messageType) const +{ + switch (messageType) + { + case MessageType::BlockQuery: + ChipLogAutomation("BlockQuery"); + break; + case MessageType::BlockAck: + ChipLogAutomation("BlockAck"); + break; + case MessageType::BlockAckEOF: + ChipLogAutomation("BlockAckEOF"); + break; + default: + break; + } + + ChipLogAutomation(" Block Counter: %" PRIu32, BlockCounter); +} +#endif // CHIP_AUTOMATION_LOGGING + // WARNING: this function should never return early, since MessageSize() relies on it to calculate // the size of the message (even if the message is incomplete or filled out incorrectly). Encoding::LittleEndian::BufferWriter & DataBlock::WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const @@ -469,6 +540,26 @@ size_t DataBlock::MessageSize() const return WriteToBuffer(emptyBuf).Needed(); } +#if CHIP_AUTOMATION_LOGGING +void DataBlock::LogMessage(bdx::MessageType messageType) const +{ + switch (messageType) + { + case MessageType::Block: + ChipLogAutomation("Block"); + break; + case MessageType::BlockEOF: + ChipLogAutomation("BlockEOF"); + break; + default: + break; + } + + ChipLogAutomation(" Block Counter: %" PRIu32, BlockCounter); + ChipLogAutomation(" Data Length: %zu", DataLength); +} +#endif // CHIP_AUTOMATION_LOGGING + bool DataBlock::operator==(const DataBlock & another) const { if (DataLength != another.DataLength) diff --git a/src/protocols/bdx/BdxMessages.h b/src/protocols/bdx/BdxMessages.h index ab15032a196e4e..880008b6956f24 100644 --- a/src/protocols/bdx/BdxMessages.h +++ b/src/protocols/bdx/BdxMessages.h @@ -120,6 +120,14 @@ struct BdxMessage */ virtual size_t MessageSize() const = 0; +#if CHIP_AUTOMATION_LOGGING + /** + * @brief + * Log all parameters for this message. + */ + virtual void LogMessage(bdx::MessageType messageType) const = 0; +#endif // CHIP_AUTOMATION_LOGGING + virtual ~BdxMessage() = default; }; @@ -139,6 +147,9 @@ struct TransferInit : public BdxMessage BitFlags TransferCtlOptions; uint8_t Version = 0; ///< The highest version supported by the sender + // Range Control + BitFlags mRangeCtlFlags; + // All required uint16_t MaxBlockSize = 0; ///< Proposed max block size to use in transfer uint64_t StartOffset = 0; ///< Proposed start offset of data. 0 for no offset @@ -158,6 +169,9 @@ struct TransferInit : public BdxMessage CHIP_ERROR Parse(System::PacketBufferHandle aBuffer) override; Encoding::LittleEndian::BufferWriter & WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const override; size_t MessageSize() const override; +#if CHIP_AUTOMATION_LOGGING + void LogMessage(bdx::MessageType messageType) const override; +#endif // CHIP_AUTOMATION_LOGGING }; using SendInit = TransferInit; @@ -192,6 +206,9 @@ struct SendAccept : public BdxMessage CHIP_ERROR Parse(System::PacketBufferHandle aBuffer) override; Encoding::LittleEndian::BufferWriter & WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const override; size_t MessageSize() const override; +#if CHIP_AUTOMATION_LOGGING + void LogMessage(bdx::MessageType messageType) const override; +#endif // CHIP_AUTOMATION_LOGGING }; /** @@ -208,6 +225,9 @@ struct ReceiveAccept : public BdxMessage // Transfer Control (required, only one should be set) BitFlags TransferCtlFlags; + // Range Control + BitFlags mRangeCtlFlags; + // All required uint8_t Version = 0; ///< The agreed upon version for the transfer uint16_t MaxBlockSize = 0; ///< Chosen max block size to use in transfer @@ -226,6 +246,9 @@ struct ReceiveAccept : public BdxMessage CHIP_ERROR Parse(System::PacketBufferHandle aBuffer) override; Encoding::LittleEndian::BufferWriter & WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const override; size_t MessageSize() const override; +#if CHIP_AUTOMATION_LOGGING + void LogMessage(bdx::MessageType messageType) const override; +#endif // CHIP_AUTOMATION_LOGGING }; /** @@ -245,6 +268,9 @@ struct CounterMessage : public BdxMessage CHIP_ERROR Parse(System::PacketBufferHandle aBuffer) override; Encoding::LittleEndian::BufferWriter & WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const override; size_t MessageSize() const override; +#if CHIP_AUTOMATION_LOGGING + void LogMessage(bdx::MessageType messageType) const override; +#endif // CHIP_AUTOMATION_LOGGING }; using BlockQuery = CounterMessage; @@ -275,6 +301,9 @@ struct DataBlock : public BdxMessage CHIP_ERROR Parse(System::PacketBufferHandle aBuffer) override; Encoding::LittleEndian::BufferWriter & WriteToBuffer(Encoding::LittleEndian::BufferWriter & aBuffer) const override; size_t MessageSize() const override; +#if CHIP_AUTOMATION_LOGGING + void LogMessage(bdx::MessageType messageType) const override; +#endif // CHIP_AUTOMATION_LOGGING }; using Block = DataBlock; diff --git a/src/protocols/bdx/BdxTransferSession.cpp b/src/protocols/bdx/BdxTransferSession.cpp index 24c03fc78d316f..96aa2d205b71d9 100644 --- a/src/protocols/bdx/BdxTransferSession.cpp +++ b/src/protocols/bdx/BdxTransferSession.cpp @@ -160,6 +160,11 @@ CHIP_ERROR TransferSession::StartTransfer(TransferRole role, const TransferInitD const MessageType msgType = (mRole == TransferRole::kSender) ? MessageType::SendInit : MessageType::ReceiveInit; +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Sending BDX Message"); + initMsg.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING + mState = TransferState::kAwaitingAccept; mAwaitingResponse = true; @@ -216,6 +221,11 @@ CHIP_ERROR TransferSession::AcceptTransfer(const TransferAcceptData & acceptData ReturnErrorOnFailure(WriteToPacketBuffer(acceptMsg, mPendingMsgHandle)); msgType = MessageType::ReceiveAccept; + +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Sending BDX Message"); + acceptMsg.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING } else { @@ -228,6 +238,11 @@ CHIP_ERROR TransferSession::AcceptTransfer(const TransferAcceptData & acceptData ReturnErrorOnFailure(WriteToPacketBuffer(acceptMsg, mPendingMsgHandle)); msgType = MessageType::SendAccept; + +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Sending BDX Message"); + acceptMsg.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING } mState = TransferState::kTransferInProgress; @@ -257,6 +272,11 @@ CHIP_ERROR TransferSession::PrepareBlockQuery() ReturnErrorOnFailure(WriteToPacketBuffer(queryMsg, mPendingMsgHandle)); +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Sending BDX Message"); + queryMsg.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING + mAwaitingResponse = true; mLastQueryNum = mNextQueryNum++; @@ -284,6 +304,11 @@ CHIP_ERROR TransferSession::PrepareBlock(const BlockData & inData) const MessageType msgType = inData.IsEof ? MessageType::BlockEOF : MessageType::Block; +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Sending BDX Message"); + blockMsg.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING + if (msgType == MessageType::BlockEOF) { mState = TransferState::kAwaitingEOFAck; @@ -310,6 +335,11 @@ CHIP_ERROR TransferSession::PrepareBlockAck() ReturnErrorOnFailure(WriteToPacketBuffer(ackMsg, mPendingMsgHandle)); +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Sending BDX Message"); + ackMsg.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING + if (mState == TransferState::kTransferInProgress) { if (mControlMode == TransferControlFlags::kSenderDrive) @@ -398,6 +428,10 @@ CHIP_ERROR TransferSession::HandleBdxMessage(const PayloadHeader & header, Syste const MessageType msgType = static_cast(header.GetMessageType()); +#if CHIP_AUTOMATION_LOGGING + ChipLogAutomation("Handling received BDX Message"); +#endif // CHIP_AUTOMATION_LOGGING + switch (msgType) { case MessageType::SendInit: @@ -496,6 +530,10 @@ void TransferSession::HandleTransferInit(MessageType msgType, System::PacketBuff mPendingOutput = OutputEventType::kInitReceived; mState = TransferState::kNegotiateTransferParams; + +#if CHIP_AUTOMATION_LOGGING + transferInit.LogMessage(msgType); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleReceiveAccept(System::PacketBufferHandle msgData) @@ -528,6 +566,10 @@ void TransferSession::HandleReceiveAccept(System::PacketBufferHandle msgData) mAwaitingResponse = (mControlMode == TransferControlFlags::kSenderDrive); mState = TransferState::kTransferInProgress; + +#if CHIP_AUTOMATION_LOGGING + rcvAcceptMsg.LogMessage(MessageType::ReceiveAccept); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleSendAccept(System::PacketBufferHandle msgData) @@ -558,6 +600,10 @@ void TransferSession::HandleSendAccept(System::PacketBufferHandle msgData) mAwaitingResponse = (mControlMode == TransferControlFlags::kReceiverDrive); mState = TransferState::kTransferInProgress; + +#if CHIP_AUTOMATION_LOGGING + sendAcceptMsg.LogMessage(MessageType::SendAccept); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleBlockQuery(System::PacketBufferHandle msgData) @@ -576,6 +622,10 @@ void TransferSession::HandleBlockQuery(System::PacketBufferHandle msgData) mAwaitingResponse = false; mLastQueryNum = query.BlockCounter; + +#if CHIP_AUTOMATION_LOGGING + query.LogMessage(MessageType::BlockQuery); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleBlock(System::PacketBufferHandle msgData) @@ -609,6 +659,10 @@ void TransferSession::HandleBlock(System::PacketBufferHandle msgData) mLastBlockNum = blockMsg.BlockCounter; mAwaitingResponse = false; + +#if CHIP_AUTOMATION_LOGGING + blockMsg.LogMessage(MessageType::Block); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleBlockEOF(System::PacketBufferHandle msgData) @@ -636,6 +690,10 @@ void TransferSession::HandleBlockEOF(System::PacketBufferHandle msgData) mAwaitingResponse = false; mState = TransferState::kReceivedEOF; + +#if CHIP_AUTOMATION_LOGGING + blockEOFMsg.LogMessage(MessageType::BlockEOF); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleBlockAck(System::PacketBufferHandle msgData) @@ -654,6 +712,10 @@ void TransferSession::HandleBlockAck(System::PacketBufferHandle msgData) // In Receiver Drive, the Receiver can send a BlockAck to indicate receipt of the message and reset the timeout. // In this case, the Sender should wait to receive a BlockQuery next. mAwaitingResponse = (mControlMode == TransferControlFlags::kReceiverDrive); + +#if CHIP_AUTOMATION_LOGGING + ackMsg.LogMessage(MessageType::BlockAck); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::HandleBlockAckEOF(System::PacketBufferHandle msgData) @@ -672,6 +734,10 @@ void TransferSession::HandleBlockAckEOF(System::PacketBufferHandle msgData) mAwaitingResponse = false; mState = TransferState::kTransferDone; + +#if CHIP_AUTOMATION_LOGGING + ackMsg.LogMessage(MessageType::BlockAckEOF); +#endif // CHIP_AUTOMATION_LOGGING } void TransferSession::ResolveTransferControlOptions(const BitFlags & proposed) diff --git a/src/system/SystemObject.h b/src/system/SystemObject.h index f6b26025ae9980..155f8f92bb3245 100644 --- a/src/system/SystemObject.h +++ b/src/system/SystemObject.h @@ -250,7 +250,7 @@ class ObjectPoolStatic * * @param[in] aStartIndex The index to start counting from; pass 0 to count over * the whole pool. - * @param[in/out] aNumInUse The number of objects in use. If aStartIndex is not 0, + * @param[in,out] aNumInUse The number of objects in use. If aStartIndex is not 0, * the function adds to the counter without resetting it first. */ void GetNumObjectsInUse(size_t aStartIndex, size_t & aNumInUse) diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index 4319b871811f1e..98a1b45865cd20 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -98,7 +98,7 @@ CHIP_ERROR TCPBase::Init(TcpListenParameters & params) err = mListenSocket->Listen(kListenBacklogSize); SuccessOrExit(err); - mListenSocket->AppState = reinterpret_cast(this); + mListenSocket->mAppState = reinterpret_cast(this); mListenSocket->OnDataReceived = OnTcpReceive; mListenSocket->OnConnectComplete = OnConnectionComplete; mListenSocket->OnConnectionClosed = OnConnectionClosed; @@ -254,7 +254,7 @@ CHIP_ERROR TCPBase::SendAfterConnect(const PeerAddress & addr, System::PacketBuf #endif SuccessOrExit(err); - endPoint->AppState = reinterpret_cast(this); + endPoint->mAppState = reinterpret_cast(this); endPoint->OnDataReceived = OnTcpReceive; endPoint->OnConnectComplete = OnConnectionComplete; endPoint->OnConnectionClosed = OnConnectionClosed; @@ -364,7 +364,7 @@ CHIP_ERROR TCPBase::OnTcpReceive(Inet::TCPEndPoint * endPoint, System::PacketBuf endPoint->GetInterfaceId(&interfaceId); PeerAddress peerAddress = PeerAddress::TCP(ipAddress, port, interfaceId); - TCPBase * tcp = reinterpret_cast(endPoint->AppState); + TCPBase * tcp = reinterpret_cast(endPoint->mAppState); CHIP_ERROR err = tcp->ProcessReceivedBuffer(endPoint, peerAddress, std::move(buffer)); if (err != CHIP_NO_ERROR) @@ -380,7 +380,7 @@ void TCPBase::OnConnectionComplete(Inet::TCPEndPoint * endPoint, CHIP_ERROR inet { CHIP_ERROR err = CHIP_NO_ERROR; bool foundPendingPacket = false; - TCPBase * tcp = reinterpret_cast(endPoint->AppState); + TCPBase * tcp = reinterpret_cast(endPoint->mAppState); Inet::IPAddress ipAddress; uint16_t port; Inet::InterfaceId interfaceId; @@ -452,7 +452,7 @@ void TCPBase::OnConnectionComplete(Inet::TCPEndPoint * endPoint, CHIP_ERROR inet void TCPBase::OnConnectionClosed(Inet::TCPEndPoint * endPoint, CHIP_ERROR err) { - TCPBase * tcp = reinterpret_cast(endPoint->AppState); + TCPBase * tcp = reinterpret_cast(endPoint->mAppState); ChipLogProgress(Inet, "Connection closed."); @@ -470,7 +470,7 @@ void TCPBase::OnConnectionClosed(Inet::TCPEndPoint * endPoint, CHIP_ERROR err) void TCPBase::OnConnectionReceived(Inet::TCPEndPoint * listenEndPoint, Inet::TCPEndPoint * endPoint, const Inet::IPAddress & peerAddress, uint16_t peerPort) { - TCPBase * tcp = reinterpret_cast(listenEndPoint->AppState); + TCPBase * tcp = reinterpret_cast(listenEndPoint->mAppState); if (tcp->mUsedEndPointCount < tcp->mActiveConnectionsSize) { @@ -484,7 +484,7 @@ void TCPBase::OnConnectionReceived(Inet::TCPEndPoint * listenEndPoint, Inet::TCP } } - endPoint->AppState = listenEndPoint->AppState; + endPoint->mAppState = listenEndPoint->mAppState; endPoint->OnDataReceived = OnTcpReceive; endPoint->OnConnectComplete = OnConnectionComplete; endPoint->OnConnectionClosed = OnConnectionClosed; @@ -531,7 +531,7 @@ void TCPBase::Disconnect(const PeerAddress & address) void TCPBase::OnPeerClosed(Inet::TCPEndPoint * endPoint) { - TCPBase * tcp = reinterpret_cast(endPoint->AppState); + TCPBase * tcp = reinterpret_cast(endPoint->mAppState); for (size_t i = 0; i < tcp->mActiveConnectionsSize; i++) { diff --git a/src/transport/raw/UDP.cpp b/src/transport/raw/UDP.cpp index 88f7546ab642cb..5915418e9dc42a 100644 --- a/src/transport/raw/UDP.cpp +++ b/src/transport/raw/UDP.cpp @@ -114,7 +114,7 @@ CHIP_ERROR UDP::SendMessage(const Transport::PeerAddress & address, System::Pack void UDP::OnUdpReceive(Inet::UDPEndPoint * endPoint, System::PacketBufferHandle && buffer, const Inet::IPPacketInfo * pktInfo) { CHIP_ERROR err = CHIP_NO_ERROR; - UDP * udp = reinterpret_cast(endPoint->AppState); + UDP * udp = reinterpret_cast(endPoint->mAppState); PeerAddress peerAddress = PeerAddress::UDP(pktInfo->SrcAddress, pktInfo->SrcPort, pktInfo->Interface); udp->HandleMessageReceived(peerAddress, std::move(buffer)); diff --git a/src/transport/raw/tests/NetworkTestHelpers.cpp b/src/transport/raw/tests/NetworkTestHelpers.cpp index f4a9ab18ea8305..280cd6b84d0a75 100644 --- a/src/transport/raw/tests/NetworkTestHelpers.cpp +++ b/src/transport/raw/tests/NetworkTestHelpers.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace chip { namespace Test { @@ -29,6 +30,7 @@ namespace Test { CHIP_ERROR IOContext::Init() { CHIP_ERROR err = Platform::MemoryInit(); + chip::DeviceLayer::SetConfigurationMgr(&chip::DeviceLayer::ConfigurationManagerImpl::GetDefaultInstance()); gSystemLayer.Init(); diff --git a/zzz_generated/all-clusters-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/all-clusters-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 759d13c5028d26..00000000000000 --- a/zzz_generated/all-clusters-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,18 +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. - */ - -// THIS FILE IS GENERATED BY ZAP diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index fff1319ed8f4fd..ecb85791eb497f 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -2566,6 +2566,9 @@ (EmberAfGenericClusterFunction) emberAfPumpConfigurationAndControlClusterServerInitCallback, \ (EmberAfGenericClusterFunction) MatterPumpConfigurationAndControlClusterServerAttributeChangedCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayThermostatUserInterfaceConfigurationServer[] = { \ + (EmberAfGenericClusterFunction) MatterThermostatUserInterfaceConfigurationClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayColorControlServer[] = { \ (EmberAfGenericClusterFunction) emberAfColorControlClusterServerInitCallback, \ }; \ @@ -2726,7 +2729,12 @@ 0x0201, ZAP_ATTRIBUTE_INDEX(292), 19, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { \ - 0x0204, ZAP_ATTRIBUTE_INDEX(311), 4, 5, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0204, \ + ZAP_ATTRIBUTE_INDEX(311), \ + 4, \ + 5, \ + ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + chipFuncArrayThermostatUserInterfaceConfigurationServer \ }, /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ { 0x0300, \ ZAP_ATTRIBUTE_INDEX(315), \ diff --git a/zzz_generated/bridge-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/bridge-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 759d13c5028d26..00000000000000 --- a/zzz_generated/bridge-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,18 +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. - */ - -// THIS FILE IS GENERATED BY ZAP diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 42e90df8818127..abe7a2e40c9e99 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -1998,6 +1998,11 @@ CHIP_ERROR LogValue(const char * label, size_t indent, } // anonymous namespace +static void OnDefaultSuccessResponseWithoutExit(void * context) +{ + ChipLogProgress(chipTool, "Default Success Response"); +} + static void OnDefaultSuccessResponse(void * context) { ChipLogProgress(chipTool, "Default Success Response"); @@ -2024,79 +2029,124 @@ static void OnDefaultFailure(void * context, EmberAfStatus status) OnDefaultFailureResponse(context, status); }; -static void OnBooleanAttributeResponse(void * context, bool value) +static void OnBooleanAttributeReport(void * context, bool value) { ChipLogProgress(chipTool, "Boolean attribute Response: %d", value); +} + +static void OnBooleanAttributeResponse(void * context, bool value) +{ + OnBooleanAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt8uAttributeResponse(void * context, uint8_t value) +static void OnInt8uAttributeReport(void * context, uint8_t value) { ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value); +} + +static void OnInt8uAttributeResponse(void * context, uint8_t value) +{ + OnInt8uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt16uAttributeResponse(void * context, uint16_t value) +static void OnInt16uAttributeReport(void * context, uint16_t value) { ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value); +} + +static void OnInt16uAttributeResponse(void * context, uint16_t value) +{ + OnInt16uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt32uAttributeResponse(void * context, uint32_t value) +static void OnInt32uAttributeReport(void * context, uint32_t value) { ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value); +} + +static void OnInt32uAttributeResponse(void * context, uint32_t value) +{ + OnInt32uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt64uAttributeResponse(void * context, uint64_t value) +static void OnInt64uAttributeReport(void * context, uint64_t value) { ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value); +} + +static void OnInt64uAttributeResponse(void * context, uint64_t value) +{ + OnInt64uAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt8sAttributeResponse(void * context, int8_t value) +static void OnInt8sAttributeReport(void * context, int8_t value) { ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); +} + +static void OnInt8sAttributeResponse(void * context, int8_t value) +{ + OnInt8sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt16sAttributeResponse(void * context, int16_t value) +static void OnInt16sAttributeReport(void * context, int16_t value) { ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); +} + +static void OnInt16sAttributeResponse(void * context, int16_t value) +{ + OnInt16sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt32sAttributeResponse(void * context, int32_t value) +static void OnInt32sAttributeReport(void * context, int32_t value) { ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); +} + +static void OnInt32sAttributeResponse(void * context, int32_t value) +{ + OnInt32sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnInt64sAttributeResponse(void * context, int64_t value) +static void OnInt64sAttributeReport(void * context, int64_t value) { ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); +} + +static void OnInt64sAttributeResponse(void * context, int64_t value) +{ + OnInt64sAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnOctetStringAttributeResponse(void * context, const chip::ByteSpan value) +static void OnOctetStringAttributeReport(void * context, const chip::ByteSpan value) { char buffer[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; if (CHIP_NO_ERROR == @@ -2108,14 +2158,24 @@ static void OnOctetStringAttributeResponse(void * context, const chip::ByteSpan { ChipLogProgress(chipTool, "OctetString attribute Response len: %zu", value.size()); } +} + +static void OnOctetStringAttributeResponse(void * context, const chip::ByteSpan value) +{ + OnOctetStringAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnCharStringAttributeResponse(void * context, const chip::CharSpan value) +static void OnCharStringAttributeReport(void * context, const chip::CharSpan value) { ChipLogProgress(chipTool, "CharString attribute Response: %.*s", static_cast(value.size()), value.data()); +} + +static void OnCharStringAttributeResponse(void * context, const chip::CharSpan value) +{ + OnCharStringAttributeReport(context, value); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -5981,12 +6041,14 @@ class ReportBinaryInputBasicPresentValue : public ModelCommand AddArgument("attr-name", "present-value"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportBinaryInputBasicPresentValue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -5998,25 +6060,29 @@ class ReportBinaryInputBasicPresentValue : public ModelCommand chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributePresentValue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributePresentValue(onReportCallback->Cancel())); - return cluster.SubscribeAttributePresentValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributePresentValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeResponse, this); + new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -6061,12 +6127,14 @@ class ReportBinaryInputBasicStatusFlags : public ModelCommand AddArgument("attr-name", "status-flags"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportBinaryInputBasicStatusFlags() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -6078,25 +6146,29 @@ class ReportBinaryInputBasicStatusFlags : public ModelCommand chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeStatusFlags(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeStatusFlags(onReportCallback->Cancel())); - return cluster.SubscribeAttributeStatusFlags(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeStatusFlags(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -6286,12 +6358,14 @@ class ReportBooleanStateStateValue : public ModelCommand AddArgument("attr-name", "state-value"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportBooleanStateStateValue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -6303,25 +6377,29 @@ class ReportBooleanStateStateValue : public ModelCommand chip::Controller::BooleanStateCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeStateValue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeStateValue(onReportCallback->Cancel())); - return cluster.SubscribeAttributeStateValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeStateValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeResponse, this); + new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -8086,12 +8164,14 @@ class ReportColorControlCurrentHue : public ModelCommand AddArgument("attr-name", "current-hue"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportColorControlCurrentHue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -8103,25 +8183,29 @@ class ReportColorControlCurrentHue : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentHue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentHue(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentHue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentHue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -8166,12 +8250,14 @@ class ReportColorControlCurrentSaturation : public ModelCommand AddArgument("attr-name", "current-saturation"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportColorControlCurrentSaturation() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -8183,25 +8269,30 @@ class ReportColorControlCurrentSaturation : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentSaturation(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentSaturation(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentSaturation(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentSaturation(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -8280,12 +8371,14 @@ class ReportColorControlCurrentX : public ModelCommand AddArgument("attr-name", "current-x"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportColorControlCurrentX() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -8297,25 +8390,29 @@ class ReportColorControlCurrentX : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentX(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentX(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentX(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentX(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -8360,12 +8457,14 @@ class ReportColorControlCurrentY : public ModelCommand AddArgument("attr-name", "current-y"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportColorControlCurrentY() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -8377,25 +8476,29 @@ class ReportColorControlCurrentY : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentY(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentY(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentY(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentY(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -8508,12 +8611,14 @@ class ReportColorControlColorTemperature : public ModelCommand AddArgument("attr-name", "color-temperature"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportColorControlColorTemperature() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -8525,25 +8630,29 @@ class ReportColorControlColorTemperature : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeColorTemperature(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeColorTemperature(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeColorTemperature(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } - return cluster.SubscribeAttributeColorTemperature(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -11571,12 +11680,14 @@ class ReportDoorLockLockState : public ModelCommand AddArgument("attr-name", "lock-state"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportDoorLockLockState() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -11588,25 +11699,29 @@ class ReportDoorLockLockState : public ModelCommand chip::Controller::DoorLockCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeLockState(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeLockState(onReportCallback->Cancel())); - return cluster.SubscribeAttributeLockState(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeLockState(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -13853,12 +13968,14 @@ class ReportIlluminanceMeasurementMeasuredValue : public ModelCommand AddArgument("attr-name", "measured-value"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportIlluminanceMeasurementMeasuredValue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -13870,25 +13987,29 @@ class ReportIlluminanceMeasurementMeasuredValue : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - return cluster.SubscribeAttributeMeasuredValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -14419,12 +14540,14 @@ class ReportLevelControlCurrentLevel : public ModelCommand AddArgument("attr-name", "current-level"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportLevelControlCurrentLevel() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -14436,25 +14559,29 @@ class ReportLevelControlCurrentLevel : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentLevel(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentLevel(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentLevel(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -16099,12 +16226,14 @@ class ReportModeSelectCurrentMode : public ModelCommand AddArgument("attr-name", "current-mode"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportModeSelectCurrentMode() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -16116,25 +16245,29 @@ class ReportModeSelectCurrentMode : public ModelCommand chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentMode(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentMode(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } - return cluster.SubscribeAttributeCurrentMode(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -17006,12 +17139,14 @@ class ReportOccupancySensingOccupancy : public ModelCommand AddArgument("attr-name", "occupancy"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportOccupancySensingOccupancy() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -17023,25 +17158,29 @@ class ReportOccupancySensingOccupancy : public ModelCommand chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeOccupancy(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeOccupancy(onReportCallback->Cancel())); - return cluster.SubscribeAttributeOccupancy(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeOccupancy(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -17349,12 +17488,14 @@ class ReportOnOffOnOff : public ModelCommand AddArgument("attr-name", "on-off"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportOnOffOnOff() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -17366,25 +17507,29 @@ class ReportOnOffOnOff : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeOnOff(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeOnOff(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeOnOff(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } - return cluster.SubscribeAttributeOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeResponse, this); + new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -18743,12 +18888,14 @@ class ReportPressureMeasurementMeasuredValue : public ModelCommand AddArgument("attr-name", "measured-value"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportPressureMeasurementMeasuredValue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -18760,25 +18907,29 @@ class ReportPressureMeasurementMeasuredValue : public ModelCommand chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - return cluster.SubscribeAttributeMeasuredValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -19399,12 +19550,14 @@ class ReportPumpConfigurationAndControlPumpStatus : public ModelCommand AddArgument("attr-name", "pump-status"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportPumpConfigurationAndControlPumpStatus() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -19416,25 +19569,29 @@ class ReportPumpConfigurationAndControlPumpStatus : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributePumpStatus(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributePumpStatus(onReportCallback->Cancel())); - return cluster.SubscribeAttributePumpStatus(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributePumpStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -19547,12 +19704,14 @@ class ReportPumpConfigurationAndControlCapacity : public ModelCommand AddArgument("attr-name", "capacity"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportPumpConfigurationAndControlCapacity() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -19564,25 +19723,29 @@ class ReportPumpConfigurationAndControlCapacity : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCapacity(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCapacity(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCapacity(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCapacity(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -19944,12 +20107,14 @@ class ReportRelativeHumidityMeasurementMeasuredValue : public ModelCommand AddArgument("attr-name", "measured-value"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportRelativeHumidityMeasurementMeasuredValue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -19961,25 +20126,29 @@ class ReportRelativeHumidityMeasurementMeasuredValue : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - return cluster.SubscribeAttributeMeasuredValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -20092,12 +20261,14 @@ class ReportRelativeHumidityMeasurementTolerance : public ModelCommand AddArgument("attr-name", "tolerance"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportRelativeHumidityMeasurementTolerance() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -20109,25 +20280,29 @@ class ReportRelativeHumidityMeasurementTolerance : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeTolerance(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeTolerance(onReportCallback->Cancel())); - return cluster.SubscribeAttributeTolerance(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeTolerance(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -20832,12 +21007,14 @@ class ReportSwitchCurrentPosition : public ModelCommand AddArgument("attr-name", "current-position"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportSwitchCurrentPosition() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -20849,25 +21026,29 @@ class ReportSwitchCurrentPosition : public ModelCommand chip::Controller::SwitchCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentPosition(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentPosition(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentPosition(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } - return cluster.SubscribeAttributeCurrentPosition(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -21361,12 +21542,14 @@ class ReportTemperatureMeasurementMeasuredValue : public ModelCommand AddArgument("attr-name", "measured-value"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportTemperatureMeasurementMeasuredValue() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -21378,25 +21561,29 @@ class ReportTemperatureMeasurementMeasuredValue : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - return cluster.SubscribeAttributeMeasuredValue(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -21509,12 +21696,14 @@ class ReportTemperatureMeasurementTolerance : public ModelCommand AddArgument("attr-name", "tolerance"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportTemperatureMeasurementTolerance() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -21526,25 +21715,29 @@ class ReportTemperatureMeasurementTolerance : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeTolerance(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeTolerance(onReportCallback->Cancel())); - return cluster.SubscribeAttributeTolerance(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeTolerance(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -23806,12 +23999,14 @@ class ReportThermostatLocalTemperature : public ModelCommand AddArgument("attr-name", "local-temperature"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportThermostatLocalTemperature() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -23823,25 +24018,29 @@ class ReportThermostatLocalTemperature : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeLocalTemperature(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeLocalTemperature(onReportCallback->Cancel())); - return cluster.SubscribeAttributeLocalTemperature(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeLocalTemperature(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeResponse, this); + new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28252,12 +28451,14 @@ class ReportWindowCoveringCurrentPositionLiftPercentage : public ModelCommand AddArgument("attr-name", "current-position-lift-percentage"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringCurrentPositionLiftPercentage() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28269,25 +28470,30 @@ class ReportWindowCoveringCurrentPositionLiftPercentage : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentPositionLiftPercentage(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionLiftPercentage(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentPositionLiftPercentage(successCallback, onFailureCallback->Cancel(), mMinInterval, + mMaxInterval); + } - return cluster.SubscribeAttributeCurrentPositionLiftPercentage(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28332,12 +28538,14 @@ class ReportWindowCoveringCurrentPositionTiltPercentage : public ModelCommand AddArgument("attr-name", "current-position-tilt-percentage"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringCurrentPositionTiltPercentage() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28349,25 +28557,30 @@ class ReportWindowCoveringCurrentPositionTiltPercentage : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentPositionTiltPercentage(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionTiltPercentage(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentPositionTiltPercentage(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentPositionTiltPercentage(successCallback, onFailureCallback->Cancel(), mMinInterval, + mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28412,12 +28625,14 @@ class ReportWindowCoveringOperationalStatus : public ModelCommand AddArgument("attr-name", "operational-status"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringOperationalStatus() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28429,25 +28644,30 @@ class ReportWindowCoveringOperationalStatus : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeOperationalStatus(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeOperationalStatus(onReportCallback->Cancel())); - return cluster.SubscribeAttributeOperationalStatus(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeOperationalStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28492,12 +28712,14 @@ class ReportWindowCoveringTargetPositionLiftPercent100ths : public ModelCommand AddArgument("attr-name", "target-position-lift-percent100ths"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringTargetPositionLiftPercent100ths() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28509,25 +28731,30 @@ class ReportWindowCoveringTargetPositionLiftPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeTargetPositionLiftPercent100ths(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeTargetPositionLiftPercent100ths(onReportCallback->Cancel())); - return cluster.SubscribeAttributeTargetPositionLiftPercent100ths(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeTargetPositionLiftPercent100ths(successCallback, onFailureCallback->Cancel(), mMinInterval, + mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28572,12 +28799,14 @@ class ReportWindowCoveringTargetPositionTiltPercent100ths : public ModelCommand AddArgument("attr-name", "target-position-tilt-percent100ths"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringTargetPositionTiltPercent100ths() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28589,25 +28818,30 @@ class ReportWindowCoveringTargetPositionTiltPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeTargetPositionTiltPercent100ths(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeTargetPositionTiltPercent100ths(onReportCallback->Cancel())); - return cluster.SubscribeAttributeTargetPositionTiltPercent100ths(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeTargetPositionTiltPercent100ths(successCallback, onFailureCallback->Cancel(), mMinInterval, + mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28686,12 +28920,14 @@ class ReportWindowCoveringCurrentPositionLiftPercent100ths : public ModelCommand AddArgument("attr-name", "current-position-lift-percent100ths"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringCurrentPositionLiftPercent100ths() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28703,25 +28939,30 @@ class ReportWindowCoveringCurrentPositionLiftPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentPositionLiftPercent100ths(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionLiftPercent100ths(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentPositionLiftPercent100ths(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentPositionLiftPercent100ths(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -28766,12 +29007,14 @@ class ReportWindowCoveringCurrentPositionTiltPercent100ths : public ModelCommand AddArgument("attr-name", "current-position-tilt-percent100ths"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringCurrentPositionTiltPercent100ths() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -28783,25 +29026,30 @@ class ReportWindowCoveringCurrentPositionTiltPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeCurrentPositionTiltPercent100ths(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionTiltPercent100ths(onReportCallback->Cancel())); - return cluster.SubscribeAttributeCurrentPositionTiltPercent100ths(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeCurrentPositionTiltPercent100ths(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* @@ -29049,12 +29297,14 @@ class ReportWindowCoveringSafetyStatus : public ModelCommand AddArgument("attr-name", "safety-status"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } ~ReportWindowCoveringSafetyStatus() { delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; delete onFailureCallback; delete onReportCallback; } @@ -29066,25 +29316,29 @@ class ReportWindowCoveringSafetyStatus : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - CHIP_ERROR err = cluster.ReportAttributeSafetyStatus(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(cluster.ReportAttributeSafetyStatus(onReportCallback->Cancel())); - return cluster.SubscribeAttributeSafetyStatus(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeSafetyStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; + bool mWait; }; /* diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 1d624d64a8849d..e97915bca48643 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -10122,10 +10122,10 @@ class Test_TC_CC_8_1 : public TestCommand } }; -class Test_TC_CC_9_2 : public TestCommand +class Test_TC_CC_9_1 : public TestCommand { public: - Test_TC_CC_9_2() : TestCommand("Test_TC_CC_9_2"), mTestIndex(0) {} + Test_TC_CC_9_1() : TestCommand("Test_TC_CC_9_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -10134,12 +10134,12 @@ class Test_TC_CC_9_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -10153,12 +10153,12 @@ class Test_TC_CC_9_2 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); + ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition : Turn on light for color control tests\n"); err = TestPreconditionTurnOnLightForColorControlTests_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Check on/off attribute value is true after on command\n"); - err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); @@ -10169,44 +10169,132 @@ class Test_TC_CC_9_2 : public TestCommand err = TestReadColorLoopActiveAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); - err = TestReadColorLoopDirectionAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); - err = TestReadColorLoopTimeAttributeFromDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); - err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); - err = TestColorLoopSetCommandSetAllAttributes_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Read ColorLoopTime attribute from DUT\n"); + err = TestReadColorLoopTimeAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); - err = TestReadColorLoopActiveAttributeFromDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Read ColorLoopStartEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopDirection attribute from DUT.\n"); - err = TestReadColorLoopDirectionAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); - err = TestReadColorLoopActiveAttributeFromDut_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); - err = TestTurnOffLightForColorControlTests_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Enhanced Move To Hue command 10\n"); + err = TestEnhancedMoveToHueCommand10_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Wait 2000ms\n"); + err = TestWait2000ms_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Turn Off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_35(); break; } @@ -10219,107 +10307,218 @@ class Test_TC_CC_9_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + const uint16_t mTestCount = 36; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, - this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ - OnSuccessCallback_6, this + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, + this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ + OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; + chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, this }; - chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; + chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; + chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; + chip::Callback::Callback mOnFailureCallback_19{ OnFailureCallback_19, this }; + chip::Callback::Callback mOnSuccessCallback_19{ OnSuccessCallback_19, this }; + chip::Callback::Callback mOnFailureCallback_22{ OnFailureCallback_22, this }; + chip::Callback::Callback mOnSuccessCallback_22{ OnSuccessCallback_22, + this }; + chip::Callback::Callback mOnFailureCallback_24{ OnFailureCallback_24, this }; + chip::Callback::Callback mOnSuccessCallback_24{ OnSuccessCallback_24, + this }; + chip::Callback::Callback mOnFailureCallback_26{ OnFailureCallback_26, this }; + chip::Callback::Callback mOnSuccessCallback_26{ OnSuccessCallback_26, this }; + chip::Callback::Callback mOnFailureCallback_28{ OnFailureCallback_28, this }; + chip::Callback::Callback mOnSuccessCallback_28{ OnSuccessCallback_28, this }; + chip::Callback::Callback mOnFailureCallback_30{ OnFailureCallback_30, this }; + chip::Callback::Callback mOnSuccessCallback_30{ OnSuccessCallback_30, + this }; + chip::Callback::Callback mOnFailureCallback_32{ OnFailureCallback_32, this }; + chip::Callback::Callback mOnSuccessCallback_32{ OnSuccessCallback_32, this }; + chip::Callback::Callback mOnFailureCallback_34{ OnFailureCallback_34, this }; + chip::Callback::Callback mOnSuccessCallback_34{ OnSuccessCallback_34, this }; static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_1(onOff); + (static_cast(context))->OnSuccessResponse_1(onOff); } static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(status); } static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_3(colorLoopActive); + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); } - static void OnFailureCallback_4(void * context, uint8_t status) + static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) + static void OnSuccessCallback_5(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); + (static_cast(context))->OnSuccessResponse_5(colorLoopDirection); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) + static void OnSuccessCallback_7(void * context, uint16_t colorLoopTime) { - (static_cast(context))->OnSuccessResponse_5(colorLoopTime); + (static_cast(context))->OnSuccessResponse_7(colorLoopTime); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) + static void OnSuccessCallback_9(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); + (static_cast(context))->OnSuccessResponse_9(colorLoopStartEnhancedHue); } - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_11(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_11(status); } - static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) + static void OnSuccessCallback_11(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_8(colorLoopActive); + (static_cast(context))->OnSuccessResponse_11(colorLoopActive); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_13(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_13(status); } - static void OnSuccessCallback_10(void * context, uint8_t colorLoopDirection) + static void OnSuccessCallback_13(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_10(colorLoopDirection); + (static_cast(context))->OnSuccessResponse_13(colorLoopActive); } - static void OnFailureCallback_12(void * context, uint8_t status) + static void OnFailureCallback_15(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_12(status); + (static_cast(context))->OnFailureResponse_15(status); } - static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) + static void OnSuccessCallback_15(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_12(colorLoopActive); + (static_cast(context))->OnSuccessResponse_15(colorLoopDirection); + } + + static void OnFailureCallback_17(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_17(status); + } + + static void OnSuccessCallback_17(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_17(colorLoopActive); + } + + static void OnFailureCallback_19(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_19(status); + } + + static void OnSuccessCallback_19(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_19(colorLoopActive); + } + + static void OnFailureCallback_22(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_22(status); + } + + static void OnSuccessCallback_22(void * context, uint16_t enhancedCurrentHue) + { + (static_cast(context))->OnSuccessResponse_22(enhancedCurrentHue); + } + + static void OnFailureCallback_24(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_24(status); + } + + static void OnSuccessCallback_24(void * context, uint8_t colorLoopDirection) + { + (static_cast(context))->OnSuccessResponse_24(colorLoopDirection); + } + + static void OnFailureCallback_26(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_26(status); + } + + static void OnSuccessCallback_26(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_26(colorLoopActive); + } + + static void OnFailureCallback_28(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_28(status); + } + + static void OnSuccessCallback_28(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_28(colorLoopActive); + } + + static void OnFailureCallback_30(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_30(status); + } + + static void OnSuccessCallback_30(void * context, uint8_t colorLoopDirection) + { + (static_cast(context))->OnSuccessResponse_30(colorLoopDirection); + } + + static void OnFailureCallback_32(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_32(status); + } + + static void OnSuccessCallback_32(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_32(colorLoopActive); + } + + static void OnFailureCallback_34(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_34(status); + } + + static void OnSuccessCallback_34(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_34(colorLoopActive); } // @@ -10337,11 +10536,11 @@ class Test_TC_CC_9_2 : public TestCommand chip::app::Clusters::OnOff::Commands::On::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_0(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); }; return cluster.InvokeCommand(request, this, success, failure); } @@ -10350,7 +10549,7 @@ class Test_TC_CC_9_2 : public TestCommand void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10375,20 +10574,20 @@ class Test_TC_CC_9_2 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(15); + request.updateFlags = static_cast>(1); request.action = static_cast(0); request.direction = static_cast(0); - request.time = 30U; - request.startHue = 160U; + request.time = 0U; + request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); + (static_cast(context))->OnSuccessResponse_2(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(status); }; return cluster.InvokeCommand(request, this, success, failure); } @@ -10413,55 +10612,101 @@ class Test_TC_CC_9_2 : public TestCommand NextTest(); } - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_4() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(2); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - NextTest(); - } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_5() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint16_t colorLoopTime) + void OnSuccessResponse_5(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_6() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); - } - - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(4); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 30U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_7() { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint16_t colorLoopTime) + { + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_8() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10470,45 +10715,45 @@ class Test_TC_CC_9_2 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); + request.updateFlags = static_cast>(8); + request.action = static_cast(0); request.direction = static_cast(0); request.time = 0U; - request.startHue = 0U; + request.startHue = 160U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_7(); + (static_cast(context))->OnSuccessResponse_8(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_8(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_8() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_9() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t colorLoopActive) + void OnSuccessResponse_9(uint16_t colorLoopStartEnhancedHue) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_10() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10517,45 +10762,45 @@ class Test_TC_CC_9_2 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(1); + request.updateFlags = static_cast>(1); + request.action = static_cast(1); + request.direction = static_cast(0); request.time = 0U; request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_9(); + (static_cast(context))->OnSuccessResponse_10(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_10(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9() { NextTest(); } + void OnSuccessResponse_10() { NextTest(); } - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_10() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_11() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t colorLoopDirection) + void OnSuccessResponse_11(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_12() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10573,304 +10818,224 @@ class Test_TC_CC_9_2 : public TestCommand request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); + (static_cast(context))->OnSuccessResponse_12(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_12(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11() { NextTest(); } + void OnSuccessResponse_12() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_13() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_12(uint8_t colorLoopActive) + void OnSuccessResponse_13(uint8_t colorLoopActive) { VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestTurnOffLightForColorControlTests_13() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_14() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; using responseType = chip::app::DataModel::NullObjectType; - chip::app::Clusters::OnOff::Commands::Off::Type request; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(2); + request.action = static_cast(0); + request.direction = static_cast(1); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_13(); + (static_cast(context))->OnSuccessResponse_14(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_13(status); + (static_cast(context))->OnFailureResponse_14(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13() { NextTest(); } -}; + void OnSuccessResponse_14() { NextTest(); } -class Test_TC_CC_9_3 : public TestCommand -{ -public: - Test_TC_CC_9_3() : TestCommand("Test_TC_CC_9_3"), mTestIndex(0) {} + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_15() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); + } + + void OnFailureResponse_15(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_15(uint8_t colorLoopDirection) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_3\n"); - } + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_16() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(1); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); - err = TestPreconditionTurnOnLightForColorControlTests_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Check on/off attribute value is true after on command\n"); - err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); - err = TestSendsColorLoopSetCommandSetAllAttributes_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read ColorLoopActive attribute from DUT\n"); - err = TestReadColorLoopActiveAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); - err = TestReadColorLoopDirectionAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); - err = TestReadColorLoopTimeAttributeFromDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); - err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); - err = TestColorLoopSetCommandSetAllAttributes_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); - err = TestReadColorLoopActiveAttributeFromDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopTime attribute from DUT.\n"); - err = TestReadColorLoopTimeAttributeFromDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); - err = TestReadColorLoopActiveAttributeFromDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); - err = TestTurnOffLightForColorControlTests_13(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_16(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_16(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + void OnFailureResponse_16(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, - this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ - OnSuccessCallback_6, this - }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; - chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; + void OnSuccessResponse_16() { NextTest(); } - static void OnFailureCallback_1(void * context, uint8_t status) + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_17() { - (static_cast(context))->OnFailureResponse_1(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_1(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_1(onOff); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); } - static void OnFailureCallback_3(void * context, uint8_t status) + void OnFailureResponse_17(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_17(uint8_t colorLoopActive) { - (static_cast(context))->OnFailureResponse_3(status); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + NextTest(); } - static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_3(colorLoopActive); - } - - static void OnFailureCallback_4(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_4(status); - } - - static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_18() { - (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_5(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_5(status); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_5(colorLoopTime); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - static void OnFailureCallback_6(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_6(status); - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_18(); + }; - static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_18(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnFailureCallback_8(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_8(status); - } + void OnFailureResponse_18(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_8(colorLoopActive); - } + void OnSuccessResponse_18() { NextTest(); } - static void OnFailureCallback_10(void * context, uint8_t status) + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_19() { - (static_cast(context))->OnFailureResponse_10(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_10(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_10(colorLoopTime); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_19.Cancel(), mOnFailureCallback_19.Cancel()); } - static void OnFailureCallback_12(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_12(status); - } + void OnFailureResponse_19(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) + void OnSuccessResponse_19(uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_12(colorLoopActive); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() + CHIP_ERROR TestEnhancedMoveToHueCommand10_20() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using requestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; using responseType = chip::app::DataModel::NullObjectType; - chip::app::Clusters::OnOff::Commands::On::Type request; + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type request; + request.enhancedHue = 40960U; + request.direction = static_cast(0); + request.transitionTime = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_20(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_20(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_20(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } + void OnSuccessResponse_20() { NextTest(); } - CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() + CHIP_ERROR TestWait2000ms_21() { return WaitForMs(2000); } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_22() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeEnhancedCurrentHue(mOnSuccessCallback_22.Cancel(), mOnFailureCallback_22.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_22(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_22(uint16_t enhancedCurrentHue) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, 40960U)); NextTest(); } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_23() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10879,93 +11044,139 @@ class Test_TC_CC_9_3 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(15); + request.updateFlags = static_cast>(2); request.action = static_cast(0); request.direction = static_cast(0); - request.time = 30U; - request.startHue = 160U; + request.time = 0U; + request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); + (static_cast(context))->OnSuccessResponse_23(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_23(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_23(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2() { NextTest(); } + void OnSuccessResponse_23() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_24() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_24.Cancel(), mOnFailureCallback_24.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_24(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t colorLoopActive) + void OnSuccessResponse_24(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_25() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(2); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - void OnSuccessResponse_4(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - NextTest(); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_25(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_25(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() + void OnFailureResponse_25(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_25() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_26() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_26.Cancel(), mOnFailureCallback_26.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_26(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint16_t colorLoopTime) + void OnSuccessResponse_26(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_27() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_27(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_27(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_27(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) + void OnSuccessResponse_27() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_28() { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_28.Cancel(), mOnFailureCallback_28.Cancel()); + } + + void OnFailureResponse_28(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_28(uint8_t colorLoopActive) + { + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_29() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10974,45 +11185,45 @@ class Test_TC_CC_9_3 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); - request.direction = static_cast(0); + request.updateFlags = static_cast>(2); + request.action = static_cast(0); + request.direction = static_cast(1); request.time = 0U; request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_7(); + (static_cast(context))->OnSuccessResponse_29(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_29(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_29(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_29() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_30() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_30.Cancel(), mOnFailureCallback_30.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_30(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t colorLoopActive) + void OnSuccessResponse_30(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_31() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -11021,45 +11232,45 @@ class Test_TC_CC_9_3 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(4); - request.action = static_cast(0); + request.updateFlags = static_cast>(1); + request.action = static_cast(2); request.direction = static_cast(0); - request.time = 60U; + request.time = 0U; request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_9(); + (static_cast(context))->OnSuccessResponse_31(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_31(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_31(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9() { NextTest(); } + void OnSuccessResponse_31() { NextTest(); } - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_10() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_32() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_32.Cancel(), mOnFailureCallback_32.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_32(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint16_t colorLoopTime) + void OnSuccessResponse_32(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 60U)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_33() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -11077,36 +11288,36 @@ class Test_TC_CC_9_3 : public TestCommand request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); + (static_cast(context))->OnSuccessResponse_33(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_33(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_33(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11() { NextTest(); } + void OnSuccessResponse_33() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_34() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_34.Cancel(), mOnFailureCallback_34.Cancel()); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_34(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_12(uint8_t colorLoopActive) + void OnSuccessResponse_34(uint8_t colorLoopActive) { VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestTurnOffLightForColorControlTests_13() + CHIP_ERROR TestTurnOffLightForColorControlTests_35() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -11117,24 +11328,24 @@ class Test_TC_CC_9_3 : public TestCommand chip::app::Clusters::OnOff::Commands::Off::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_13(); + (static_cast(context))->OnSuccessResponse_35(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_13(status); + (static_cast(context))->OnFailureResponse_35(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_35(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13() { NextTest(); } + void OnSuccessResponse_35() { NextTest(); } }; -class Test_TC_DM_1_1 : public TestCommand +class Test_TC_CC_9_2 : public TestCommand { public: - Test_TC_DM_1_1() : TestCommand("Test_TC_DM_1_1"), mTestIndex(0) {} + Test_TC_CC_9_2() : TestCommand("Test_TC_CC_9_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -11143,12 +11354,12 @@ class Test_TC_DM_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -11162,76 +11373,60 @@ class Test_TC_DM_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Query Interaction Model Version\n"); - err = TestQueryInteractionModelVersion_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); + err = TestPreconditionTurnOnLightForColorControlTests_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Query Vendor Name\n"); - err = TestQueryVendorName_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Check on/off attribute value is true after on command\n"); + err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query VendorID\n"); - err = TestQueryVendorID_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query Product Name\n"); - err = TestQueryProductName_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Query ProductID\n"); - err = TestQueryProductID_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Query User Label\n"); - err = TestQueryUserLabel_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Query User Location\n"); - err = TestQueryUserLocation_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Query HardwareVersion\n"); - err = TestQueryHardwareVersion_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); + err = TestColorLoopSetCommandSetAllAttributes_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Query HardwareVersionString\n"); - err = TestQueryHardwareVersionString_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); + err = TestReadColorLoopActiveAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Query SoftwareVersion\n"); - err = TestQuerySoftwareVersion_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Query SoftwareVersionString\n"); - err = TestQuerySoftwareVersionString_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Query ManufacturingDate\n"); - err = TestQueryManufacturingDate_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Query PartNumber\n"); - err = TestQueryPartNumber_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Query ProductURL\n"); - err = TestQueryProductURL_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Query ProductLabel\n"); - err = TestQueryProductLabel_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Query SerialNumber\n"); - err = TestQuerySerialNumber_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Query LocalConfigDisabled\n"); - err = TestQueryLocalConfigDisabled_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Query Reachable\n"); - err = TestQueryReachable_17(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_13(); break; } @@ -11244,574 +11439,418 @@ class Test_TC_DM_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 14; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, - this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, - this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, + this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ - OnSuccessCallback_8, this + chip::Callback::Callback mOnSuccessCallback_6{ + OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ - OnSuccessCallback_10, this - }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ - OnSuccessCallback_11, this - }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, + this }; chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, - this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, - this }; - chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; - chip::Callback::Callback mOnSuccessCallback_14{ OnSuccessCallback_14, - this }; - chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; - chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, - this }; - chip::Callback::Callback mOnFailureCallback_16{ OnFailureCallback_16, this }; - chip::Callback::Callback mOnSuccessCallback_16{ OnSuccessCallback_16, - this }; - chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; - chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_0(status); - } - - static void OnSuccessCallback_0(void * context, uint16_t interactionModelVersion) - { - (static_cast(context))->OnSuccessResponse_0(interactionModelVersion); - } + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); - } - - static void OnSuccessCallback_1(void * context, chip::CharSpan vendorName) - { - (static_cast(context))->OnSuccessResponse_1(vendorName); - } - - static void OnFailureCallback_2(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_2(void * context, uint16_t vendorID) + static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_2(vendorID); + (static_cast(context))->OnSuccessResponse_1(onOff); } static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context, chip::CharSpan productName) + static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_3(productName); + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); } static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint16_t productID) + static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_4(productID); + (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); } static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_5(void * context, chip::CharSpan userLabel) + static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) { - (static_cast(context))->OnSuccessResponse_5(userLabel); + (static_cast(context))->OnSuccessResponse_5(colorLoopTime); } static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_6(void * context, chip::CharSpan location) + static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_6(location); + (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); } - static void OnFailureCallback_7(void * context, uint8_t status) + static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_7(void * context, uint16_t hardwareVersion) + static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_7(hardwareVersion); + (static_cast(context))->OnSuccessResponse_8(colorLoopActive); } - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_8(void * context, chip::CharSpan hardwareVersionString) + static void OnSuccessCallback_10(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_8(hardwareVersionString); + (static_cast(context))->OnSuccessResponse_10(colorLoopDirection); } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_9(void * context, uint32_t softwareVersion) + static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_9(softwareVersion); + (static_cast(context))->OnSuccessResponse_12(colorLoopActive); } - static void OnFailureCallback_10(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_10(status); - } + // + // Tests methods + // - static void OnSuccessCallback_10(void * context, chip::CharSpan softwareVersionString) + CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() { - (static_cast(context))->OnSuccessResponse_10(softwareVersionString); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_11(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_11(status); - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnSuccessCallback_11(void * context, chip::CharSpan manufacturingDate) - { - (static_cast(context))->OnSuccessResponse_11(manufacturingDate); - } + chip::app::Clusters::OnOff::Commands::On::Type request; - static void OnFailureCallback_12(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_12(status); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnSuccessCallback_12(void * context, chip::CharSpan partNumber) + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { - (static_cast(context))->OnSuccessResponse_12(partNumber); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - static void OnFailureCallback_13(void * context, uint8_t status) + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool onOff) { - (static_cast(context))->OnFailureResponse_13(status); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); } - static void OnSuccessCallback_13(void * context, chip::CharSpan productURL) + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() { - (static_cast(context))->OnSuccessResponse_13(productURL); - } - - static void OnFailureCallback_14(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_14(status); - } - - static void OnSuccessCallback_14(void * context, chip::CharSpan productLabel) - { - (static_cast(context))->OnSuccessResponse_14(productLabel); - } - - static void OnFailureCallback_15(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_15(status); - } - - static void OnSuccessCallback_15(void * context, chip::CharSpan serialNumber) - { - (static_cast(context))->OnSuccessResponse_15(serialNumber); - } - - static void OnFailureCallback_16(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_16(status); - } - - static void OnSuccessCallback_16(void * context, bool localConfigDisabled) - { - (static_cast(context))->OnSuccessResponse_16(localConfigDisabled); - } - - static void OnFailureCallback_17(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_17(status); - } - - static void OnSuccessCallback_17(void * context, bool reachable) - { - (static_cast(context))->OnSuccessResponse_17(reachable); - } - - // - // Tests methods - // - - CHIP_ERROR TestQueryInteractionModelVersion_0() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeInteractionModelVersion(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint16_t interactionModelVersion) - { - VerifyOrReturn(CheckConstraintType("interactionModelVersion", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestQueryVendorName_1() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeVendorName(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_1(chip::CharSpan vendorName) - { - VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); - NextTest(); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(15); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 30U; + request.startHue = 160U; + request.optionsMask = 0; + request.optionsOverride = 0; - CHIP_ERROR TestQueryVendorID_2() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; - return cluster.ReadAttributeVendorID(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t vendorID) - { - VerifyOrReturn(CheckConstraintType("vendorID", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestQueryProductName_3() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeProductName(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(chip::CharSpan productName) + void OnSuccessResponse_3(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("productName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productName", productName.size(), 32)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestQueryProductID_4() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeProductID(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t productID) + void OnSuccessResponse_4(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } - CHIP_ERROR TestQueryUserLabel_5() + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeUserLabel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(chip::CharSpan userLabel) + void OnSuccessResponse_5(uint16_t colorLoopTime) { - VerifyOrReturn(CheckConstraintType("userLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("userLabel", userLabel.size(), 32)); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); NextTest(); } - CHIP_ERROR TestQueryUserLocation_6() + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeLocation(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(chip::CharSpan location) + void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) { - VerifyOrReturn(CheckConstraintType("location", "", "string")); - VerifyOrReturn(CheckConstraintFormat("location", "", "ISO 3166-1 alpha-2")); - VerifyOrReturn(CheckConstraintMaxLength("location", location.size(), 2)); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); NextTest(); } - CHIP_ERROR TestQueryHardwareVersion_7() + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeHardwareVersion(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(1); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint16_t hardwareVersion) - { - VerifyOrReturn(CheckConstraintType("hardwareVersion", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestQueryHardwareVersionString_8() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeHardwareVersionString(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); } void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(chip::CharSpan hardwareVersionString) + void OnSuccessResponse_8(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("hardwareVersionString", "", "string")); - VerifyOrReturn(CheckConstraintMinLength("hardwareVersionString", hardwareVersionString.size(), 1)); - VerifyOrReturn(CheckConstraintMaxLength("hardwareVersionString", hardwareVersionString.size(), 64)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestQuerySoftwareVersion_9() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSoftwareVersion(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(2); + request.action = static_cast(0); + request.direction = static_cast(1); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint32_t softwareVersion) - { - VerifyOrReturn(CheckConstraintType("softwareVersion", "", "uint32")); - NextTest(); - } + void OnSuccessResponse_9() { NextTest(); } - CHIP_ERROR TestQuerySoftwareVersionString_10() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_10() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSoftwareVersionString(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(chip::CharSpan softwareVersionString) + void OnSuccessResponse_10(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckConstraintType("softwareVersionString", "", "string")); - VerifyOrReturn(CheckConstraintFormat("softwareVersionString", "", "ASCII")); - VerifyOrReturn(CheckConstraintMinLength("softwareVersionString", softwareVersionString.size(), 1)); - VerifyOrReturn(CheckConstraintMaxLength("softwareVersionString", softwareVersionString.size(), 64)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); NextTest(); } - CHIP_ERROR TestQueryManufacturingDate_11() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeManufacturingDate(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); - } - - void OnFailureResponse_11(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_11(chip::CharSpan manufacturingDate) - { - VerifyOrReturn(CheckConstraintType("manufacturingDate", "", "string")); - VerifyOrReturn(CheckConstraintFormat("manufacturingDate", "", "ISO 8601")); - VerifyOrReturn(CheckConstraintMinLength("manufacturingDate", manufacturingDate.size(), 8)); - VerifyOrReturn(CheckConstraintMaxLength("manufacturingDate", manufacturingDate.size(), 16)); - NextTest(); - } - - CHIP_ERROR TestQueryPartNumber_12() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributePartNumber(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); - } - - void OnFailureResponse_12(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_12(chip::CharSpan partNumber) - { - VerifyOrReturn(CheckConstraintType("partNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("partNumber", partNumber.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryProductURL_13() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeProductURL(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_13(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_13(chip::CharSpan productURL) - { - VerifyOrReturn(CheckConstraintType("productURL", "", "string")); - VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); - VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); - NextTest(); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - CHIP_ERROR TestQueryProductLabel_14() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; - return cluster.ReadAttributeProductLabel(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_14(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_14(chip::CharSpan productLabel) - { - VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); - NextTest(); - } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestQuerySerialNumber_15() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSerialNumber(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - void OnFailureResponse_15(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_15(chip::CharSpan serialNumber) + void OnSuccessResponse_12(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestQueryLocalConfigDisabled_16() + CHIP_ERROR TestTurnOffLightForColorControlTests_13() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeLocalConfigDisabled(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_16(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_16(bool localConfigDisabled) - { - VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); - NextTest(); - } + chip::app::Clusters::OnOff::Commands::Off::Type request; - CHIP_ERROR TestQueryReachable_17() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; - return cluster.ReadAttributeReachable(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_17(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_17(bool reachable) - { - VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); - NextTest(); - } + void OnSuccessResponse_13() { NextTest(); } }; -class Test_TC_DM_3_1 : public TestCommand +class Test_TC_CC_9_3 : public TestCommand { public: - Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {} + Test_TC_CC_9_3() : TestCommand("Test_TC_CC_9_3"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -11820,12 +11859,12 @@ class Test_TC_DM_3_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -11838,6 +11877,62 @@ class Test_TC_DM_3_1 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); + err = TestPreconditionTurnOnLightForColorControlTests_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Check on/off attribute value is true after on command\n"); + err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); + err = TestColorLoopSetCommandSetAllAttributes_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); + err = TestReadColorLoopActiveAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_13(); + break; } if (CHIP_NO_ERROR != err) @@ -11849,529 +11944,417 @@ class Test_TC_DM_3_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - // - // Tests methods - // -}; + const uint16_t mTestCount = 14; -class Test_TC_EMR_1_1 : public TestCommand -{ -public: - Test_TC_EMR_1_1() : TestCommand("Test_TC_EMR_1_1"), mTestIndex(0) {} + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, + this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ + OnSuccessCallback_6, this + }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_1(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnFailureResponse_1(status); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_EMR_1_1\n"); - } + static void OnSuccessCallback_1(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_1(onOff); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } - Wait(); + static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_2(); - break; - } + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) + { + (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) + { + (static_cast(context))->OnSuccessResponse_5(colorLoopTime); + } - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_8(colorLoopActive); + } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_10(void * context, uint16_t colorLoopTime) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnSuccessResponse_10(colorLoopTime); + } + + static void OnFailureCallback_12(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_12(status); + } + + static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_12(colorLoopActive); } // // Tests methods // - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() { - chip::Controller::ElectricalMeasurementClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() { - chip::Controller::ElectricalMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(15); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 30U; + request.startHue = 160U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() { - chip::Controller::ElectricalMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t clusterRevision) + void OnSuccessResponse_3(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } -}; - -class Test_TC_FLW_1_1 : public TestCommand -{ -public: - Test_TC_FLW_1_1() : TestCommand("Test_TC_FLW_1_1"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); - } + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_4(uint8_t colorLoopDirection) + { + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); + NextTest(); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, - " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, EmberAfStatus status) + void OnSuccessResponse_5(uint16_t colorLoopTime) { - (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + NextTest(); } - static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } - - // - // Tests methods - // - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 2U; - - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } - - void OnSuccessResponse_0() { ThrowSuccessResponse(); } -}; - -class Test_TC_FLW_2_1 : public TestCommand -{ -public: - Test_TC_FLW_2_1() : TestCommand("Test_TC_FLW_2_1"), mTestIndex(0) {} + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - /////////// TestCommand Interface ///////// - void NextTest() override + void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); - } + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(1); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : write the default value to optional attribute: MinMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : write the default value to optional attribute: MaxMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_7(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + void OnSuccessResponse_7() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_0(void * context, int16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_0(measuredValue); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); } - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); - } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_1(void * context, int16_t minMeasuredValue) + void OnSuccessResponse_8(uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + NextTest(); } - static void OnFailureCallback_2(void * context, uint8_t status) + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() { - (static_cast(context))->OnFailureResponse_2(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_2(void * context, int16_t maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnFailureCallback_3(void * context, EmberAfStatus status) - { - (static_cast(context))->OnFailureResponse_3(chip::to_underlying(status)); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(4); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 60U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; - static void OnFailureCallback_4(void * context, EmberAfStatus status) - { - (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_5(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_5(status); - } + void OnSuccessResponse_9() { NextTest(); } - static void OnSuccessCallback_5(void * context, int16_t measuredValue) + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_10() { - (static_cast(context))->OnSuccessResponse_5(measuredValue); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_6(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_6(status); + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - static void OnSuccessCallback_6(void * context, int16_t minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); - } + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_7(void * context, uint8_t status) + void OnSuccessResponse_10(uint16_t colorLoopTime) { - (static_cast(context))->OnFailureResponse_7(status); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 60U)); + NextTest(); } - static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() { - (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - // - // Tests methods - // + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(int16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(int16_t minMeasuredValue) + void OnSuccessResponse_12(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + CHIP_ERROR TestTurnOffLightForColorControlTests_13() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_2(int16_t maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - int16_t minMeasuredValueArgument; - minMeasuredValueArgument = 0; - - return cluster.WriteAttribute( - minMeasuredValueArgument, this, OnSuccessCallback_3, OnFailureCallback_3); - } - - void OnFailureResponse_3(uint8_t status) { NextTest(); } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - int16_t maxMeasuredValueArgument; - maxMeasuredValueArgument = 0; - - return cluster.WriteAttribute( - maxMeasuredValueArgument, this, OnSuccessCallback_4, OnFailureCallback_4); - } - - void OnFailureResponse_4(uint8_t status) { NextTest(); } - - void OnSuccessResponse_4() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_5() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); - } - - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_5(int16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_6() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); - } - - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6(int16_t minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - NextTest(); - } + chip::app::Clusters::OnOff::Commands::Off::Type request; - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_7() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; - return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(int16_t maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_13() { NextTest(); } }; -class Test_TC_FLW_2_2 : public TestCommand +class Test_TC_DM_1_1 : public TestCommand { public: - Test_TC_FLW_2_2() : TestCommand("Test_TC_FLW_2_2"), mTestIndex(0) {} + Test_TC_DM_1_1() : TestCommand("Test_TC_DM_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12380,12 +12363,12 @@ class Test_TC_FLW_2_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12399,12 +12382,76 @@ class Test_TC_FLW_2_2 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Query Interaction Model Version\n"); + err = TestQueryInteractionModelVersion_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Query Vendor Name\n"); + err = TestQueryVendorName_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Query VendorID\n"); + err = TestQueryVendorID_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Query Product Name\n"); + err = TestQueryProductName_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Query ProductID\n"); + err = TestQueryProductID_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Query User Label\n"); + err = TestQueryUserLabel_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Query User Location\n"); + err = TestQueryUserLocation_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Query HardwareVersion\n"); + err = TestQueryHardwareVersion_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Query HardwareVersionString\n"); + err = TestQueryHardwareVersionString_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Query SoftwareVersion\n"); + err = TestQuerySoftwareVersion_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Query SoftwareVersionString\n"); + err = TestQuerySoftwareVersionString_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Query ManufacturingDate\n"); + err = TestQueryManufacturingDate_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Query PartNumber\n"); + err = TestQueryPartNumber_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Query ProductURL\n"); + err = TestQueryProductURL_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Query ProductLabel\n"); + err = TestQueryProductLabel_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Query SerialNumber\n"); + err = TestQuerySerialNumber_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Query LocalConfigDisabled\n"); + err = TestQueryLocalConfigDisabled_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Query Reachable\n"); + err = TestQueryReachable_17(); break; } @@ -12417,926 +12464,813 @@ class Test_TC_FLW_2_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 18; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, + this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, + this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ + OnSuccessCallback_8, this + }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ + OnSuccessCallback_10, this + }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ + OnSuccessCallback_11, this + }; + chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, + this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, + this }; + chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; + chip::Callback::Callback mOnSuccessCallback_14{ OnSuccessCallback_14, + this }; + chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; + chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, + this }; + chip::Callback::Callback mOnFailureCallback_16{ OnFailureCallback_16, this }; + chip::Callback::Callback mOnSuccessCallback_16{ OnSuccessCallback_16, + this }; + chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; + chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, int16_t measuredValue) + static void OnSuccessCallback_0(void * context, uint16_t interactionModelVersion) { - (static_cast(context))->OnSuccessResponse_0(measuredValue); + (static_cast(context))->OnSuccessResponse_0(interactionModelVersion); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_1(void * context, int16_t measuredValue) + static void OnSuccessCallback_1(void * context, chip::CharSpan vendorName) { - (static_cast(context))->OnSuccessResponse_1(measuredValue); + (static_cast(context))->OnSuccessResponse_1(vendorName); } - // - // Tests methods - // - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + static void OnFailureCallback_2(void * context, uint8_t status) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnFailureResponse_2(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(int16_t measuredValue) + static void OnSuccessCallback_2(void * context, uint16_t vendorID) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); + (static_cast(context))->OnSuccessResponse_2(vendorID); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() + static void OnFailureCallback_3(void * context, uint8_t status) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + (static_cast(context))->OnFailureResponse_3(status); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(int16_t measuredValue) + static void OnSuccessCallback_3(void * context, chip::CharSpan productName) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); + (static_cast(context))->OnSuccessResponse_3(productName); } -}; - -class Test_TC_LVL_1_1 : public TestCommand -{ -public: - Test_TC_LVL_1_1() : TestCommand("Test_TC_LVL_1_1"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_4(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, - " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + (static_cast(context))->OnFailureResponse_4(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - static void OnFailureCallback_0(void * context, EmberAfStatus status) + static void OnSuccessCallback_4(void * context, uint16_t productID) { - (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_4(productID); } - static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } - - // - // Tests methods - // - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + static void OnFailureCallback_5(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 4U; - - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + (static_cast(context))->OnFailureResponse_5(status); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } - - void OnSuccessResponse_0() { ThrowSuccessResponse(); } -}; - -class Test_TC_LVL_2_1 : public TestCommand -{ -public: - Test_TC_LVL_2_1() : TestCommand("Test_TC_LVL_2_1"), mTestIndex(0) {} - - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_5(void * context, chip::CharSpan userLabel) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); - err = TestWait100ms_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 200ms\n"); - err = TestWait200ms_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : reads On Off Transition Time attribute from DUT\n"); - err = TestReadsOnOffTransitionTimeAttributeFromDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 10ms\n"); - err = TestWait10ms_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 0\n"); - err = TestResetLevelTo0_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + (static_cast(context))->OnSuccessResponse_5(userLabel); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, - this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + static void OnSuccessCallback_6(void * context, chip::CharSpan location) { - (static_cast(context))->OnSuccessResponse_0(currentLevel); + (static_cast(context))->OnSuccessResponse_6(location); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + static void OnSuccessCallback_7(void * context, uint16_t hardwareVersion) { - (static_cast(context))->OnSuccessResponse_3(currentLevel); + (static_cast(context))->OnSuccessResponse_7(hardwareVersion); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + static void OnSuccessCallback_8(void * context, chip::CharSpan hardwareVersionString) { - (static_cast(context))->OnSuccessResponse_6(currentLevel); + (static_cast(context))->OnSuccessResponse_8(hardwareVersionString); } - static void OnFailureCallback_7(void * context, uint8_t status) + static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnSuccessCallback_7(void * context, uint16_t onOffTransitionTime) + static void OnSuccessCallback_9(void * context, uint32_t softwareVersion) { - (static_cast(context))->OnSuccessResponse_7(onOffTransitionTime); + (static_cast(context))->OnSuccessResponse_9(softwareVersion); } static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + static void OnSuccessCallback_10(void * context, chip::CharSpan softwareVersionString) { - (static_cast(context))->OnSuccessResponse_10(currentLevel); + (static_cast(context))->OnSuccessResponse_10(softwareVersionString); } - // - // Tests methods - // - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + static void OnFailureCallback_11(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnFailureResponse_11(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_11(void * context, chip::CharSpan manufacturingDate) + { + (static_cast(context))->OnSuccessResponse_11(manufacturingDate); + } - void OnSuccessResponse_0(uint8_t currentLevel) + static void OnFailureCallback_12(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); - NextTest(); + (static_cast(context))->OnFailureResponse_12(status); } - CHIP_ERROR TestSendsAMoveToLevelCommand_1() + static void OnSuccessCallback_12(void * context, chip::CharSpan partNumber) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_12(partNumber); + } - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 64; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_13(void * context, chip::CharSpan productURL) + { + (static_cast(context))->OnSuccessResponse_13(productURL); + } - void OnSuccessResponse_1() { NextTest(); } + static void OnFailureCallback_14(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_14(status); + } - CHIP_ERROR TestWait100ms_2() { return WaitForMs(100); } + static void OnSuccessCallback_14(void * context, chip::CharSpan productLabel) + { + (static_cast(context))->OnSuccessResponse_14(productLabel); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + static void OnFailureCallback_15(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_15(status); + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + static void OnSuccessCallback_15(void * context, chip::CharSpan serialNumber) + { + (static_cast(context))->OnSuccessResponse_15(serialNumber); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_16(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_16(status); + } - void OnSuccessResponse_3(uint8_t currentLevel) + static void OnSuccessCallback_16(void * context, bool localConfigDisabled) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); - NextTest(); + (static_cast(context))->OnSuccessResponse_16(localConfigDisabled); } - CHIP_ERROR TestSendsAMoveToLevelCommand_4() + static void OnFailureCallback_17(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_17(status); + } - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + static void OnSuccessCallback_17(void * context, bool reachable) + { + (static_cast(context))->OnSuccessResponse_17(reachable); + } - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 128; - request.transitionTime = 1U; - request.optionMask = 1; - request.optionOverride = 1; + // + // Tests methods + // - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; + CHIP_ERROR TestQueryInteractionModelVersion_0() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeInteractionModelVersion(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_4() { NextTest(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestWait200ms_5() { return WaitForMs(200); } + void OnSuccessResponse_0(uint16_t interactionModelVersion) + { + VerifyOrReturn(CheckConstraintType("interactionModelVersion", "", "uint16")); + NextTest(); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + CHIP_ERROR TestQueryVendorName_1() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttributeVendorName(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint8_t currentLevel) + void OnSuccessResponse_1(chip::CharSpan vendorName) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); NextTest(); } - CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_7() + CHIP_ERROR TestQueryVendorID_2() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeOnOffTransitionTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + return cluster.ReadAttributeVendorID(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint16_t onOffTransitionTime) + void OnSuccessResponse_2(uint16_t vendorID) { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); + VerifyOrReturn(CheckConstraintType("vendorID", "", "uint16")); NextTest(); } - CHIP_ERROR TestSendsAMoveToLevelCommand_8() + CHIP_ERROR TestQueryProductName_3() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 254; - request.transitionTime = 65535U; - request.optionMask = 1; - request.optionOverride = 1; + return cluster.ReadAttributeProductName(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_3(chip::CharSpan productName) + { + VerifyOrReturn(CheckConstraintType("productName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("productName", productName.size(), 32)); + NextTest(); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + CHIP_ERROR TestQueryProductID_4() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - void OnSuccessResponse_8() { NextTest(); } + return cluster.ReadAttributeProductID(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } - CHIP_ERROR TestWait10ms_9() { return WaitForMs(10); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + void OnSuccessResponse_4(uint16_t productID) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + NextTest(); + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + CHIP_ERROR TestQueryUserLabel_5() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeUserLabel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t currentLevel) + void OnSuccessResponse_5(chip::CharSpan userLabel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckConstraintType("userLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("userLabel", userLabel.size(), 32)); NextTest(); } - CHIP_ERROR TestResetLevelTo0_11() + CHIP_ERROR TestQueryUserLocation_6() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 0; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; + return cluster.ReadAttributeLocation(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_6(chip::CharSpan location) + { + VerifyOrReturn(CheckConstraintType("location", "", "string")); + VerifyOrReturn(CheckConstraintFormat("location", "", "ISO 3166-1 alpha-2")); + VerifyOrReturn(CheckConstraintMaxLength("location", location.size(), 2)); + NextTest(); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + CHIP_ERROR TestQueryHardwareVersion_7() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - void OnSuccessResponse_11() { NextTest(); } + return cluster.ReadAttributeHardwareVersion(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } - CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } -}; + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } -class Test_TC_LVL_3_1 : public TestCommand -{ -public: - Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) {} + void OnSuccessResponse_7(uint16_t hardwareVersion) + { + VerifyOrReturn(CheckConstraintType("hardwareVersion", "", "uint16")); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestQueryHardwareVersionString_8() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); - } + return cluster.ReadAttributeHardwareVersionString(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_8(chip::CharSpan hardwareVersionString) + { + VerifyOrReturn(CheckConstraintType("hardwareVersionString", "", "string")); + VerifyOrReturn(CheckConstraintMinLength("hardwareVersionString", hardwareVersionString.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("hardwareVersionString", hardwareVersionString.size(), 64)); + NextTest(); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads min level attribute from DUT\n"); - err = TestReadsMinLevelAttributeFromDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : sends a Move down command\n"); - err = TestSendsAMoveDownCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 3000ms\n"); - err = TestWait3000ms_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write default move rate attribute from DUT\n"); - err = TestWriteDefaultMoveRateAttributeFromDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads default move rate attribute from DUT\n"); - err = TestReadsDefaultMoveRateAttributeFromDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move up command at default move rate\n"); - err = TestSendsAMoveUpCommandAtDefaultMoveRate_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_13(); - break; - } + CHIP_ERROR TestQuerySoftwareVersion_9() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeSoftwareVersion(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, uint8_t status) + void OnSuccessResponse_9(uint32_t softwareVersion) { - (static_cast(context))->OnFailureResponse_0(status); + VerifyOrReturn(CheckConstraintType("softwareVersion", "", "uint32")); + NextTest(); } - static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + CHIP_ERROR TestQuerySoftwareVersionString_10() { - (static_cast(context))->OnSuccessResponse_0(currentLevel); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeSoftwareVersionString(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - static void OnFailureCallback_1(void * context, uint8_t status) + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(chip::CharSpan softwareVersionString) { - (static_cast(context))->OnFailureResponse_1(status); + VerifyOrReturn(CheckConstraintType("softwareVersionString", "", "string")); + VerifyOrReturn(CheckConstraintFormat("softwareVersionString", "", "ASCII")); + VerifyOrReturn(CheckConstraintMinLength("softwareVersionString", softwareVersionString.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("softwareVersionString", softwareVersionString.size(), 64)); + NextTest(); } - static void OnSuccessCallback_1(void * context, uint8_t maxLevel) + CHIP_ERROR TestQueryManufacturingDate_11() { - (static_cast(context))->OnSuccessResponse_1(maxLevel); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeManufacturingDate(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - static void OnFailureCallback_4(void * context, uint8_t status) + void OnFailureResponse_11(uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + void OnSuccessResponse_11(chip::CharSpan manufacturingDate) { - (static_cast(context))->OnSuccessResponse_4(currentLevel); + VerifyOrReturn(CheckConstraintType("manufacturingDate", "", "string")); + VerifyOrReturn(CheckConstraintFormat("manufacturingDate", "", "ISO 8601")); + VerifyOrReturn(CheckConstraintMinLength("manufacturingDate", manufacturingDate.size(), 8)); + VerifyOrReturn(CheckConstraintMaxLength("manufacturingDate", manufacturingDate.size(), 16)); + NextTest(); } - static void OnFailureCallback_5(void * context, uint8_t status) + CHIP_ERROR TestQueryPartNumber_12() { - (static_cast(context))->OnFailureResponse_5(status); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributePartNumber(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - static void OnSuccessCallback_5(void * context, uint8_t minLevel) + void OnFailureResponse_12(uint8_t status) { - (static_cast(context))->OnSuccessResponse_5(minLevel); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnFailureCallback_8(void * context, uint8_t status) + void OnSuccessResponse_12(chip::CharSpan partNumber) { - (static_cast(context))->OnFailureResponse_8(status); + VerifyOrReturn(CheckConstraintType("partNumber", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("partNumber", partNumber.size(), 32)); + NextTest(); } - static void OnSuccessCallback_8(void * context, uint8_t currentLevel) + CHIP_ERROR TestQueryProductURL_13() { - (static_cast(context))->OnSuccessResponse_8(currentLevel); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductURL(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - static void OnFailureCallback_9(void * context, EmberAfStatus status) + void OnFailureResponse_13(uint8_t status) { - (static_cast(context))->OnFailureResponse_9(chip::to_underlying(status)); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, uint8_t status) + void OnSuccessResponse_13(chip::CharSpan productURL) { - (static_cast(context))->OnFailureResponse_10(status); + VerifyOrReturn(CheckConstraintType("productURL", "", "string")); + VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); + VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); + NextTest(); } - static void OnSuccessCallback_10(void * context, uint8_t defaultMoveRate) + CHIP_ERROR TestQueryProductLabel_14() { - (static_cast(context))->OnSuccessResponse_10(defaultMoveRate); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductLabel(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); } - static void OnFailureCallback_13(void * context, uint8_t status) + void OnFailureResponse_14(uint8_t status) { - (static_cast(context))->OnFailureResponse_13(status); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnSuccessCallback_13(void * context, uint8_t currentLevel) + void OnSuccessResponse_14(chip::CharSpan productLabel) { - (static_cast(context))->OnSuccessResponse_13(currentLevel); + VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + CHIP_ERROR TestQuerySerialNumber_15() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeSerialNumber(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_15(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } - void OnSuccessResponse_0(uint8_t currentLevel) + void OnSuccessResponse_15(chip::CharSpan serialNumber) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); NextTest(); } - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() + CHIP_ERROR TestQueryLocalConfigDisabled_16() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeMaxLevel(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeLocalConfigDisabled(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_16(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } - void OnSuccessResponse_1(uint8_t maxLevel) + void OnSuccessResponse_16(bool localConfigDisabled) { - VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); + VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommand_2() + CHIP_ERROR TestQueryReachable_17() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(0); - request.rate = 200; - request.optionMask = 1; - request.optionOverride = 1; + return cluster.ReadAttributeReachable(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; + void OnFailureResponse_17(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_17(bool reachable) + { + VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); + NextTest(); } +}; - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } +class Test_TC_DM_3_1 : public TestCommand +{ +public: + Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {} - void OnSuccessResponse_2() { NextTest(); } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - CHIP_ERROR TestWait3000ms_3() { return WaitForMs(3000); } + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); - } + Wait(); - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } - void OnSuccessResponse_4(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 255)); - NextTest(); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsMinLevelAttributeFromDut_5() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; - return cluster.ReadAttributeMinLevel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); - } + // + // Tests methods + // +}; - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } +class Test_TC_DM_2_2 : public TestCommand +{ +public: + Test_TC_DM_2_2() : TestCommand("Test_TC_DM_2_2"), mTestIndex(0) {} - void OnSuccessResponse_5(uint8_t minLevel) + /////////// TestCommand Interface ///////// + void NextTest() override { - VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); - NextTest(); - } + CHIP_ERROR err = CHIP_NO_ERROR; - CHIP_ERROR TestSendsAMoveDownCommand_6() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_2\n"); + } - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(1); - request.rate = 250; - request.optionMask = 1; - request.optionOverride = 1; + Wait(); - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Query fabrics list\n"); + err = TestQueryFabricsList_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Query Supported Fabrics\n"); + err = TestQuerySupportedFabrics_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Query Commissioned Fabrics\n"); + err = TestQueryCommissionedFabrics_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Query User Trusted Root Certificates\n"); + err = TestQueryUserTrustedRootCertificates_3(); + break; + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6() { NextTest(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; - CHIP_ERROR TestWait3000ms_7() { return WaitForMs(3000); } + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback & fabricsList)> + mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, + this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback & trustedRootCertificates)> + mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + static void OnFailureCallback_0(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_0(status); + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + static void + OnSuccessCallback_0(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabricsList) + { + (static_cast(context))->OnSuccessResponse_0(fabricsList); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } - void OnSuccessResponse_8(uint8_t currentLevel) + static void OnSuccessCallback_1(void * context, uint8_t supportedFabrics) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); - NextTest(); + (static_cast(context))->OnSuccessResponse_1(supportedFabrics); } - CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_9() + static void OnFailureCallback_2(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_2(status); + } - uint8_t defaultMoveRateArgument; - defaultMoveRateArgument = 20; + static void OnSuccessCallback_2(void * context, uint8_t commissionedFabrics) + { + (static_cast(context))->OnSuccessResponse_2(commissionedFabrics); + } - return cluster.WriteAttribute( - defaultMoveRateArgument, this, OnSuccessCallback_9, OnFailureCallback_9); + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & trustedRootCertificates) + { + (static_cast(context))->OnSuccessResponse_3(trustedRootCertificates); + } - void OnSuccessResponse_9() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_10() + CHIP_ERROR TestQueryFabricsList_0() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeDefaultMoveRate(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeFabricsList(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t defaultMoveRate) + void OnSuccessResponse_0(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabricsList) { - VerifyOrReturn(CheckValue("defaultMoveRate", defaultMoveRate, 20)); + auto iter = fabricsList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabricsList", iter, 0)); + VerifyOrReturn(CheckNoMoreListItems("fabricsList", iter, 1)); NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_11() + CHIP_ERROR TestQuerySupportedFabrics_1() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(1); - request.rate = 255; - request.optionMask = 1; - request.optionOverride = 1; + return cluster.ReadAttributeSupportedFabrics(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_1(uint8_t supportedFabrics) + { + VerifyOrReturn(CheckValue("supportedFabrics", supportedFabrics, 16)); + NextTest(); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + CHIP_ERROR TestQueryCommissionedFabrics_2() + { + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); - void OnSuccessResponse_11() { NextTest(); } + return cluster.ReadAttributeCommissionedFabrics(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } - CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() + void OnSuccessResponse_2(uint8_t commissionedFabrics) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + VerifyOrReturn(CheckValue("commissionedFabrics", commissionedFabrics, 1)); + NextTest(); + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + CHIP_ERROR TestQueryUserTrustedRootCertificates_3() + { + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeTrustedRootCertificates(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13(uint8_t currentLevel) + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & trustedRootCertificates) { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); + VerifyOrReturn(CheckConstraintType("trustedRootCertificates", "", "list")); NextTest(); } }; -class Test_TC_LVL_4_1 : public TestCommand +class Test_TC_EMR_1_1 : public TestCommand { public: - Test_TC_LVL_4_1() : TestCommand("Test_TC_LVL_4_1"), mTestIndex(0) {} + Test_TC_EMR_1_1() : TestCommand("Test_TC_EMR_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13345,12 +13279,12 @@ class Test_TC_LVL_4_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_EMR_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13364,48 +13298,17 @@ class Test_TC_LVL_4_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Sending on command\n"); - err = TestSendingOnCommand_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_1(); + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); - err = TestWait3000ms_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Sends step down command to DUT\n"); - err = TestSendsStepDownCommandToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); - err = TestWait3000ms_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Sends a Step up command\n"); - err = TestSendsAStepUpCommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); - err = TestWait3000ms_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Sending off command\n"); - err = TestSendingOffCommand_10(); + ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_2(); break; } @@ -13418,243 +13321,97 @@ class Test_TC_LVL_4_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 3; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_3(currentLevel); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); } - static void OnSuccessCallback_6(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_6(currentLevel); - } + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_9(void * context, uint8_t currentLevel) + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_9(currentLevel); + (static_cast(context))->OnSuccessResponse_2(clusterRevision); } // // Tests methods // - CHIP_ERROR TestSendingOnCommand_0() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ElectricalMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::On::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } - - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Step::Type request; - request.stepMode = static_cast(0); - request.stepSize = 128; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); - } - - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_3(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); - NextTest(); - } - - CHIP_ERROR TestSendsStepDownCommandToDut_4() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Step::Type request; - request.stepMode = static_cast(1); - request.stepSize = 64; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWait3000ms_5() { return WaitForMs(3000); } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); - } - - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6(uint8_t currentLevel) + void OnSuccessResponse_0(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); NextTest(); } - CHIP_ERROR TestSendsAStepUpCommand_7() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::ElectricalMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Step::Type request; - request.stepMode = static_cast(0); - request.stepSize = 64; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 1U; - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_7() { NextTest(); } + void OnFailureResponse_1(uint8_t status) { NextTest(); } - CHIP_ERROR TestWait3000ms_8() { return WaitForMs(3000); } + void OnSuccessResponse_1() { ThrowSuccessResponse(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::ElectricalMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t currentLevel) + void OnSuccessResponse_2(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); NextTest(); } - - CHIP_ERROR TestSendingOffCommand_10() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::Off::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_10() { NextTest(); } }; -class Test_TC_LVL_5_1 : public TestCommand +class Test_TC_FLW_1_1 : public TestCommand { public: - Test_TC_LVL_5_1() : TestCommand("Test_TC_LVL_5_1"), mTestIndex(0) {} + Test_TC_FLW_1_1() : TestCommand("Test_TC_FLW_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13663,12 +13420,12 @@ class Test_TC_LVL_5_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13682,32 +13439,9 @@ class Test_TC_LVL_5_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Sending on command\n"); - err = TestSendingOnCommand_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); - err = TestWait3000ms_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Sends a move up command to DUT\n"); - err = TestSendsAMoveUpCommandToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); - err = TestWait3000ms_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends stop command to DUT\n"); - err = TestSendsStopCommandToDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Sending off command\n"); - err = TestSendingOffCommand_6(); + ChipLogProgress(chipTool, + " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); break; } @@ -13720,152 +13454,40 @@ class Test_TC_LVL_5_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - // - // Tests methods - // - - CHIP_ERROR TestSendingOnCommand_0() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::On::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0() { NextTest(); } - - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Step::Type request; - request.stepMode = static_cast(0); - request.stepSize = 128; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } - - CHIP_ERROR TestSendsAMoveUpCommandToDut_3() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(0); - request.rate = 1; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_3(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestWait3000ms_4() { return WaitForMs(3000); } + const uint16_t mTestCount = 1; - CHIP_ERROR TestSendsStopCommandToDut_5() + static void OnFailureCallback_0(void * context, EmberAfStatus status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Stop::Type request; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } - void OnSuccessResponse_5() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestSendingOffCommand_6() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::Off::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 2U; - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { NextTest(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_0() { ThrowSuccessResponse(); } }; -class Test_TC_MC_1_1 : public TestCommand +class Test_TC_FLW_2_1 : public TestCommand { public: - Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) {} + Test_TC_FLW_2_1() : TestCommand("Test_TC_FLW_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13874,12 +13496,12 @@ class Test_TC_MC_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13893,9 +13515,36 @@ class Test_TC_MC_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, - " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : write the default value to optional attribute: MinMeasuredValue\n"); + err = TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : write the default value to optional attribute: MaxMeasuredValue\n"); + err = TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_7(); break; } @@ -13908,164 +13557,232 @@ class Test_TC_MC_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 8; - static void OnFailureCallback_0(void * context, EmberAfStatus status) + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } - - // - // Tests methods - // - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + static void OnSuccessCallback_0(void * context, int16_t measuredValue) { - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_0(measuredValue); + } - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + static void OnSuccessCallback_1(void * context, int16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } - void OnSuccessResponse_0() { ThrowSuccessResponse(); } -}; + static void OnSuccessCallback_2(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); + } -class Test_TC_MC_2_1 : public TestCommand -{ -public: - Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) {} + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(chip::to_underlying(status)); + } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); - } + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } - Wait(); + static void OnSuccessCallback_5(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_5(measuredValue); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Put the device into low power mode\n"); - err = TestPutTheDeviceIntoLowPowerMode_0(); - break; - } + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnSuccessCallback_6(void * context, int16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); + } // // Tests methods // - CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_0() + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() { - chip::Controller::LowPowerClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; - using responseType = chip::app::DataModel::NullObjectType; + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } - chip::app::Clusters::LowPower::Commands::Sleep::Type request; + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; + void OnSuccessResponse_0(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } -}; + void OnSuccessResponse_1(int16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + NextTest(); + } -class Test_TC_MC_3_1 : public TestCommand -{ -public: - Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) {} + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(int16_t maxMeasuredValue) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); - } + CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + int16_t minMeasuredValueArgument; + minMeasuredValueArgument = 0; - Wait(); + return cluster.WriteAttribute( + minMeasuredValueArgument, this, OnSuccessCallback_3, OnFailureCallback_3); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + void OnFailureResponse_3(uint8_t status) { NextTest(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + void OnSuccessResponse_3() { ThrowSuccessResponse(); } + + CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + int16_t maxMeasuredValueArgument; + maxMeasuredValueArgument = 0; + + return cluster.WriteAttribute( + maxMeasuredValueArgument, this, OnSuccessCallback_4, OnFailureCallback_4); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_4(uint8_t status) { NextTest(); } - // - // Tests methods - // + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_5() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_6() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(int16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_7() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(int16_t maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + NextTest(); + } }; -class Test_TC_MC_3_2 : public TestCommand +class Test_TC_FLW_2_2 : public TestCommand { public: - Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) {} + Test_TC_FLW_2_2() : TestCommand("Test_TC_FLW_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14074,12 +13791,12 @@ class Test_TC_MC_3_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14092,6 +13809,14 @@ class Test_TC_MC_3_2 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_1(); + break; } if (CHIP_NO_ERROR != err) @@ -14103,113 +13828,74 @@ class Test_TC_MC_3_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 2; - // - // Tests methods - // -}; - -class Test_TC_MC_3_3 : public TestCommand -{ -public: - Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) {} + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_0(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + (static_cast(context))->OnFailureResponse_0(status); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + static void OnSuccessCallback_0(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_0(measuredValue); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + static void OnSuccessCallback_1(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_1(measuredValue); + } // // Tests methods // -}; - -class Test_TC_MC_3_4 : public TestCommand -{ -public: - Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); - } + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_0(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_1(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } }; -class Test_TC_MC_3_5 : public TestCommand +class Test_TC_LVL_1_1 : public TestCommand { public: - Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) {} + Test_TC_LVL_1_1() : TestCommand("Test_TC_LVL_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14218,12 +13904,12 @@ class Test_TC_MC_3_5 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14236,6 +13922,11 @@ class Test_TC_MC_3_5 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, + " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; } if (CHIP_NO_ERROR != err) @@ -14247,65 +13938,40 @@ class Test_TC_MC_3_5 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 1; + + static void OnFailureCallback_0(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + } + + static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } // // Tests methods // -}; - -class Test_TC_MC_3_6 : public TestCommand -{ -public: - Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 4U; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_0(uint8_t status) { NextTest(); } - // - // Tests methods - // + void OnSuccessResponse_0() { ThrowSuccessResponse(); } }; -class Test_TC_MC_3_7 : public TestCommand +class Test_TC_LVL_2_1 : public TestCommand { public: - Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) {} + Test_TC_LVL_2_1() : TestCommand("Test_TC_LVL_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14314,12 +13980,12 @@ class Test_TC_MC_3_7 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14332,6 +13998,58 @@ class Test_TC_MC_3_7 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); + err = TestWait100ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 200ms\n"); + err = TestWait200ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : reads On Off Transition Time attribute from DUT\n"); + err = TestReadsOnOffTransitionTimeAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 10ms\n"); + err = TestWait10ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 0\n"); + err = TestResetLevelTo0_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; } if (CHIP_NO_ERROR != err) @@ -14343,17 +14061,2345 @@ class Test_TC_MC_3_7 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - // - // Tests methods - // -}; + const uint16_t mTestCount = 13; -class Test_TC_MC_3_8 : public TestCommand + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, + this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_0(currentLevel); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_3(currentLevel); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_6(currentLevel); + } + + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, uint16_t onOffTransitionTime) + { + (static_cast(context))->OnSuccessResponse_7(onOffTransitionTime); + } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_10(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 64; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestWait100ms_2() { return WaitForMs(100); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_4() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 128; + request.transitionTime = 1U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWait200ms_5() { return WaitForMs(200); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + NextTest(); + } + + CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_7() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOffTransitionTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint16_t onOffTransitionTime) + { + VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_8() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 254; + request.transitionTime = 65535U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR TestWait10ms_9() { return WaitForMs(10); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + NextTest(); + } + + CHIP_ERROR TestResetLevelTo0_11() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 0; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } +}; + +class Test_TC_LVL_3_1 : public TestCommand +{ +public: + Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); + err = TestReadsMaxLevelAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); + err = TestSendsAMoveUpCommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); + err = TestWait3000ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : reads min level attribute from DUT\n"); + err = TestReadsMinLevelAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : sends a Move down command\n"); + err = TestSendsAMoveDownCommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 3000ms\n"); + err = TestWait3000ms_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Write default move rate attribute from DUT\n"); + err = TestWriteDefaultMoveRateAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : reads default move rate attribute from DUT\n"); + err = TestReadsDefaultMoveRateAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move up command at default move rate\n"); + err = TestSendsAMoveUpCommandAtDefaultMoveRate_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_13(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_0(currentLevel); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t maxLevel) + { + (static_cast(context))->OnSuccessResponse_1(maxLevel); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_4(currentLevel); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t minLevel) + { + (static_cast(context))->OnSuccessResponse_5(minLevel); + } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_8(currentLevel); + } + + static void OnFailureCallback_9(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_9(chip::to_underlying(status)); + } + + static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint8_t defaultMoveRate) + { + (static_cast(context))->OnSuccessResponse_10(defaultMoveRate); + } + + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); + } + + static void OnSuccessCallback_13(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_13(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxLevel(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t maxLevel) + { + VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommand_2() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(0); + request.rate = 200; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestWait3000ms_3() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 255)); + NextTest(); + } + + CHIP_ERROR TestReadsMinLevelAttributeFromDut_5() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMinLevel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint8_t minLevel) + { + VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveDownCommand_6() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(1); + request.rate = 250; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestWait3000ms_7() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_9() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t defaultMoveRateArgument; + defaultMoveRateArgument = 20; + + return cluster.WriteAttribute( + defaultMoveRateArgument, this, OnSuccessCallback_9, OnFailureCallback_9); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_10() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeDefaultMoveRate(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint8_t defaultMoveRate) + { + VerifyOrReturn(CheckValue("defaultMoveRate", defaultMoveRate, 20)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_11() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(1); + request.rate = 255; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13(uint8_t currentLevel) + { + VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); + NextTest(); + } +}; + +class Test_TC_LVL_4_1 : public TestCommand +{ +public: + Test_TC_LVL_4_1() : TestCommand("Test_TC_LVL_4_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Sending on command\n"); + err = TestSendingOnCommand_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); + err = TestWait3000ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Sends step down command to DUT\n"); + err = TestSendsStepDownCommandToDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); + err = TestWait3000ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Sends a Step up command\n"); + err = TestSendsAStepUpCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); + err = TestWait3000ms_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Sending off command\n"); + err = TestSendingOffCommand_10(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 11; + + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_3(currentLevel); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_6(currentLevel); + } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_9(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestSendingOnCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(0); + request.stepSize = 128; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + NextTest(); + } + + CHIP_ERROR TestSendsStepDownCommandToDut_4() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(1); + request.stepSize = 64; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWait3000ms_5() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + NextTest(); + } + + CHIP_ERROR TestSendsAStepUpCommand_7() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(0); + request.stepSize = 64; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestWait3000ms_8() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + NextTest(); + } + + CHIP_ERROR TestSendingOffCommand_10() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10() { NextTest(); } +}; + +class Test_TC_LVL_5_1 : public TestCommand +{ +public: + Test_TC_LVL_5_1() : TestCommand("Test_TC_LVL_5_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Sending on command\n"); + err = TestSendingOnCommand_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); + err = TestWait3000ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Sends a move up command to DUT\n"); + err = TestSendsAMoveUpCommandToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); + err = TestWait3000ms_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends stop command to DUT\n"); + err = TestSendsStopCommandToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Sending off command\n"); + err = TestSendingOffCommand_6(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 7; + + // + // Tests methods + // + + CHIP_ERROR TestSendingOnCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(0); + request.stepSize = 128; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } + + CHIP_ERROR TestSendsAMoveUpCommandToDut_3() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(0); + request.rate = 1; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_3(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestWait3000ms_4() { return WaitForMs(3000); } + + CHIP_ERROR TestSendsStopCommandToDut_5() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Stop::Type request; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_5(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestSendingOffCommand_6() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6() { NextTest(); } +}; + +class Test_TC_MC_1_1 : public TestCommand +{ +public: + Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, + " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + static void OnFailureCallback_0(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + } + + static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 1U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0() { ThrowSuccessResponse(); } +}; + +class Test_TC_MC_2_1 : public TestCommand +{ +public: + Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Put the device into low power mode\n"); + err = TestPutTheDeviceIntoLowPowerMode_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + // + // Tests methods + // + + CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_0() + { + chip::Controller::LowPowerClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LowPower::Commands::Sleep::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } +}; + +class Test_TC_MC_3_1 : public TestCommand +{ +public: + Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_2 : public TestCommand +{ +public: + Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_3 : public TestCommand +{ +public: + Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_4 : public TestCommand +{ +public: + Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_5 : public TestCommand +{ +public: + Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_6 : public TestCommand +{ +public: + Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_7 : public TestCommand +{ +public: + Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_8 : public TestCommand +{ +public: + Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_9 : public TestCommand +{ +public: + Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_10 : public TestCommand +{ +public: + Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_11 : public TestCommand +{ +public: + Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_OCC_1_1 : public TestCommand +{ +public: + Test_TC_OCC_1_1() : TestCommand("Test_TC_OCC_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 2U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1() { ThrowSuccessResponse(); } +}; + +class Test_TC_OCC_2_1 : public TestCommand +{ +public: + Test_TC_OCC_2_1() : TestCommand("Test_TC_OCC_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reads mandatory attribute constrains: Occupancy\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancy_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : Writes the respective default value to mandatory attribute: Occupancy\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back mandatory attribute: Occupancy\n"); + err = TestReadsBackMandatoryAttributeOccupancy_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads mandatory attribute constrains: OccupancySensorType\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads back mandatory attribute: OccupancySensorType\n"); + err = TestReadsBackMandatoryAttributeOccupancySensorType_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6(); + break; + case 7: + ChipLogProgress( + chipTool, + " ***** Test Step 7 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); + err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, + this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, + this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, + this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, + this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_0(occupancy); + } + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_2(occupancy); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t occupancySensorType) + { + (static_cast(context))->OnSuccessResponse_3(occupancySensorType); + } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + } + + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t occupancySensorType) + { + (static_cast(context))->OnSuccessResponse_5(occupancySensorType); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_6(occupancySensorTypeBitmap); + } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + } + + static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_8(occupancySensorTypeBitmap); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_0() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t occupancy) + { + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); + NextTest(); + } + + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t occupancyArgument; + occupancyArgument = 0; + + return cluster.WriteAttribute( + occupancyArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_2() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint8_t occupancy) + { + VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_3() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t occupancySensorType) + { + VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); + NextTest(); + } + + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t occupancySensorTypeArgument; + occupancySensorTypeArgument = static_cast(0); + + return cluster.WriteAttribute( + occupancySensorTypeArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + } + + void OnFailureResponse_4(uint8_t status) { NextTest(); } + + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_5() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint8_t occupancySensorType) + { + VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t occupancySensorTypeBitmap) + { + VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); + NextTest(); + } + + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t occupancySensorTypeBitmapArgument; + occupancySensorTypeBitmapArgument = 1; + + return cluster.WriteAttribute( + occupancySensorTypeBitmapArgument, this, OnSuccessCallback_7, OnFailureCallback_7); + } + + void OnFailureResponse_7(uint8_t status) { NextTest(); } + + void OnSuccessResponse_7() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t occupancySensorTypeBitmap) + { + VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + NextTest(); + } +}; + +class Test_TC_OCC_2_2 : public TestCommand { public: - Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) {} + Test_TC_OCC_2_2() : TestCommand("Test_TC_OCC_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14362,12 +16408,12 @@ class Test_TC_MC_3_8 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14380,6 +16426,14 @@ class Test_TC_MC_3_8 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reads Occupancy attribute from DUT\n"); + err = TestReadsOccupancyAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Occupancy attribute from DUT\n"); + err = TestReadsOccupancyAttributeFromDut_1(); + break; } if (CHIP_NO_ERROR != err) @@ -14391,17 +16445,74 @@ class Test_TC_MC_3_8 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 2; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_0(occupancy); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_1(occupancy); + } // // Tests methods // + + CHIP_ERROR TestReadsOccupancyAttributeFromDut_0() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t occupancy) + { + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + NextTest(); + } + + CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t occupancy) + { + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + NextTest(); + } }; -class Test_TC_MC_3_9 : public TestCommand +class Test_TC_OO_1_1 : public TestCommand { public: - Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), mTestIndex(0) {} + Test_TC_OO_1_1() : TestCommand("Test_TC_OO_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14410,12 +16521,12 @@ class Test_TC_MC_3_9 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14428,6 +16539,31 @@ class Test_TC_MC_3_9 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_5(); + break; } if (CHIP_NO_ERROR != err) @@ -14439,17 +16575,176 @@ class Test_TC_MC_3_9 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 6; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_2(clusterRevision); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_3(featureMap); + } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + } + + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_5(featureMap); + } // // Tests methods // + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 3U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_3() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint32_t featureMapArgument; + featureMapArgument = 0UL; + + return cluster.WriteAttribute( + featureMapArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + } + + void OnFailureResponse_4(uint8_t status) { NextTest(); } + + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_5() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + NextTest(); + } }; -class Test_TC_MC_3_10 : public TestCommand +class Test_TC_OO_2_1 : public TestCommand { public: - Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), mTestIndex(0) {} + Test_TC_OO_2_1() : TestCommand("Test_TC_OO_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14458,12 +16753,12 @@ class Test_TC_MC_3_10 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14476,6 +16771,54 @@ class Test_TC_MC_3_10 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: OnOff\n"); + err = TestReadTheMandatoryAttributeOnOff_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : reads back mandatory attribute: OnOff\n"); + err = TestReadsBackMandatoryAttributeOnOff_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); + err = TestReadLtAttributeGlobalSceneControl_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); + err = TestReadLtAttributeOnTime_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); + err = TestReadLtAttributeOffWaitTime_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); + err = TestReadLtAttributeStartUpOnOff_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : write the default value to LT attribute: OnTime\n"); + err = TestWriteTheDefaultValueToLtAttributeOnTime_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : write the default value to LT attribute: OffWaitTime\n"); + err = TestWriteTheDefaultValueToLtAttributeOffWaitTime_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : write the default value to LT attribute: StartUpOnOff\n"); + err = TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads back LT attribute: OnTime\n"); + err = TestReadsBackLtAttributeOnTime_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : reads back LT attribute: OffWaitTime\n"); + err = TestReadsBackLtAttributeOffWaitTime_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : reads back LT attribute: StartUpOnOff\n"); + err = TestReadsBackLtAttributeStartUpOnOff_11(); + break; } if (CHIP_NO_ERROR != err) @@ -14487,174 +16830,339 @@ class Test_TC_MC_3_10 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 12; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_0(onOff); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_1(onOff); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, bool globalSceneControl) + { + (static_cast(context))->OnSuccessResponse_2(globalSceneControl); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_3(onTime); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_4(offWaitTime); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t startUpOnOff) + { + (static_cast(context))->OnSuccessResponse_5(startUpOnOff); + } + + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(chip::to_underlying(status)); + } + + static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + } + + static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + + static void OnFailureCallback_8(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_8(chip::to_underlying(status)); + } + + static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_9(onTime); + } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_10(offWaitTime); + } + + static void OnFailureCallback_11(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_11(status); + } + + static void OnSuccessCallback_11(void * context, uint8_t startUpOnOff) + { + (static_cast(context))->OnSuccessResponse_11(startUpOnOff); + } // // Tests methods // -}; -class Test_TC_MC_3_11 : public TestCommand -{ -public: - Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), mTestIndex(0) {} + CHIP_ERROR TestReadTheMandatoryAttributeOnOff_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsBackMandatoryAttributeOnOff_1() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } + + CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(bool globalSceneControl) + { + VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); + NextTest(); + } + + CHIP_ERROR TestReadLtAttributeOnTime_3() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadLtAttributeOffWaitTime_4() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); - } + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_4(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - // - // Tests methods - // -}; + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } -class Test_TC_OCC_1_1 : public TestCommand -{ -public: - Test_TC_OCC_1_1() : TestCommand("Test_TC_OCC_1_1"), mTestIndex(0) {} + void OnSuccessResponse_5(uint8_t startUpOnOff) + { + VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOnTime_6() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); - } + uint16_t onTimeArgument; + onTimeArgument = 0U; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.WriteAttribute( + onTimeArgument, this, OnSuccessCallback_6, OnFailureCallback_6); + } - Wait(); + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); - break; - } + void OnSuccessResponse_6() { NextTest(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOffWaitTime_7() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t offWaitTimeArgument; + offWaitTimeArgument = 0U; + + return cluster.WriteAttribute( + offWaitTimeArgument, this, OnSuccessCallback_7, OnFailureCallback_7); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + void OnSuccessResponse_7() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8() { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + uint8_t startUpOnOffArgument; + startUpOnOffArgument = static_cast(0); + + return cluster.WriteAttribute( + startUpOnOffArgument, this, OnSuccessCallback_8, OnFailureCallback_8); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR TestReadsBackLtAttributeOnTime_9() { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_9(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadsBackLtAttributeOffWaitTime_10() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) + void OnSuccessResponse_10(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestReadsBackLtAttributeStartUpOnOff_11() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 2U; - - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + void OnSuccessResponse_11(uint8_t startUpOnOff) + { + VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + NextTest(); + } }; -class Test_TC_OCC_2_1 : public TestCommand +class Test_TC_OO_2_2 : public TestCommand { public: - Test_TC_OCC_2_1() : TestCommand("Test_TC_OCC_2_1"), mTestIndex(0) {} + Test_TC_OO_2_2() : TestCommand("Test_TC_OO_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14663,12 +17171,12 @@ class Test_TC_OCC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14682,44 +17190,60 @@ class Test_TC_OCC_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reads mandatory attribute constrains: Occupancy\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancy_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Send Off Command\n"); + err = TestSendOffCommand_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Writes the respective default value to mandatory attribute: Occupancy\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back mandatory attribute: Occupancy\n"); - err = TestReadsBackMandatoryAttributeOccupancy_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Send On Command\n"); + err = TestSendOnCommand_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads mandatory attribute constrains: OccupancySensorType\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3(); break; case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Send Off Command\n"); + err = TestSendOffCommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads back mandatory attribute: OccupancySensorType\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorType_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Send Toggle Command\n"); + err = TestSendToggleCommand_6(); break; case 7: - ChipLogProgress( - chipTool, - " ***** Test Step 7 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Check on/off attribute value is true after toggle command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Send Toggle Command\n"); + err = TestSendToggleCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after toggle command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Send On Command\n"); + err = TestSendOnCommand_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Send Off Command\n"); + err = TestSendOffCommand_12(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8(); + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13(); break; } @@ -14732,376 +17256,382 @@ class Test_TC_OCC_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 14; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, - this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, - this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, - this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, - this }; - - static void OnFailureCallback_0(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; - static void OnSuccessCallback_0(void * context, uint8_t occupancy) + static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_0(occupancy); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_1(onOff); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_2(void * context, uint8_t occupancy) + static void OnSuccessCallback_3(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_2(occupancy); + (static_cast(context))->OnSuccessResponse_3(onOff); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_3(void * context, uint8_t occupancySensorType) + static void OnSuccessCallback_5(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_3(occupancySensorType); + (static_cast(context))->OnSuccessResponse_5(onOff); } - static void OnFailureCallback_4(void * context, EmberAfStatus status) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnSuccessCallback_7(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnSuccessResponse_7(onOff); } - static void OnSuccessCallback_5(void * context, uint8_t occupancySensorType) + static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_5(occupancySensorType); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnSuccessCallback_9(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnSuccessResponse_9(onOff); } - static void OnSuccessCallback_6(void * context, uint8_t occupancySensorTypeBitmap) + static void OnFailureCallback_11(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_6(occupancySensorTypeBitmap); + (static_cast(context))->OnFailureResponse_11(status); } - static void OnFailureCallback_7(void * context, EmberAfStatus status) + static void OnSuccessCallback_11(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_11(onOff); } - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_13(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_13(status); } - static void OnSuccessCallback_8(void * context, uint8_t occupancySensorTypeBitmap) + static void OnSuccessCallback_13(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_8(occupancySensorTypeBitmap); + (static_cast(context))->OnSuccessResponse_13(onOff); } // // Tests methods // - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_0() + CHIP_ERROR TestSendOffCommand_0() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint8_t occupancy) - { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); - NextTest(); - } + void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancyArgument; - occupancyArgument = 0; - - return cluster.WriteAttribute( - occupancyArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + void OnSuccessResponse_1(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_2() + CHIP_ERROR TestSendOnCommand_2() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t occupancy) - { - VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); - NextTest(); - } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_3() + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t occupancySensorType) + void OnSuccessResponse_3(bool onOff) { - VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4() + CHIP_ERROR TestSendOffCommand_4() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancySensorTypeArgument; - occupancySensorTypeArgument = static_cast(0); + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - occupancySensorTypeArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4() { ThrowSuccessResponse(); } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_5() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t occupancySensorType) + void OnSuccessResponse_5(bool onOff) { - VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6() + CHIP_ERROR TestSendToggleCommand_6() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Toggle::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint8_t occupancySensorTypeBitmap) + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7() { - VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7() + CHIP_ERROR TestSendToggleCommand_8() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancySensorTypeBitmapArgument; - occupancySensorTypeBitmapArgument = 1; + using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Toggle::Type request; - return cluster.WriteAttribute( - occupancySensorTypeBitmapArgument, this, OnSuccessCallback_7, OnFailureCallback_7); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { NextTest(); } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { ThrowSuccessResponse(); } + void OnSuccessResponse_8() { NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t occupancySensorTypeBitmap) + void OnSuccessResponse_9(bool onOff) { - VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } -}; - -class Test_TC_OCC_2_2 : public TestCommand -{ -public: - Test_TC_OCC_2_2() : TestCommand("Test_TC_OCC_2_2"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestSendOnCommand_10() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::OnOff::Commands::On::Type request; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reads Occupancy attribute from DUT\n"); - err = TestReadsOccupancyAttributeFromDut_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Occupancy attribute from DUT\n"); - err = TestReadsOccupancyAttributeFromDut_1(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + void OnSuccessResponse_10() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11() { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_0(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_0(occupancy); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); - } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_1(void * context, uint8_t occupancy) + void OnSuccessResponse_11(bool onOff) { - (static_cast(context))->OnSuccessResponse_1(occupancy); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestReadsOccupancyAttributeFromDut_0() + CHIP_ERROR TestSendOffCommand_12() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + chip::app::Clusters::OnOff::Commands::Off::Type request; - void OnSuccessResponse_0(uint8_t occupancy) - { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - NextTest(); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_12(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_12(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_12() { NextTest(); } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t occupancy) + void OnSuccessResponse_13(bool onOff) { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } }; -class Test_TC_OO_1_1 : public TestCommand +class Test_TC_OO_2_3 : public TestCommand { public: - Test_TC_OO_1_1() : TestCommand("Test_TC_OO_1_1"), mTestIndex(0) {} + Test_TC_OO_2_3() : TestCommand("Test_TC_OO_2_3"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -15110,12 +17640,12 @@ class Test_TC_OO_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -15129,29 +17659,188 @@ class Test_TC_OO_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Send On Command\n"); + err = TestSendOnCommand_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Wait 1000ms\n"); + err = TestWait1000ms_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads GlobalSceneControl attribute from DUT\n"); + err = TestReadsGlobalSceneControlAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Send On Command\n"); + err = TestSendOnCommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 1000ms\n"); + err = TestWait1000ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads GlobalSceneControl attribute from DUT\n"); + err = TestReadsGlobalSceneControlAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Send On Command\n"); + err = TestSendOnCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 1000ms\n"); + err = TestWait1000ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads GlobalSceneControl attribute from DUT\n"); + err = TestReadsGlobalSceneControlAttributeFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Send On Command\n"); + err = TestSendOnCommand_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Send Off Command\n"); + err = TestSendOffCommand_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Send On Command\n"); + err = TestSendOnCommand_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Send Off Command\n"); + err = TestSendOffCommand_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Send On Command\n"); + err = TestSendOnCommand_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Send Off Command\n"); + err = TestSendOffCommand_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_38(); + break; + case 39: + ChipLogProgress(chipTool, " ***** Test Step 39 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Send Off Command\n"); + err = TestSendOffCommand_45(); break; } @@ -15164,859 +17853,1008 @@ class Test_TC_OO_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 46; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; + chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, this }; + chip::Callback::Callback mOnFailureCallback_16{ OnFailureCallback_16, this }; + chip::Callback::Callback mOnSuccessCallback_16{ OnSuccessCallback_16, this }; + chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; + chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; + chip::Callback::Callback mOnFailureCallback_19{ OnFailureCallback_19, this }; + chip::Callback::Callback mOnSuccessCallback_19{ OnSuccessCallback_19, this }; + chip::Callback::Callback mOnFailureCallback_20{ OnFailureCallback_20, this }; + chip::Callback::Callback mOnSuccessCallback_20{ OnSuccessCallback_20, this }; + chip::Callback::Callback mOnFailureCallback_21{ OnFailureCallback_21, this }; + chip::Callback::Callback mOnSuccessCallback_21{ OnSuccessCallback_21, this }; + chip::Callback::Callback mOnFailureCallback_22{ OnFailureCallback_22, this }; + chip::Callback::Callback mOnSuccessCallback_22{ OnSuccessCallback_22, this }; + chip::Callback::Callback mOnFailureCallback_23{ OnFailureCallback_23, this }; + chip::Callback::Callback mOnSuccessCallback_23{ OnSuccessCallback_23, this }; + chip::Callback::Callback mOnFailureCallback_25{ OnFailureCallback_25, this }; + chip::Callback::Callback mOnSuccessCallback_25{ OnSuccessCallback_25, this }; + chip::Callback::Callback mOnFailureCallback_26{ OnFailureCallback_26, this }; + chip::Callback::Callback mOnSuccessCallback_26{ OnSuccessCallback_26, this }; + chip::Callback::Callback mOnFailureCallback_28{ OnFailureCallback_28, this }; + chip::Callback::Callback mOnSuccessCallback_28{ OnSuccessCallback_28, this }; + chip::Callback::Callback mOnFailureCallback_29{ OnFailureCallback_29, this }; + chip::Callback::Callback mOnSuccessCallback_29{ OnSuccessCallback_29, this }; + chip::Callback::Callback mOnFailureCallback_30{ OnFailureCallback_30, this }; + chip::Callback::Callback mOnSuccessCallback_30{ OnSuccessCallback_30, this }; + chip::Callback::Callback mOnFailureCallback_31{ OnFailureCallback_31, this }; + chip::Callback::Callback mOnSuccessCallback_31{ OnSuccessCallback_31, this }; + chip::Callback::Callback mOnFailureCallback_33{ OnFailureCallback_33, this }; + chip::Callback::Callback mOnSuccessCallback_33{ OnSuccessCallback_33, this }; + chip::Callback::Callback mOnFailureCallback_34{ OnFailureCallback_34, this }; + chip::Callback::Callback mOnSuccessCallback_34{ OnSuccessCallback_34, this }; + chip::Callback::Callback mOnFailureCallback_35{ OnFailureCallback_35, this }; + chip::Callback::Callback mOnSuccessCallback_35{ OnSuccessCallback_35, this }; + chip::Callback::Callback mOnFailureCallback_37{ OnFailureCallback_37, this }; + chip::Callback::Callback mOnSuccessCallback_37{ OnSuccessCallback_37, this }; + chip::Callback::Callback mOnFailureCallback_38{ OnFailureCallback_38, this }; + chip::Callback::Callback mOnSuccessCallback_38{ OnSuccessCallback_38, this }; + chip::Callback::Callback mOnFailureCallback_39{ OnFailureCallback_39, this }; + chip::Callback::Callback mOnSuccessCallback_39{ OnSuccessCallback_39, this }; + chip::Callback::Callback mOnFailureCallback_40{ OnFailureCallback_40, this }; + chip::Callback::Callback mOnSuccessCallback_40{ OnSuccessCallback_40, this }; + chip::Callback::Callback mOnFailureCallback_41{ OnFailureCallback_41, this }; + chip::Callback::Callback mOnSuccessCallback_41{ OnSuccessCallback_41, this }; + chip::Callback::Callback mOnFailureCallback_42{ OnFailureCallback_42, this }; + chip::Callback::Callback mOnSuccessCallback_42{ OnSuccessCallback_42, this }; + chip::Callback::Callback mOnFailureCallback_43{ OnFailureCallback_43, this }; + chip::Callback::Callback mOnSuccessCallback_43{ OnSuccessCallback_43, this }; + chip::Callback::Callback mOnFailureCallback_44{ OnFailureCallback_44, this }; + chip::Callback::Callback mOnSuccessCallback_44{ OnSuccessCallback_44, this }; - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_2(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_2(onOff); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnSuccessCallback_3(void * context, bool globalSceneControl) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnSuccessResponse_3(globalSceneControl); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnSuccessCallback_6(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnSuccessResponse_6(onOff); } - static void OnSuccessCallback_3(void * context, uint32_t featureMap) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_3(featureMap); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnFailureCallback_4(void * context, EmberAfStatus status) + static void OnSuccessCallback_7(void * context, bool globalSceneControl) { - (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_7(globalSceneControl); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_5(void * context, uint32_t featureMap) + static void OnSuccessCallback_10(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_5(featureMap); + (static_cast(context))->OnSuccessResponse_10(onOff); } - // - // Tests methods - // - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + static void OnFailureCallback_11(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnFailureResponse_11(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint16_t clusterRevision) + static void OnSuccessCallback_11(void * context, bool globalSceneControl) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); - NextTest(); + (static_cast(context))->OnSuccessResponse_11(globalSceneControl); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + static void OnFailureCallback_12(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_12(status); + } - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 3U; + static void OnSuccessCallback_12(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_12(onTime); + } - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + static void OnSuccessCallback_13(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_13(offWaitTime); + } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + static void OnFailureCallback_15(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_15(status); + } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + static void OnSuccessCallback_15(void * context, bool onOff) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_15(onOff); + } - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + static void OnFailureCallback_16(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_16(status); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_16(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_16(onTime); + } - void OnSuccessResponse_2(uint16_t clusterRevision) + static void OnFailureCallback_17(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); - NextTest(); + (static_cast(context))->OnFailureResponse_17(status); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_3() + static void OnSuccessCallback_17(void * context, uint16_t offWaitTime) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_17(offWaitTime); + } - return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + static void OnFailureCallback_19(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_19(status); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_19(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_19(onOff); + } - void OnSuccessResponse_3(uint32_t featureMap) + static void OnFailureCallback_20(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); - NextTest(); + (static_cast(context))->OnFailureResponse_20(status); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4() + static void OnSuccessCallback_20(void * context, uint16_t onTime) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_20(onTime); + } - uint32_t featureMapArgument; - featureMapArgument = 0UL; + static void OnFailureCallback_21(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_21(status); + } - return cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + static void OnSuccessCallback_21(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_21(onOff); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + static void OnFailureCallback_22(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_22(status); + } - void OnSuccessResponse_4() { ThrowSuccessResponse(); } + static void OnSuccessCallback_22(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_22(onTime); + } - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_5() + static void OnFailureCallback_23(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_23(status); + } - return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + static void OnSuccessCallback_23(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_23(offWaitTime); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_25(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_25(status); + } - void OnSuccessResponse_5(uint32_t featureMap) + static void OnSuccessCallback_25(void * context, uint16_t onTime) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); - NextTest(); + (static_cast(context))->OnSuccessResponse_25(onTime); } -}; -class Test_TC_OO_2_1 : public TestCommand -{ -public: - Test_TC_OO_2_1() : TestCommand("Test_TC_OO_2_1"), mTestIndex(0) {} + static void OnFailureCallback_26(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_26(status); + } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_26(void * context, uint16_t offWaitTime) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_26(offWaitTime); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); - } + static void OnFailureCallback_28(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_28(status); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnSuccessCallback_28(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_28(onOff); + } - Wait(); + static void OnFailureCallback_29(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_29(status); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: OnOff\n"); - err = TestReadTheMandatoryAttributeOnOff_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads back mandatory attribute: OnOff\n"); - err = TestReadsBackMandatoryAttributeOnOff_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); - err = TestReadLtAttributeGlobalSceneControl_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); - err = TestReadLtAttributeOnTime_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); - err = TestReadLtAttributeOffWaitTime_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); - err = TestReadLtAttributeStartUpOnOff_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : write the default value to LT attribute: OnTime\n"); - err = TestWriteTheDefaultValueToLtAttributeOnTime_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : write the default value to LT attribute: OffWaitTime\n"); - err = TestWriteTheDefaultValueToLtAttributeOffWaitTime_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write the default value to LT attribute: StartUpOnOff\n"); - err = TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads back LT attribute: OnTime\n"); - err = TestReadsBackLtAttributeOnTime_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads back LT attribute: OffWaitTime\n"); - err = TestReadsBackLtAttributeOffWaitTime_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads back LT attribute: StartUpOnOff\n"); - err = TestReadsBackLtAttributeStartUpOnOff_11(); - break; - } + static void OnSuccessCallback_29(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_29(onTime); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnFailureCallback_30(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_30(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + static void OnSuccessCallback_30(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_30(onOff); + } - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_31(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_31(status); } - static void OnSuccessCallback_0(void * context, bool onOff) + static void OnSuccessCallback_31(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_0(onOff); + (static_cast(context))->OnSuccessResponse_31(onTime); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_33(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_33(status); } - static void OnSuccessCallback_1(void * context, bool onOff) + static void OnSuccessCallback_33(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_1(onOff); + (static_cast(context))->OnSuccessResponse_33(onOff); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_34(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_34(status); } - static void OnSuccessCallback_2(void * context, bool globalSceneControl) + static void OnSuccessCallback_34(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_2(globalSceneControl); + (static_cast(context))->OnSuccessResponse_34(onTime); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_35(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_35(status); } - static void OnSuccessCallback_3(void * context, uint16_t onTime) + static void OnSuccessCallback_35(void * context, uint16_t offWaitTime) { - (static_cast(context))->OnSuccessResponse_3(onTime); + (static_cast(context))->OnSuccessResponse_35(offWaitTime); } - static void OnFailureCallback_4(void * context, uint8_t status) + static void OnFailureCallback_37(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_37(status); } - static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) + static void OnSuccessCallback_37(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_4(offWaitTime); + (static_cast(context))->OnSuccessResponse_37(onOff); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_38(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_38(status); } - static void OnSuccessCallback_5(void * context, uint8_t startUpOnOff) + static void OnSuccessCallback_38(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_5(startUpOnOff); + (static_cast(context))->OnSuccessResponse_38(onTime); } - static void OnFailureCallback_6(void * context, EmberAfStatus status) + static void OnFailureCallback_39(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_39(status); } - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } + static void OnSuccessCallback_39(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_39(onOff); + } - static void OnFailureCallback_7(void * context, EmberAfStatus status) + static void OnFailureCallback_40(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_40(status); } - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + static void OnSuccessCallback_40(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_40(onTime); + } - static void OnFailureCallback_8(void * context, EmberAfStatus status) + static void OnFailureCallback_41(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_41(status); } - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } + static void OnSuccessCallback_41(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_41(offWaitTime); + } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_42(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_42(status); } - static void OnSuccessCallback_9(void * context, uint16_t onTime) + static void OnSuccessCallback_42(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_9(onTime); + (static_cast(context))->OnSuccessResponse_42(onOff); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_43(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_43(status); } - static void OnSuccessCallback_10(void * context, uint16_t offWaitTime) + static void OnSuccessCallback_43(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_10(offWaitTime); + (static_cast(context))->OnSuccessResponse_43(onTime); } - static void OnFailureCallback_11(void * context, uint8_t status) + static void OnFailureCallback_44(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_44(status); } - static void OnSuccessCallback_11(void * context, uint8_t startUpOnOff) + static void OnSuccessCallback_44(void * context, uint16_t offWaitTime) { - (static_cast(context))->OnSuccessResponse_11(startUpOnOff); + (static_cast(context))->OnSuccessResponse_44(offWaitTime); } // // Tests methods // - CHIP_ERROR TestReadTheMandatoryAttributeOnOff_0() + CHIP_ERROR TestSendOnCommand_0() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(bool onOff) + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestWait1000ms_1() { return WaitForMs(1000); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_2() { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOnOff_1() + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_3() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_3(bool globalSceneControl) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); NextTest(); } - CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() + CHIP_ERROR TestSendOnCommand_4() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(bool globalSceneControl) + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWait1000ms_5() { return WaitForMs(1000); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_6() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); + } + + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_7() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(bool globalSceneControl) + { + VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); + NextTest(); + } + + CHIP_ERROR TestSendOnCommand_8() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR TestWait1000ms_9() { return WaitForMs(1000); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_10() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); + } + + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_11() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11(bool globalSceneControl) { VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); NextTest(); } - CHIP_ERROR TestReadLtAttributeOnTime_3() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_12() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + } + + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_12(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } + + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_13() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } + + CHIP_ERROR TestSendOnCommand_14() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_14(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_14(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_14() { NextTest(); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_15() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnTime(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_15(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint16_t onTime) + void OnSuccessResponse_15(bool onOff) { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestReadLtAttributeOffWaitTime_4() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_16() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_16(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t offWaitTime) + void OnSuccessResponse_16(uint16_t onTime) { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); NextTest(); } - CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_17() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_17(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t startUpOnOff) + void OnSuccessResponse_17(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOnTime_6() + CHIP_ERROR TestSendOffCommand_18() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t onTimeArgument; - onTimeArgument = 0U; + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - onTimeArgument, this, OnSuccessCallback_6, OnFailureCallback_6); + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_18(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_18(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_18(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_18() { NextTest(); } - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOffWaitTime_7() + CHIP_ERROR TestReadsOnOffAttributeFromDut_19() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t offWaitTimeArgument; - offWaitTimeArgument = 0U; - - return cluster.WriteAttribute( - offWaitTimeArgument, this, OnSuccessCallback_7, OnFailureCallback_7); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_19.Cancel(), mOnFailureCallback_19.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_19(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_19(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_20() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t startUpOnOffArgument; - startUpOnOffArgument = static_cast(0); - - return cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_8, OnFailureCallback_8); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_20.Cancel(), mOnFailureCallback_20.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_20(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8() { NextTest(); } + void OnSuccessResponse_20(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestReadsBackLtAttributeOnTime_9() + CHIP_ERROR TestReadsOnOffAttributeFromDut_21() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnTime(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_21.Cancel(), mOnFailureCallback_21.Cancel()); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_21(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint16_t onTime) + void OnSuccessResponse_21(bool onOff) { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestReadsBackLtAttributeOffWaitTime_10() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_22() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_22.Cancel(), mOnFailureCallback_22.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_22(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint16_t offWaitTime) + void OnSuccessResponse_22(uint16_t onTime) { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); NextTest(); } - CHIP_ERROR TestReadsBackLtAttributeStartUpOnOff_11() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_23() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_23.Cancel(), mOnFailureCallback_23.Cancel()); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_23(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(uint8_t startUpOnOff) + void OnSuccessResponse_23(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } -}; - -class Test_TC_OO_2_2 : public TestCommand -{ -public: - Test_TC_OO_2_2() : TestCommand("Test_TC_OO_2_2"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestSendOnCommand_24() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::OnOff::Commands::On::Type request; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Send Off Command\n"); - err = TestSendOffCommand_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Send On Command\n"); - err = TestSendOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Send Off Command\n"); - err = TestSendOffCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Send Toggle Command\n"); - err = TestSendToggleCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Check on/off attribute value is true after toggle command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Send Toggle Command\n"); - err = TestSendToggleCommand_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after toggle command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Send On Command\n"); - err = TestSendOnCommand_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Send Off Command\n"); - err = TestSendOffCommand_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_24(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_24(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + void OnFailureResponse_24(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + void OnSuccessResponse_24() { NextTest(); } - static void OnFailureCallback_1(void * context, uint8_t status) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_25() { - (static_cast(context))->OnFailureResponse_1(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_1(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_1(onOff); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_25.Cancel(), mOnFailureCallback_25.Cancel()); } - static void OnFailureCallback_3(void * context, uint8_t status) + void OnFailureResponse_25(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_25(uint16_t onTime) { - (static_cast(context))->OnFailureResponse_3(status); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); } - static void OnSuccessCallback_3(void * context, bool onOff) + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_26() { - (static_cast(context))->OnSuccessResponse_3(onOff); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_26.Cancel(), mOnFailureCallback_26.Cancel()); } - static void OnFailureCallback_5(void * context, uint8_t status) + void OnFailureResponse_26(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_26(uint16_t offWaitTime) { - (static_cast(context))->OnFailureResponse_5(status); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); } - static void OnSuccessCallback_5(void * context, bool onOff) + CHIP_ERROR TestSendOffCommand_27() { - (static_cast(context))->OnSuccessResponse_5(onOff); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_27(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_27(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnFailureCallback_7(void * context, uint8_t status) + void OnFailureResponse_27(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_27() { NextTest(); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_28() { - (static_cast(context))->OnFailureResponse_7(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_28.Cancel(), mOnFailureCallback_28.Cancel()); } - static void OnSuccessCallback_7(void * context, bool onOff) + void OnFailureResponse_28(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_28(bool onOff) { - (static_cast(context))->OnSuccessResponse_7(onOff); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); } - static void OnFailureCallback_9(void * context, uint8_t status) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_29() { - (static_cast(context))->OnFailureResponse_9(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_29.Cancel(), mOnFailureCallback_29.Cancel()); } - static void OnSuccessCallback_9(void * context, bool onOff) + void OnFailureResponse_29(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_29(uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_9(onOff); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); } - static void OnFailureCallback_11(void * context, uint8_t status) + CHIP_ERROR TestReadsOnOffAttributeFromDut_30() { - (static_cast(context))->OnFailureResponse_11(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_30.Cancel(), mOnFailureCallback_30.Cancel()); } - static void OnSuccessCallback_11(void * context, bool onOff) + void OnFailureResponse_30(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_30(bool onOff) { - (static_cast(context))->OnSuccessResponse_11(onOff); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); } - static void OnFailureCallback_13(void * context, uint8_t status) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_31() { - (static_cast(context))->OnFailureResponse_13(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_31.Cancel(), mOnFailureCallback_31.Cancel()); } - static void OnSuccessCallback_13(void * context, bool onOff) + void OnFailureResponse_31(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_31(uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_13(onOff); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestSendOffCommand_0() + CHIP_ERROR TestSendOnCommand_32() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; using responseType = chip::app::DataModel::NullObjectType; - chip::app::Clusters::OnOff::Commands::Off::Type request; + chip::app::Clusters::OnOff::Commands::On::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_32(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_32(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_32(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } + void OnSuccessResponse_32() { NextTest(); } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1() + CHIP_ERROR TestReadsOnOffAttributeFromDut_33() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_33.Cancel(), mOnFailureCallback_33.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_33(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_33(bool onOff) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestSendOnCommand_2() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_34() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::On::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_34.Cancel(), mOnFailureCallback_34.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_34(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2() { NextTest(); } + void OnSuccessResponse_34(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_35() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_35.Cancel(), mOnFailureCallback_35.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_35(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(bool onOff) + void OnSuccessResponse_35(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestSendOffCommand_4() + CHIP_ERROR TestSendOffCommand_36() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -16027,156 +18865,148 @@ class Test_TC_OO_2_2 : public TestCommand chip::app::Clusters::OnOff::Commands::Off::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); + (static_cast(context))->OnSuccessResponse_36(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_36(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_36(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4() { NextTest(); } + void OnSuccessResponse_36() { NextTest(); } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR TestReadsOnOffAttributeFromDut_37() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_37.Cancel(), mOnFailureCallback_37.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_37(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(bool onOff) + void OnSuccessResponse_37(bool onOff) { VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestSendToggleCommand_6() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_38() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::Toggle::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_38.Cancel(), mOnFailureCallback_38.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_38(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_38(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7() + CHIP_ERROR TestReadsOnOffAttributeFromDut_39() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_39.Cancel(), mOnFailureCallback_39.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_39(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(bool onOff) + void OnSuccessResponse_39(bool onOff) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestSendToggleCommand_8() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_40() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - using responseType = chip::app::DataModel::NullObjectType; + return cluster.ReadAttributeOnTime(mOnSuccessCallback_40.Cancel(), mOnFailureCallback_40.Cancel()); + } - chip::app::Clusters::OnOff::Commands::Toggle::Type request; + void OnFailureResponse_40(uint8_t status) { ThrowFailureResponse(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; + void OnSuccessResponse_40(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_41() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_41.Cancel(), mOnFailureCallback_41.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_41(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8() { NextTest(); } + void OnSuccessResponse_41(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9() + CHIP_ERROR TestReadsOnOffAttributeFromDut_42() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_42.Cancel(), mOnFailureCallback_42.Cancel()); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_42(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(bool onOff) + void OnSuccessResponse_42(bool onOff) { VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestSendOnCommand_10() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_43() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::On::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_43.Cancel(), mOnFailureCallback_43.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_43(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10() { NextTest(); } + void OnSuccessResponse_43(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_44() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_44.Cancel(), mOnFailureCallback_44.Cancel()); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_44(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(bool onOff) + void OnSuccessResponse_44(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestSendOffCommand_12() + CHIP_ERROR TestSendOffCommand_45() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -16187,34 +19017,18 @@ class Test_TC_OO_2_2 : public TestCommand chip::app::Clusters::OnOff::Commands::Off::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_12(); + (static_cast(context))->OnSuccessResponse_45(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_12(status); + (static_cast(context))->OnFailureResponse_45(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeOnOff(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); - } - - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_45(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - NextTest(); - } + void OnSuccessResponse_45() { NextTest(); } }; class Test_TC_PRS_1_1 : public TestCommand @@ -19727,6 +22541,54 @@ class Test_TC_WNCV_2_1 : public TestCommand } }; +class Test_TC_WNCV_2_2 : public TestCommand +{ +public: + Test_TC_WNCV_2_2() : TestCommand("Test_TC_WNCV_2_2"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + class Test_TC_WNCV_2_5 : public TestCommand { public: @@ -20341,7 +23203,14 @@ class TV_TargetNavigatorCluster : public TestCommand const chip::app::DataModel::DecodableList< chip::app::Clusters::TargetNavigator::Structs::NavigateTargetTargetInfo::DecodableType> & targetNavigatorList) { - VerifyOrReturn(CheckValueAsListLength("targetNavigatorList", targetNavigatorList, 2)); + auto iter = targetNavigatorList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("targetNavigatorList", iter, 0)); + VerifyOrReturn(CheckValue<>("targetNavigatorList[0].identifier", iter.GetValue().identifier, 1)); + VerifyOrReturn(CheckValueAsString("targetNavigatorList[0].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckNextListItemDecodes("targetNavigatorList", iter, 1)); + VerifyOrReturn(CheckValue<>("targetNavigatorList[1].identifier", iter.GetValue().identifier, 2)); + VerifyOrReturn(CheckValueAsString("targetNavigatorList[1].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckNoMoreListItems("targetNavigatorList", iter, 2)); NextTest(); } @@ -20465,7 +23334,20 @@ class TV_AudioOutputCluster : public TestCommand const chip::app::DataModel::DecodableList & audioOutputList) { - VerifyOrReturn(CheckValueAsListLength("audioOutputList", audioOutputList, 3)); + auto iter = audioOutputList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("audioOutputList", iter, 0)); + VerifyOrReturn(CheckValue<>("audioOutputList[0].index", iter.GetValue().index, 1)); + VerifyOrReturn(CheckValue<>("audioOutputList[0].outputType", iter.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("audioOutputList[0].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckNextListItemDecodes("audioOutputList", iter, 1)); + VerifyOrReturn(CheckValue<>("audioOutputList[1].index", iter.GetValue().index, 2)); + VerifyOrReturn(CheckValue<>("audioOutputList[1].outputType", iter.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("audioOutputList[1].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckNextListItemDecodes("audioOutputList", iter, 2)); + VerifyOrReturn(CheckValue<>("audioOutputList[2].index", iter.GetValue().index, 3)); + VerifyOrReturn(CheckValue<>("audioOutputList[2].outputType", iter.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("audioOutputList[2].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckNoMoreListItems("audioOutputList", iter, 3)); NextTest(); } @@ -20635,7 +23517,12 @@ class TV_ApplicationLauncherCluster : public TestCommand void OnSuccessResponse_0(const chip::app::DataModel::DecodableList & applicationLauncherList) { - VerifyOrReturn(CheckValueAsListLength("applicationLauncherList", applicationLauncherList, 2)); + auto iter = applicationLauncherList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("applicationLauncherList", iter, 0)); + VerifyOrReturn(CheckValue("applicationLauncherList[0]", iter.GetValue(), 123U)); + VerifyOrReturn(CheckNextListItemDecodes("applicationLauncherList", iter, 1)); + VerifyOrReturn(CheckValue("applicationLauncherList[1]", iter.GetValue(), 456U)); + VerifyOrReturn(CheckNoMoreListItems("applicationLauncherList", iter, 2)); NextTest(); } @@ -21639,7 +24526,20 @@ class TV_TvChannelCluster : public TestCommand const chip::app::DataModel::DecodableList & tvChannelList) { - VerifyOrReturn(CheckValueAsListLength("tvChannelList", tvChannelList, 2)); + auto iter = tvChannelList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("tvChannelList", iter, 0)); + VerifyOrReturn(CheckValue<>("tvChannelList[0].majorNumber", iter.GetValue().majorNumber, 1U)); + VerifyOrReturn(CheckValue<>("tvChannelList[0].minorNumber", iter.GetValue().minorNumber, 2U)); + VerifyOrReturn(CheckValueAsString("tvChannelList[0].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckValueAsString("tvChannelList[0].callSign", iter.GetValue().callSign, "exampleCSign")); + VerifyOrReturn(CheckValueAsString("tvChannelList[0].affiliateCallSign", iter.GetValue().affiliateCallSign, "exampleASign")); + VerifyOrReturn(CheckNextListItemDecodes("tvChannelList", iter, 1)); + VerifyOrReturn(CheckValue<>("tvChannelList[1].majorNumber", iter.GetValue().majorNumber, 2U)); + VerifyOrReturn(CheckValue<>("tvChannelList[1].minorNumber", iter.GetValue().minorNumber, 3U)); + VerifyOrReturn(CheckValueAsString("tvChannelList[1].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckValueAsString("tvChannelList[1].callSign", iter.GetValue().callSign, "exampleCSign")); + VerifyOrReturn(CheckValueAsString("tvChannelList[1].affiliateCallSign", iter.GetValue().affiliateCallSign, "exampleASign")); + VerifyOrReturn(CheckNoMoreListItems("tvChannelList", iter, 2)); NextTest(); } @@ -21888,7 +24788,18 @@ class TV_MediaInputCluster : public TestCommand const chip::app::DataModel::DecodableList & mediaInputList) { - VerifyOrReturn(CheckValueAsListLength("mediaInputList", mediaInputList, 2)); + auto iter = mediaInputList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("mediaInputList", iter, 0)); + VerifyOrReturn(CheckValue<>("mediaInputList[0].index", iter.GetValue().index, 1)); + VerifyOrReturn(CheckValue<>("mediaInputList[0].inputType", iter.GetValue().inputType, 4)); + VerifyOrReturn(CheckValueAsString("mediaInputList[0].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckValueAsString("mediaInputList[0].description", iter.GetValue().description, "exampleDescription")); + VerifyOrReturn(CheckNextListItemDecodes("mediaInputList", iter, 1)); + VerifyOrReturn(CheckValue<>("mediaInputList[1].index", iter.GetValue().index, 2)); + VerifyOrReturn(CheckValue<>("mediaInputList[1].inputType", iter.GetValue().inputType, 4)); + VerifyOrReturn(CheckValueAsString("mediaInputList[1].name", iter.GetValue().name, "exampleName")); + VerifyOrReturn(CheckValueAsString("mediaInputList[1].description", iter.GetValue().description, "exampleDescription")); + VerifyOrReturn(CheckNoMoreListItems("mediaInputList", iter, 2)); NextTest(); } @@ -25550,7 +28461,16 @@ class TestCluster : public TestCommand void OnSuccessResponse_106(const chip::app::DataModel::DecodableList & listInt8u) { - VerifyOrReturn(CheckValueAsListLength("listInt8u", listInt8u, 4)); + auto iter = listInt8u.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter, 0)); + VerifyOrReturn(CheckValue("listInt8u[0]", iter.GetValue(), 1)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter, 1)); + VerifyOrReturn(CheckValue("listInt8u[1]", iter.GetValue(), 2)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter, 2)); + VerifyOrReturn(CheckValue("listInt8u[2]", iter.GetValue(), 3)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter, 3)); + VerifyOrReturn(CheckValue("listInt8u[3]", iter.GetValue(), 4)); + VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter, 4)); NextTest(); } @@ -25566,7 +28486,16 @@ class TestCluster : public TestCommand void OnSuccessResponse_107(const chip::app::DataModel::DecodableList & listOctetString) { - VerifyOrReturn(CheckValueAsListLength("listOctetString", listOctetString, 4)); + auto iter = listOctetString.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter, 0)); + VerifyOrReturn(CheckValueAsString("listOctetString[0]", iter.GetValue(), "Test0")); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter, 1)); + VerifyOrReturn(CheckValueAsString("listOctetString[1]", iter.GetValue(), "Test1")); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter, 2)); + VerifyOrReturn(CheckValueAsString("listOctetString[2]", iter.GetValue(), "Test2")); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter, 3)); + VerifyOrReturn(CheckValueAsString("listOctetString[3]", iter.GetValue(), "Test3")); + VerifyOrReturn(CheckNoMoreListItems("listOctetString", iter, 4)); NextTest(); } @@ -25584,7 +28513,20 @@ class TestCluster : public TestCommand const chip::app::DataModel::DecodableList & listStructOctetString) { - VerifyOrReturn(CheckValueAsListLength("listStructOctetString", listStructOctetString, 4)); + auto iter = listStructOctetString.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter, 0)); + VerifyOrReturn(CheckValue<>("listStructOctetString[0].fabricIndex", iter.GetValue().fabricIndex, 0ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[0].operationalCert", iter.GetValue().operationalCert, "Test0")); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter, 1)); + VerifyOrReturn(CheckValue<>("listStructOctetString[1].fabricIndex", iter.GetValue().fabricIndex, 1ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[1].operationalCert", iter.GetValue().operationalCert, "Test1")); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter, 2)); + VerifyOrReturn(CheckValue<>("listStructOctetString[2].fabricIndex", iter.GetValue().fabricIndex, 2ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[2].operationalCert", iter.GetValue().operationalCert, "Test2")); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter, 3)); + VerifyOrReturn(CheckValue<>("listStructOctetString[3].fabricIndex", iter.GetValue().fabricIndex, 3ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[3].operationalCert", iter.GetValue().operationalCert, "Test3")); + VerifyOrReturn(CheckNoMoreListItems("listStructOctetString", iter, 4)); NextTest(); } @@ -26189,7 +29131,26 @@ class TestClusterComplexTypes : public TestCommand void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & arg1) { - VerifyOrReturn(CheckValueAsList("arg1", arg1, 9, 8, 7, 6, 5, 4, 3, 2, 1)); + auto iter = arg1.begin(); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 0)); + VerifyOrReturn(CheckValue("arg1[0]", iter.GetValue(), 9)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 1)); + VerifyOrReturn(CheckValue("arg1[1]", iter.GetValue(), 8)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 2)); + VerifyOrReturn(CheckValue("arg1[2]", iter.GetValue(), 7)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 3)); + VerifyOrReturn(CheckValue("arg1[3]", iter.GetValue(), 6)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 4)); + VerifyOrReturn(CheckValue("arg1[4]", iter.GetValue(), 5)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 5)); + VerifyOrReturn(CheckValue("arg1[5]", iter.GetValue(), 4)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 6)); + VerifyOrReturn(CheckValue("arg1[6]", iter.GetValue(), 3)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 7)); + VerifyOrReturn(CheckValue("arg1[7]", iter.GetValue(), 2)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter, 8)); + VerifyOrReturn(CheckValue("arg1[8]", iter.GetValue(), 1)); + VerifyOrReturn(CheckNoMoreListItems("arg1", iter, 9)); NextTest(); } @@ -26219,7 +29180,8 @@ class TestClusterComplexTypes : public TestCommand void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & arg1) { - VerifyOrReturn(CheckValueAsList("arg1", arg1)); + auto iter = arg1.begin(); + VerifyOrReturn(CheckNoMoreListItems("arg1", iter, 0)); NextTest(); } @@ -26838,7 +29800,10 @@ class TestDescriptorCluster : public TestCommand void OnSuccessResponse_0( const chip::app::DataModel::DecodableList & deviceList) { - VerifyOrReturn(CheckValueAsListLength("deviceList", deviceList, 1)); + auto iter = deviceList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("deviceList", iter, 0)); + VerifyOrReturn(CheckValue<>("deviceList[0].revision", iter.GetValue().revision, 1U)); + VerifyOrReturn(CheckNoMoreListItems("deviceList", iter, 1)); NextTest(); } @@ -26854,7 +29819,44 @@ class TestDescriptorCluster : public TestCommand void OnSuccessResponse_1(const chip::app::DataModel::DecodableList & serverList) { - VerifyOrReturn(CheckValueAsListLength("serverList", serverList, 18)); + auto iter = serverList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 0)); + VerifyOrReturn(CheckValue("serverList[0]", iter.GetValue(), 3UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 1)); + VerifyOrReturn(CheckValue("serverList[1]", iter.GetValue(), 29UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 2)); + VerifyOrReturn(CheckValue("serverList[2]", iter.GetValue(), 40UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 3)); + VerifyOrReturn(CheckValue("serverList[3]", iter.GetValue(), 41UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 4)); + VerifyOrReturn(CheckValue("serverList[4]", iter.GetValue(), 42UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 5)); + VerifyOrReturn(CheckValue("serverList[5]", iter.GetValue(), 48UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 6)); + VerifyOrReturn(CheckValue("serverList[6]", iter.GetValue(), 49UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 7)); + VerifyOrReturn(CheckValue("serverList[7]", iter.GetValue(), 50UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 8)); + VerifyOrReturn(CheckValue("serverList[8]", iter.GetValue(), 51UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 9)); + VerifyOrReturn(CheckValue("serverList[9]", iter.GetValue(), 52UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 10)); + VerifyOrReturn(CheckValue("serverList[10]", iter.GetValue(), 53UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 11)); + VerifyOrReturn(CheckValue("serverList[11]", iter.GetValue(), 54UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 12)); + VerifyOrReturn(CheckValue("serverList[12]", iter.GetValue(), 55UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 13)); + VerifyOrReturn(CheckValue("serverList[13]", iter.GetValue(), 60UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 14)); + VerifyOrReturn(CheckValue("serverList[14]", iter.GetValue(), 62UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 15)); + VerifyOrReturn(CheckValue("serverList[15]", iter.GetValue(), 1029UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 16)); + VerifyOrReturn(CheckValue("serverList[16]", iter.GetValue(), 61440UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 17)); + VerifyOrReturn(CheckValue("serverList[17]", iter.GetValue(), 61444UL)); + VerifyOrReturn(CheckNoMoreListItems("serverList", iter, 18)); NextTest(); } @@ -26870,7 +29872,8 @@ class TestDescriptorCluster : public TestCommand void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & clientList) { - VerifyOrReturn(CheckValueAsListLength("clientList", clientList, 0)); + auto iter = clientList.begin(); + VerifyOrReturn(CheckNoMoreListItems("clientList", iter, 0)); NextTest(); } @@ -26886,7 +29889,12 @@ class TestDescriptorCluster : public TestCommand void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & partsList) { - VerifyOrReturn(CheckValueAsListLength("partsList", partsList, 2)); + auto iter = partsList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("partsList", iter, 0)); + VerifyOrReturn(CheckValue("partsList[0]", iter.GetValue(), 1U)); + VerifyOrReturn(CheckNextListItemDecodes("partsList", iter, 1)); + VerifyOrReturn(CheckValue("partsList[1]", iter.GetValue(), 2U)); + VerifyOrReturn(CheckNoMoreListItems("partsList", iter, 2)); NextTest(); } }; @@ -27524,7 +30532,20 @@ class TestModeSelectCluster : public TestCommand const chip::app::DataModel::DecodableList & supportedModes) { - VerifyOrReturn(CheckValueAsListLength("supportedModes", supportedModes, 3)); + auto iter = supportedModes.begin(); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter, 0)); + VerifyOrReturn(CheckValueAsString("supportedModes[0].label", iter.GetValue().label, "Black")); + VerifyOrReturn(CheckValue<>("supportedModes[0].mode", iter.GetValue().mode, 0)); + VerifyOrReturn(CheckValue<>("supportedModes[0].semanticTag", iter.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter, 1)); + VerifyOrReturn(CheckValueAsString("supportedModes[1].label", iter.GetValue().label, "Cappuccino")); + VerifyOrReturn(CheckValue<>("supportedModes[1].mode", iter.GetValue().mode, 4)); + VerifyOrReturn(CheckValue<>("supportedModes[1].semanticTag", iter.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter, 2)); + VerifyOrReturn(CheckValueAsString("supportedModes[2].label", iter.GetValue().label, "Espresso")); + VerifyOrReturn(CheckValue<>("supportedModes[2].mode", iter.GetValue().mode, 7)); + VerifyOrReturn(CheckValue<>("supportedModes[2].semanticTag", iter.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNoMoreListItems("supportedModes", iter, 3)); NextTest(); } @@ -28063,10 +31084,12 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -28095,6 +31118,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -28114,6 +31138,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp index 65019b8a70d4ea..d00d188fe702a0 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp @@ -1018,7 +1018,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 611de322d6bf2d..00000000000000 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,471 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// AccountLogin Cluster Attributes - -// AdministratorCommissioning Cluster Attributes - -// ApplicationBasic Cluster Attributes - -// ApplicationLauncher Cluster Attributes - -// AudioOutput Cluster Attributes - -// BarrierControl Cluster Attributes - -// Basic Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::UserLabel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::Location::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::LocalConfigDisabled::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// BinaryInputBasic Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BinaryInputBasic::Attributes::OutOfService::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BinaryInputBasic::Attributes::PresentValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// Binding Cluster Attributes - -// BooleanState Cluster Attributes - -// BridgedActions Cluster Attributes - -// BridgedDeviceBasic Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::UserLabel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// ColorControl Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorControlOptions::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::WhitePointX::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::WhitePointY::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointRX::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointRY::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointGX::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointGY::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointBX::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointBY::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// ContentLauncher Cluster Attributes - -// Descriptor Cluster Attributes - -// DiagnosticLogs Cluster Attributes - -// DoorLock Cluster Attributes - -// ElectricalMeasurement Cluster Attributes - -// EthernetNetworkDiagnostics Cluster Attributes - -// FixedLabel Cluster Attributes - -// FlowMeasurement Cluster Attributes - -// GeneralCommissioning Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// GeneralDiagnostics Cluster Attributes - -// GroupKeyManagement Cluster Attributes - -// Groups Cluster Attributes - -// Identify Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Identify::Attributes::IdentifyTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// IlluminanceMeasurement Cluster Attributes - -// KeypadInput Cluster Attributes - -// LevelControl Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::Options::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::OnLevel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// LowPower Cluster Attributes - -// MediaInput Cluster Attributes - -// MediaPlayback Cluster Attributes - -// ModeSelect Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ModeSelect::Attributes::OnMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// NetworkCommissioning Cluster Attributes - -// OtaSoftwareUpdateProvider Cluster Attributes - -// OtaSoftwareUpdateRequestor Cluster Attributes - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProvider::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// OccupancySensing Cluster Attributes - -// OnOff Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::OnTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::OffWaitTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::StartUpOnOff::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// OnOffSwitchConfiguration Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchActions::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// OperationalCredentials Cluster Attributes - -// PowerSource Cluster Attributes - -// PressureMeasurement Cluster Attributes - -// PumpConfigurationAndControl Cluster Attributes - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// RelativeHumidityMeasurement Cluster Attributes - -// Scenes Cluster Attributes - -// SoftwareDiagnostics Cluster Attributes - -// Switch Cluster Attributes - -// TvChannel Cluster Attributes - -// TargetNavigator Cluster Attributes - -// TemperatureMeasurement Cluster Attributes - -// TestCluster Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Boolean::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Bitmap8::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Bitmap16::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Bitmap32::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Bitmap64::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int8u::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int16u::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int32u::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int64u::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int8s::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int16s::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int32s::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Int64s::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Enum8::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Enum16::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::OctetString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::LongOctetString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::CharString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::LongCharString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::EpochUs::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::EpochS::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::VendorId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::Unsupported::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// Thermostat Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::SystemMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// ThermostatUserInterfaceConfiguration Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - const chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo::Type & - requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - const chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo::Type & - requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// ThreadNetworkDiagnostics Cluster Attributes - -// WakeOnLan Cluster Attributes - -// WiFiNetworkDiagnostics Cluster Attributes - -// WindowCovering Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::Mode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTestWrite.cpp b/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTestWrite.cpp deleted file mode 100644 index 3d81f2f936b3ad..00000000000000 --- a/zzz_generated/controller-clusters/zap-generated/tests/CHIPClustersTestWrite.cpp +++ /dev/null @@ -1,1734 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include - -#include - -namespace chip { -namespace Controller { - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::AccountLogin::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::AdministratorCommissioning::Attributes::ClusterRevision::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::VendorId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::ProductId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::ApplicationId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::CatalogVendorId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::ApplicationStatus::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationLauncher::Attributes::ApplicationLauncherList::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationLauncher::Attributes::CatalogVendorId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationLauncher::Attributes::ApplicationId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::AudioOutput::Attributes::AudioOutputList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::AudioOutput::Attributes::CurrentAudioOutput::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::AudioOutput::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BarrierControl::Attributes::BarrierMovingState::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BarrierControl::Attributes::BarrierSafetyStatus::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BarrierControl::Attributes::BarrierCapabilities::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BarrierControl::Attributes::BarrierPosition::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BarrierControl::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::InteractionModelVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::VendorName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::VendorID::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::ProductName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::ProductID::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::HardwareVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::HardwareVersionString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::SoftwareVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::SoftwareVersionString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::ManufacturingDate::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::PartNumber::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::ProductURL::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::ProductLabel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::SerialNumber::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::Reachable::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Basic::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BinaryInputBasic::Attributes::StatusFlags::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BinaryInputBasic::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Binding::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BooleanState::Attributes::StateValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BooleanState::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedActions::Attributes::ActionList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedActions::Attributes::EndpointList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedActions::Attributes::SetupUrl::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedActions::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::VendorName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::VendorID::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::ProductName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::HardwareVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::HardwareVersionString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::SoftwareVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::SoftwareVersionString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::ManufacturingDate::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::PartNumber::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::ProductURL::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::ProductLabel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::SerialNumber::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::Reachable::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::BridgedDeviceBasic::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::CurrentHue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::CurrentSaturation::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::RemainingTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::CurrentX::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::CurrentY::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::DriftCompensation::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::CompensationText::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorTemperature::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::NumberOfPrimaries::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary1X::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary1Y::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary1Intensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary2X::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary2Y::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary2Intensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary3X::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary3Y::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary3Intensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary4X::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary4Y::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary4Intensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary5X::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary5Y::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary5Intensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary6X::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary6Y::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::Primary6Intensity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::EnhancedCurrentHue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::EnhancedColorMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorLoopActive::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorLoopDirection::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorLoopTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorLoopStartEnhancedHue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorLoopStoredEnhancedHue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorCapabilities::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMin::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMax::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::CoupleColorTempToLevelMinMireds::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ColorControl::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingTypes::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Descriptor::Attributes::DeviceList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Descriptor::Attributes::ServerList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Descriptor::Attributes::ClientList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Descriptor::Attributes::PartsList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Descriptor::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::DoorLock::Attributes::LockState::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::DoorLock::Attributes::LockType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::DoorLock::Attributes::ActuatorEnabled::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::DoorLock::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::MeasurementType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::TotalActivePower::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltage::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMin::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMax::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrent::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMin::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMax::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePower::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMin::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMax::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ElectricalMeasurement::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PHYRate::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FullDuplex::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketRxCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketTxCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TxErrCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CollisionCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::OverrunCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CarrierDetect::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TimeSinceReset::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FixedLabel::Attributes::LabelList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FixedLabel::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FlowMeasurement::Attributes::MeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FlowMeasurement::Attributes::MinMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FlowMeasurement::Attributes::MaxMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FlowMeasurement::Attributes::Tolerance::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::FlowMeasurement::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralCommissioning::Attributes::BasicCommissioningInfoList::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralDiagnostics::Attributes::NetworkInterfaces::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralDiagnostics::Attributes::UpTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralDiagnostics::Attributes::TotalOperationalHours::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralDiagnostics::Attributes::BootReasons::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralDiagnostics::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GroupKeyManagement::Attributes::Groups::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeys::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GroupKeyManagement::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Groups::Attributes::NameSupport::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Groups::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Identify::Attributes::IdentifyType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Identify::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::IlluminanceMeasurement::Attributes::MinMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::IlluminanceMeasurement::Attributes::MaxMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::IlluminanceMeasurement::Attributes::Tolerance::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::IlluminanceMeasurement::Attributes::LightSensorType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::IlluminanceMeasurement::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::RemainingTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::CurrentFrequency::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::MinFrequency::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::MaxFrequency::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LevelControl::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::LowPower::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaInput::Attributes::MediaInputList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaInput::Attributes::CurrentMediaInput::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaInput::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::PlaybackState::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::StartTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::PositionUpdatedAt::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::Position::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ModeSelect::Attributes::CurrentMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ModeSelect::Attributes::SupportedModes::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ModeSelect::Attributes::StartUpMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ModeSelect::Attributes::Description::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ModeSelect::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::NetworkCommissioning::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::NetworkCommissioning::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::ClusterRevision::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OccupancySensing::Attributes::Occupancy::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorTypeBitmap::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OccupancySensing::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::OnOff::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::GlobalSceneControl::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOffSwitchConfiguration::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OperationalCredentials::Attributes::FabricsList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OperationalCredentials::Attributes::SupportedFabrics::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OperationalCredentials::Attributes::TrustedRootCertificates::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OperationalCredentials::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::Status::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::Order::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::Description::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::BatteryVoltage::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::BatteryPercentRemaining::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::BatteryTimeRemaining::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::BatteryChargeLevel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::ActiveBatteryFaults::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::BatteryChargeState::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PowerSource::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PressureMeasurement::Attributes::MeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PressureMeasurement::Attributes::MinMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PressureMeasurement::Attributes::MaxMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PressureMeasurement::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxPressure::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxSpeed::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxFlow::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstPressure::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstPressure::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinCompPressure::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxCompPressure::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstSpeed::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstSpeed::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstFlow::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstFlow::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstTemp::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstTemp::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::PumpStatus::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveOperationMode::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveControlMode::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::Capacity::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::Speed::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::AlarmMask::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::ClusterRevision::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MinMeasuredValue::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::RelativeHumidityMeasurement::Attributes::ClusterRevision::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Scenes::Attributes::SceneCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Scenes::Attributes::CurrentScene::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Scenes::Attributes::CurrentGroup::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Scenes::Attributes::SceneValid::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Scenes::Attributes::NameSupport::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Scenes::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapFree::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapUsed::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::SoftwareDiagnostics::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Switch::Attributes::NumberOfPositions::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Switch::Attributes::CurrentPosition::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Switch::Attributes::MultiPressMax::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Switch::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Switch::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TvChannel::Attributes::TvChannelList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TvChannel::Attributes::TvChannelLineup::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TvChannel::Attributes::CurrentTvChannel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TvChannel::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TargetNavigator::Attributes::TargetNavigatorList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::TemperatureMeasurement::Attributes::MinMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::TemperatureMeasurement::Attributes::MaxMeasuredValue::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TemperatureMeasurement::Attributes::Tolerance::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TemperatureMeasurement::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::ListInt8u::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::ListOctetString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::ListStructOctetString::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::TestCluster::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::LocalTemperature::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::AbsMinHeatSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::AbsMaxHeatSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::AbsMinCoolSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::AbsMaxCoolSetpointLimit::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::StartOfWeek::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::NumberOfWeeklyTransitions::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::NumberOfDailyTransitions::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Thermostat::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Channel::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RoutingRole::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NetworkName::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PanId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ExtendedPanId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OverrunCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTableList::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTableList::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Weighting::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DataVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::StableDataVersion::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRouterId::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChildRoleCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouterRoleCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::TypeInfo::Type & - requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ParentChangeCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxTotalCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxUnicastCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckedCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataPollCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxOtherCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxRetryCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxTotalCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxUnicastCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataPollCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxOtherCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelMask::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WakeOnLan::Attributes::WakeOnLanMacAddress::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WakeOnLan::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Bssid::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::SecurityType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::WiFiVersion::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ChannelNumber::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Rssi::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconLostCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconRxCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::OverrunCount::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::Type::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLift::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTilt::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::ConfigStatus::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercentage::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercentage::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::OperationalStatus::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::TargetPositionLiftPercent100ths::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::TargetPositionTiltPercent100ths::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::EndProductType::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercent100ths::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercent100ths::TypeInfo::Type & requestData, - void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitLift::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitLift::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitTilt::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitTilt::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::SafetyStatus::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::FeatureMap::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::WindowCovering::Attributes::ClusterRevision::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClustersInvoke.cpp index 7b72162bfb792d..582acfe9f12b0a 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/lighting-app/zap-generated/CHIPClustersInvoke.cpp @@ -36,7 +36,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 547118cf182642..00000000000000 --- a/zzz_generated/lighting-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,74 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// OnOff Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::OnTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::OffWaitTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::OnOff::Attributes::StartUpOnOff::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/lock-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/lock-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 759d13c5028d26..00000000000000 --- a/zzz_generated/lock-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,18 +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. - */ - -// THIS FILE IS GENERATED BY ZAP diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp index 5ef6695b4a310e..3c48b3d64f383b 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp @@ -55,7 +55,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index c97fad2ed0dace..00000000000000 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,62 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// OtaSoftwareUpdateProvider Cluster Attributes - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/pump-app/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/pump-app/zap-generated/CHIPClustersInvoke.cpp index 7b72162bfb792d..582acfe9f12b0a 100644 --- a/zzz_generated/pump-app/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/pump-app/zap-generated/CHIPClustersInvoke.cpp @@ -36,7 +36,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/pump-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/pump-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 2d99becde8961a..00000000000000 --- a/zzz_generated/pump-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,66 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// FlowMeasurement Cluster Attributes - -// PressureMeasurement Cluster Attributes - -// TemperatureMeasurement Cluster Attributes - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/pump-controller-app/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/pump-controller-app/zap-generated/CHIPClustersInvoke.cpp index 2cac57f240fcf2..43b67771204d54 100644 --- a/zzz_generated/pump-controller-app/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/pump-controller-app/zap-generated/CHIPClustersInvoke.cpp @@ -91,7 +91,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/pump-controller-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/pump-controller-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 14352ee5b8cbe0..00000000000000 --- a/zzz_generated/pump-controller-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,77 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// FlowMeasurement Cluster Attributes - -// LevelControl Cluster Attributes - -// OnOff Cluster Attributes - -// PressureMeasurement Cluster Attributes - -// PumpConfigurationAndControl Cluster Attributes - -template CHIP_ERROR -ClusterBase::WriteAttribute( - const chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// TemperatureMeasurement Cluster Attributes - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/temperature-measurement-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/temperature-measurement-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 759d13c5028d26..00000000000000 --- a/zzz_generated/temperature-measurement-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,18 +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. - */ - -// THIS FILE IS GENERATED BY ZAP diff --git a/zzz_generated/thermostat/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/thermostat/zap-generated/CHIPClustersInvoke.cpp index 0cf4406f57cb50..10cfbc0c726183 100644 --- a/zzz_generated/thermostat/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/thermostat/zap-generated/CHIPClustersInvoke.cpp @@ -47,7 +47,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/thermostat/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/thermostat/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index fd53e2d427638a..00000000000000 --- a/zzz_generated/thermostat/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,66 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// Identify Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::Identify::Attributes::IdentifyTime::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/tv-app/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/tv-app/zap-generated/CHIPClustersInvoke.cpp index 5d37300058cb47..d792245340f9c7 100644 --- a/zzz_generated/tv-app/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/tv-app/zap-generated/CHIPClustersInvoke.cpp @@ -130,7 +130,6 @@ CHIP_ERROR ClusterBase::InvokeCommand(const RequestDataT & requestData, void * c CommandResponseFailureCallback failureCb) { VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); auto onSuccessCb = [context, successCb](const app::ConcreteCommandPath & commandPath, const app::StatusIB & aStatus, const ResponseDataT & responseData) { successCb(context, responseData); }; diff --git a/zzz_generated/tv-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/tv-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 3fab7369ccfc79..00000000000000 --- a/zzz_generated/tv-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,70 +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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#include "CHIPClusters.h" - -#include -#include - -namespace chip { - -using namespace app::Clusters; -using namespace System; -using namespace Encoding::LittleEndian; - -namespace Controller { - -// GeneralCommissioning Cluster Attributes - -template CHIP_ERROR ClusterBase::WriteAttribute( - const chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::TypeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb); - -// NetworkCommissioning Cluster Attributes - -// OperationalCredentials Cluster Attributes - -template -CHIP_ERROR ClusterBase::WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, - WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb) -{ - VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mDevice->LoadSecureSessionParametersIfNeeded()); - - auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & commandPath) { - if (successCb != nullptr) - { - successCb(context); - } - }; - - auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, - CHIP_ERROR aError) { - if (failureCb != nullptr) - { - failureCb(context, app::ToEmberAfStatus(status.mStatus)); - } - }; - - return chip::Controller::WriteAttribute(mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), - mEndpoint, requestData, onSuccessCb, onFailureCb); -} - -} // namespace Controller -} // namespace chip diff --git a/zzz_generated/tv-casting-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/tv-casting-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 759d13c5028d26..00000000000000 --- a/zzz_generated/tv-casting-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,18 +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. - */ - -// THIS FILE IS GENERATED BY ZAP diff --git a/zzz_generated/window-app/zap-generated/CHIPClustersWrite.cpp b/zzz_generated/window-app/zap-generated/CHIPClustersWrite.cpp deleted file mode 100644 index 759d13c5028d26..00000000000000 --- a/zzz_generated/window-app/zap-generated/CHIPClustersWrite.cpp +++ /dev/null @@ -1,18 +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. - */ - -// THIS FILE IS GENERATED BY ZAP