Skip to content

Commit 629fea4

Browse files
Change nodesWithStoredData to be a property. (#37772)
1 parent c545da3 commit 629fea4

5 files changed

+8
-8
lines changed

src/darwin/Framework/CHIP/MTRDeviceController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
321321
* information. Returns empty list if the controller does not have any
322322
* information stored.
323323
*/
324-
- (NSArray<NSNumber *> *)nodesWithStoredData MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4));
324+
@property (readonly, nonatomic) NSArray<NSNumber *> * nodesWithStoredData MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4));
325325

326326
/**
327327
* Shut down the controller. Calls to shutdown after the first one are NO-OPs.

src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ typedef void (^MTRDeviceControllerDataStoreClusterDataHandler)(NSDictionary<NSNu
109109
* Returns the list of node IDs for which this data store has stored data of
110110
* some sort.
111111
*/
112-
- (NSArray<NSNumber *> *)nodesWithStoredData;
112+
@property (readonly, nonatomic) NSArray<NSNumber *> * nodesWithStoredData;
113113

114114
@end
115115

src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ - (nullable NSNumber *)neededReadPrivilegeForClusterID:(NSNumber *)clusterID att
17601760
return @[];
17611761
}
17621762

1763-
return [self.controllerDataStore nodesWithStoredData];
1763+
return self.controllerDataStore.nodesWithStoredData;
17641764
}
17651765

17661766
@end

src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -1787,9 +1787,9 @@ - (void)test010_TestDataStoreMTRDeviceWithBulkReadWrite
17871787
XCTAssertNotNil([dataStore findResumptionInfoByNodeID:deviceID]);
17881788
XCTAssertNotNil([dataStore getStoredDeviceDataForNodeID:deviceID]);
17891789
XCTAssertNotNil([dataStore getStoredClusterDataForNodeID:deviceID]);
1790-
__auto_type * nodesWithStoredData = [controller nodesWithStoredData];
1790+
__auto_type * nodesWithStoredData = controller.nodesWithStoredData;
17911791
XCTAssertTrue([nodesWithStoredData containsObject:deviceID]);
1792-
XCTAssertEqualObjects(nodesWithStoredData, [dataStore nodesWithStoredData]);
1792+
XCTAssertEqualObjects(nodesWithStoredData, dataStore.nodesWithStoredData);
17931793
XCTAssertEqualObjects(nodesWithStoredData, deviceAttributeCounts.allKeys);
17941794

17951795
[controller forgetDeviceWithNodeID:deviceID];
@@ -1798,9 +1798,9 @@ - (void)test010_TestDataStoreMTRDeviceWithBulkReadWrite
17981798
XCTAssertNil([dataStore findResumptionInfoByNodeID:deviceID]);
17991799
XCTAssertNil([dataStore getStoredDeviceDataForNodeID:deviceID]);
18001800
XCTAssertNil([dataStore getStoredClusterDataForNodeID:deviceID]);
1801-
nodesWithStoredData = [controller nodesWithStoredData];
1801+
nodesWithStoredData = controller.nodesWithStoredData;
18021802
XCTAssertFalse([nodesWithStoredData containsObject:deviceID]);
1803-
XCTAssertEqualObjects(nodesWithStoredData, [dataStore nodesWithStoredData]);
1803+
XCTAssertEqualObjects(nodesWithStoredData, dataStore.nodesWithStoredData);
18041804

18051805
[controller shutdown];
18061806
XCTAssertFalse([controller isRunning]);

src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
4444
- (nullable NSArray<NSNumber *> *)_fetchClusterIndexForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID;
4545
- (nullable MTRDeviceClusterData *)_fetchClusterDataForNodeID:(NSNumber *)nodeID endpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID;
4646
- (nullable NSDictionary<NSString *, id> *)getStoredDeviceDataForNodeID:(NSNumber *)nodeID;
47-
- (NSArray<NSNumber *> *)nodesWithStoredData;
47+
@property (readonly, nonatomic) NSArray<NSNumber *> * nodesWithStoredData;
4848
@end
4949

5050
// Declare internal methods for testing

0 commit comments

Comments
 (0)