Skip to content

Commit

Permalink
Adding logging
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple committed Jul 12, 2024
1 parent 4c6a612 commit 8272575
Showing 1 changed file with 8 additions and 7 deletions.
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

0 comments on commit 8272575

Please sign in to comment.