From 604e51eb8f7ad1067df466f16ea46feb96ba61d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=A9gevand?= <77852424+jmeg-sfy@users.noreply.github.com> Date: Tue, 19 Apr 2022 15:37:18 +0200 Subject: [PATCH] WindowCovering: Support of WNCV_2_3 + refactor of Mode/ConfigStatus (#17429) * ZAP: Rework Mode + ConfigStatus declaration * ZAP: Rework GoTo with Percent100ths as optional * YAML + ZAP: Remove tests on Mode and ConfigStatus * DEV: ReWork ConfigStatus init and functions * DEV: Update Mode behavior + init + functions * DEV: Check current mode for command + rework optional GoTos params * YAML: disabled non-compatible test on WNCV-2.1 * YAML: Update test WNCV_2.3 - fix PICS * DEV: Add support for test constraints Min/Max w/ BitFlags * DEV: Add support for test constraints NotValue w/ BitFlags * YAML: ReEnable BitFlags related tests * DEV: Add WNCV ci-pics-values * YAML: Activate 2.3 test in chip-tools * [DEV] Add autogen tests for WNCV 2.3 * YAML: Remove Manual Test WNCV 2.3 * YAML: Add missing WaitForCommissionee * Zap: Regen config for 2.3 WNCV test * FIX: Issue with locking * Restyled by whitespace * Restyled by clang-format * Restyled by prettier-yaml * Update src/app/clusters/window-covering-server/window-covering-server.cpp Co-authored-by: Boris Zbarsky Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- .../all-clusters-app.matter | 28 +- examples/chip-tool-darwin/templates/tests.js | 1 + examples/chip-tool/templates/tests/tests.js | 2 +- .../placeholder/linux/apps/app1/config.matter | 28 +- .../placeholder/linux/apps/app2/config.matter | 28 +- examples/window-app/common/src/WindowApp.cpp | 36 +- examples/window-app/common/window-app.matter | 28 +- .../window-covering-server.cpp | 227 ++- .../window-covering-server.h | 35 +- src/app/tests/suites/certification/PICS.yaml | 14 +- .../certification/Test_TC_WNCV_2_3.yaml | 233 ++- .../certification/Test_TC_WNCV_4_1.yaml | 4 +- .../certification/Test_TC_WNCV_4_2.yaml | 4 +- .../certification/Test_TC_WNCV_4_3.yaml | 6 +- .../certification/Test_TC_WNCV_4_4.yaml | 6 +- .../tests/suites/certification/ci-pics-values | 7 +- .../tests/suites/include/ConstraintsChecker.h | 37 + .../zcl/data-model/chip/window-covering.xml | 16 +- .../data_model/controller-clusters.matter | 28 +- .../CHIPAttributeTLVValueDecoder.cpp | 4 +- .../chip/devicecontroller/ChipClusters.java | 12 +- .../devicecontroller/ClusterInfoMapping.java | 8 +- .../python/chip/clusters/Objects.py | 8 +- .../Framework/CHIP/templates/tests/tests.js | 1 + .../CHIPAttributeTLVValueDecoder.mm | 4 +- .../CHIP/zap-generated/CHIPCallbackBridge.mm | 48 + .../CHIPCallbackBridge_internal.h | 56 + .../CHIP/zap-generated/CHIPClustersObjc.h | 30 +- .../CHIP/zap-generated/CHIPClustersObjc.mm | 87 +- .../zap-generated/CHIPCommandPayloadsObjc.h | 4 +- .../zap-generated/CHIPCommandPayloadsObjc.mm | 4 +- .../zap-generated/CHIPTestClustersObjc.mm | 2 +- .../Framework/CHIPTests/CHIPClustersTests.m | 482 ++++++ .../zap-generated/attributes/Accessors.cpp | 16 +- .../zap-generated/attributes/Accessors.h | 9 +- .../app-common/zap-generated/cluster-enums.h | 36 +- .../zap-generated/cluster-objects.h | 35 +- .../app-common/zap-generated/enums.h | 44 +- .../cluster/CHIPTestClustersObjc.mm | 2 +- .../zap-generated/test/Commands.h | 614 +++++++- .../zap-generated/cluster/Commands.h | 2 +- .../cluster/logging/DataModelLogger.cpp | 4 +- .../chip-tool/zap-generated/test/Commands.h | 1372 +++++++++++++---- 43 files changed, 2947 insertions(+), 705 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index d4d3ab9c281c2f..ea90c395ed6bc5 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -3620,16 +3620,23 @@ server cluster WindowCovering = 258 { kUnknown = 255; } - bitmap WcConfigStatus : BITMAP8 { + bitmap ConfigStatus : BITMAP8 { kOperational = 0x1; - kOnline = 0x2; - kOpenAndUpCommandsReversed = 0x4; + kOnlineReserved = 0x2; + kLiftMovementReversed = 0x4; kLiftPositionAware = 0x8; kTiltPositionAware = 0x10; kLiftEncoderControlled = 0x20; kTiltEncoderControlled = 0x40; } + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + bitmap WcFeature : BITMAP32 { kLift = 0x1; kTilt = 0x2; @@ -3638,13 +3645,6 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcMode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - bitmap WcOperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; @@ -3669,7 +3669,7 @@ server cluster WindowCovering = 258 { readonly attribute Type type = 0; readonly attribute nullable int16u currentPositionLift = 3; readonly attribute nullable int16u currentPositionTilt = 4; - readonly attribute bitmap8 configStatus = 7; + readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; readonly attribute bitmap8 operationalStatus = 10; @@ -3682,7 +3682,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedClosedLimitLift = 17; readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; - attribute access(write: manage) bitmap8 mode = 23; + attribute access(write: manage) Mode mode = 23; readonly attribute bitmap16 safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -3693,7 +3693,7 @@ server cluster WindowCovering = 258 { request struct GoToLiftPercentageRequest { Percent liftPercentageValue = 0; - Percent100ths liftPercent100thsValue = 1; + optional Percent100ths liftPercent100thsValue = 1; } request struct GoToTiltValueRequest { @@ -3702,7 +3702,7 @@ server cluster WindowCovering = 258 { request struct GoToTiltPercentageRequest { Percent tiltPercentageValue = 0; - Percent100ths tiltPercent100thsValue = 1; + optional Percent100ths tiltPercent100thsValue = 1; } command UpOrOpen(): DefaultSuccess = 0; diff --git a/examples/chip-tool-darwin/templates/tests.js b/examples/chip-tool-darwin/templates/tests.js index 0c27c4e4b407b9..e1761ab50c2ba1 100644 --- a/examples/chip-tool-darwin/templates/tests.js +++ b/examples/chip-tool-darwin/templates/tests.js @@ -251,6 +251,7 @@ function getTests() 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', 'Test_TC_WNCV_2_2', + 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_2_4', 'Test_TC_WNCV_2_5', //'Test_TC_WNCV_3_1', diff --git a/examples/chip-tool/templates/tests/tests.js b/examples/chip-tool/templates/tests/tests.js index 911d50623efe9b..0c2fd94522bdaa 100644 --- a/examples/chip-tool/templates/tests/tests.js +++ b/examples/chip-tool/templates/tests/tests.js @@ -218,7 +218,6 @@ function getManualTests() ]; const WindowCovering = [ - 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_6_1', ]; @@ -502,6 +501,7 @@ function getTests() 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', 'Test_TC_WNCV_2_2', + 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_2_4', 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index ae7e8fb259a913..39da75e07e4fa2 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -2430,16 +2430,23 @@ server cluster WindowCovering = 258 { kUnknown = 255; } - bitmap WcConfigStatus : BITMAP8 { + bitmap ConfigStatus : BITMAP8 { kOperational = 0x1; - kOnline = 0x2; - kOpenAndUpCommandsReversed = 0x4; + kOnlineReserved = 0x2; + kLiftMovementReversed = 0x4; kLiftPositionAware = 0x8; kTiltPositionAware = 0x10; kLiftEncoderControlled = 0x20; kTiltEncoderControlled = 0x40; } + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + bitmap WcFeature : BITMAP32 { kLift = 0x1; kTilt = 0x2; @@ -2448,13 +2455,6 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcMode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - bitmap WcOperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; @@ -2479,7 +2479,7 @@ server cluster WindowCovering = 258 { readonly attribute Type type = 0; readonly attribute nullable int16u currentPositionLift = 3; readonly attribute nullable int16u currentPositionTilt = 4; - readonly attribute bitmap8 configStatus = 7; + readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; readonly attribute bitmap8 operationalStatus = 10; @@ -2492,7 +2492,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedClosedLimitLift = 17; readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; - attribute access(write: manage) bitmap8 mode = 23; + attribute access(write: manage) Mode mode = 23; readonly attribute bitmap16 safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -2503,7 +2503,7 @@ server cluster WindowCovering = 258 { request struct GoToLiftPercentageRequest { Percent liftPercentageValue = 0; - Percent100ths liftPercent100thsValue = 1; + optional Percent100ths liftPercent100thsValue = 1; } request struct GoToTiltValueRequest { @@ -2512,7 +2512,7 @@ server cluster WindowCovering = 258 { request struct GoToTiltPercentageRequest { Percent tiltPercentageValue = 0; - Percent100ths tiltPercent100thsValue = 1; + optional Percent100ths tiltPercent100thsValue = 1; } command UpOrOpen(): DefaultSuccess = 0; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index ae7e8fb259a913..39da75e07e4fa2 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -2430,16 +2430,23 @@ server cluster WindowCovering = 258 { kUnknown = 255; } - bitmap WcConfigStatus : BITMAP8 { + bitmap ConfigStatus : BITMAP8 { kOperational = 0x1; - kOnline = 0x2; - kOpenAndUpCommandsReversed = 0x4; + kOnlineReserved = 0x2; + kLiftMovementReversed = 0x4; kLiftPositionAware = 0x8; kTiltPositionAware = 0x10; kLiftEncoderControlled = 0x20; kTiltEncoderControlled = 0x40; } + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + bitmap WcFeature : BITMAP32 { kLift = 0x1; kTilt = 0x2; @@ -2448,13 +2455,6 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcMode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - bitmap WcOperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; @@ -2479,7 +2479,7 @@ server cluster WindowCovering = 258 { readonly attribute Type type = 0; readonly attribute nullable int16u currentPositionLift = 3; readonly attribute nullable int16u currentPositionTilt = 4; - readonly attribute bitmap8 configStatus = 7; + readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; readonly attribute bitmap8 operationalStatus = 10; @@ -2492,7 +2492,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedClosedLimitLift = 17; readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; - attribute access(write: manage) bitmap8 mode = 23; + attribute access(write: manage) Mode mode = 23; readonly attribute bitmap16 safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -2503,7 +2503,7 @@ server cluster WindowCovering = 258 { request struct GoToLiftPercentageRequest { Percent liftPercentageValue = 0; - Percent100ths liftPercent100thsValue = 1; + optional Percent100ths liftPercent100thsValue = 1; } request struct GoToTiltValueRequest { @@ -2512,7 +2512,7 @@ server cluster WindowCovering = 258 { request struct GoToTiltPercentageRequest { Percent tiltPercentageValue = 0; - Percent100ths tiltPercent100thsValue = 1; + optional Percent100ths tiltPercent100thsValue = 1; } command UpOrOpen(): DefaultSuccess = 0; diff --git a/examples/window-app/common/src/WindowApp.cpp b/examples/window-app/common/src/WindowApp.cpp index 03d3c90fee718c..a9d357eea42e6c 100644 --- a/examples/window-app/common/src/WindowApp.cpp +++ b/examples/window-app/common/src/WindowApp.cpp @@ -294,6 +294,8 @@ void WindowApp::DispatchEvent(const WindowApp::Event & event) void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::AttributeId attribute) { Cover * cover = GetCover(endpoint); + chip::BitFlags mode; + chip::BitFlags configStatus; if (nullptr == cover) { @@ -319,15 +321,24 @@ void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::At break; /* RW Mode */ case Attributes::Mode::Id: - emberAfWindowCoveringClusterPrint("Mode set: ignored"); + chip::DeviceLayer::PlatformMgr().LockChipStack(); + mode = ModeGet(endpoint); + ModePrint(mode); + ModeSet(endpoint, mode); // refilter mode if needed + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + break; + /* RO ConfigStatus: set by WC server */ + case Attributes::ConfigStatus::Id: + chip::DeviceLayer::PlatformMgr().LockChipStack(); + configStatus = ConfigStatusGet(endpoint); + ConfigStatusPrint(configStatus); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); break; /* ### ATTRIBUTEs CHANGEs IGNORED ### */ /* RO Type: not supposed to dynamically change */ case Attributes::Type::Id: /* RO EndProductType: not supposed to dynamically change */ case Attributes::EndProductType::Id: - /* RO ConfigStatus: set by WC server */ - case Attributes::ConfigStatus::Id: /* RO SafetyStatus: set by WC server */ case Attributes::SafetyStatus::Id: /* ============= Positions for Position Aware ============= */ @@ -415,13 +426,10 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint) TypeSet(endpoint, Type::kTiltBlindLiftAndTilt); // Attribute: Id 7 ConfigStatus - ConfigStatus configStatus = { .operational = 1, - .online = 1, - .liftIsReversed = 0, - .liftIsPA = HasFeaturePaLift(endpoint), - .tiltIsPA = HasFeaturePaTilt(endpoint), - .liftIsEncoderControlled = 1, - .tiltIsEncoderControlled = 1 }; + chip::BitFlags configStatus = ConfigStatusGet(endpoint); + configStatus.Set(ConfigStatus::kLiftEncoderControlled); + configStatus.Set(ConfigStatus::kTiltEncoderControlled); + configStatus.Set(ConfigStatus::kOnlineReserved); ConfigStatusSet(endpoint, configStatus); OperationalStatusSetWithGlobalUpdated(endpoint, mOperationalStatus); @@ -430,7 +438,13 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint) EndProductTypeSet(endpoint, EndProductType::kInteriorBlind); // Attribute: Id 24 Mode - Mode mode = { .motorDirReversed = 0, .calibrationMode = 1, .maintenanceMode = 1, .ledDisplay = 1 }; + chip::BitFlags mode; + mode.Clear(Mode::kMotorDirectionReversed); + mode.Clear(Mode::kMaintenanceMode); + mode.Clear(Mode::kCalibrationMode); + mode.Set(Mode::kLedFeedback); + + /* Mode also update ConfigStatus accordingly */ ModeSet(endpoint, mode); // Attribute: Id 27 SafetyStatus (Optional) diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index 6b7f2ca07d1bcc..d8ba9dc29519a6 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -1277,16 +1277,23 @@ server cluster WindowCovering = 258 { kUnknown = 255; } - bitmap WcConfigStatus : BITMAP8 { + bitmap ConfigStatus : BITMAP8 { kOperational = 0x1; - kOnline = 0x2; - kOpenAndUpCommandsReversed = 0x4; + kOnlineReserved = 0x2; + kLiftMovementReversed = 0x4; kLiftPositionAware = 0x8; kTiltPositionAware = 0x10; kLiftEncoderControlled = 0x20; kTiltEncoderControlled = 0x40; } + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + bitmap WcFeature : BITMAP32 { kLift = 0x1; kTilt = 0x2; @@ -1295,13 +1302,6 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcMode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - bitmap WcOperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; @@ -1326,7 +1326,7 @@ server cluster WindowCovering = 258 { readonly attribute Type type = 0; readonly attribute nullable int16u currentPositionLift = 3; readonly attribute nullable int16u currentPositionTilt = 4; - readonly attribute bitmap8 configStatus = 7; + readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; readonly attribute bitmap8 operationalStatus = 10; @@ -1339,7 +1339,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedClosedLimitLift = 17; readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; - attribute access(write: manage) bitmap8 mode = 23; + attribute access(write: manage) Mode mode = 23; readonly attribute bitmap16 safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; @@ -1350,7 +1350,7 @@ server cluster WindowCovering = 258 { request struct GoToLiftPercentageRequest { Percent liftPercentageValue = 0; - Percent100ths liftPercent100thsValue = 1; + optional Percent100ths liftPercent100thsValue = 1; } request struct GoToTiltValueRequest { @@ -1359,7 +1359,7 @@ server cluster WindowCovering = 258 { request struct GoToTiltPercentageRequest { Percent tiltPercentageValue = 0; - Percent100ths tiltPercent100thsValue = 1; + optional Percent100ths tiltPercent100thsValue = 1; } command UpOrOpen(): DefaultSuccess = 0; diff --git a/src/app/clusters/window-covering-server/window-covering-server.cpp b/src/app/clusters/window-covering-server/window-covering-server.cpp index fefa288ca28c48..33fec58d9b17cc 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -170,34 +170,45 @@ Type TypeGet(chip::EndpointId endpoint) return value; } -void ConfigStatusSet(chip::EndpointId endpoint, const ConfigStatus & status) +void ConfigStatusPrint(const chip::BitFlags & configStatus) { - /* clang-format off */ - uint8_t value = (status.operational ? 0x01 : 0) - | (status.online ? 0x02 : 0) - | (status.liftIsReversed ? 0x04 : 0) - | (status.liftIsPA ? 0x08 : 0) - | (status.tiltIsPA ? 0x10 : 0) - | (status.liftIsEncoderControlled ? 0x20 : 0) - | (status.tiltIsEncoderControlled ? 0x40 : 0); - /* clang-format on */ - Attributes::ConfigStatus::Set(endpoint, value); + emberAfWindowCoveringClusterPrint("ConfigStatus 0x%02X Operational=%u OnlineReserved=%u", configStatus.Raw(), + configStatus.Has(ConfigStatus::kOperational), + configStatus.Has(ConfigStatus::kOnlineReserved)); + + emberAfWindowCoveringClusterPrint( + "Lift(PA=%u Encoder=%u Reversed=%u) Tilt(PA=%u Encoder=%u)", configStatus.Has(ConfigStatus::kLiftPositionAware), + configStatus.Has(ConfigStatus::kLiftEncoderControlled), configStatus.Has(ConfigStatus::kLiftMovementReversed), + configStatus.Has(ConfigStatus::kTiltPositionAware), configStatus.Has(ConfigStatus::kTiltEncoderControlled)); } -const ConfigStatus ConfigStatusGet(chip::EndpointId endpoint) +void ConfigStatusSet(chip::EndpointId endpoint, const chip::BitFlags & configStatus) { - uint8_t value = 0; - ConfigStatus status; - - Attributes::ConfigStatus::Get(endpoint, &value); - status.operational = (value & 0x01) ? 1 : 0; - status.online = (value & 0x02) ? 1 : 0; - status.liftIsReversed = (value & 0x04) ? 1 : 0; - status.liftIsPA = (value & 0x08) ? 1 : 0; - status.tiltIsPA = (value & 0x10) ? 1 : 0; - status.liftIsEncoderControlled = (value & 0x20) ? 1 : 0; - status.tiltIsEncoderControlled = (value & 0x40) ? 1 : 0; - return status; + Attributes::ConfigStatus::Set(endpoint, configStatus); +} + +chip::BitFlags ConfigStatusGet(chip::EndpointId endpoint) +{ + chip::BitFlags configStatus; + Attributes::ConfigStatus::Get(endpoint, &configStatus); + + return configStatus; +} + +void ConfigStatusUpdateFeatures(chip::EndpointId endpoint) +{ + chip::BitFlags configStatus = ConfigStatusGet(endpoint); + + configStatus.Set(ConfigStatus::kLiftPositionAware, HasFeaturePaLift(endpoint)); + configStatus.Set(ConfigStatus::kTiltPositionAware, HasFeaturePaTilt(endpoint)); + + if (!HasFeaturePaLift(endpoint)) + configStatus.Clear(ConfigStatus::kLiftEncoderControlled); + + if (!HasFeaturePaTilt(endpoint)) + configStatus.Clear(ConfigStatus::kTiltEncoderControlled); + + ConfigStatusSet(endpoint, configStatus); } void OperationalStatusSetWithGlobalUpdated(chip::EndpointId endpoint, OperationalStatus & status) @@ -249,23 +260,44 @@ EndProductType EndProductTypeGet(chip::EndpointId endpoint) return value; } -void ModeSet(chip::EndpointId endpoint, const Mode & mode) +void ModePrint(const chip::BitFlags & mode) { - uint8_t value = (mode.motorDirReversed ? 0x01 : 0) | (mode.calibrationMode ? 0x02 : 0) | (mode.maintenanceMode ? 0x04 : 0) | - (mode.ledDisplay ? 0x08 : 0); - Attributes::Mode::Set(endpoint, value); + emberAfWindowCoveringClusterPrint("Mode 0x%02X MotorDirReversed=%u LedFeedback=%u Maintenance=%u Calibration=%u", mode.Raw(), + mode.Has(Mode::kMotorDirectionReversed), mode.Has(Mode::kLedFeedback), + mode.Has(Mode::kMaintenanceMode), mode.Has(Mode::kCalibrationMode)); } -const Mode ModeGet(chip::EndpointId endpoint) +void ModeSet(chip::EndpointId endpoint, chip::BitFlags & newMode) { - uint8_t value = 0; - Mode mode; + chip::BitFlags newStatus; + + chip::BitFlags oldStatus = ConfigStatusGet(endpoint); + chip::BitFlags oldMode = ModeGet(endpoint); + + newStatus = oldStatus; + + // Attribute: ConfigStatus reflects the following current mode flags + newStatus.Set(ConfigStatus::kOperational, !newMode.HasAny(Mode::kMaintenanceMode, Mode::kCalibrationMode)); + newStatus.Set(ConfigStatus::kLiftMovementReversed, newMode.Has(Mode::kMotorDirectionReversed)); - Attributes::Mode::Get(endpoint, &value); - mode.motorDirReversed = (value & 0x01) ? 1 : 0; - mode.calibrationMode = (value & 0x02) ? 1 : 0; - mode.maintenanceMode = (value & 0x04) ? 1 : 0; - mode.ledDisplay = (value & 0x08) ? 1 : 0; + // Verify only one mode supported at once and maintenance lock goes over calibration + if (newMode.HasAll(Mode::kMaintenanceMode, Mode::kCalibrationMode)) + { + newMode.Clear(Mode::kCalibrationMode); + } + + if (oldMode != newMode) + Attributes::Mode::Set(endpoint, newMode); + + if (oldStatus != newStatus) + ConfigStatusSet(endpoint, newStatus); +} + +chip::BitFlags ModeGet(chip::EndpointId endpoint) +{ + chip::BitFlags mode; + + Attributes::Mode::Get(endpoint, &mode); return mode; } @@ -565,6 +597,8 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI { // all-cluster-app: simulation for the CI testing // otherwise it is defined for manufacturer specific implementation */ + BitFlags mode; + BitFlags configStatus; NPercent100ths current, target; OperationalStatus prevOpStatus = OperationalStatusGet(endpoint); OperationalStatus opStatus = prevOpStatus; @@ -610,6 +644,16 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI Attributes::CurrentPositionTiltPercent100ths::Get(endpoint, current); opStatus.tilt = ComputeOperationalState(target, current); break; + /* Mode change is either internal from the application or external from a write request */ + case Attributes::Mode::Id: + mode = ModeGet(endpoint); + ModePrint(mode); + ModeSet(endpoint, mode); // refilter mode if needed + break; + case Attributes::ConfigStatus::Id: + configStatus = ConfigStatusGet(endpoint); + ConfigStatusPrint(configStatus); + break; default: break; } @@ -619,6 +663,30 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI OperationalStatusSetWithGlobalUpdated(endpoint, opStatus); } +EmberAfStatus GetMotionLockStatus(chip::EndpointId endpoint) +{ + BitFlags mode = ModeGet(endpoint); + BitFlags configStatus = ConfigStatusGet(endpoint); + + // Is the device locked? + if (!configStatus.Has(ConfigStatus::kOperational)) + { + if (mode.Has(Mode::kMaintenanceMode)) + { + // Mainterance Mode + return EMBER_ZCL_STATUS_BUSY; + } + + if (mode.Has(Mode::kCalibrationMode)) + { + // Calibration Mode + return EMBER_ZCL_STATUS_FAILURE; + } + } + + return EMBER_ZCL_STATUS_SUCCESS; +} + } // namespace WindowCovering } // namespace Clusters } // namespace app @@ -637,6 +705,8 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint) { emberAfWindowCoveringClusterPrint("Window Covering Cluster init"); + + ConfigStatusUpdateFeatures(endpoint); } /** @@ -648,6 +718,15 @@ bool emberAfWindowCoveringClusterUpOrOpenCallback(app::CommandHandler * commandO EndpointId endpoint = commandPath.mEndpointId; emberAfWindowCoveringClusterPrint("UpOrOpen command received"); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeature(endpoint, WcFeature::kLift)) { Attributes::TargetPositionLiftPercent100ths::Set(endpoint, WC_PERCENT100THS_MIN_OPEN); @@ -669,6 +748,15 @@ bool emberAfWindowCoveringClusterDownOrCloseCallback(app::CommandHandler * comma EndpointId endpoint = commandPath.mEndpointId; emberAfWindowCoveringClusterPrint("DownOrClose command received"); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeature(endpoint, WcFeature::kLift)) { Attributes::TargetPositionLiftPercent100ths::Set(endpoint, WC_PERCENT100THS_MAX_CLOSED); @@ -687,10 +775,19 @@ bool emberAfWindowCoveringClusterDownOrCloseCallback(app::CommandHandler * comma bool emberAfWindowCoveringClusterStopMotionCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::StopMotion::DecodableType & fields) { - emberAfWindowCoveringClusterPrint("StopMotion command received"); app::DataModel::Nullable current; chip::EndpointId endpoint = commandPath.mEndpointId; + emberAfWindowCoveringClusterPrint("StopMotion command received"); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeaturePaLift(endpoint)) { (void) Attributes::CurrentPositionLiftPercent100ths::Get(endpoint, current); @@ -717,7 +814,16 @@ bool emberAfWindowCoveringClusterGoToLiftValueCallback(app::CommandHandler * com EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToLiftValue Value command received"); + emberAfWindowCoveringClusterPrint("GoToLiftValue %u command received", liftValue); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeature(endpoint, WcFeature::kAbsolutePosition) && HasFeaturePaLift(endpoint)) { Attributes::TargetPositionLiftPercent100ths::Set(endpoint, LiftToPercent100ths(endpoint, liftValue)); @@ -740,15 +846,26 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler { auto & liftPercentageValue = commandData.liftPercentageValue; auto & liftPercent100thsValue = commandData.liftPercent100thsValue; + Percent100ths liftPercent100ths = + liftPercent100thsValue.ValueOr(static_cast(liftPercentageValue * WC_PERCENT100THS_COEF)); EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u%% %u command received", liftPercentageValue, liftPercent100thsValue); + emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u%% %u command received", liftPercentageValue, liftPercent100ths); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeaturePaLift(endpoint)) { - if (IsPercent100thsValid(liftPercent100thsValue)) + if (IsPercent100thsValid(liftPercent100ths)) { - Attributes::TargetPositionLiftPercent100ths::Set(endpoint, liftPercent100thsValue); + Attributes::TargetPositionLiftPercent100ths::Set(endpoint, liftPercent100ths); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); } else @@ -775,7 +892,16 @@ bool emberAfWindowCoveringClusterGoToTiltValueCallback(app::CommandHandler * com EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToTiltValue command received"); + emberAfWindowCoveringClusterPrint("GoToTiltValue %u command received", tiltValue); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeature(endpoint, WcFeature::kAbsolutePosition) && HasFeaturePaTilt(endpoint)) { Attributes::TargetPositionTiltPercent100ths::Set(endpoint, TiltToPercent100ths(endpoint, tiltValue)); @@ -798,15 +924,26 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler { auto & tiltPercentageValue = commandData.tiltPercentageValue; auto & tiltPercent100thsValue = commandData.tiltPercent100thsValue; + Percent100ths tiltPercent100ths = + tiltPercent100thsValue.ValueOr(static_cast(tiltPercentageValue * WC_PERCENT100THS_COEF)); EndpointId endpoint = commandPath.mEndpointId; - emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u%% %u command received", tiltPercentageValue, tiltPercent100thsValue); + emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u%% %u command received", tiltPercentageValue, tiltPercent100ths); + + EmberAfStatus status = GetMotionLockStatus(endpoint); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + emberAfWindowCoveringClusterPrint("Err device locked"); + emberAfSendImmediateDefaultResponse(status); + return true; + } + if (HasFeaturePaTilt(endpoint)) { - if (IsPercent100thsValid(tiltPercent100thsValue)) + if (IsPercent100thsValid(tiltPercent100ths)) { - Attributes::TargetPositionTiltPercent100ths::Set(endpoint, tiltPercent100thsValue); + Attributes::TargetPositionTiltPercent100ths::Set(endpoint, tiltPercent100ths); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); } else diff --git a/src/app/clusters/window-covering-server/window-covering-server.h b/src/app/clusters/window-covering-server/window-covering-server.h index 65e6ebaf9b9948..5ec1e83a82fddc 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.h +++ b/src/app/clusters/window-covering-server/window-covering-server.h @@ -27,6 +27,7 @@ #define WC_PERCENT100THS_MIN_OPEN 0 #define WC_PERCENT100THS_MAX_CLOSED 10000 #define WC_PERCENT100THS_MIDDLE 5000 +#define WC_PERCENT100THS_COEF 100 namespace chip { namespace app { @@ -37,27 +38,6 @@ typedef DataModel::Nullable NPercent; typedef DataModel::Nullable NPercent100ths; typedef DataModel::Nullable NAbsolute; -struct Mode -{ - uint8_t motorDirReversed : 1; // bit 0 - uint8_t calibrationMode : 1; // bit 1 - uint8_t maintenanceMode : 1; // bit 2 - uint8_t ledDisplay : 1; // bit 3 -}; -static_assert(sizeof(Mode) == sizeof(uint8_t), "Mode Size is not correct"); - -struct ConfigStatus -{ - uint8_t operational : 1; // bit 0 M - uint8_t online : 1; // bit 1 M - uint8_t liftIsReversed : 1; // bit 2 LF - uint8_t liftIsPA : 1; // bit 3 LF & PA - uint8_t tiltIsPA : 1; // bit 4 TL & PA - uint8_t liftIsEncoderControlled : 1; // bit 5 LF & PA - uint8_t tiltIsEncoderControlled : 1; // bit 6 LF & PA -}; -static_assert(sizeof(ConfigStatus) == sizeof(uint8_t), "ConfigStatus Size is not correct"); - // Match directly with OperationalStatus 2 bits Fields enum class OperationalState : uint8_t { @@ -117,8 +97,10 @@ bool HasFeaturePaTilt(chip::EndpointId endpoint); void TypeSet(chip::EndpointId endpoint, Type type); Type TypeGet(chip::EndpointId endpoint); -void ConfigStatusSet(chip::EndpointId endpoint, const ConfigStatus & status); -const ConfigStatus ConfigStatusGet(chip::EndpointId endpoint); +void ConfigStatusPrint(const chip::BitFlags & configStatus); +void ConfigStatusSet(chip::EndpointId endpoint, const chip::BitFlags & status); +chip::BitFlags ConfigStatusGet(chip::EndpointId endpoint); +void ConfigStatusUpdateFeatures(chip::EndpointId endpoint); void OperationalStatusSet(chip::EndpointId endpoint, const OperationalStatus & status); void OperationalStatusSetWithGlobalUpdated(chip::EndpointId endpoint, OperationalStatus & status); @@ -131,8 +113,9 @@ Percent100ths ComputePercent100thsStep(OperationalState direction, Percent100ths void EndProductTypeSet(chip::EndpointId endpoint, EndProductType type); EndProductType EndProductTypeGet(chip::EndpointId endpoint); -void ModeSet(chip::EndpointId endpoint, const Mode & mode); -const Mode ModeGet(chip::EndpointId endpoint); +void ModePrint(const chip::BitFlags & mode); +void ModeSet(chip::EndpointId endpoint, chip::BitFlags & mode); +chip::BitFlags ModeGet(chip::EndpointId endpoint); void SafetyStatusSet(chip::EndpointId endpoint, SafetyStatus & status); const SafetyStatus SafetyStatusGet(chip::EndpointId endpoint); @@ -150,6 +133,8 @@ uint16_t TiltToPercent100ths(chip::EndpointId endpoint, uint16_t tilt); uint16_t Percent100thsToTilt(chip::EndpointId endpoint, uint16_t percent100ths); void TiltPositionSet(chip::EndpointId endpoint, NPercent100ths position); +EmberAfStatus GetMotionLockStatus(chip::EndpointId endpoint); + } // namespace WindowCovering } // namespace Clusters } // namespace app diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index fe086caec192b6..ff16126e6c3998 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -226,11 +226,21 @@ PICS: ## WC-Commands received - label: "Does the device implement receiving the GoToLiftPercentage command?" - id: PICS_CR_GOTOLIFTPERCENTAGE + id: CR_GOTOLIFTPERCENTAGE - label: "Does the device implement receiving the GoToTiltPercentage command?" - id: PICS_CR_GOTOTILTPERCENTAGE + id: CR_GOTOTILTPERCENTAGE + + ## WC-Other features + - label: "Does the device support reversal of lift movement?" + id: WNCV_REVERSAL + + - label: "Does the device support a calibration mode?" + id: WNCV_CALIBRATION + + - label: "Does the device support a maintenance mode?" + id: WNCV_MAINTENANCE # On/Off Cluster - label: "Does the device implement the OnOff attribute?" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_2_3.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_2_3.yaml index 35cffd62ae7fee..5de033874860c6 100644 --- a/src/app/tests/suites/certification/Test_TC_WNCV_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_WNCV_2_3.yaml @@ -17,69 +17,176 @@ name: 36.2.3. [TC-WNCV-2.3] Mode Attribute with server as DUT config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Window Covering" + endpoint: 1 tests: - - label: "Check Lift Reversal (If PICS_WNCV_REVERSAL)" - disabled: true - - - label: "TH set the Mode attribute bit0 of the DUT" - disabled: true - - - label: "TH reads ConfigStatus attribute from DUT" - disabled: true - - - label: "TH clear the Mode attribute bit0 of the DUT" - disabled: true - - - label: "TH reads ConfigStatus attribute from DUT" - disabled: true - - - label: "Check Calibration" - disabled: true - - - label: "TH set the Mode attribute bit1 of the DUT" - disabled: true - - - label: "TH reads ConfigStatus attribute from DUT" - disabled: true - - - label: "If (ConfigStatus bit0 == 0) TH sends DownOrClose command to DUT" - disabled: true - + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + ### ------------------------------------------------------ + ### Step 1x -> Check Lift Reversal (If PICS_WNCV_REVERSAL) + ## Set b0 + - label: "1a: TH set the Mode Attribute bit0 of the DUT" + command: "writeAttribute" + attribute: "Mode" + PICS: "WNCV_REVERSAL" + arguments: + value: 0x01 + + ## Value of bit2 must be 1b + - label: "1b: TH reads ConfigStatus attribute from DUT" + command: "readAttribute" + attribute: "ConfigStatus" + PICS: "WNCV_REVERSAL" + response: + constraints: + minValue: 0x04 + maxValue: 0x7F + + ## Clear b0 + - label: "1c: TH clear the Mode Attribute bit0 of the DUT" + command: "writeAttribute" + attribute: "Mode" + PICS: "WNCV_REVERSAL" + arguments: + value: 0x00 + + ## Value of bit2 must be 0b + - label: "1d: TH reads ConfigStatus attribute from DUT" + command: "readAttribute" + attribute: "ConfigStatus" + PICS: "WNCV_REVERSAL" + response: + constraints: + minValue: 0x00 + maxValue: 0x7F + + ### ------------------------------------------------------ + ### Step 2x -> Check Calibration mode + ## Set b1 + - label: "2a: TH set the Mode Attribute bit1 of the DUT" + command: "writeAttribute" + attribute: "Mode" + PICS: "WNCV_CALIBRATION" + arguments: + value: 0x02 + + ## Value of bitO can be 0b + - label: "2b: TH reads ConfigStatus attribute from DUT" + command: "readAttribute" + attribute: "ConfigStatus" + PICS: "WNCV_CALIBRATION" + response: + saveAs: configStatusValA + constraints: + minValue: 0x00 + maxValue: 0x7F + + ## If (ConfigStatus bit0 == 0) Verify DUT responds with FAILURE (value 0x01) status response - label: - "Clear the Mode attribute bit1 by perforimg a calibration of the DUT. - Refer to manufacturer provided instructions for how a calibration is - performed." - disabled: true - - - label: "TH reads ConfigStatus attribute from DUT" - disabled: true - - - label: "TH reads Mode attribute from DUT" - disabled: true - - - label: "TH sends DownOrClose command to DUT" - disabled: true - - - label: "Check Maintenance (If PICS_WNCV_MAINTENANCE)" - disabled: true - - - label: "TH set the Mode attribute bit2 of the DUT" - disabled: true - - - label: "TH sends DownOrClose command to DUT" - disabled: true - - - label: "TH reads ConfigStatus attribute from DUT" - disabled: true - - - label: "TH clear the Mode attribute bit2 of the DUT" - disabled: true - - - label: "TH sends DownOrClose command to DUT" - disabled: true - - - label: "TH reads ConfigStatus attribute from DUT" - disabled: true + "2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the + DUT" + command: "DownOrClose" + PICS: "WNCV_CALIBRATION" + response: + error: FAILURE + + ## Clear b1 + - label: "2d: TH clear the Mode Attribute bit1 of the DUT" + command: "writeAttribute" + attribute: "Mode" + PICS: "WNCV_CALIBRATION" + arguments: + value: 0x00 + + ## Value of bitO must be 1b + - label: "2e: TH reads ConfigStatus attribute from DUT" + command: "readAttribute" + attribute: "ConfigStatus" + PICS: "WNCV_CALIBRATION" + response: + constraints: + minValue: 0x01 + maxValue: 0x7F + + ## Value of bit1 must be 0b + - label: "2f: TH reads the Mode Attribute from the DUT" + command: "readAttribute" + attribute: "Mode" + PICS: "WNCV_CALIBRATION" + response: + constraints: + minValue: 0x00 + maxValue: 0x7F + + ## Verify DUT responds with SUCCESS status response + - label: "2g: TH send DownOrClose command to the DUT" + command: "DownOrClose" + PICS: "WNCV_CALIBRATION" + + ### ------------------------------------------------------ + ### Step 3x -> Check Maintenance mode + ## Set b2 + - label: "3a: TH set the Mode Attribute bit2 of the DUT" + command: "writeAttribute" + attribute: "Mode" + PICS: "WNCV_MAINTENANCE" + arguments: + value: 0x04 + + ## Value of bitO must be 0b + - label: "3c: TH reads ConfigStatus attribute from DUT" + command: "readAttribute" + PICS: "WNCV_MAINTENANCE" + attribute: "ConfigStatus" + response: + saveAs: configStatusValB + constraints: + minValue: 0x00 + maxValue: 0x7F + + ## If Verify DUT responds with BUSY (value 0x9c) status response + - label: "3c: TH send DownOrClose command to the DUT" + command: "DownOrClose" + PICS: "WNCV_MAINTENANCE" + response: + error: BUSY + + ## Clear b2 + - label: "3d: TH clear the Mode Attribute bit2 of the DUT" + command: "writeAttribute" + attribute: "Mode" + PICS: "WNCV_MAINTENANCE" + arguments: + value: 0x00 + + ## Value of bitO must be 1b + - label: "3e: TH reads ConfigStatus attribute from DUT" + command: "readAttribute" + attribute: "ConfigStatus" + PICS: "WNCV_MAINTENANCE" + response: + constraints: + minValue: 0x01 + maxValue: 0x7F + + ## Value of bit2 must be 0b + - label: "3f: TH reads the Mode Attribute from the DUT" + command: "readAttribute" + attribute: "Mode" + PICS: "WNCV_MAINTENANCE" + response: + constraints: + minValue: 0x00 + maxValue: 0x7F + + ## Verify DUT responds with SUCCESS status response + - label: "3g: TH send DownOrClose command to the DUT" + command: "DownOrClose" + PICS: "WNCV_MAINTENANCE" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml index 7dd23cc07d8055..6ef4fd9a312deb 100644 --- a/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml @@ -65,7 +65,7 @@ tests: ### Step 2x -> Check GoToLiftPercentage 25% Long-Run effects - label: "2a: TH sends GoToLiftPercentage command with 25 percent to DUT" command: "GoToLiftPercentage" - PICS: "WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE" + PICS: "WNCV_LF && CR_GOTOLIFTPERCENTAGE" arguments: values: - name: "liftPercent100thsValue" @@ -135,7 +135,7 @@ tests: ### Step 4x -> Check GoToLiftPercentage 75.20% Long-Run effects - label: "4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT" command: "GoToLiftPercentage" - PICS: "WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE" + PICS: "WNCV_LF && CR_GOTOLIFTPERCENTAGE" arguments: values: - name: "liftPercent100thsValue" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml index d0b1cd2cb26273..cee4c7380c49d9 100644 --- a/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml @@ -65,7 +65,7 @@ tests: ### Step 2x -> Check GoToTiltPercentage 30% Long-Run effects - label: "2a: TH sends GoToTiltPercentage command with 30 percent to DUT" command: "GoToTiltPercentage" - PICS: "WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE" + PICS: "WNCV_TL && CR_GOTOTILTPERCENTAGE" arguments: values: - name: "tiltPercent100thsValue" @@ -135,7 +135,7 @@ tests: ### Step 4x -> Check GoToTiltPercentage 60.20% Long-Run effects - label: "4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT" command: "GoToTiltPercentage" - PICS: "WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE" + PICS: "WNCV_TL && CR_GOTOTILTPERCENTAGE" arguments: values: - name: "tiltPercent100thsValue" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml index 5520094206a847..b3bb217a7d9b76 100644 --- a/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml @@ -70,7 +70,7 @@ tests: - label: "2b: TH sends GoToLiftPercentage command with BadParam to DUT" command: "GoToLiftPercentage" - PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE + PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE arguments: values: - name: "LiftPercent100thsValue" @@ -84,7 +84,7 @@ tests: ### Step 3x -> Verify the GoToLiftPercentage with 10001 as param - label: "3a: TH sends GoToLiftPercentage command with 10001 to DUT" command: "GoToLiftPercentage" - PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE + PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE arguments: values: - name: "LiftPercent100thsValue" @@ -98,7 +98,7 @@ tests: ### Step 4x -> Verify the GoToLiftPercentage with 0xFFFF as param - label: "4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT" command: "GoToLiftPercentage" - PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE + PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE arguments: values: - name: "LiftPercent100thsValue" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml index cf11a0093a52dc..a74f3d86c641a7 100644 --- a/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml @@ -70,7 +70,7 @@ tests: - label: "2b: TH sends GoToTiltPercentage command with BadParam to DUT" command: "GoToTiltPercentage" - PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE + PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE arguments: values: - name: "TiltPercent100thsValue" @@ -84,7 +84,7 @@ tests: ### Step 3x -> Verify the GoToTiltPercentage with 10001 as param - label: "3a: TH sends GoToTiltPercentage command with 10001 to DUT" command: "GoToTiltPercentage" - PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE + PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE arguments: values: - name: "TiltPercent100thsValue" @@ -98,7 +98,7 @@ tests: ### Step 4x -> Verify the GoToTiltPercentage with 0xFFFF as param - label: "4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT" command: "GoToTiltPercentage" - PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE + PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE arguments: values: - name: "TiltPercent100thsValue" diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 284392adf0538b..e1fc672fc6f74a 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -53,13 +53,16 @@ WNCV_LF=1 WNCV_PA_LF=1 WNCV_TL=1 WNCV_PA_TL=1 +WNCV_CALIBRATION=1 +WNCV_MAINTENANCE=1 +WNCV_REVERSAL=1 A_TYPE=1 A_CONFIGSTATUS=1 A_ENDPRODUCTTYPE=1 A_CURRENTPOSITIONLIFTPERCENTAGE=1 A_CURRENTPOSITIONTILTPERCENTAGE=1 -PICS_CR_GOTOLIFTPERCENTAGE=1 -PICS_CR_GOTOTILTPERCENTAGE=1 +CR_GOTOLIFTPERCENTAGE=1 +CR_GOTOTILTPERCENTAGE=1 A_ONOFF=1 A_GLOBALSCENECONTROL=1 A_ONTIME=1 diff --git a/src/app/tests/suites/include/ConstraintsChecker.h b/src/app/tests/suites/include/ConstraintsChecker.h index 0ef172376a11e0..7ac43270bfef2b 100644 --- a/src/app/tests/suites/include/ConstraintsChecker.h +++ b/src/app/tests/suites/include/ConstraintsChecker.h @@ -207,6 +207,18 @@ class ConstraintsChecker return CheckConstraintMinValue(itemName, chip::to_underlying(current), expected); } + template + bool CheckConstraintMinValue(const char * itemName, chip::BitFlags current, U expected) + { + if (current.Raw() < expected) + { + Exit(std::string(itemName) + " value < minValue: " + std::to_string(current.Raw()) + " < " + std::to_string(expected)); + return false; + } + + return true; + } + template bool CheckConstraintMinValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) { @@ -235,6 +247,18 @@ class ConstraintsChecker return CheckConstraintMaxValue(itemName, chip::to_underlying(current), expected); } + template + bool CheckConstraintMaxValue(const char * itemName, chip::BitFlags current, U expected) + { + if (current.Raw() > expected) + { + Exit(std::string(itemName) + " value > maxValue: " + std::to_string(current.Raw()) + " > " + std::to_string(expected)); + return false; + } + + return true; + } + template bool CheckConstraintMaxValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) { @@ -275,6 +299,19 @@ class ConstraintsChecker return true; } + template + bool CheckConstraintNotValue(const char * itemName, chip::BitFlags current, U expected) + { + if (current.Raw() == expected) + { + + Exit(std::string(itemName) + " got unexpected value: " + std::to_string(current.Raw())); + return false; + } + + return true; + } + template bool CheckConstraintNotValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) { diff --git a/src/app/zap-templates/zcl/data-model/chip/window-covering.xml b/src/app/zap-templates/zcl/data-model/chip/window-covering.xml index 33b76d926bc687..de556f9535bfc6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/window-covering.xml +++ b/src/app/zap-templates/zcl/data-model/chip/window-covering.xml @@ -49,7 +49,7 @@ limitations under the License. NumberOfActuationsTilt - ConfigStatus + ConfigStatus CurrentPositionLiftPercentage @@ -79,7 +79,7 @@ limitations under the License. - + Mode @@ -110,7 +110,7 @@ limitations under the License. Go to lift percentage specified - + @@ -121,7 +121,7 @@ limitations under the License. Go to tilt percentage specified - + @@ -171,7 +171,7 @@ limitations under the License. - + @@ -186,11 +186,11 @@ limitations under the License. - + - - + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 613ba5cf52c429..cb8a42792c0d56 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4160,16 +4160,23 @@ client cluster WindowCovering = 258 { kUnknown = 255; } - bitmap WcConfigStatus : BITMAP8 { + bitmap ConfigStatus : BITMAP8 { kOperational = 0x1; - kOnline = 0x2; - kOpenAndUpCommandsReversed = 0x4; + kOnlineReserved = 0x2; + kLiftMovementReversed = 0x4; kLiftPositionAware = 0x8; kTiltPositionAware = 0x10; kLiftEncoderControlled = 0x20; kTiltEncoderControlled = 0x40; } + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + bitmap WcFeature : BITMAP32 { kLift = 0x1; kTilt = 0x2; @@ -4178,13 +4185,6 @@ client cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcMode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - bitmap WcOperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; @@ -4209,7 +4209,7 @@ client cluster WindowCovering = 258 { readonly attribute Type type = 0; readonly attribute nullable int16u currentPositionLift = 3; readonly attribute nullable int16u currentPositionTilt = 4; - readonly attribute bitmap8 configStatus = 7; + readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; readonly attribute bitmap8 operationalStatus = 10; @@ -4222,7 +4222,7 @@ client cluster WindowCovering = 258 { readonly attribute int16u installedClosedLimitLift = 17; readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; - attribute access(write: manage) bitmap8 mode = 23; + attribute access(write: manage) Mode mode = 23; readonly attribute bitmap16 safetyStatus = 26; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -4236,7 +4236,7 @@ client cluster WindowCovering = 258 { request struct GoToLiftPercentageRequest { Percent liftPercentageValue = 0; - Percent100ths liftPercent100thsValue = 1; + optional Percent100ths liftPercent100thsValue = 1; } request struct GoToTiltValueRequest { @@ -4245,7 +4245,7 @@ client cluster WindowCovering = 258 { request struct GoToTiltPercentageRequest { Percent tiltPercentageValue = 0; - Percent100ths tiltPercent100thsValue = 1; + optional Percent100ths tiltPercent100thsValue = 1; } command UpOrOpen(): DefaultSuccess = 0; diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 2de59fd1f3dd10..b1627ce95c6069 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -16889,7 +16889,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + cppValue.Raw(), value); return value; } case Attributes::CurrentPositionLiftPercentage::Id: { @@ -17126,7 +17126,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + cppValue.Raw(), value); return value; } case Attributes::SafetyStatus::Id: { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index d862b304cc31f8..0e573acca23b2b 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -21975,7 +21975,7 @@ public void downOrClose(DefaultClusterCallback callback, int timedInvokeTimeoutM public void goToLiftPercentage( DefaultClusterCallback callback, Integer liftPercentageValue, - Integer liftPercent100thsValue) { + Optional liftPercent100thsValue) { goToLiftPercentage( chipClusterPtr, callback, liftPercentageValue, liftPercent100thsValue, null); } @@ -21983,7 +21983,7 @@ public void goToLiftPercentage( public void goToLiftPercentage( DefaultClusterCallback callback, Integer liftPercentageValue, - Integer liftPercent100thsValue, + Optional liftPercent100thsValue, int timedInvokeTimeoutMs) { goToLiftPercentage( chipClusterPtr, @@ -22005,7 +22005,7 @@ public void goToLiftValue( public void goToTiltPercentage( DefaultClusterCallback callback, Integer tiltPercentageValue, - Integer tiltPercent100thsValue) { + Optional tiltPercent100thsValue) { goToTiltPercentage( chipClusterPtr, callback, tiltPercentageValue, tiltPercent100thsValue, null); } @@ -22013,7 +22013,7 @@ public void goToTiltPercentage( public void goToTiltPercentage( DefaultClusterCallback callback, Integer tiltPercentageValue, - Integer tiltPercent100thsValue, + Optional tiltPercent100thsValue, int timedInvokeTimeoutMs) { goToTiltPercentage( chipClusterPtr, @@ -22059,7 +22059,7 @@ private native void goToLiftPercentage( long chipClusterPtr, DefaultClusterCallback Callback, Integer liftPercentageValue, - Integer liftPercent100thsValue, + Optional liftPercent100thsValue, @Nullable Integer timedInvokeTimeoutMs); private native void goToLiftValue( @@ -22072,7 +22072,7 @@ private native void goToTiltPercentage( long chipClusterPtr, DefaultClusterCallback Callback, Integer tiltPercentageValue, - Integer tiltPercent100thsValue, + Optional tiltPercent100thsValue, @Nullable Integer timedInvokeTimeoutMs); private native void goToTiltValue( diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 94b35eae89f654..13d569ff343e84 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -11882,7 +11882,7 @@ public Map> getCommandMap() { CommandParameterInfo windowCoveringgoToLiftPercentageliftPercent100thsValueCommandParameterInfo = - new CommandParameterInfo("liftPercent100thsValue", Integer.class); + new CommandParameterInfo("liftPercent100thsValue", Optional.class); windowCoveringgoToLiftPercentageCommandParams.put( "liftPercent100thsValue", windowCoveringgoToLiftPercentageliftPercent100thsValueCommandParameterInfo); @@ -11894,7 +11894,7 @@ public Map> getCommandMap() { .goToLiftPercentage( (DefaultClusterCallback) callback, (Integer) commandArguments.get("liftPercentageValue"), - (Integer) commandArguments.get("liftPercent100thsValue")); + (Optional) commandArguments.get("liftPercent100thsValue")); }, () -> new DelegatedDefaultClusterCallback(), windowCoveringgoToLiftPercentageCommandParams); @@ -11929,7 +11929,7 @@ public Map> getCommandMap() { CommandParameterInfo windowCoveringgoToTiltPercentagetiltPercent100thsValueCommandParameterInfo = - new CommandParameterInfo("tiltPercent100thsValue", Integer.class); + new CommandParameterInfo("tiltPercent100thsValue", Optional.class); windowCoveringgoToTiltPercentageCommandParams.put( "tiltPercent100thsValue", windowCoveringgoToTiltPercentagetiltPercent100thsValueCommandParameterInfo); @@ -11941,7 +11941,7 @@ public Map> getCommandMap() { .goToTiltPercentage( (DefaultClusterCallback) callback, (Integer) commandArguments.get("tiltPercentageValue"), - (Integer) commandArguments.get("tiltPercent100thsValue")); + (Optional) commandArguments.get("tiltPercent100thsValue")); }, () -> new DelegatedDefaultClusterCallback(), windowCoveringgoToTiltPercentageCommandParams); diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 5bee1d340b6f87..2fdcf4fee2e416 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -18453,11 +18453,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ ClusterObjectFieldDescriptor(Label="liftPercentageValue", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="liftPercent100thsValue", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="liftPercent100thsValue", Tag=1, Type=typing.Optional[uint]), ]) liftPercentageValue: 'uint' = 0 - liftPercent100thsValue: 'uint' = 0 + liftPercent100thsValue: 'typing.Optional[uint]' = None @dataclass class GoToTiltValue(ClusterCommand): @@ -18485,11 +18485,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ ClusterObjectFieldDescriptor(Label="tiltPercentageValue", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="tiltPercent100thsValue", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="tiltPercent100thsValue", Tag=1, Type=typing.Optional[uint]), ]) tiltPercentageValue: 'uint' = 0 - tiltPercent100thsValue: 'uint' = 0 + tiltPercent100thsValue: 'typing.Optional[uint]' = None class Attributes: diff --git a/src/darwin/Framework/CHIP/templates/tests/tests.js b/src/darwin/Framework/CHIP/templates/tests/tests.js index 6633e0649bb7f5..278ed1896d3039 100644 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests/tests.js @@ -251,6 +251,7 @@ function getTests() 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', 'Test_TC_WNCV_2_2', + 'Test_TC_WNCV_2_3', 'Test_TC_WNCV_2_4', 'Test_TC_WNCV_2_5', //'Test_TC_WNCV_3_1', diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 2dddcaba019d3e..60d80530e5f105 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -13248,7 +13248,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::CurrentPositionLiftPercentage::Id: { @@ -13415,7 +13415,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::SafetyStatus::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index c5878368729a9f..8748909ad28641 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -10422,6 +10422,54 @@ } } +void CHIPWindowCoveringConfigStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::BitFlags value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void CHIPWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void CHIPWindowCoveringModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::BitFlags value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void CHIPWindowCoveringModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void CHIPWindowCoveringGeneratedCommandListListAttributeCallbackBridge::OnSuccessFn( void * context, const chip::app::DataModel::DecodableList & value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index f2671f3b6130bf..f59a18450ef915 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -605,6 +605,9 @@ typedef void (*TestClusterNullableBitmap64AttributeCallback)( void *, const chip::app::DataModel::Nullable> &); typedef void (*TestClusterNullableStructStructAttributeCallback)( void *, const chip::app::DataModel::Nullable &); +typedef void (*WindowCoveringConfigStatusAttributeCallback)(void *, + chip::BitFlags); +typedef void (*WindowCoveringModeAttributeCallback)(void *, chip::BitFlags); class CHIPDefaultSuccessCallbackBridge : public CHIPCallbackBridge { @@ -8105,6 +8108,59 @@ class CHIPWiFiNetworkDiagnosticsAttributeListListAttributeCallbackSubscriptionBr SubscriptionEstablishedHandler mEstablishedHandler; }; +class CHIPWindowCoveringConfigStatusAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPWindowCoveringConfigStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::BitFlags value); +}; + +class CHIPWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge + : public CHIPWindowCoveringConfigStatusAttributeCallbackBridge +{ +public: + CHIPWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPWindowCoveringConfigStatusAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class CHIPWindowCoveringModeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPWindowCoveringModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::BitFlags value); +}; + +class CHIPWindowCoveringModeAttributeCallbackSubscriptionBridge : public CHIPWindowCoveringModeAttributeCallbackBridge +{ +public: + CHIPWindowCoveringModeAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPWindowCoveringModeAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class CHIPWindowCoveringGeneratedCommandListListAttributeCallbackBridge : public CHIPCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 2bf6f422cf1a1d..ee66a6c23f1658 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -16070,14 +16070,21 @@ typedef NS_ENUM(uint8_t, CHIPWindowCoveringType) { CHIPWindowCoveringTypeUnknown = 0xFF, }; -typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcConfigStatus) { - CHIPWindowCoveringWcConfigStatusOperational = 0x1, - CHIPWindowCoveringWcConfigStatusOnline = 0x2, - CHIPWindowCoveringWcConfigStatusOpenAndUpCommandsReversed = 0x4, - CHIPWindowCoveringWcConfigStatusLiftPositionAware = 0x8, - CHIPWindowCoveringWcConfigStatusTiltPositionAware = 0x10, - CHIPWindowCoveringWcConfigStatusLiftEncoderControlled = 0x20, - CHIPWindowCoveringWcConfigStatusTiltEncoderControlled = 0x40, +typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringConfigStatus) { + CHIPWindowCoveringConfigStatusOperational = 0x1, + CHIPWindowCoveringConfigStatusOnlineReserved = 0x2, + CHIPWindowCoveringConfigStatusLiftMovementReversed = 0x4, + CHIPWindowCoveringConfigStatusLiftPositionAware = 0x8, + CHIPWindowCoveringConfigStatusTiltPositionAware = 0x10, + CHIPWindowCoveringConfigStatusLiftEncoderControlled = 0x20, + CHIPWindowCoveringConfigStatusTiltEncoderControlled = 0x40, +}; + +typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringMode) { + CHIPWindowCoveringModeMotorDirectionReversed = 0x1, + CHIPWindowCoveringModeCalibrationMode = 0x2, + CHIPWindowCoveringModeMaintenanceMode = 0x4, + CHIPWindowCoveringModeLedFeedback = 0x8, }; typedef NS_OPTIONS(uint32_t, CHIPWindowCoveringWcFeature) { @@ -16088,13 +16095,6 @@ typedef NS_OPTIONS(uint32_t, CHIPWindowCoveringWcFeature) { CHIPWindowCoveringWcFeaturePositionAwareTilt = 0x10, }; -typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcMode) { - CHIPWindowCoveringWcModeMotorDirectionReversed = 0x1, - CHIPWindowCoveringWcModeCalibrationMode = 0x2, - CHIPWindowCoveringWcModeMaintenanceMode = 0x4, - CHIPWindowCoveringWcModeLedFeedback = 0x8, -}; - typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcOperationalStatus) { CHIPWindowCoveringWcOperationalStatusGlobal = 0x3, CHIPWindowCoveringWcOperationalStatusLift = 0xC, diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 50906b4d30db11..62392b173656ea 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -55754,7 +55754,10 @@ - (void)goToLiftPercentageWithParams:(CHIPWindowCoveringClusterGoToLiftPercentag ListFreer listFreer; WindowCovering::Commands::GoToLiftPercentage::Type request; request.liftPercentageValue = params.liftPercentageValue.unsignedCharValue; - request.liftPercent100thsValue = params.liftPercent100thsValue.unsignedShortValue; + if (params.liftPercent100thsValue != nil) { + auto & definedValue_0 = request.liftPercent100thsValue.Emplace(); + definedValue_0 = params.liftPercent100thsValue.unsignedShortValue; + } new CHIPCommandSuccessCallbackBridge( self.callbackQueue, @@ -55793,7 +55796,10 @@ - (void)goToTiltPercentageWithParams:(CHIPWindowCoveringClusterGoToTiltPercentag ListFreer listFreer; WindowCovering::Commands::GoToTiltPercentage::Type request; request.tiltPercentageValue = params.tiltPercentageValue.unsignedCharValue; - request.tiltPercent100thsValue = params.tiltPercent100thsValue.unsignedShortValue; + if (params.tiltPercent100thsValue != nil) { + auto & definedValue_0 = request.tiltPercent100thsValue.Emplace(); + definedValue_0 = params.tiltPercent100thsValue.unsignedShortValue; + } new CHIPCommandSuccessCallbackBridge( self.callbackQueue, @@ -56052,12 +56058,13 @@ new CHIPNullableInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancel - (void)readAttributeConfigStatusWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPWindowCoveringConfigStatusAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } - (void)subscribeAttributeConfigStatusWithMinInterval:(NSNumber * _Nonnull)minInterval @@ -56066,7 +56073,7 @@ - (void)subscribeAttributeConfigStatusWithMinInterval:(NSNumber * _Nonnull)minIn subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt8uAttributeCallbackSubscriptionBridge( + new CHIPWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56074,11 +56081,11 @@ new CHIPInt8uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56091,23 +56098,24 @@ + (void)readAttributeConfigStatusWithAttributeCache:(CHIPAttributeCacheContainer completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - if (attributeCacheContainer.cppAttributeCache) { - chip::app::ConcreteAttributePath path; - using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; - path.mEndpointId = static_cast([endpoint unsignedShortValue]); - path.mClusterId = TypeInfo::GetClusterId(); - path.mAttributeId = TypeInfo::GetAttributeId(); - TypeInfo::DecodableType value; - CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); - if (err == CHIP_NO_ERROR) { - successFn->mCall(successFn->mContext, value); + new CHIPWindowCoveringConfigStatusAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; } - return err; - } - return CHIP_ERROR_NOT_FOUND; - }); + return CHIP_ERROR_NOT_FOUND; + }); } - (void)readAttributeCurrentPositionLiftPercentageWithCompletionHandler:(void (^)(NSNumber * _Nullable value, @@ -56874,12 +56882,13 @@ new CHIPInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * s - (void)readAttributeModeWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPWindowCoveringModeAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } - (void)writeAttributeModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler @@ -56893,7 +56902,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -56906,7 +56915,7 @@ - (void)subscribeAttributeModeWithMinInterval:(NSNumber * _Nonnull)minInterval subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt8uAttributeCallbackSubscriptionBridge( + new CHIPWindowCoveringModeAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -56914,11 +56923,11 @@ new CHIPInt8uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPWindowCoveringModeAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -56930,7 +56939,7 @@ + (void)readAttributeModeWithAttributeCache:(CHIPAttributeCacheContainer *)attri queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + new CHIPWindowCoveringModeAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { if (attributeCacheContainer.cppAttributeCache) { chip::app::ConcreteAttributePath path; using TypeInfo = WindowCovering::Attributes::Mode::TypeInfo; @@ -56939,7 +56948,7 @@ new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * su path.mAttributeId = TypeInfo::GetAttributeId(); TypeInfo::DecodableType value; CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); if (err == CHIP_NO_ERROR) { successFn->mCall(successFn->mContext, value); } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h index 77d639f6c88c70..f960e51a1a518a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h @@ -1150,7 +1150,7 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPWindowCoveringClusterGoToLiftPercentageParams : NSObject @property (strong, nonatomic) NSNumber * _Nonnull liftPercentageValue; -@property (strong, nonatomic) NSNumber * _Nonnull liftPercent100thsValue; +@property (strong, nonatomic) NSNumber * _Nullable liftPercent100thsValue; - (instancetype)init; @end @@ -1161,7 +1161,7 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPWindowCoveringClusterGoToTiltPercentageParams : NSObject @property (strong, nonatomic) NSNumber * _Nonnull tiltPercentageValue; -@property (strong, nonatomic) NSNumber * _Nonnull tiltPercent100thsValue; +@property (strong, nonatomic) NSNumber * _Nullable tiltPercent100thsValue; - (instancetype)init; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm index 8cda13bd8c9e72..85993b02681628 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm @@ -2443,7 +2443,7 @@ - (instancetype)init _liftPercentageValue = @(0); - _liftPercent100thsValue = @(0); + _liftPercent100thsValue = nil; } return self; } @@ -2467,7 +2467,7 @@ - (instancetype)init _tiltPercentageValue = @(0); - _tiltPercent100thsValue = @(0); + _tiltPercent100thsValue = nil; } return self; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 775c7dca2f4b0d..8f3d3fbe5d0bcc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -16606,7 +16606,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index b249713640b17e..40f2321c3f51c6 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -31377,6 +31377,488 @@ - (void)testSendClusterTest_TC_WNCV_2_2_000000_WaitForCommissionee [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_WNCV_2_3_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000001_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"1a: TH set the Mode Attribute bit0 of the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"1a: TH set the Mode Attribute bit0 of the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"1b: TH reads ConfigStatus attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1b: TH reads ConfigStatus attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 4); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000003_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"1c: TH clear the Mode Attribute bit0 of the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"1c: TH clear the Mode Attribute bit0 of the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"1d: TH reads ConfigStatus attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1d: TH reads ConfigStatus attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000005_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2a: TH set the Mode Attribute bit1 of the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"2a: TH set the Mode Attribute bit1 of the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nonnull configStatusValA; +- (void)testSendClusterTest_TC_WNCV_2_3_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2b: TH reads ConfigStatus attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"2b: TH reads ConfigStatus attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + { + id actualValue = value; + configStatusValA = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000007_DownOrClose +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_FAILURE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000008_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2d: TH clear the Mode Attribute bit1 of the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"2d: TH clear the Mode Attribute bit1 of the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000009_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2e: TH reads ConfigStatus attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"2e: TH reads ConfigStatus attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2f: TH reads the Mode Attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"2f: TH reads the Mode Attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000011_DownOrClose +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2g: TH send DownOrClose command to the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"2g: TH send DownOrClose command to the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000012_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3a: TH set the Mode Attribute bit2 of the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:4]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"3a: TH set the Mode Attribute bit2 of the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nonnull configStatusValB; +- (void)testSendClusterTest_TC_WNCV_2_3_000013_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3c: TH reads ConfigStatus attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3c: TH reads ConfigStatus attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + { + id actualValue = value; + configStatusValB = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000014_DownOrClose +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3c: TH send DownOrClose command to the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"3c: TH send DownOrClose command to the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_BUSY); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000015_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3d: TH clear the Mode Attribute bit2 of the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"3d: TH clear the Mode Attribute bit2 of the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000016_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3e: TH reads ConfigStatus attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3e: TH reads ConfigStatus attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 1); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000017_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3f: TH reads the Mode Attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3f: TH reads the Mode Attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 127); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_3_000018_DownOrClose +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"3g: TH send DownOrClose command to the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"3g: TH send DownOrClose command to the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_WNCV_2_4_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index e622189bafbd20..609ea9c85d06cb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -15680,9 +15680,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace ConfigStatus { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, readable, sizeof(temp)); @@ -15694,9 +15694,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -16215,9 +16215,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace Mode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, readable, sizeof(temp)); @@ -16229,9 +16229,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index a900e0a02d8a48..a216278fd4d86f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2799,8 +2799,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace NumberOfActuationsTilt namespace ConfigStatus { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitFlags * value); // ConfigStatus +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace ConfigStatus namespace CurrentPositionLiftPercentage { @@ -2876,8 +2877,8 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace InstalledClosedLimitTilt namespace Mode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitFlags * value); // Mode +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitFlags value); } // namespace Mode namespace SafetyStatus { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 4758bc2b93a6a5..01bf61d23a09ee 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1425,16 +1425,25 @@ enum class Type : uint8_t kUnknown = 0xFF, }; -// Bitmap for WcConfigStatus -enum class WcConfigStatus : uint8_t +// Bitmap for ConfigStatus +enum class ConfigStatus : uint8_t { - kOperational = 0x1, - kOnline = 0x2, - kOpenAndUpCommandsReversed = 0x4, - kLiftPositionAware = 0x8, - kTiltPositionAware = 0x10, - kLiftEncoderControlled = 0x20, - kTiltEncoderControlled = 0x40, + kOperational = 0x1, + kOnlineReserved = 0x2, + kLiftMovementReversed = 0x4, + kLiftPositionAware = 0x8, + kTiltPositionAware = 0x10, + kLiftEncoderControlled = 0x20, + kTiltEncoderControlled = 0x40, +}; + +// Bitmap for Mode +enum class Mode : uint8_t +{ + kMotorDirectionReversed = 0x1, + kCalibrationMode = 0x2, + kMaintenanceMode = 0x4, + kLedFeedback = 0x8, }; // Bitmap for WcFeature @@ -1447,15 +1456,6 @@ enum class WcFeature : uint32_t kPositionAwareTilt = 0x10, }; -// Bitmap for WcMode -enum class WcMode : uint8_t -{ - kMotorDirectionReversed = 0x1, - kCalibrationMode = 0x2, - kMaintenanceMode = 0x4, - kLedFeedback = 0x8, -}; - // Bitmap for WcOperationalStatus enum class WcOperationalStatus : uint8_t { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 9dc9c52dd021bc..dde8ddf8b46984 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -20349,8 +20349,8 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GoToLiftPercentage::Id; } static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } - chip::Percent liftPercentageValue = static_cast(0); - chip::Percent100ths liftPercent100thsValue = static_cast(0); + chip::Percent liftPercentageValue = static_cast(0); + Optional liftPercent100thsValue; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -20365,8 +20365,8 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GoToLiftPercentage::Id; } static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } - chip::Percent liftPercentageValue = static_cast(0); - chip::Percent100ths liftPercent100thsValue = static_cast(0); + chip::Percent liftPercentageValue = static_cast(0); + Optional liftPercent100thsValue; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GoToLiftPercentage @@ -20416,8 +20416,8 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GoToTiltPercentage::Id; } static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } - chip::Percent tiltPercentageValue = static_cast(0); - chip::Percent100ths tiltPercent100thsValue = static_cast(0); + chip::Percent tiltPercentageValue = static_cast(0); + Optional tiltPercent100thsValue; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -20432,8 +20432,8 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GoToTiltPercentage::Id; } static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } - chip::Percent tiltPercentageValue = static_cast(0); - chip::Percent100ths tiltPercent100thsValue = static_cast(0); + chip::Percent tiltPercentageValue = static_cast(0); + Optional tiltPercent100thsValue; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GoToTiltPercentage @@ -20528,9 +20528,9 @@ struct TypeInfo namespace ConfigStatus { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::ConfigStatus::Id; } @@ -20684,9 +20684,9 @@ struct TypeInfo namespace Mode { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitFlags; + using DecodableType = chip::BitFlags; + using DecodableArgType = chip::BitFlags; static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::Mode::Id; } @@ -20781,7 +20781,8 @@ struct TypeInfo Attributes::CurrentPositionTilt::TypeInfo::DecodableType currentPositionTilt; Attributes::NumberOfActuationsLift::TypeInfo::DecodableType numberOfActuationsLift = static_cast(0); Attributes::NumberOfActuationsTilt::TypeInfo::DecodableType numberOfActuationsTilt = static_cast(0); - Attributes::ConfigStatus::TypeInfo::DecodableType configStatus = static_cast(0); + Attributes::ConfigStatus::TypeInfo::DecodableType configStatus = + static_cast>(0); Attributes::CurrentPositionLiftPercentage::TypeInfo::DecodableType currentPositionLiftPercentage; Attributes::CurrentPositionTiltPercentage::TypeInfo::DecodableType currentPositionTiltPercentage; Attributes::OperationalStatus::TypeInfo::DecodableType operationalStatus = static_cast(0); @@ -20795,8 +20796,8 @@ struct TypeInfo Attributes::InstalledClosedLimitLift::TypeInfo::DecodableType installedClosedLimitLift = static_cast(0); Attributes::InstalledOpenLimitTilt::TypeInfo::DecodableType installedOpenLimitTilt = static_cast(0); Attributes::InstalledClosedLimitTilt::TypeInfo::DecodableType installedClosedLimitTilt = static_cast(0); - Attributes::Mode::TypeInfo::DecodableType mode = static_cast(0); - Attributes::SafetyStatus::TypeInfo::DecodableType safetyStatus = static_cast(0); + Attributes::Mode::TypeInfo::DecodableType mode = static_cast>(0); + Attributes::SafetyStatus::TypeInfo::DecodableType safetyStatus = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::AttributeList::TypeInfo::DecodableType attributeList; diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index e8affcf2c61efb..010b0d07d5902d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -496,6 +496,20 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_COMMAND_BITS_DISABLE_ACTION_OFFSET (10) #define EMBER_AF_COMMAND_BITS_DISABLE_ACTION_WITH_DURATION (2048) #define EMBER_AF_COMMAND_BITS_DISABLE_ACTION_WITH_DURATION_OFFSET (11) +#define EMBER_AF_CONFIG_STATUS_OPERATIONAL (1) +#define EMBER_AF_CONFIG_STATUS_OPERATIONAL_OFFSET (0) +#define EMBER_AF_CONFIG_STATUS_ONLINE_RESERVED (2) +#define EMBER_AF_CONFIG_STATUS_ONLINE_RESERVED_OFFSET (1) +#define EMBER_AF_CONFIG_STATUS_LIFT_MOVEMENT_REVERSED (4) +#define EMBER_AF_CONFIG_STATUS_LIFT_MOVEMENT_REVERSED_OFFSET (2) +#define EMBER_AF_CONFIG_STATUS_LIFT_POSITION_AWARE (8) +#define EMBER_AF_CONFIG_STATUS_LIFT_POSITION_AWARE_OFFSET (3) +#define EMBER_AF_CONFIG_STATUS_TILT_POSITION_AWARE (16) +#define EMBER_AF_CONFIG_STATUS_TILT_POSITION_AWARE_OFFSET (4) +#define EMBER_AF_CONFIG_STATUS_LIFT_ENCODER_CONTROLLED (32) +#define EMBER_AF_CONFIG_STATUS_LIFT_ENCODER_CONTROLLED_OFFSET (5) +#define EMBER_AF_CONFIG_STATUS_TILT_ENCODER_CONTROLLED (64) +#define EMBER_AF_CONFIG_STATUS_TILT_ENCODER_CONTROLLED_OFFSET (6) #define EMBER_AF_CONTENT_LAUNCHER_FEATURE_CONTENT_SEARCH (1) #define EMBER_AF_CONTENT_LAUNCHER_FEATURE_CONTENT_SEARCH_OFFSET (0) #define EMBER_AF_CONTENT_LAUNCHER_FEATURE_URL_PLAYBACK (2) @@ -794,6 +808,14 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_MESSAGING_CONTROL_MASK_MESSAGE_CONFIRMATION_OFFSET (7) #define EMBER_AF_MESSAGING_EXTENDED_CONTROL_MASK_MESSAGE_CONFIRMATION_STATUS (1) #define EMBER_AF_MESSAGING_EXTENDED_CONTROL_MASK_MESSAGE_CONFIRMATION_STATUS_OFFSET (0) +#define EMBER_AF_MODE_MOTOR_DIRECTION_REVERSED (1) +#define EMBER_AF_MODE_MOTOR_DIRECTION_REVERSED_OFFSET (0) +#define EMBER_AF_MODE_CALIBRATION_MODE (2) +#define EMBER_AF_MODE_CALIBRATION_MODE_OFFSET (1) +#define EMBER_AF_MODE_MAINTENANCE_MODE (4) +#define EMBER_AF_MODE_MAINTENANCE_MODE_OFFSET (2) +#define EMBER_AF_MODE_LED_FEEDBACK (8) +#define EMBER_AF_MODE_LED_FEEDBACK_OFFSET (3) #define EMBER_AF_MODE_FOR_SEQUENCE_HEAT_SETPOINT_FIELD_PRESENT (1) #define EMBER_AF_MODE_FOR_SEQUENCE_HEAT_SETPOINT_FIELD_PRESENT_OFFSET (0) #define EMBER_AF_MODE_FOR_SEQUENCE_COOL_SETPOINT_FIELD_PRESENT (2) @@ -964,20 +986,6 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_WARNING_INFO_STROBE_OFFSET (2) #define EMBER_AF_WARNING_INFO_SIREN_LEVEL (3) #define EMBER_AF_WARNING_INFO_SIREN_LEVEL_OFFSET (0) -#define EMBER_AF_WC_CONFIG_STATUS_OPERATIONAL (1) -#define EMBER_AF_WC_CONFIG_STATUS_OPERATIONAL_OFFSET (0) -#define EMBER_AF_WC_CONFIG_STATUS_ONLINE (2) -#define EMBER_AF_WC_CONFIG_STATUS_ONLINE_OFFSET (1) -#define EMBER_AF_WC_CONFIG_STATUS_OPEN_AND_UP_COMMANDS_REVERSED (4) -#define EMBER_AF_WC_CONFIG_STATUS_OPEN_AND_UP_COMMANDS_REVERSED_OFFSET (2) -#define EMBER_AF_WC_CONFIG_STATUS_LIFT_POSITION_AWARE (8) -#define EMBER_AF_WC_CONFIG_STATUS_LIFT_POSITION_AWARE_OFFSET (3) -#define EMBER_AF_WC_CONFIG_STATUS_TILT_POSITION_AWARE (16) -#define EMBER_AF_WC_CONFIG_STATUS_TILT_POSITION_AWARE_OFFSET (4) -#define EMBER_AF_WC_CONFIG_STATUS_LIFT_ENCODER_CONTROLLED (32) -#define EMBER_AF_WC_CONFIG_STATUS_LIFT_ENCODER_CONTROLLED_OFFSET (5) -#define EMBER_AF_WC_CONFIG_STATUS_TILT_ENCODER_CONTROLLED (64) -#define EMBER_AF_WC_CONFIG_STATUS_TILT_ENCODER_CONTROLLED_OFFSET (6) #define EMBER_AF_WC_FEATURE_LIFT (1) #define EMBER_AF_WC_FEATURE_LIFT_OFFSET (0) #define EMBER_AF_WC_FEATURE_TILT (2) @@ -988,14 +996,6 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_WC_FEATURE_ABSOLUTE_POSITION_OFFSET (3) #define EMBER_AF_WC_FEATURE_POSITION_AWARE_TILT (16) #define EMBER_AF_WC_FEATURE_POSITION_AWARE_TILT_OFFSET (4) -#define EMBER_AF_WC_MODE_MOTOR_DIRECTION_REVERSED (1) -#define EMBER_AF_WC_MODE_MOTOR_DIRECTION_REVERSED_OFFSET (0) -#define EMBER_AF_WC_MODE_CALIBRATION_MODE (2) -#define EMBER_AF_WC_MODE_CALIBRATION_MODE_OFFSET (1) -#define EMBER_AF_WC_MODE_MAINTENANCE_MODE (4) -#define EMBER_AF_WC_MODE_MAINTENANCE_MODE_OFFSET (2) -#define EMBER_AF_WC_MODE_LED_FEEDBACK (8) -#define EMBER_AF_WC_MODE_LED_FEEDBACK_OFFSET (3) #define EMBER_AF_WC_OPERATIONAL_STATUS_GLOBAL (3) #define EMBER_AF_WC_OPERATIONAL_STATUS_GLOBAL_OFFSET (0) #define EMBER_AF_WC_OPERATIONAL_STATUS_LIFT (12) diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index 775c7dca2f4b0d..8f3d3fbe5d0bcc 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -16606,7 +16606,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = WindowCovering::Attributes::ConfigStatus::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 3f7418b1add5f0..c9215d8353503d 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -165,6 +165,7 @@ class TestList : public Command { printf("Test_TC_WNCV_1_1\n"); printf("Test_TC_WNCV_2_1\n"); printf("Test_TC_WNCV_2_2\n"); + printf("Test_TC_WNCV_2_3\n"); printf("Test_TC_WNCV_2_4\n"); printf("Test_TC_WNCV_2_5\n"); printf("Test_TC_WNCV_3_4\n"); @@ -42240,6 +42241,606 @@ class Test_TC_WNCV_2_2 : public TestCommandBridge { } }; +class Test_TC_WNCV_2_3 : public TestCommandBridge { +public: + Test_TC_WNCV_2_3() + : TestCommandBridge("Test_TC_WNCV_2_3") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_WNCV_2_3() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_3\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_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++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : 1a: TH set the Mode Attribute bit0 of the DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) { + NextTest(); + return; + } + err = Test1aThSetTheModeAttributeBit0OfTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) { + NextTest(); + return; + } + err = Test1bThReadsConfigStatusAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : 1c: TH clear the Mode Attribute bit0 of the DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) { + NextTest(); + return; + } + err = Test1cThClearTheModeAttributeBit0OfTheDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : 1d: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) { + NextTest(); + return; + } + err = Test1dThReadsConfigStatusAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : 2a: TH set the Mode Attribute bit1 of the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2aThSetTheModeAttributeBit1OfTheDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : 2b: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2bThReadsConfigStatusAttributeFromDut_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : 2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2cIfConfigStatusBit00ThSendDownOrCloseCommandToTheDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : 2d: TH clear the Mode Attribute bit1 of the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2dThClearTheModeAttributeBit1OfTheDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : 2e: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2eThReadsConfigStatusAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : 2f: TH reads the Mode Attribute from the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2fThReadsTheModeAttributeFromTheDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : 2g: TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { + NextTest(); + return; + } + err = Test2gThSendDownOrCloseCommandToTheDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : 3a: TH set the Mode Attribute bit2 of the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3aThSetTheModeAttributeBit2OfTheDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : 3c: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3cThReadsConfigStatusAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : 3c: TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3cThSendDownOrCloseCommandToTheDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : 3d: TH clear the Mode Attribute bit2 of the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3dThClearTheModeAttributeBit2OfTheDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : 3e: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3eThReadsConfigStatusAttributeFromDut_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : 3f: TH reads the Mode Attribute from the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3fThReadsTheModeAttributeFromTheDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : 3g: TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) { + NextTest(); + return; + } + err = Test3gThSendDownOrCloseCommandToTheDut_18(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 19; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test1aThSetTheModeAttributeBit0OfTheDut_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"1a: TH set the Mode Attribute bit0 of the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test1bThReadsConfigStatusAttributeFromDut_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1b: TH reads ConfigStatus attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("configStatus", [value unsignedCharValue], 4)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("configStatus", [value unsignedCharValue], 127)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test1cThClearTheModeAttributeBit0OfTheDut_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"1c: TH clear the Mode Attribute bit0 of the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test1dThReadsConfigStatusAttributeFromDut_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1d: TH reads ConfigStatus attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("configStatus", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("configStatus", [value unsignedCharValue], 127)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test2aThSetTheModeAttributeBit1OfTheDut_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"2a: TH set the Mode Attribute bit1 of the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull configStatusValA; + + CHIP_ERROR Test2bThReadsConfigStatusAttributeFromDut_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"2b: TH reads ConfigStatus attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("configStatus", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("configStatus", [value unsignedCharValue], 127)); + } + { + configStatusValA = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test2cIfConfigStatusBit00ThSendDownOrCloseCommandToTheDut_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test2dThClearTheModeAttributeBit1OfTheDut_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"2d: TH clear the Mode Attribute bit1 of the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test2eThReadsConfigStatusAttributeFromDut_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"2e: TH reads ConfigStatus attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("configStatus", [value unsignedCharValue], 1)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("configStatus", [value unsignedCharValue], 127)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test2fThReadsTheModeAttributeFromTheDut_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"2f: TH reads the Mode Attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("mode", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("mode", [value unsignedCharValue], 127)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test2gThSendDownOrCloseCommandToTheDut_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"2g: TH send DownOrClose command to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test3aThSetTheModeAttributeBit2OfTheDut_12() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:4]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"3a: TH set the Mode Attribute bit2 of the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull configStatusValB; + + CHIP_ERROR Test3cThReadsConfigStatusAttributeFromDut_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3c: TH reads ConfigStatus attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("configStatus", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("configStatus", [value unsignedCharValue], 127)); + } + { + configStatusValB = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test3cThSendDownOrCloseCommandToTheDut_14() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"3c: TH send DownOrClose command to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_BUSY)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test3dThClearTheModeAttributeBit2OfTheDut_15() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id modeArgument; + modeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeModeWithValue:modeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"3d: TH clear the Mode Attribute bit2 of the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test3eThReadsConfigStatusAttributeFromDut_16() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConfigStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3e: TH reads ConfigStatus attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("configStatus", [value unsignedCharValue], 1)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("configStatus", [value unsignedCharValue], 127)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test3fThReadsTheModeAttributeFromTheDut_17() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3f: TH reads the Mode Attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("mode", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("mode", [value unsignedCharValue], 127)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR Test3gThSendDownOrCloseCommandToTheDut_18() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"3g: TH send DownOrClose command to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_WNCV_2_4 : public TestCommandBridge { public: Test_TC_WNCV_2_4() @@ -43103,7 +43704,7 @@ class Test_TC_WNCV_4_3 : public TestCommandBridge { break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToLiftPercentage command with BadParam to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) { + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; } @@ -43111,7 +43712,7 @@ class Test_TC_WNCV_4_3 : public TestCommandBridge { break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToLiftPercentage command with 10001 to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) { + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; } @@ -43119,7 +43720,7 @@ class Test_TC_WNCV_4_3 : public TestCommandBridge { break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) { + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; } @@ -43335,7 +43936,7 @@ class Test_TC_WNCV_4_4 : public TestCommandBridge { break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToTiltPercentage command with BadParam to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) { + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; } @@ -43343,7 +43944,7 @@ class Test_TC_WNCV_4_4 : public TestCommandBridge { break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToTiltPercentage command with 10001 to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) { + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; } @@ -43351,7 +43952,7 @@ class Test_TC_WNCV_4_4 : public TestCommandBridge { break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) { + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; } @@ -64008,6 +64609,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index df540ac64a693d..00d77b2e2101b3 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -9431,7 +9431,7 @@ class WriteWindowCoveringMode : public WriteAttribute } private: - uint8_t mValue; + chip::BitFlags mValue; }; /*----------------------------------------------------------------------------*\ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 21e53882e1e7c2..f5655a4dd20bb7 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -9928,7 +9928,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("NumberOfActuationsTilt", 1, value); } case WindowCovering::Attributes::ConfigStatus::Id: { - uint8_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ConfigStatus", 1, value); } @@ -9993,7 +9993,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("InstalledClosedLimitTilt", 1, value); } case WindowCovering::Attributes::Mode::Id: { - uint8_t value; + chip::BitFlags value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("Mode", 1, value); } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 473002dcce8513..fad0405e40bd86 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -167,6 +167,7 @@ class TestList : public Command printf("Test_TC_WNCV_1_1\n"); printf("Test_TC_WNCV_2_1\n"); printf("Test_TC_WNCV_2_2\n"); + printf("Test_TC_WNCV_2_3\n"); printf("Test_TC_WNCV_2_4\n"); printf("Test_TC_WNCV_2_5\n"); printf("Test_TC_WNCV_3_1\n"); @@ -364,7 +365,6 @@ class ManualTestList : public Command printf("Test_TC_SWDIAG_1_2\n"); printf("Test_TC_WIFIDIAG_1_2\n"); printf("Test_TC_WIFIDIAG_2_1\n"); - printf("Test_TC_WNCV_2_3\n"); printf("Test_TC_WNCV_6_1\n"); printf("Test_TC_FLW_3_1\n"); printf("Test_TC_OCC_2_3\n"); @@ -58826,7 +58826,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context, uint8_t configStatus) + static void OnSuccessCallback_4(void * context, chip::BitFlags configStatus) { (static_cast(context))->OnSuccessResponse_4(configStatus); } @@ -58843,7 +58843,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_6(error); } - static void OnSuccessCallback_6(void * context, uint8_t configStatus) + static void OnSuccessCallback_6(void * context, chip::BitFlags configStatus) { (static_cast(context))->OnSuccessResponse_6(configStatus); } @@ -58907,7 +58907,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_13(error); } - static void OnSuccessCallback_13(void * context, uint8_t mode) + static void OnSuccessCallback_13(void * context, chip::BitFlags mode) { (static_cast(context))->OnSuccessResponse_13(mode); } @@ -58924,7 +58924,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_15(error); } - static void OnSuccessCallback_15(void * context, uint8_t mode) + static void OnSuccessCallback_15(void * context, chip::BitFlags mode) { (static_cast(context))->OnSuccessResponse_15(mode); } @@ -59392,7 +59392,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand ThrowFailureResponse(error); } - void OnSuccessResponse_4(uint8_t configStatus) + void OnSuccessResponse_4(chip::BitFlags configStatus) { VerifyOrReturn(CheckConstraintType("configStatus", "", "map8")); VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); @@ -59406,8 +59406,8 @@ class Test_TC_WNCV_2_1Suite : public TestCommand chip::Controller::WindowCoveringClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint8_t configStatusArgument; - configStatusArgument = 128; + chip::BitFlags configStatusArgument; + configStatusArgument = static_cast>(128); ReturnErrorOnFailure(cluster.WriteAttribute( configStatusArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); @@ -59440,7 +59440,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand ThrowFailureResponse(error); } - void OnSuccessResponse_6(uint8_t configStatus) + void OnSuccessResponse_6(chip::BitFlags configStatus) { VerifyOrReturn(CheckConstraintType("configStatus", "", "map8")); VerifyOrReturn(CheckConstraintNotValue("configStatus", configStatus, 128)); @@ -59611,7 +59611,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand ThrowFailureResponse(error); } - void OnSuccessResponse_13(uint8_t mode) + void OnSuccessResponse_13(chip::BitFlags mode) { VerifyOrReturn(CheckConstraintType("mode", "", "map8")); VerifyOrReturn(CheckConstraintMinValue("mode", mode, 0)); @@ -59625,8 +59625,8 @@ class Test_TC_WNCV_2_1Suite : public TestCommand chip::Controller::WindowCoveringClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint8_t modeArgument; - modeArgument = 8; + chip::BitFlags modeArgument; + modeArgument = static_cast>(8); ReturnErrorOnFailure(cluster.WriteAttribute( modeArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); @@ -59658,7 +59658,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand ThrowFailureResponse(error); } - void OnSuccessResponse_15(uint8_t mode) + void OnSuccessResponse_15(chip::BitFlags mode) { VerifyOrReturn(CheckValue("mode", mode, 8)); @@ -60750,11 +60750,11 @@ class Test_TC_WNCV_2_2Suite : public TestCommand } }; -class Test_TC_WNCV_2_4Suite : public TestCommand +class Test_TC_WNCV_2_3Suite : public TestCommand { public: - Test_TC_WNCV_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_4", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_2_3", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -60762,7 +60762,7 @@ class Test_TC_WNCV_2_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_WNCV_2_4Suite() {} + ~Test_TC_WNCV_2_3Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -60771,12 +60771,12 @@ class Test_TC_WNCV_2_4Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -60794,206 +60794,167 @@ class Test_TC_WNCV_2_4Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Type attribute from DUT\n"); - if (ShouldSkip("A_TYPE")) + ChipLogProgress(chipTool, " ***** Test Step 1 : 1a: TH set the Mode Attribute bit0 of the DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) { NextTest(); return; } - err = TestReadsTypeAttributeFromDut_1(); + err = Test1aThSetTheModeAttributeBit0OfTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads Type attribute constraints\n"); - if (ShouldSkip("A_TYPE")) + ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) { NextTest(); return; } - err = TestReadsTypeAttributeConstraints_2(); + err = Test1bThReadsConfigStatusAttributeFromDut_2(); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : 1c: TH clear the Mode Attribute bit0 of the DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) + { + NextTest(); + return; + } + err = Test1cThClearTheModeAttributeBit0OfTheDut_3(); break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::app::Clusters::WindowCovering::Type type) - { - (static_cast(context))->OnSuccessResponse_1(type); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, chip::app::Clusters::WindowCovering::Type type) - { - (static_cast(context))->OnSuccessResponse_2(type); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsTypeAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::WindowCovering::Type type) - { - VerifyOrReturn(CheckValue("type", type, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsTypeAttributeConstraints_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::app::Clusters::WindowCovering::Type type) - { - VerifyOrReturn(CheckConstraintType("type", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("type", type, 0)); - VerifyOrReturn(CheckConstraintMaxValue("type", type, 9)); - NextTest(); - } -}; - -class Test_TC_WNCV_2_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_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++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : 1d: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_REVERSAL")) + { + NextTest(); + return; + } + err = Test1dThReadsConfigStatusAttributeFromDut_4(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads EndProductType attribute from DUT\n"); - if (ShouldSkip("A_ENDPRODUCTTYPE")) + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : 2a: TH set the Mode Attribute bit1 of the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { NextTest(); return; } - err = TestReadsEndProductTypeAttributeFromDut_1(); + err = Test2aThSetTheModeAttributeBit1OfTheDut_5(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads EndProductType attribute constraints from DUT\n"); - if (ShouldSkip("A_ENDPRODUCTTYPE")) + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : 2b: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) { NextTest(); return; } - err = TestReadsEndProductTypeAttributeConstraintsFromDut_2(); + err = Test2bThReadsConfigStatusAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : 2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) + { + NextTest(); + return; + } + err = Test2cIfConfigStatusBit00ThSendDownOrCloseCommandToTheDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : 2d: TH clear the Mode Attribute bit1 of the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) + { + NextTest(); + return; + } + err = Test2dThClearTheModeAttributeBit1OfTheDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : 2e: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) + { + NextTest(); + return; + } + err = Test2eThReadsConfigStatusAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : 2f: TH reads the Mode Attribute from the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) + { + NextTest(); + return; + } + err = Test2fThReadsTheModeAttributeFromTheDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : 2g: TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_CALIBRATION")) + { + NextTest(); + return; + } + err = Test2gThSendDownOrCloseCommandToTheDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : 3a: TH set the Mode Attribute bit2 of the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3aThSetTheModeAttributeBit2OfTheDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : 3c: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3cThReadsConfigStatusAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : 3c: TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3cThSendDownOrCloseCommandToTheDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : 3d: TH clear the Mode Attribute bit2 of the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3dThClearTheModeAttributeBit2OfTheDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : 3e: TH reads ConfigStatus attribute from DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3eThReadsConfigStatusAttributeFromDut_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : 3f: TH reads the Mode Attribute from the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3fThReadsTheModeAttributeFromTheDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : 3g: TH send DownOrClose command to the DUT\n"); + if (ShouldSkip("WNCV_MAINTENANCE")) + { + NextTest(); + return; + } + err = Test3gThSendDownOrCloseCommandToTheDut_18(); break; } @@ -61011,7 +60972,867 @@ class Test_TC_WNCV_2_5Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 19; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::BitFlags configStatusValA; + chip::BitFlags configStatusValB; + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, chip::BitFlags configStatus) + { + (static_cast(context))->OnSuccessResponse_2(configStatus); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, chip::BitFlags configStatus) + { + (static_cast(context))->OnSuccessResponse_4(configStatus); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } + + static void OnFailureCallback_6(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_6(error); + } + + static void OnSuccessCallback_6(void * context, chip::BitFlags configStatus) + { + (static_cast(context))->OnSuccessResponse_6(configStatus); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } + + static void OnFailureCallback_9(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_9(error); + } + + static void OnSuccessCallback_9(void * context, chip::BitFlags configStatus) + { + (static_cast(context))->OnSuccessResponse_9(configStatus); + } + + static void OnFailureCallback_10(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_10(error); + } + + static void OnSuccessCallback_10(void * context, chip::BitFlags mode) + { + (static_cast(context))->OnSuccessResponse_10(mode); + } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } + + static void OnFailureCallback_13(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_13(error); + } + + static void OnSuccessCallback_13(void * context, chip::BitFlags configStatus) + { + (static_cast(context))->OnSuccessResponse_13(configStatus); + } + + static void OnFailureCallback_15(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_15(error); + } + + static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } + + static void OnFailureCallback_16(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_16(error); + } + + static void OnSuccessCallback_16(void * context, chip::BitFlags configStatus) + { + (static_cast(context))->OnSuccessResponse_16(configStatus); + } + + static void OnFailureCallback_17(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_17(error); + } + + static void OnSuccessCallback_17(void * context, chip::BitFlags mode) + { + (static_cast(context))->OnSuccessResponse_17(mode); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR Test1aThSetTheModeAttributeBit0OfTheDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::BitFlags modeArgument; + modeArgument = static_cast>(1); + + ReturnErrorOnFailure(cluster.WriteAttribute( + modeArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR Test1bThReadsConfigStatusAttributeFromDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_2(chip::BitFlags configStatus) + { + VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 4)); + VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); + NextTest(); + } + + CHIP_ERROR Test1cThClearTheModeAttributeBit0OfTheDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::BitFlags modeArgument; + modeArgument = static_cast>(0); + + ReturnErrorOnFailure(cluster.WriteAttribute( + modeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR Test1dThReadsConfigStatusAttributeFromDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_4(chip::BitFlags configStatus) + { + VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); + VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); + NextTest(); + } + + CHIP_ERROR Test2aThSetTheModeAttributeBit1OfTheDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::BitFlags modeArgument; + modeArgument = static_cast>(2); + + ReturnErrorOnFailure(cluster.WriteAttribute( + modeArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR Test2bThReadsConfigStatusAttributeFromDut_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_6(chip::BitFlags configStatus) + { + VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); + VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); + configStatusValA = configStatus; + NextTest(); + } + + CHIP_ERROR Test2cIfConfigStatusBit00ThSendDownOrCloseCommandToTheDut_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_7(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + } + + void OnSuccessResponse_7() { ThrowSuccessResponse(); } + + CHIP_ERROR Test2dThClearTheModeAttributeBit1OfTheDut_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::BitFlags modeArgument; + modeArgument = static_cast>(0); + + ReturnErrorOnFailure(cluster.WriteAttribute( + modeArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR Test2eThReadsConfigStatusAttributeFromDut_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_9(chip::BitFlags configStatus) + { + VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 1)); + VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); + NextTest(); + } + + CHIP_ERROR Test2fThReadsTheModeAttributeFromTheDut_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_10(chip::BitFlags mode) + { + VerifyOrReturn(CheckConstraintMinValue("mode", mode, 0)); + VerifyOrReturn(CheckConstraintMaxValue("mode", mode, 127)); + NextTest(); + } + + CHIP_ERROR Test2gThSendDownOrCloseCommandToTheDut_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_11(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR Test3aThSetTheModeAttributeBit2OfTheDut_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::BitFlags modeArgument; + modeArgument = static_cast>(4); + + ReturnErrorOnFailure(cluster.WriteAttribute( + modeArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_12() { NextTest(); } + + CHIP_ERROR Test3cThReadsConfigStatusAttributeFromDut_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_13, OnFailureCallback_13, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_13(chip::BitFlags configStatus) + { + VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); + VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); + configStatusValB = configStatus; + NextTest(); + } + + CHIP_ERROR Test3cThSendDownOrCloseCommandToTheDut_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_14(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_14(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_14(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_BUSY)); + NextTest(); + } + + void OnSuccessResponse_14() { ThrowSuccessResponse(); } + + CHIP_ERROR Test3dThClearTheModeAttributeBit2OfTheDut_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::BitFlags modeArgument; + modeArgument = static_cast>(0); + + ReturnErrorOnFailure(cluster.WriteAttribute( + modeArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_15() { NextTest(); } + + CHIP_ERROR Test3eThReadsConfigStatusAttributeFromDut_16() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_16, OnFailureCallback_16, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_16(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_16(chip::BitFlags configStatus) + { + VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 1)); + VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); + NextTest(); + } + + CHIP_ERROR Test3fThReadsTheModeAttributeFromTheDut_17() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_17, OnFailureCallback_17, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_17(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_17(chip::BitFlags mode) + { + VerifyOrReturn(CheckConstraintMinValue("mode", mode, 0)); + VerifyOrReturn(CheckConstraintMaxValue("mode", mode, 127)); + NextTest(); + } + + CHIP_ERROR Test3gThSendDownOrCloseCommandToTheDut_18() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_18(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_18(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_18(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_18() { NextTest(); } +}; + +class Test_TC_WNCV_2_4Suite : public TestCommand +{ +public: + Test_TC_WNCV_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_2_4", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_WNCV_2_4Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_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++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Type attribute from DUT\n"); + if (ShouldSkip("A_TYPE")) + { + NextTest(); + return; + } + err = TestReadsTypeAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads Type attribute constraints\n"); + if (ShouldSkip("A_TYPE")) + { + NextTest(); + return; + } + err = TestReadsTypeAttributeConstraints_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, chip::app::Clusters::WindowCovering::Type type) + { + (static_cast(context))->OnSuccessResponse_1(type); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, chip::app::Clusters::WindowCovering::Type type) + { + (static_cast(context))->OnSuccessResponse_2(type); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR TestReadsTypeAttributeFromDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_1(chip::app::Clusters::WindowCovering::Type type) + { + VerifyOrReturn(CheckValue("type", type, 0)); + + NextTest(); + } + + CHIP_ERROR TestReadsTypeAttributeConstraints_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(error); + } + + void OnSuccessResponse_2(chip::app::Clusters::WindowCovering::Type type) + { + VerifyOrReturn(CheckConstraintType("type", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("type", type, 0)); + VerifyOrReturn(CheckConstraintMaxValue("type", type, 9)); + NextTest(); + } +}; + +class Test_TC_WNCV_2_5Suite : public TestCommand +{ +public: + Test_TC_WNCV_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_2_5", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_WNCV_2_5Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_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++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads EndProductType attribute from DUT\n"); + if (ShouldSkip("A_ENDPRODUCTTYPE")) + { + NextTest(); + return; + } + err = TestReadsEndProductTypeAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads EndProductType attribute constraints from DUT\n"); + if (ShouldSkip("A_ENDPRODUCTTYPE")) + { + NextTest(); + return; + } + err = TestReadsEndProductTypeAttributeConstraintsFromDut_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -64552,7 +65373,7 @@ class Test_TC_WNCV_4_1Suite : public TestCommand break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : 2a: TH sends GoToLiftPercentage command with 25 percent to DUT\n"); - if (ShouldSkip("WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + if (ShouldSkip("WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; @@ -64583,7 +65404,7 @@ class Test_TC_WNCV_4_1Suite : public TestCommand break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : 4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT\n"); - if (ShouldSkip("WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + if (ShouldSkip("WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; @@ -64782,8 +65603,9 @@ class Test_TC_WNCV_4_1Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; RequestType request; - request.liftPercentageValue = 25; - request.liftPercent100thsValue = 2500U; + request.liftPercentageValue = 25; + request.liftPercent100thsValue.Emplace(); + request.liftPercent100thsValue.Value() = 2500U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_4(); @@ -64873,8 +65695,9 @@ class Test_TC_WNCV_4_1Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; RequestType request; - request.liftPercentageValue = 75; - request.liftPercent100thsValue = 7520U; + request.liftPercentageValue = 75; + request.liftPercent100thsValue.Emplace(); + request.liftPercent100thsValue.Value() = 7520U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_9(); @@ -64999,7 +65822,7 @@ class Test_TC_WNCV_4_2Suite : public TestCommand break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : 2a: TH sends GoToTiltPercentage command with 30 percent to DUT\n"); - if (ShouldSkip("WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + if (ShouldSkip("WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; @@ -65030,7 +65853,7 @@ class Test_TC_WNCV_4_2Suite : public TestCommand break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : 4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT\n"); - if (ShouldSkip("WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + if (ShouldSkip("WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; @@ -65229,8 +66052,9 @@ class Test_TC_WNCV_4_2Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; RequestType request; - request.tiltPercentageValue = 30; - request.tiltPercent100thsValue = 3000U; + request.tiltPercentageValue = 30; + request.tiltPercent100thsValue.Emplace(); + request.tiltPercent100thsValue.Value() = 3000U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_4(); @@ -65320,8 +66144,9 @@ class Test_TC_WNCV_4_2Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; RequestType request; - request.tiltPercentageValue = 60; - request.tiltPercent100thsValue = 6005U; + request.tiltPercentageValue = 60; + request.tiltPercent100thsValue.Emplace(); + request.tiltPercent100thsValue.Value() = 6005U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_9(); @@ -65444,7 +66269,7 @@ class Test_TC_WNCV_4_3Suite : public TestCommand break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToLiftPercentage command with BadParam to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; @@ -65453,7 +66278,7 @@ class Test_TC_WNCV_4_3Suite : public TestCommand break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToLiftPercentage command with 10001 to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; @@ -65462,7 +66287,7 @@ class Test_TC_WNCV_4_3Suite : public TestCommand break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) { NextTest(); return; @@ -65605,8 +66430,9 @@ class Test_TC_WNCV_4_3Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; RequestType request; - request.liftPercentageValue = 63; - request.liftPercent100thsValue = 12288U; + request.liftPercentageValue = 63; + request.liftPercent100thsValue.Emplace(); + request.liftPercent100thsValue.Value() = 12288U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_3(); @@ -65635,8 +66461,9 @@ class Test_TC_WNCV_4_3Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; RequestType request; - request.liftPercentageValue = 100; - request.liftPercent100thsValue = 10001U; + request.liftPercentageValue = 100; + request.liftPercent100thsValue.Emplace(); + request.liftPercent100thsValue.Value() = 10001U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_4(); @@ -65665,8 +66492,9 @@ class Test_TC_WNCV_4_3Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; RequestType request; - request.liftPercentageValue = 255; - request.liftPercent100thsValue = 65535U; + request.liftPercentageValue = 255; + request.liftPercent100thsValue.Emplace(); + request.liftPercent100thsValue.Value() = 65535U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_5(); @@ -65754,7 +66582,7 @@ class Test_TC_WNCV_4_4Suite : public TestCommand break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToTiltPercentage command with BadParam to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; @@ -65763,7 +66591,7 @@ class Test_TC_WNCV_4_4Suite : public TestCommand break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToTiltPercentage command with 10001 to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; @@ -65772,7 +66600,7 @@ class Test_TC_WNCV_4_4Suite : public TestCommand break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) { NextTest(); return; @@ -65915,8 +66743,9 @@ class Test_TC_WNCV_4_4Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; RequestType request; - request.tiltPercentageValue = 63; - request.tiltPercent100thsValue = 12288U; + request.tiltPercentageValue = 63; + request.tiltPercent100thsValue.Emplace(); + request.tiltPercent100thsValue.Value() = 12288U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_3(); @@ -65945,8 +66774,9 @@ class Test_TC_WNCV_4_4Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; RequestType request; - request.tiltPercentageValue = 100; - request.tiltPercent100thsValue = 10001U; + request.tiltPercentageValue = 100; + request.tiltPercent100thsValue.Emplace(); + request.tiltPercent100thsValue.Value() = 10001U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_4(); @@ -65975,8 +66805,9 @@ class Test_TC_WNCV_4_4Suite : public TestCommand using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; RequestType request; - request.tiltPercentageValue = 255; - request.tiltPercent100thsValue = 65535U; + request.tiltPercentageValue = 255; + request.tiltPercent100thsValue.Emplace(); + request.tiltPercent100thsValue.Value() = 65535U; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_5(); @@ -125402,89 +126233,6 @@ class Test_TC_WIFIDIAG_2_1Suite : public TestCommand // }; -class Test_TC_WNCV_2_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_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); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // -}; - class Test_TC_WNCV_6_1Suite : public TestCommand { public: @@ -126291,6 +127039,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -126477,7 +127226,6 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig),