Skip to content

Commit e7a2952

Browse files
Improve logging around network technology detection in MTRDevice. (#37878)
1. Log which values get filtered on reports, so we know what's in the cache. 2. Log some state around our network features after we load information from persistent storage.
1 parent c0ee0a0 commit e7a2952

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/darwin/Framework/CHIP/MTRDevice_Concrete.mm

+18-2
Original file line numberDiff line numberDiff line change
@@ -4204,9 +4204,9 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
42044204
// When the expected value interval expires, the correct value will be reported,
42054205
// if needed.
42064206
if (expectedValue) {
4207-
MTR_LOG("%@ report %@ value filtered - expected value still present", self, attributePath);
4207+
MTR_LOG("%@ report %@ value %@ filtered - expected value still present", self, attributePath, attributeDataValue);
42084208
} else {
4209-
MTR_LOG("%@ report %@ value filtered - same as read cache", self, attributePath);
4209+
MTR_LOG("%@ report %@ value %@ filtered - same as read cache", self, attributePath, attributeDataValue);
42104210
}
42114211
}
42124212

@@ -4319,6 +4319,22 @@ - (void)_doSetPersistedClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClus
43194319

43204320
[self _updateAttributeDependentDescriptionData];
43214321

4322+
NSNumber * networkFeatures = nil;
4323+
{
4324+
std::lock_guard descriptionLock(_descriptionLock);
4325+
networkFeatures = _allNetworkFeatures;
4326+
}
4327+
4328+
if ((networkFeatures.unsignedLongLongValue & MTRNetworkCommissioningFeatureWiFiNetworkInterface) == 0 && (networkFeatures.unsignedLongLongValue & MTRNetworkCommissioningFeatureThreadNetworkInterface) == 0) {
4329+
// We had persisted data, but apparently this device does not have any
4330+
// known network technologies? Log some more information about what's
4331+
// going on.
4332+
auto * rootNetworkCommissioningPath = [MTRClusterPath clusterPathWithEndpointID:@(kRootEndpointId) clusterID:@(MTRClusterIDTypeNetworkCommissioningID)];
4333+
auto * networkCommisioningData = clusterData[rootNetworkCommissioningPath];
4334+
MTR_LOG("%@ after setting persisted data, network features: %@, root network commissioning featureMap: %@", self, networkFeatures,
4335+
networkCommisioningData.attributes[@(MTRClusterGlobalAttributeFeatureMapID)]);
4336+
}
4337+
43224338
// We have some stored data. Since we don't store data until the end of the
43234339
// initial priming report, our device cache must be primed.
43244340
_deviceCachePrimed = YES;

0 commit comments

Comments
 (0)