Skip to content

Commit

Permalink
[Darwin][Ble] Keep scanning while connecting to a device until didCon…
Browse files Browse the repository at this point in the history
…nectPeripheral fires
  • Loading branch information
vivien-apple committed Nov 21, 2024
1 parent 2439117 commit d0f17e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platform/Darwin/BleConnectionDelegateImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPerip
MATTER_LOG_METRIC_BEGIN(kMetricBLEDiscoveredServices);
[peripheral setDelegate:self];
[peripheral discoverServices:nil];
[self stopScanning];
}

// End CBCentralManagerDelegate
Expand Down Expand Up @@ -734,7 +735,7 @@ - (void)updateWithDiscriminator:(const chip::SetupDiscriminator &)deviceDiscrimi
MATTER_LOG_METRIC_BEGIN(kMetricBLEDiscoveredMatchingPeripheral);
ChipLogProgress(Ble, "Connecting to cached device: %p", peripheral);
[self connect:peripheral];
[self stopScanning];
// The cached peripheral might be obsolete, so continue scanning until didConnectPeripheral is triggered.
} else {
[self setupTimer:kScanningWithDiscriminatorTimeoutInSeconds];
}
Expand Down

0 comments on commit d0f17e6

Please sign in to comment.