diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index ff2187c8e0fd61..61dbc643f5ccd1 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -1367,11 +1367,6 @@ - (void)_handleAttributeReport:(NSArray *> *)attrib [self _reportAttributes:[self _getAttributesToReportWithReportedValues:attributeReport fromSubscription:isFromSubscription]]; } -- (void)_handleAttributeReport:(NSArray *> *)attributeReport -{ - [self _handleAttributeReport:attributeReport fromSubscription:NO]; -} - #ifdef DEBUG - (void)unitTestInjectEventReport:(NSArray *> *)eventReport { @@ -1380,11 +1375,11 @@ - (void)unitTestInjectEventReport:(NSArray *> *)eve }); } -- (void)unitTestInjectAttributeReport:(NSArray *> *)attributeReport +- (void)unitTestInjectAttributeReport:(NSArray *> *)attributeReport fromSubscription:(BOOL)isFromSubscription { dispatch_async(self.queue, ^{ [self _handleReportBegin]; - [self _handleAttributeReport:attributeReport]; + [self _handleAttributeReport:attributeReport fromSubscription:isFromSubscription]; [self _handleReportEnd]; }); } @@ -2168,7 +2163,7 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) // Since the format is the same data-value dictionary, this looks like an // attribute report MTR_LOG_INFO("Read attribute work item [%llu] result: %@ [0x%016llX:%@:0x%llX:0x%llX]", workItemID, values, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - [self _handleAttributeReport:values]; + [self _handleAttributeReport:values fromSubscription:NO]; } // TODO: better retry logic diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index c05ee000b20e5f..1c2d5ddfe39a9a 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -3202,7 +3202,7 @@ + (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att wasOnDeviceConfigurationChangedCallbackCalled = YES; }; - [device unitTestInjectAttributeReport:attributeReport]; + [device unitTestInjectAttributeReport:attributeReport fromSubscription:YES]; [testcase waitForExpectations:@[ gotAttributeReportExpectation, gotAttributeReportEndExpectation, deviceConfigurationChangedExpectation ] timeout:kTimeoutInSeconds]; if (!expectConfigurationChanged) { @@ -3530,7 +3530,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged [deviceConfigurationChangedExpectationForAttributeReportWithMultipleAttributes fulfill]; }; - [device unitTestInjectAttributeReport:attributeReport]; + [device unitTestInjectAttributeReport:attributeReport fromSubscription:YES]; [self waitForExpectations:@[ gotAttributeReportWithMultipleAttributesExpectation, gotAttributeReportWithMultipleAttributesEndExpectation, deviceConfigurationChangedExpectationForAttributeReportWithMultipleAttributes ] timeout:kTimeoutInSeconds]; } diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h index 119822099ce0a3..0cf5707c05c8b4 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MTRDevice (TestDebug) - (void)unitTestInjectEventReport:(NSArray *> *)eventReport; -- (void)unitTestInjectAttributeReport:(NSArray *> *)attributeReport; +- (void)unitTestInjectAttributeReport:(NSArray *> *)attributeReport fromSubscription:(BOOL)isFromSubscription; - (NSUInteger)unitTestAttributesReportedSinceLastCheck; - (void)unitTestClearClusterData; @end