Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data version handling in test033_TestMTRDeviceDeviceConfigurationChanged #35628

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/darwin/Framework/CHIP/MTRDevice_Concrete.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,8 @@ - (void)setStorageBehaviorConfiguration:(MTRDeviceStorageBehaviorConfiguration *

- (void)_handleReportEnd
{
MTR_LOG("%@ handling report end", self);

std::lock_guard lock(_lock);
_receivingReport = NO;
_receivingPrimingReport = NO;
Expand Down Expand Up @@ -1853,6 +1855,11 @@ - (void)_reportAttributes:(NSArray<NSDictionary<NSString *, id> *> *)attributes

- (void)_handleAttributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport fromSubscription:(BOOL)isFromSubscription
{
// Note: %p to avoid double-logging the whole big structure; can be matched
// up to where we receive the attribute report, which logs pointer value and
// actual value.
MTR_LOG("%@ handling attribute report %p, fromSubscription: %@", self, attributeReport, MTR_YES_NO(isFromSubscription));

std::lock_guard lock(_lock);

// _getAttributesToReportWithReportedValues will log attribute paths reported
Expand All @@ -1863,6 +1870,7 @@ - (void)_handleAttributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attrib
- (void)_injectAttributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport fromSubscription:(BOOL)isFromSubscription
{
[_deviceController asyncDispatchToMatterQueue:^{
MTR_LOG("%@ injected attribute report (%p) %@", self, attributeReport, attributeReport);
[self _handleReportBegin];
dispatch_async(self.queue, ^{
[self _handleAttributeReport:attributeReport fromSubscription:isFromSubscription];
Expand Down Expand Up @@ -2396,7 +2404,7 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason

auto callback = std::make_unique<SubscriptionCallback>(
^(NSArray * value) {
MTR_LOG("%@ got attribute report %@", self, value);
MTR_LOG("%@ got attribute report (%p) %@", self, value, value);
dispatch_async(self.queue, ^{
// OnAttributeData
[self _handleAttributeReport:value fromSubscription:YES];
Expand Down Expand Up @@ -2823,7 +2831,7 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath)
if (values) {
// Since the format is the same data-value dictionary, this looks like an
// attribute report
MTR_LOG("Read attribute work item [%llu] result: %@ [0x%016llX:%@:0x%llX:0x%llX]", workItemID, values, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue);
MTR_LOG("Read attribute work item [%llu] result: (%p) %@ [0x%016llX:%@:0x%llX:0x%llX]", workItemID, values, values, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue);
[self _handleAttributeReport:values fromSubscription:NO];
}

Expand Down
Loading
Loading