Skip to content

Commit

Permalink
Make the iOS CHIPTool reboot the Matter stack prior to each pairing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar-apple authored and pull[bot] committed Oct 6, 2023
1 parent c2f4d29 commit 1029386
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,22 @@ - (NSString *)getNetworkName:(NSNumber *)discriminator
return peripheralFullName;
}

- (void)_restartMatterStack
{
NSLog(@"Shutting down the stack");
[self.chipController shutdown];
NSLog(@"Starting up the stack");
[self.chipController startup:nil vendorId:0 nocSigner:nil];
}

- (void)handleRendezVousDefault:(NSString *)payload
{
NSError * error;
uint64_t deviceID = CHIPGetNextAvailableDeviceID();

// restart the Matter Stack before pairing (for reliability + testing restarts)
[self _restartMatterStack];

if ([self.chipController pairDevice:deviceID onboardingPayload:payload error:&error]) {
deviceID++;
CHIPSetNextAvailableDeviceID(deviceID);
Expand Down

0 comments on commit 1029386

Please sign in to comment.