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.
Hi,
I'm working on bluetooth integration for trezor-suite app and i would like to use
btleplug
as a bridge between the electron app and bluetooth device.To make it work i would like to contribute and address some missing features and issues
CentralState
Implementation of #280 for macos, windows and linux.
I wasn't sure should i extend existing
adapter_info
method or just add newadapter_state
, just for clarity i've added new function. I'm leaving this decision to you.Also i'm not sure about the naming
adapter_state() -> CentralState
i didn't want to mess up current naming convention.Feel free to nitpick anything.
Tested on Windows 10, macOS sonoma, linux nixOS
Commits
c244d41 add
CBManagerState
getter https://developer.apple.com/documentation/corebluetooth/cbmanagerstate incorebluetooth
delegate. The state is emitted inCentralDelegateEvent::DidUpdateState
event.6cdb170 add
api::Adapter.adapter_state
function andCentralEvent::StateUpdate
event, by default all targets returnsCentralState::Unknown
e13a5e1 implementation for corebluetooth using delegate
centralmanager_state
getter08ef9a1 implementation for bluez using
BluetoothEvent::Adapter
eventc608e55 implementation for winrtble using
Radio.State()
https://github.com/microsoft/windows-rs/blob/master/crates/libs/windows/src/Windows/Devices/Radios/mod.rs - there might be some side effects, not sure why sometimes i'm receiving same event twice, but i don't mind that