Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth api changes #116

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

rickjansen-dev
Copy link
Contributor

@rickjansen-dev rickjansen-dev commented Oct 20, 2020

This would be the minimal changes I need to be able to integrate bluez support properly and avoid deadlocks.


There's something else I'd like to propose, since the library targets .net standard 2.1 (and thus C# 8 is standard) maybe it's nice to leverage IAsyncEnumerable for the Discover method, so it becomes something like:

IAsyncEnumerable<PoweredUpBluetoothDeviceInfo> Discover(CancellationToken cancellationToken = default)

This way the newly discovered devices would be streamed to whoever is invoking the discovery as they become available.


And about the BluetoothAdapter class, is this meant to be a representation of an actual bluetooth adapter, or is it more like an bluetooth managing class? Since at least on linux (and I assume on windows too), you can have multiple adapters and I guess it would be nice to have some interface to list and select the adapter you want (and provide some convenience methods to simply select the first one available)

Closes #117

@tthiery
Copy link
Member

tthiery commented Oct 20, 2020

It is abstracting the adapter. I do not know how WinRT or WebBluetooth behave, whether they combine them or not. I mean the API is not exactly starting in both cases with an adapter enumeration. Will figure out.

Review and test this later

@tthiery
Copy link
Member

tthiery commented Oct 20, 2020

Feedback on the merge request

  • I tested most examples and they work beautifully on WinRT. So we are good here.
  • When you add commits please always add in the last line a reference to an issue and a statement whether it is a breaking change (e.g. "Extend Discover Callback to be truly async #117 non-breaking").
  • I do not consider this a breaking change, because this is not a contracted API surface.
  • One example is broken (for other reasons) which i will fix on opportunity.

@tthiery tthiery added this to the v3.2 (non-breaking) milestone Oct 20, 2020
@tthiery tthiery merged commit 9a3831e into sharpbrick:master Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend Discover Callback to be truly async
2 participants