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 commissioning error handling in darwin-framework-tool to be more like chip-tool. #19298

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,14 @@ class TestCommandBridge : public CHIPCommandBridge,
Exit("Unexpected deletion of pairing");
}

void PairingComplete(chip::NodeId nodeId, NSError * _Nullable error)
void PairingComplete(chip::NodeId nodeId)
{
CHIP_ERROR err = [CHIPError errorToCHIPErrorCode:error];
if (err != CHIP_NO_ERROR) {
Exit("Pairing completed with error", err);
return;
}

CHIPDeviceController * controller = CurrentCommissioner();
VerifyOrReturn(controller != nil, Exit("No current commissioner"));

NSError * commissionError = nil;
[controller commissionDevice:nodeId commissioningParams:[[CHIPCommissioningParameters alloc] init] error:&commissionError];
err = [CHIPError errorToCHIPErrorCode:commissionError];
CHIP_ERROR err = [CHIPError errorToCHIPErrorCode:commissionError];
if (err != CHIP_NO_ERROR) {
Exit("Failed to kick off commissioning", err);
return;
Expand Down Expand Up @@ -460,7 +454,14 @@ NS_ASSUME_NONNULL_BEGIN
- (void)onPairingComplete:(NSError * _Nullable)error
{
if (_active) {
_commandBridge->PairingComplete(_deviceId, error);
if (error != nil) {
_active = NO;
NSLog(@"Pairing complete with error");
CHIP_ERROR err = [CHIPError errorToCHIPErrorCode:error];
_commandBridge->OnStatusUpdate([self convertToStatusIB:err]);
} else {
_commandBridge->PairingComplete(_deviceId);
}
}
}

Expand Down