diff --git a/examples/chip-tool-darwin/commands/pairing/Commands.h b/examples/chip-tool-darwin/commands/pairing/Commands.h index faf6c6c63d5996..dcfd6fc789c7cb 100644 --- a/examples/chip-tool-darwin/commands/pairing/Commands.h +++ b/examples/chip-tool-darwin/commands/pairing/Commands.h @@ -20,12 +20,6 @@ #include "PairingCommandBridge.h" -class Unpair : public PairingCommandBridge -{ -public: - Unpair() : PairingCommandBridge("unpair", PairingMode::None) {} -}; - class PairQRCode : public PairingCommandBridge { public: @@ -49,7 +43,6 @@ void registerCommandsPairing(Commands & commands) const char * clusterName = "Pairing"; commands_list clusterCommands = { - make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.h b/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.h index 0b273b9eeb362d..917d7e2bf9521d 100644 --- a/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.h +++ b/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.h @@ -23,7 +23,6 @@ enum class PairingMode { - None, QRCode, ManualCode, Ethernet @@ -38,8 +37,6 @@ class PairingCommandBridge : public CHIPCommandBridge switch (mode) { - case PairingMode::None: - break; case PairingMode::QRCode: AddArgument("payload", &mOnboardingPayload); break; @@ -62,7 +59,6 @@ class PairingCommandBridge : public CHIPCommandBridge private: void PairWithCode(NSError * __autoreleasing * error); void PairWithIPAddress(NSError * __autoreleasing * error); - void Unpair(NSError * __autoreleasing * error); void SetUpPairingDelegate(); const PairingMode mPairingMode; diff --git a/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.mm b/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.mm index 9059fb01fe03d1..31c2e73fffbfbd 100644 --- a/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.mm +++ b/examples/chip-tool-darwin/commands/pairing/PairingCommandBridge.mm @@ -42,9 +42,6 @@ { NSError * error; switch (mPairingMode) { - case PairingMode::None: - Unpair(&error); - break; case PairingMode::QRCode: case PairingMode::ManualCode: PairWithCode(&error); @@ -75,5 +72,3 @@ setupPINCode:mSetupPINCode error:error]; } - -void PairingCommandBridge::Unpair(NSError * __autoreleasing * error) { [CurrentCommissioner() unpairDevice:mNodeId error:error]; } diff --git a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h index 44bcf732832763..4d7a00c6c9c168 100644 --- a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h +++ b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.h @@ -30,7 +30,10 @@ id CHIPGetDomainValueForKey(NSString * domain, NSString * key); void CHIPSetDomainValueForKey(NSString * domain, NSString * key, id value); void CHIPRemoveDomainValueForKey(NSString * domain, NSString * key); uint64_t CHIPGetNextAvailableDeviceID(void); +NSString * KeyForPairedDevice(uint64_t id); +uint64_t CHIPGetLastPairedDeviceId(void); void CHIPSetNextAvailableDeviceID(uint64_t id); +void CHIPSetDevicePaired(uint64_t id, BOOL paired); BOOL CHIPIsDevicePaired(uint64_t id); BOOL CHIPGetConnectedDevice(CHIPDeviceConnectionCallback completionHandler); BOOL CHIPGetConnectedDeviceWithID(uint64_t deviceId, CHIPDeviceConnectionCallback completionHandler); diff --git a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m index 5e30ddb8e62154..26598a5b9a0044 100644 --- a/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m +++ b/src/darwin/CHIPTool/CHIPTool/Framework Helpers/DefaultsUtils.m @@ -22,6 +22,7 @@ NSString * const kNetworkPasswordDefaultsKey = @"networkPassword"; NSString * const kCHIPNextAvailableDeviceIDKey = @"nextDeviceID"; NSString * const kFabricIdKey = @"fabricId"; +NSString * const kDevicePairedKey = @"Paired"; id CHIPGetDomainValueForKey(NSString * domain, NSString * key) { @@ -115,23 +116,50 @@ BOOL CHIPGetConnectedDeviceWithID(uint64_t deviceId, CHIPDeviceConnectionCallbac BOOL CHIPIsDevicePaired(uint64_t deviceId) { - CHIPDeviceController * controller = InitializeCHIP(); + NSString * PairedString = CHIPGetDomainValueForKey(kCHIPToolDefaultsDomain, KeyForPairedDevice(deviceId)); + return [PairedString boolValue]; +} - NSError * error; - bool paired = [controller isDevicePaired:deviceId error:&error]; - if (error != nil) { - NSLog(@"Error retrieving device info for deviceId %llu", deviceId); - paired = NO; - } - return paired; +void CHIPSetDevicePaired(uint64_t deviceId, BOOL paired) +{ + CHIPSetDomainValueForKey(kCHIPToolDefaultsDomain, KeyForPairedDevice(deviceId), paired ? @"YES" : @"NO"); } +NSString * KeyForPairedDevice(uint64_t deviceId) { return [NSString stringWithFormat:@"%@%llu", kDevicePairedKey, deviceId]; } + void CHIPUnpairDeviceWithID(uint64_t deviceId) { - CHIPDeviceController * controller = InitializeCHIP(); - - NSError * error; - [controller unpairDevice:deviceId error:&error]; + CHIPSetDevicePaired(deviceId, NO); + CHIPGetConnectedDeviceWithID(deviceId, ^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to unpair device %llu still removing from CHIPTool. %@", deviceId, error); + return; + } + NSLog(@"Attempting to unpair device %llu", deviceId); + CHIPOperationalCredentials * opCredsCluster = [[CHIPOperationalCredentials alloc] initWithDevice:device + endpoint:0 + queue:dispatch_get_main_queue()]; + [opCredsCluster + readAttributeCurrentFabricIndexWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to get current fabric index for device %llu still removing from CHIPTool. %@", deviceId, error); + return; + } + CHIPOperationalCredentialsClusterRemoveFabricParams * params = + [[CHIPOperationalCredentialsClusterRemoveFabricParams alloc] init]; + params.fabricIndex = value; + [opCredsCluster removeFabricWithParams:params + completionHandler:^(CHIPOperationalCredentialsClusterNOCResponseParams * _Nullable data, + NSError * _Nullable error) { + if (error) { + NSLog(@"Failed to remove current fabric index %@ for device %llu. %@", + params.fabricIndex, deviceId, error); + return; + } + NSLog(@"Successfully unpaired deviceId %llu", deviceId); + }]; + }]; + }); } @implementation CHIPToolPersistentStorageDelegate diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m index 3b32193c8477d2..9dfa89bd3f9d0a 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/Fabric/FabricUIViewController.m @@ -22,8 +22,8 @@ @interface FabricUIViewController () @property (nonatomic, strong) UILabel * commissionedFabricsLabel; @property (nonatomic, strong) UIStackView * stackView; -@property (nonatomic, strong) NSArray * fabricsList; -@property (nonatomic, strong) NSNumber * fabricID; +@property (nonatomic, strong) NSArray * fabricsList; +@property (nonatomic, strong) NSNumber * currentFabricIndex; @end @implementation FabricUIViewController @@ -34,6 +34,7 @@ - (void)viewDidLoad [super viewDidLoad]; [self setupUIElements]; + _currentFabricIndex = @(-1); [self fetchFabricsList]; // listen for taps to dismiss the keyboard @@ -69,16 +70,6 @@ - (void)setupUIElements [_stackView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:30].active = YES; [_stackView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-30].active = YES; - // Get Fabric ID - _getFabricIDLabel = [UILabel new]; - NSNumber * fabricId = CHIPGetDomainValueForKey(kCHIPToolDefaultsDomain, kFabricIdKey); - _getFabricIDLabel.text = [NSString stringWithFormat:@"FabricID: %@", fabricId]; - [_stackView addArrangedSubview:_getFabricIDLabel]; - - _getFabricIDLabel.translatesAutoresizingMaskIntoConstraints = false; - [_getFabricIDLabel.leadingAnchor constraintEqualToAnchor:_stackView.leadingAnchor].active = YES; - [_getFabricIDLabel.trailingAnchor constraintEqualToAnchor:_stackView.trailingAnchor].active = YES; - // Update Fabric Label UIButton * updateFabricLabelButton = [UIButton new]; [updateFabricLabelButton setTitle:@"Go" forState:UIControlStateNormal]; @@ -192,18 +183,18 @@ - (void)updateResult:(NSString *)result isError:(BOOL)isError _resultLabel.text = result; } -- (void)updateFabricsListUIWithFabrics:(NSArray *)fabricsList error:(NSError *)error +- (void)updateFabricsListUIWithFabrics:(NSArray *)fabricsList + error:(NSError *)error { NSMutableString * fabricsText = [NSMutableString new]; if (fabricsList) { - for (NSDictionary * fabricDict in fabricsList) { - NSNumber * fabricIndex = [fabricDict objectForKey:@"FabricIndex"]; - NSNumber * fabricId = [fabricDict objectForKey:@"FabricId"]; - NSNumber * nodeID = [fabricDict objectForKey:@"NodeId"]; - NSNumber * vendorID = [fabricDict objectForKey:@"VendorId"]; - NSData * labelData = [fabricDict objectForKey:@"Label"]; - - NSString * label = [[NSString alloc] initWithData:labelData encoding:NSUTF8StringEncoding]; + for (CHIPOperationalCredentialsClusterFabricDescriptor * fabricDescriptor in fabricsList) { + NSNumber * fabricIndex = fabricDescriptor.fabricIndex; + NSNumber * fabricId = fabricDescriptor.fabricId; + NSNumber * nodeID = fabricDescriptor.nodeId; + NSNumber * vendorID = fabricDescriptor.vendorId; + NSString * label = fabricDescriptor.label; + [fabricsText appendString:[NSString stringWithFormat:@"FabricIndex: %@\n", fabricIndex]]; [fabricsText appendString:[NSString stringWithFormat:@"FabricId: %@\n", fabricId]]; [fabricsText appendString:[NSString stringWithFormat:@"NodeId: %@\n", nodeID]]; @@ -230,6 +221,13 @@ - (void)fetchCommissionedFabricsNumber if (chipDevice) { CHIPOperationalCredentials * cluster = [[CHIPOperationalCredentials alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()]; + [cluster + readAttributeCurrentFabricIndexWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + if (!error) { + self->_currentFabricIndex = value; + } + }]; + [self updateResult:[NSString stringWithFormat:@"readAttributeCommissionedFabricsWithCompletionHandler command sent."] isError:NO]; @@ -271,7 +269,9 @@ - (void)fetchFabricsList CHIPOperationalCredentials * cluster = [[CHIPOperationalCredentials alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()]; [self updateResult:[NSString stringWithFormat:@"readAttributeFabrics command sent."] isError:NO]; - [cluster readAttributeFabricsWithCompletionHandler:^(NSArray * _Nullable fabricsList, NSError * _Nullable error) { + [cluster readAttributeFabricsWithCompletionHandler:^( + NSArray * _Nullable fabricsList, + NSError * _Nullable error) { if (error) { dispatch_async(dispatch_get_main_queue(), ^{ [self updateResult:[NSString stringWithFormat:@"readAttributeFabrics command failed: %@.", error] @@ -315,8 +315,31 @@ - (IBAction)removeAllFabricsButtonPressed:(id)sender handler:^(UIAlertAction * action) { if (CHIPGetConnectedDevice(^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) { if (!chipDevice) { - [self updateResult:[NSString stringWithFormat:@"Failed to establish a connection with the device"] - isError:YES]; + [self + updateResult:[NSString + stringWithFormat:@"Failed to establish a connection with the device %@", error] + isError:YES]; + } + // Loop over the list of all fabrics and for each, call remove + for (CHIPOperationalCredentialsClusterFabricDescriptor * fabricDescriptor in self.fabricsList) { + CHIPOperationalCredentials * opCredsCluster = + [[CHIPOperationalCredentials alloc] initWithDevice:chipDevice + endpoint:0 + queue:dispatch_get_main_queue()]; + CHIPOperationalCredentialsClusterRemoveFabricParams * params = + [[CHIPOperationalCredentialsClusterRemoveFabricParams alloc] init]; + params.fabricIndex = fabricDescriptor.fabricIndex; + [opCredsCluster + removeFabricWithParams:params + completionHandler:^(CHIPOperationalCredentialsClusterNOCResponseParams * _Nullable data, + NSError * _Nullable error) { + if (!error) { + CHIPSetDevicePaired(CHIPGetLastPairedDeviceId(), NO); + } + [self updateResult:[NSString stringWithFormat:@"Removed Fabric Index %@ with Error %@", + params.fabricIndex, error] + isError:error]; + }]; } })) { [self updateResult:[NSString stringWithFormat:@"Waiting for connection with the device"] isError:NO]; @@ -359,30 +382,27 @@ - (IBAction)updateFabricLabelButtonPressed:(id)sender // via the NOCResponse response, but that // seems like a spec bug that should be fixed // in the spec. - dispatch_async(dispatch_get_main_queue(), ^{ - if (error) { - NSLog(@"Got back error trying to updateFabricLabel %@", error); - dispatch_async(dispatch_get_main_queue(), ^{ - self->_updateFabricLabelTextField.text = @""; - [self updateResult:[NSString - stringWithFormat: - @"Command updateFabricLabel failed with error %@", error] - isError:YES]; - }); - } else { - NSLog(@"Successfully updated the label: %@", response); - dispatch_async(dispatch_get_main_queue(), ^{ - self->_updateFabricLabelTextField.text = @""; - [self - updateResult:[NSString - stringWithFormat: - @"Command updateFabricLabel succeeded to update label to %@", - label] - isError:NO]; - [self fetchFabricsList]; - }); - } - }); + if (error) { + NSLog(@"Error trying to updateFabricLabel %@", error); + dispatch_async(dispatch_get_main_queue(), ^{ + self->_updateFabricLabelTextField.text = @""; + [self updateResult:[NSString + stringWithFormat:@"Command updateFabricLabel failed with error %@", + error] + isError:YES]; + }); + } else { + NSLog(@"Successfully updated the label: %@", response); + dispatch_async(dispatch_get_main_queue(), ^{ + self->_updateFabricLabelTextField.text = @""; + [self updateResult:[NSString + stringWithFormat: + @"Command updateFabricLabel succeeded to update label to %@", + label] + isError:NO]; + [self fetchFabricsList]; + }); + } }]; } else { [self updateResult:[NSString stringWithFormat:@"Failed to establish a connection with the device"] isError:YES]; @@ -396,31 +416,37 @@ - (IBAction)updateFabricLabelButtonPressed:(id)sender - (IBAction)removeFabricButtonPressed:(id)sender { - int fabricIndex = [_removeFabricTextField.text intValue]; - NSLog(@"Request to fabric at index %@", @(fabricIndex)); - if (fabricIndex < [_fabricsList count] && [_fabricsList objectAtIndex:fabricIndex]) { - NSDictionary * fabricToRemove = [_fabricsList objectAtIndex:fabricIndex]; - NSLog(@"Request to remove %@", fabricToRemove); - NSNumber * fabricId = [fabricToRemove objectForKey:@"FabricId"]; - - if (CHIPGetConnectedDevice(^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) { - if (chipDevice) { - [self updateResult:[NSString stringWithFormat:@"removeFabric command sent for fabricID %@.", fabricId] - isError:NO]; - } else { - [self updateResult:[NSString stringWithFormat:@"Failed to establish a connection with the device"] isError:YES]; - } - })) { - [self updateResult:[NSString stringWithFormat:@"Waiting for connection with the device"] isError:NO]; - } else { - [self updateResult:[NSString stringWithFormat:@"Failed to trigger the connection with the device"] isError:YES]; - } + NSNumber * fabricIndex = @([_removeFabricTextField.text intValue]); + NSLog(@"Request to fabric at index %@", fabricIndex); + if (CHIPGetConnectedDevice(^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) { + if (chipDevice) { + [self updateResult:[NSString stringWithFormat:@"removeFabric command sent for fabricIndex %@.", fabricIndex] + isError:NO]; + CHIPOperationalCredentials * opCredsCluster = + [[CHIPOperationalCredentials alloc] initWithDevice:chipDevice endpoint:0 queue:dispatch_get_main_queue()]; + CHIPOperationalCredentialsClusterRemoveFabricParams * params = + [[CHIPOperationalCredentialsClusterRemoveFabricParams alloc] init]; + params.fabricIndex = fabricIndex; + [opCredsCluster + removeFabricWithParams:params + completionHandler:^( + CHIPOperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error) { + if (!error) { + if (fabricIndex == self.currentFabricIndex) { + CHIPSetDevicePaired(CHIPGetLastPairedDeviceId(), NO); + } + } + [self updateResult:[NSString stringWithFormat:@"Finished removing fabric Index %@ with Error :%@", + fabricIndex, error] + isError:error]; + }]; + } else { + [self updateResult:[NSString stringWithFormat:@"Failed to establish a connection with the device"] isError:YES]; + } + })) { + [self updateResult:[NSString stringWithFormat:@"Waiting for connection with the device"] isError:NO]; } else { - dispatch_async(dispatch_get_main_queue(), ^{ - self->_removeFabricTextField.text = @""; - [self updateResult:[NSString stringWithFormat:@"Cannot removeFabric, no fabric found at index %@", @(fabricIndex)] - isError:YES]; - }); + [self updateResult:[NSString stringWithFormat:@"Failed to trigger the connection with the device"] isError:YES]; } } diff --git a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m index 92bc646b7e6065..baaafe1c157e14 100644 --- a/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m +++ b/src/darwin/CHIPTool/CHIPTool/View Controllers/QRCode/QRCodeViewController.m @@ -692,6 +692,9 @@ - (void)onCommissioningComplete:(NSError * _Nullable)error NSLog(@"Error retrieving device informations over Mdns: %@", error); return; } + // track this device + uint64_t deviceId = CHIPGetNextAvailableDeviceID() - 1; + CHIPSetDevicePaired(deviceId, YES); [self setVendorIDOnAccessory]; } diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.h b/src/darwin/Framework/CHIP/CHIPDeviceController.h index 0d53fb0e9a37bf..e2dd125619b4ef 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.h @@ -55,11 +55,9 @@ typedef void (^CHIPDeviceConnectionCallback)(CHIPDevice * _Nullable device, NSEr error:(NSError * __autoreleasing *)error; - (void)setListenPort:(uint16_t)port; -- (BOOL)unpairDevice:(uint64_t)deviceID error:(NSError * __autoreleasing *)error; - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)error; - (void)updateDevice:(uint64_t)deviceID fabricId:(uint64_t)fabricId; -- (BOOL)isDevicePaired:(uint64_t)deviceID error:(NSError * __autoreleasing *)error; - (nullable CHIPDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error; - (BOOL)getConnectedDevice:(uint64_t)deviceID queue:(dispatch_queue_t)queue diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.mm b/src/darwin/Framework/CHIP/CHIPDeviceController.mm index 2509084490a119..e65089c9ab7056 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.mm @@ -395,24 +395,6 @@ - (BOOL)commissionDevice:(uint64_t)deviceId return success; } -- (BOOL)unpairDevice:(uint64_t)deviceID error:(NSError * __autoreleasing *)error -{ - __block CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; - __block BOOL success = NO; - if (![self isRunning]) { - success = ![self checkForError:errorCode logMsg:kErrorNotRunning error:error]; - return success; - } - dispatch_sync(_chipWorkQueue, ^{ - if ([self isRunning]) { - errorCode = self.cppCommissioner->UnpairDevice(deviceID); - } - success = ![self checkForError:errorCode logMsg:kErrorUnpairDevice error:error]; - }); - - return success; -} - - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)error { __block CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; @@ -432,22 +414,6 @@ - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *) return success; } -- (BOOL)isDevicePaired:(uint64_t)deviceID error:(NSError * __autoreleasing *)error -{ - __block BOOL paired = NO; - if (![self isRunning]) { - [self checkForError:CHIP_ERROR_INCORRECT_STATE logMsg:kErrorNotRunning error:error]; - return paired; - } - dispatch_sync(_chipWorkQueue, ^{ - if ([self isRunning]) { - paired = self.cppCommissioner->DoesDevicePairingExist(chip::PeerId().SetNodeId(deviceID)); - } - }); - - return paired; -} - - (CHIPDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError * __autoreleasing *)error { CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; diff --git a/src/darwin/Framework/CHIP/templates/clusters-tests.zapt b/src/darwin/Framework/CHIP/templates/clusters-tests.zapt index c5c64e0cec6957..ff5e2bf07fcc27 100644 --- a/src/darwin/Framework/CHIP/templates/clusters-tests.zapt +++ b/src/darwin/Framework/CHIP/templates/clusters-tests.zapt @@ -158,10 +158,6 @@ CHIPDevice * GetConnectedDevice(void) CHIPDeviceController * controller = [CHIPDeviceController sharedController]; XCTAssertNotNil(controller); - NSError * error; - [controller unpairDevice:nodeId error:&error]; - XCTAssertEqual(error.code, 0); - BOOL stopped = [controller shutdown]; XCTAssertTrue(stopped); } diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 7f279c636e2693..b4f3b9747fb049 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -175,10 +175,6 @@ - (void)testShutdownStack CHIPDeviceController * controller = [CHIPDeviceController sharedController]; XCTAssertNotNil(controller); - NSError * error; - [controller unpairDevice:nodeId error:&error]; - XCTAssertEqual(error.code, 0); - BOOL stopped = [controller shutdown]; XCTAssertTrue(stopped); } diff --git a/src/darwin/Framework/CHIPTests/CHIPControllerTests.m b/src/darwin/Framework/CHIPTests/CHIPControllerTests.m index 82dd31e62a09a0..a6bef0b3fa08cc 100644 --- a/src/darwin/Framework/CHIPTests/CHIPControllerTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPControllerTests.m @@ -61,15 +61,12 @@ - (void)testControllerMultipleShutdown - (void)testControllerInvalidAccess { CHIPDeviceController * controller = [CHIPDeviceController sharedController]; - NSError * error; XCTAssertFalse([controller isRunning]); XCTAssertFalse([controller getConnectedDevice:1234 queue:dispatch_get_main_queue() completionHandler:^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) { XCTAssertEqual(error.code, CHIPErrorCodeInvalidState); }]); - XCTAssertFalse([controller unpairDevice:1 error:&error]); - XCTAssertEqual(error.code, CHIPErrorCodeInvalidState); } @end