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 Feb 2, 2024
1 parent 3f3f43b commit b098175
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 b098175

Please sign in to comment.