Skip to content

Waiting 750ms between Bluetooth calls and other oddities #1400

Answered by aritchie
munkii asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Some older android flavours used to take a couple of seconds to disconnect and it happens async. CancelConnection is also meant to stop future connection attempts which is why it isn't async in the first place. However, the test should likely be:
var task = this.peripheral.WhenDisconnected().Timeout(TimeSpan.FromSeconds(5)).Take(1).ToTask();
this.peripheral.CancelConnection();

await task.ConfigureAwait(false);
  1. I guess it is just making sure the disconnect event fires. If the device is already connected, it will fire once on hook anyhow.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by munkii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants