@@ -117,14 +117,14 @@ - (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSEr
117
117
@interface MTRDeviceTests : XCTestCase
118
118
119
119
+ (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)attributeId
120
- clusterId : (MTRClusterIDType)clusterId
121
- endpointId : (NSNumber *)endpointId
122
- device : (MTRDevice *)device
123
- delegate : (MTRDeviceTestDelegate *)delegate
124
- dataVersion : (NSNumber *)dataVersion
125
- attributeReport : (NSArray <NSDictionary<NSString *, id> *> *)attributeReport
126
- testcase : (XCTestCase *)testcase
127
- expectConfigurationChanged : (BOOL )expectConfigurationChanged ;
120
+ clusterId:(MTRClusterIDType)clusterId
121
+ endpointId:(NSNumber *)endpointId
122
+ device:(MTRDevice *)device
123
+ delegate:(MTRDeviceTestDelegate *)delegate
124
+ dataVersion:(NSNumber *)dataVersion
125
+ attributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport
126
+ testcase:(XCTestCase *)testcase
127
+ expectConfigurationChanged:(BOOL)expectConfigurationChanged;
128
128
129
129
@end
130
130
@@ -3063,14 +3063,14 @@ - (void)test032_MTRPathClassesEncoding
3063
3063
// device configuration changed callbacks for a given MTRDevice. This API creates a fake attribute report for the given attribute path
3064
3064
// and injects it into MTRDevice to exercise and test the delegate's device configuration changed callback.
3065
3065
+ (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)attributeId
3066
- clusterId : (MTRClusterIDType)clusterId
3067
- endpointId : (NSNumber *)endpointId
3068
- device : (MTRDevice *)device
3069
- delegate : (MTRDeviceTestDelegate *)delegate
3070
- dataVersion : (NSNumber *)dataVersion
3071
- attributeReport : (NSArray <NSDictionary<NSString *, id> *> *)attributeReport
3072
- testcase : (XCTestCase *)testcase
3073
- expectConfigurationChanged : (BOOL )expectConfigurationChanged
3066
+ clusterId:(MTRClusterIDType)clusterId
3067
+ endpointId:(NSNumber *)endpointId
3068
+ device:(MTRDevice *)device
3069
+ delegate:(MTRDeviceTestDelegate *)delegate
3070
+ dataVersion:(NSNumber *)dataVersion
3071
+ attributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport
3072
+ testcase:(XCTestCase *)testcase
3073
+ expectConfigurationChanged:(BOOL)expectConfigurationChanged
3074
3074
{
3075
3075
XCTAssertNotNil(endpointId);
3076
3076
XCTAssertNotNil(device);
@@ -3125,21 +3125,19 @@ + (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att
3125
3125
__block BOOL wasOnDeviceConfigurationChangedCallbackCalled = NO;
3126
3126
3127
3127
delegate.onDeviceConfigurationChanged = ^() {
3128
- if (expectConfigurationChanged)
3129
- {
3128
+ if (expectConfigurationChanged) {
3130
3129
[deviceConfigurationChangedExpectation fulfill];
3131
3130
}
3132
3131
wasOnDeviceConfigurationChangedCallbackCalled = YES;
3133
3132
};
3134
3133
3135
3134
[device unitTestInjectAttributeReport:attributeReport];
3136
3135
3137
- if (expectConfigurationChanged)
3138
- {
3136
+ if (expectConfigurationChanged) {
3139
3137
[testcase waitForExpectations:@[ gotAttributeReportExpectation, gotAttributeReportEndExpectation, deviceConfigurationChangedExpectation ] timeout:kTimeoutInSeconds];
3140
3138
XCTAssertTrue(wasOnDeviceConfigurationChangedCallbackCalled);
3141
3139
} else {
3142
- [testcase waitForExpectations: @[ gotAttributeReportExpectation, gotAttributeReportEndExpectation] timeout: kTimeoutInSeconds ];
3140
+ [testcase waitForExpectations:@[ gotAttributeReportExpectation, gotAttributeReportEndExpectation ] timeout:kTimeoutInSeconds];
3143
3141
XCTAssertFalse(wasOnDeviceConfigurationChangedCallbackCalled);
3144
3142
}
3145
3143
}
@@ -3427,29 +3425,30 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
3427
3425
dataVersionForPowerConfigurationSources = [NSNumber numberWithUnsignedLongLong:(dataVersionForPowerConfigurationSources.unsignedLongLongValue + 1)];
3428
3426
attributeReport = @[
3429
3427
@{
3430
- MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID: @(0 ) clusterID: @(MTRClusterIDTypeIdentifyID) attributeID: @(MTRAttributeIDTypeGlobalAttributeAttributeListID)],
3431
- MTRDataKey : @ {
3432
- MTRDataVersionKey : dataVersionForAttributeList,
3433
- MTRTypeKey : MTRArrayValueType,
3434
- MTRValueKey : unsignedIntegerArrayValue,
3435
- }
3428
+ MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)],
3429
+ MTRDataKey : @ {
3430
+ MTRDataVersionKey : dataVersionForAttributeList,
3431
+ MTRTypeKey : MTRArrayValueType,
3432
+ MTRValueKey : unsignedIntegerArrayValue,
3433
+ }
3436
3434
},
3437
3435
@{
3438
- MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID: @(0 ) clusterID: @(MTRClusterIDTypeGroupsID) attributeID: @(MTRAttributeIDTypeGlobalAttributeFeatureMapID)],
3439
- MTRDataKey : @ {
3440
- MTRDataVersionKey : dataVersionForFeatureMap,
3441
- MTRTypeKey : MTRUnsignedIntegerValueType,
3442
- MTRValueKey : @3 ,
3443
- }
3436
+ MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeGroupsID) attributeID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID)],
3437
+ MTRDataKey : @ {
3438
+ MTRDataVersionKey : dataVersionForFeatureMap,
3439
+ MTRTypeKey : MTRUnsignedIntegerValueType,
3440
+ MTRValueKey : @3,
3441
+ }
3444
3442
},
3445
3443
@{
3446
- MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID: @(0 ) clusterID: @(MTRClusterIDTypePowerSourceConfigurationID) attributeID: @(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID)],
3447
- MTRDataKey : @ {
3448
- MTRDataVersionKey : dataVersionForPowerConfigurationSources,
3449
- MTRTypeKey : MTRArrayValueType,
3450
- MTRValueKey : newUnsignedIntegerArrayValue,
3451
- }
3452
- }];
3444
+ MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID)],
3445
+ MTRDataKey : @ {
3446
+ MTRDataVersionKey : dataVersionForPowerConfigurationSources,
3447
+ MTRTypeKey : MTRArrayValueType,
3448
+ MTRValueKey : newUnsignedIntegerArrayValue,
3449
+ }
3450
+ }
3451
+ ];
3453
3452
3454
3453
XCTestExpectation * gotAttributeReportWithMultipleAttributesExpectation = [self expectationWithDescription:@"Attribute report with multiple attributes has been received"];
3455
3454
XCTestExpectation * gotAttributeReportWithMultipleAttributesEndExpectation = [self expectationWithDescription:@"Attribute report with multiple attributes has ended"];
0 commit comments