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

Adding logging to MTRDeviceController #34320

Merged
merged 5 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
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
15 changes: 8 additions & 7 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ - (void)shutdown
return;
}

MTR_LOG(@"Shutting down MTRDeviceController: %@", self)
[self cleanupAfterStartup];
}

Expand All @@ -306,6 +307,7 @@ - (void)cleanupAfterStartup
// do the secure session shutdowns. Since we don't want to hold the lock
// while calling out into arbitrary invalidation code, snapshot the list of
// devices before we start invalidating.
MTR_LOG(@"cleanupAfterStartup MTRDeviceController: %@", self)
os_unfair_lock_lock(&_deviceMapLock);
NSEnumerator * devices = [_nodeIDToDeviceMap objectEnumerator];
[_nodeIDToDeviceMap removeAllObjects];
Expand All @@ -323,6 +325,7 @@ - (void)cleanupAfterStartup
// in a very specific way that only MTRDeviceControllerFactory knows about.
- (void)shutDownCppController
{
MTR_LOG(@"shutDownCppController MTRDeviceController: %p", self)
assertChipStackLockedByCurrentThread();

// Shut down all our endpoints.
Expand Down Expand Up @@ -624,6 +627,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams
});
}];
}
MTR_LOG(@"MTRDeviceController startup: %@", self)

return YES;
}
Expand Down Expand Up @@ -948,8 +952,7 @@ - (void)preWarmCommissioningSession

- (MTRBaseDevice *)deviceBeingCommissionedWithNodeID:(NSNumber *)nodeID error:(NSError * __autoreleasing *)error
{
auto block = ^MTRBaseDevice *
{
auto block = ^MTRBaseDevice * {
chip::CommissioneeDeviceProxy * deviceProxy;

auto errorCode = self->_cppCommissioner->GetDeviceBeingCommissioned(nodeID.unsignedLongLongValue, &deviceProxy);
Expand Down Expand Up @@ -1108,8 +1111,7 @@ + (nullable NSData *)computePASEVerifierForSetupPasscode:(NSNumber *)setupPassco

- (NSData * _Nullable)attestationChallengeForDeviceID:(NSNumber *)deviceID
{
auto block = ^NSData *
{
auto block = ^NSData * {
chip::CommissioneeDeviceProxy * deviceProxy;

auto errorCode = CHIP_NO_ERROR;
Expand Down Expand Up @@ -1259,7 +1261,7 @@ - (BOOL)checkIsRunning:(NSError * __autoreleasing *)error
return YES;
}

MTR_LOG_ERROR("Error: %s", [kErrorNotRunning UTF8String]);
MTR_LOG_ERROR("MTRDeviceController: %@ Error: %s", self, [kErrorNotRunning UTF8String]);
if (error) {
*error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE];
}
Expand Down Expand Up @@ -1931,8 +1933,7 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID
return nil;
}

auto block = ^NSString *
{
auto block = ^NSString * {
chip::SetupPayload setupPayload;
errorCode = chip::Controller::AutoCommissioningWindowOpener::OpenCommissioningWindow(self->_cppCommissioner, deviceID,
chip::System::Clock::Seconds16(static_cast<uint16_t>(duration)), chip::Crypto::kSpake2p_Min_PBKDF_Iterations,
Expand Down
Loading