Skip to content

Commit 4426712

Browse files
Tweaks from review
1 parent acefa8e commit 4426712

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/platform/Darwin/BleConnectionDelegateImpl.mm

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,9 @@ - (void)removePeripheralsFromCache;
163163

164164
void BleConnectionDelegateImpl::StartScan(BleScannerDelegate * delegate, BleScanMode mode)
165165
{
166-
// A null delegate is only allowed in PreWarm mode
167-
bool prewarm = (mode == BleScanMode::kPreWarm);
168-
VerifyOrDie(delegate != nullptr || prewarm);
169166
assertChipStackLockedByCurrentThread();
170167

168+
bool prewarm = (mode == BleScanMode::kPreWarm);
171169
ChipLogProgress(Ble, "ConnectionDelegate StartScan (%s)", (prewarm ? "pre-warm" : "default"));
172170

173171
if (!bleWorkQueue) {
@@ -177,6 +175,8 @@ - (void)removePeripheralsFromCache;
177175
dispatch_async(bleWorkQueue, ^{
178176
// Pre-warming is best-effort, don't cancel an ongoing scan or connection attempt
179177
if (prewarm && ble) {
178+
// TODO: Once we get rid of the separate BLE queue we can just return CHIP_ERROR_BUSY.
179+
// That will also allow these cases to be distinguished in our metric.
180180
ChipLogProgress(Ble, "Not starting pre-warm scan, an operation is already in progress");
181181
if (delegate) {
182182
dispatch_async(PlatformMgrImpl().GetWorkQueue(), ^{

src/platform/Darwin/BleScannerDelegate.h

+4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ namespace DeviceLayer {
2626

2727
enum class BleScanMode
2828
{
29+
/// Scan continues until stopped.
30+
/// Replaces existing BLE operation.
2931
kDefault = 0,
32+
/// Scan stops automatically after some time.
33+
/// Does not replace an existing BLE operation.
3034
kPreWarm,
3135
};
3236

0 commit comments

Comments
 (0)