feat(windows-ble): auto-pair on characteristic read#421
Draft
igiona wants to merge 1 commit into
Draft
Conversation
Member
|
Sorry for the delay in responding. I like the idea of this, and I'm guessing it will need implementing on writes as well. I share your concern about how to handle other pairing types, I think the behaviour on mobile would be to prompt the user with the standard UI but I would need to test this. I think this functionality is very much needed as by following the WebBluetooth model there is no explicit pairing API and so it needs to be smarter like this. |
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.
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
ProtocolErrorstatus (I would guess thatAccessDeniedis 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
justworksscenario (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?