@@ -1040,9 +1040,7 @@ - (void)_handleReportBegin
1040
1040
for (MTRClusterPath * clusterPath in clusterPaths) {
1041
1041
NSNumber * dataVersion = _clusterData[clusterPath].dataVersion ;
1042
1042
NSDictionary <NSNumber *, MTRDeviceDataValueDictionary> * attributes = nil ;
1043
- #if MTRDEVICE_ATTRIBUTE_CACHE_STORE_ATTRIBUTES_BY_CLUSTER
1044
1043
attributes = [self _attributesForCluster: clusterPath];
1045
- #endif
1046
1044
if (dataVersion || attributes) {
1047
1045
MTRDeviceClusterData * clusterData = [[MTRDeviceClusterData alloc ] initWithDataVersion: dataVersion attributes: attributes];
1048
1046
clusterDataToReturn[clusterPath] = clusterData;
@@ -2340,12 +2338,6 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
2340
2338
NSMutableArray * attributesToReport = [NSMutableArray array ];
2341
2339
NSMutableArray * attributePathsToReport = [NSMutableArray array ];
2342
2340
BOOL dataStoreExists = _deviceController.controllerDataStore != nil ;
2343
- #if !MTRDEVICE_ATTRIBUTE_CACHE_STORE_ATTRIBUTES_BY_CLUSTER
2344
- NSMutableArray * attributesToPersist;
2345
- if (dataStoreExists) {
2346
- attributesToPersist = [NSMutableArray array ];
2347
- }
2348
- #endif
2349
2341
for (NSDictionary <NSString *, id > * attributeResponseValue in reportedAttributeValues) {
2350
2342
MTRAttributePath * attributePath = attributeResponseValue[MTRAttributePathKey];
2351
2343
NSDictionary * attributeDataValue = attributeResponseValue[MTRDataKey];
@@ -2388,20 +2380,7 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
2388
2380
BOOL readCacheValueChanged = ![self _attributeDataValue: attributeDataValue isEqualToDataValue: _readCache[attributePath]];
2389
2381
// Check if attribute needs to be persisted - compare only to read cache and disregard expected values
2390
2382
if (dataStoreExists && readCacheValueChanged) {
2391
- #if MTRDEVICE_ATTRIBUTE_CACHE_STORE_ATTRIBUTES_BY_CLUSTER
2392
2383
[self _noteChangeForClusterPath: clusterPath];
2393
- #else
2394
- NSDictionary * attributeResponseValueToPersist;
2395
- if (dataVersion) {
2396
- // Remove data version from what we cache in memory and storage
2397
- NSMutableDictionary * attributeResponseValueCopy = [attributeResponseValue mutableCopy ];
2398
- attributeResponseValueCopy[MTRDataKey] = attributeDataValue;
2399
- attributeResponseValueToPersist = attributeResponseValueCopy;
2400
- } else {
2401
- attributeResponseValueToPersist = attributeResponseValue;
2402
- }
2403
- [attributesToPersist addObject: attributeResponseValueToPersist];
2404
- #endif
2405
2384
}
2406
2385
NSArray * expectedValue = _expectedValueCache[attributePath];
2407
2386
@@ -2473,12 +2452,6 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
2473
2452
2474
2453
MTR_LOG_INFO (" %@ report from reported values %@" , self, attributePathsToReport);
2475
2454
2476
- #if !MTRDEVICE_ATTRIBUTE_CACHE_STORE_ATTRIBUTES_BY_CLUSTER
2477
- if (dataStoreExists && attributesToPersist.count ) {
2478
- [_deviceController.controllerDataStore storeAttributeValues: attributesToPersist forNodeID: _nodeID];
2479
- }
2480
- #endif
2481
-
2482
2455
return attributesToReport;
2483
2456
}
2484
2457
@@ -2530,7 +2503,6 @@ - (void)setClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *> *
2530
2503
2531
2504
std::lock_guard lock (_lock);
2532
2505
2533
- #if MTRDEVICE_ATTRIBUTE_CACHE_STORE_ATTRIBUTES_BY_CLUSTER
2534
2506
// For each cluster, extract and create the attribute response-value for the read cache
2535
2507
// TODO: consider some optimization in how the read cache is structured so there's fewer conversions from this format to what's in the cache
2536
2508
for (MTRClusterPath * clusterPath in clusterData) {
@@ -2548,7 +2520,6 @@ - (void)setClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *> *
2548
2520
}
2549
2521
}
2550
2522
}
2551
- #endif
2552
2523
2553
2524
[_clusterData addEntriesFromDictionary: clusterData];
2554
2525
}
0 commit comments