diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_3_3.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_3_3.yaml index 6b54f1b78fc367..651420e8e5126e 100644 --- a/src/app/tests/suites/certification/Test_TC_WNCV_3_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_WNCV_3_3.yaml @@ -111,13 +111,10 @@ tests: ### Step 3x -> Verify StopMotion longer period effects on Lift ### Mandatory/Optionality Depends on (PA & LF) for all 4x Steps - # TODO Remove disabled once issue 14502 is fixed - ### Read Current Position -> Store this value for step 4c - label: "3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT" - disabled: true command: "readAttribute" attribute: "CurrentPositionLiftPercent100ths" PICS: WNCV_LF && WNCV_PA_LF @@ -132,7 +129,6 @@ tests: - label: "3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must be equal with CurrentPositionLiftPercent100ths from DUT" - disabled: true command: "readAttribute" attribute: "TargetPositionLiftPercent100ths" PICS: WNCV_LF && WNCV_PA_LF @@ -147,7 +143,6 @@ tests: - label: "4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT" - disabled: true command: "readAttribute" attribute: "CurrentPositionTiltPercent100ths" PICS: WNCV_TL && WNCV_PA_TL @@ -162,7 +157,6 @@ tests: - label: "4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must be equal with CurrentPositionTiltPercent100ths from DUT" - disabled: true command: "readAttribute" attribute: "TargetPositionTiltPercent100ths" PICS: WNCV_TL && WNCV_PA_TL diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 47d6439521c763..d68708001e06a4 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -26547,6 +26547,152 @@ - (void)testSendClusterTest_TC_WNCV_3_3_000011_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +NSNumber * _Nullable attrCurrentPositionLift; +- (void)testSendClusterTest_TC_WNCV_3_3_000012_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths 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 + readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 10000U); + } + } + { + id actualValue = value; + attrCurrentPositionLift = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_3_000013_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must be " + @"equal with CurrentPositionLiftPercent100ths 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 + readAttributeTargetPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must be equal with " + @"CurrentPositionLiftPercent100ths from DUT Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (attrCurrentPositionLift == nil) { + XCTAssertTrue(actualValue == nil); + } else { + XCTAssertFalse(actualValue == nil); + XCTAssertEqualObjects(actualValue, attrCurrentPositionLift); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nullable attrCurrentPositionTilt; +- (void)testSendClusterTest_TC_WNCV_3_3_000014_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths 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 + readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 10000U); + } + } + { + id actualValue = value; + attrCurrentPositionTilt = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_3_000015_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must be " + @"equal with CurrentPositionTiltPercent100ths 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 + readAttributeTargetPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must be equal with " + @"CurrentPositionTiltPercent100ths from DUT Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (attrCurrentPositionTilt == nil) { + XCTAssertTrue(actualValue == nil); + } else { + XCTAssertFalse(actualValue == nil); + XCTAssertEqualObjects(actualValue, attrCurrentPositionTilt); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTestCluster_000000_WaitForCommissionee { diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 7e4879da4d01c6..8b61ebdb1a1920 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -365,7 +365,7 @@ /* Endpoint: 1, Cluster: Window Covering (server), big-endian */ \ \ /* 957 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server), big-endian */ \ \ @@ -1040,7 +1040,7 @@ /* Endpoint: 1, Cluster: Window Covering (server), little-endian */ \ \ /* 957 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x00, \ + 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server), little-endian */ \ \ @@ -2470,6 +2470,9 @@ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerAttributeChangedCallback, \ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerPreAttributeChangedCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \ + (EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayPumpConfigurationAndControlServer[] = { \ (EmberAfGenericClusterFunction) emberAfPumpConfigurationAndControlClusterServerInitCallback, \ (EmberAfGenericClusterFunction) MatterPumpConfigurationAndControlClusterServerAttributeChangedCallback, \ @@ -3376,8 +3379,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(335), \ .attributeCount = 20, \ .clusterSize = 35, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayWindowCoveringServer, \ .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 159 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index d3b1f21790ff95..ddc2eb384569b7 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -46179,6 +46179,50 @@ class Test_TC_WNCV_3_3 : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 11 : 2e: TH reads OperationalStatus attribute from DUT\n"); err = Test2eThReadsOperationalStatusAttributeFromDut_11(); break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) + { + NextTest(); + return; + } + err = Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : 3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must " + "be equal with CurrentPositionLiftPercent100ths from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) + { + NextTest(); + return; + } + err = + Test3bIfPaLfThReadsTargetPositionLiftPercent100thsAttribute3cItMustBeEqualWithCurrentPositionLiftPercent100thsFromDut_13(); + break; + case 14: + ChipLogProgress( + chipTool, " ***** Test Step 14 : 4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) + { + NextTest(); + return; + } + err = Test4aIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : 4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must " + "be equal with CurrentPositionTiltPercent100ths from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) + { + NextTest(); + return; + } + err = + Test4bIfPaTlThReadsTargetPositionTiltPercent100thsAttribute4cItMustBeEqualWithCurrentPositionTiltPercent100thsFromDut_15(); + break; } if (CHIP_NO_ERROR != err) @@ -46190,11 +46234,14 @@ class Test_TC_WNCV_3_3 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 16; chip::Optional mCluster; chip::Optional mEndpoint; + chip::app::DataModel::Nullable attrCurrentPositionLift; + chip::app::DataModel::Nullable attrCurrentPositionTilt; + typedef void (*Test_Test_TC_WNCV_3_3_OperationalStatus_ReportCallback)(void * context, uint8_t value); Test_Test_TC_WNCV_3_3_OperationalStatus_ReportCallback mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported = nullptr; @@ -46247,6 +46294,50 @@ class Test_TC_WNCV_3_3 : public TestCommand (static_cast(context))->OnSuccessResponse_11(operationalStatus); } + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + (static_cast(context))->OnSuccessResponse_12(currentPositionLiftPercent100ths); + } + + static void OnFailureCallback_13(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_13(error); + } + + static void OnSuccessCallback_13(void * context, + const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) + { + (static_cast(context))->OnSuccessResponse_13(targetPositionLiftPercent100ths); + } + + static void OnFailureCallback_14(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_14(error); + } + + static void OnSuccessCallback_14(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + (static_cast(context))->OnSuccessResponse_14(currentPositionTiltPercent100ths); + } + + static void OnFailureCallback_15(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_15(error); + } + + static void OnSuccessCallback_15(void * context, + const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) + { + (static_cast(context))->OnSuccessResponse_15(targetPositionTiltPercent100ths); + } + // // Tests methods // @@ -46473,6 +46564,132 @@ class Test_TC_WNCV_3_3 : public TestCommand NextTest(); } + + CHIP_ERROR Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_12(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + VerifyOrReturn( + CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", + currentPositionLiftPercent100ths, 10000U)); + attrCurrentPositionLift = currentPositionLiftPercent100ths; + NextTest(); + } + + CHIP_ERROR + Test3bIfPaLfThReadsTargetPositionLiftPercent100thsAttribute3cItMustBeEqualWithCurrentPositionLiftPercent100thsFromDut_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)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_13(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) + { + if (attrCurrentPositionLift.IsNull()) + { + VerifyOrReturn(CheckValueNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); + } + else + { + VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); + VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", targetPositionLiftPercent100ths.Value(), + attrCurrentPositionLift.Value())); + } + + NextTest(); + } + + CHIP_ERROR Test4aIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_14(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_14(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + VerifyOrReturn( + CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", + currentPositionTiltPercent100ths, 10000U)); + attrCurrentPositionTilt = currentPositionTiltPercent100ths; + NextTest(); + } + + CHIP_ERROR + Test4bIfPaTlThReadsTargetPositionTiltPercent100thsAttribute4cItMustBeEqualWithCurrentPositionTiltPercent100thsFromDut_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_15, OnFailureCallback_15)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_15(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) + { + if (attrCurrentPositionTilt.IsNull()) + { + VerifyOrReturn(CheckValueNull("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths)); + } + else + { + VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths)); + VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", targetPositionTiltPercent100ths.Value(), + attrCurrentPositionTilt.Value())); + } + + NextTest(); + } }; class TV_TargetNavigatorCluster : public TestCommand diff --git a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h index 3aacf8d1dbc93c..521bf538e0ce3e 100644 --- a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h @@ -1511,6 +1511,9 @@ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerAttributeChangedCallback, \ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerPreAttributeChangedCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \ + (EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayThermostatServer[] = { \ (EmberAfGenericClusterFunction) emberAfThermostatClusterServerInitCallback, \ }; \ @@ -2168,8 +2171,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(271), \ .attributeCount = 19, \ .clusterSize = 31, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayWindowCoveringServer, \ .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 110 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ diff --git a/zzz_generated/window-app/zap-generated/endpoint_config.h b/zzz_generated/window-app/zap-generated/endpoint_config.h index 9f6adeff76c8e6..f5b27ee3afcad6 100644 --- a/zzz_generated/window-app/zap-generated/endpoint_config.h +++ b/zzz_generated/window-app/zap-generated/endpoint_config.h @@ -273,12 +273,12 @@ /* Endpoint: 1, Cluster: Window Covering (server), big-endian */ \ \ /* 383 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x01, \ + 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 2, Cluster: Window Covering (server), big-endian */ \ \ /* 387 - FeatureMap, */ \ - 0x00, 0x00, 0x00, 0x01, \ + 0x00, 0x00, 0x00, 0x17, \ } #else // !BIGENDIAN_CPU @@ -531,12 +531,12 @@ /* Endpoint: 1, Cluster: Window Covering (server), little-endian */ \ \ /* 383 - FeatureMap, */ \ - 0x01, 0x00, 0x00, 0x00, \ + 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: Window Covering (server), little-endian */ \ \ /* 387 - FeatureMap, */ \ - 0x01, 0x00, 0x00, 0x00, \ + 0x17, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU