feat(windows-ble): auto-pair on characteristic read #421
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.
I noticed that on Windows, when I try to read a pairing-protected characteristic the Windows implementation simply returns null.
In the mobile apps though, the OS detect such a read and automatically performs a pairing request and the user gets prompt with the standard pairing UI.
In my case I'm using
justworks
, hence a simple "yes/no" is prompted.When I try to read that characteristic while unpaired on Windows, I get a
ProtocolError
status (I would guess thatAccessDenied
is more appropriate, but that's what I see..)This PR as-is, is meant to trigger a discussion on this issue more than being real merge-request.
Attempt1 Basic Pairing
Here for me the pairing never worked,
Service.Device.NativeDevice.DeviceInformation.Pairing.PairAsync()
always immediately returned the statusFailed
.I'll tried to debug further more this. Every suggestion is welcomed.
Attempt2 (this PR) Custom pairing
The code introduces the iOS & Android behaviour on Windows, although I did not implemented any UI hence the pairing happens silently and works only in a
justworks
scenario (not good of course, but I wanted to get it to work quick&dirty).What's your opinion on this @peterfoot ?
Do you like to align the behaviour to the mobile platforms?