Feat: CentralState
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 https://github.com/deviceplug/btleplug/issues/280 for macos, windows and linux.
I wasn't sure should i extend existing adapter_info method or just add new adapter_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
-
c244d4170b93fa904bf67d0848926058284cdd30 add
CBManagerStategetter https://developer.apple.com/documentation/corebluetooth/cbmanagerstate incorebluetoothdelegate. The state is emitted inCentralDelegateEvent::DidUpdateStateevent. -
6cdb1707a39554cba32811326254cd363b38cee3 add
api::Adapter.adapter_statefunction andCentralEvent::StateUpdateevent, by default all targets returnsCentralState::Unknown -
e13a5e1b8f7a5f6501912fa3016341662684131d implementation for corebluetooth using delegate
centralmanager_stategetter -
08ef9a1770f7446c7d3505f029b827a7233b30a3 implementation for bluez using
BluetoothEvent::Adapterevent -
c608e55143613d6f88379416b80cdff5c565c7b3 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
sorry for the force-push, too many fixes for cargo fmt
wait this feature merged 😁
Hi, i've rebased over recent dev branch and resolve conflicts with Use objc2-core-bluetooth
is there anything else i can do to push things forward?
im expecting more conflicts with https://github.com/deviceplug/btleplug/pull/388