Skip to content

Commit 754a20c

Browse files
Apply suggestions from code review
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 10da082 commit 754a20c

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/darwin/Framework/CHIP/MTRDevice.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ MTR_EXTERN NSString * const MTRDataVersionKey MTR_NEWLY_AVAILABLE;
429429
*
430430
* This is called when the MTRDevice object detects a change in the device configuration.
431431
*
432-
* The intention is that after this is called, the client should re-enumerate the device topology.
432+
* The intention is that this is called whenever any of the things that usually don't change about a device might have changed.
433433
*/
434434
- (void)deviceConfigurationChanged:(MTRDevice *)device MTR_NEWLY_AVAILABLE;
435435

src/darwin/Framework/CHIP/MTRDevice.mm

+3-4
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,8 @@ @implementation MTRDevice {
372372
NSDate * _Nullable _lastSubscriptionFailureTime;
373373
MTRDeviceConnectivityMonitor * _connectivityMonitor;
374374

375-
// This boolean keeps track of any device configuration changes received in an attribute report
376-
// and when the report ends, we notify the delegate. Device configuration changes include parts list,
377-
// server list, device type list, accepted commands list, attribute list, cluster revision and feature map updates.
375+
// This boolean keeps track of any device configuration changes received in an attribute report.
376+
// If this is true when the report ends, we notify the delegate.
378377
BOOL _deviceConfigurationChanged;
379378
}
380379

@@ -1128,7 +1127,7 @@ - (void)_noteDeviceConfigurationChanged:(NSArray<NSDictionary<NSString *, id> *>
11281127
case MTRClusterDescriptorAttributeClusterRevisionID:
11291128
case MTRClusterDescriptorAttributeFeatureMapID: {
11301129
// If changes are detected, note that the device configuration has changed.
1131-
NSDictionary * cachedAttributeDataValue = [self _cachedAttributeValueForPath:attributePath];
1130+
MTRDeviceDataValueDictionary cachedAttributeDataValue = [self _cachedAttributeValueForPath:attributePath];
11321131
if (cachedAttributeDataValue != nil && ![self _attributeDataValue:attribute[MTRDataKey] isEqualToDataValue:cachedAttributeDataValue]) {
11331132
_deviceConfigurationChanged = YES;
11341133
break;

src/darwin/Framework/CHIPTests/MTRDeviceTests.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -3021,7 +3021,6 @@ - (void)test032_MTRPathClassesEncoding
30213021
XCTAssertEqualObjects(originalCommandPath, decodedCommandPath);
30223022
}
30233023

3024-
#ifdef DEBUG
30253024
- (void)test033_TestMTRDeviceDeviceConfigurationChanged
30263025
{
30273026
// Ensure the test starts with clean slate.
@@ -3063,7 +3062,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
30633062
XCTAssert(attributeReportsReceived > 0);
30643063
for (NSDictionary<NSString *, id> * attributeDict in attributeReport) {
30653064
MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey];
3066-
XCTAssert(attributePath != nil);
3065+
XCTAssertNotNil(attributePath);
30673066

30683067
XCTAssert(attributePath.cluster.unsignedLongValue == MTRClusterDescriptorID);
30693068
XCTAssert(attributePath.attribute.unsignedLongValue == MTRClusterDescriptorAttributePartsListID);

0 commit comments

Comments
 (0)