Conversation
…rts it SetUseCodedPhy(true) is accepted, and Start succeeds, on adapters without Coded PHY support (e.g. Bluetooth 4.x dongles), but the scan then never delivers a single advertisement. Gate the call on BluetoothAdapter.IsLowEnergyCodedPhySupported so those adapters scan as in 0.12, and log which path was taken. Fixes deviceplug#473.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #473. Related: #472.
Problem
#463 (shipped in 0.13.0) made the WinRT watcher call
SetUseCodedPhy(true)unconditionally, next to the existingSetAllowExtendedAdvertisements(true). The assumption was that on adapters without Coded PHY the call would fail and be ignored, like the extended-advertisements flag is.Fix
Adapter::newasks theBluetoothAdapterit already holds whetherIsLowEnergyCodedPhySupported, and passes the answer intoBLEWatcher::new.start()requests Coded PHY only when it is true, and logs onedebug!line saying which path was taken, so future scan reports on Windows show whether Coded PHY was in play.Adapters without Coded PHY get the 0.12.0 behavior back. Adapters with it keep the long-range reception #463 added.
Validation
On an Intel adapter that reports
IsLowEnergyCodedPhySupported == true(the enabled path), with this branch versusmaster:start_scanyields the same mix of events on both (several hundred over 25 s: discoveries, updates, manufacturer data, RSSI, service data).So the gate is transparent where the capability exists. I do not have an adapter without Coded PHY, so the disabled path is validated by reasoning from the report rather than measured here: with the call skipped, the watcher configuration is byte-for-byte what 0.12.0 set, and
start_scansucceeding in the reporter's own program shows nothing else in the start path was affected.Follow-ups (not in this PR)
AllowExtendedAdvertisements/UseCodedPhyfrom the public API, because an adapter that does support extended scanning can still drop a specific peripheral while it is enabled. That needs a scan-options design across backends; this PR only removes the unconditional Coded PHY request.SetAllowExtendedAdvertisements(viaIsExtendedAdvertisingSupported), left out to keep this a minimal regression fix.