feat(winrtble): implement add_peripheral (connect by address)#465
feat(winrtble): implement add_peripheral (connect by address)#465tanarchytan wants to merge 1 commit into
Conversation
Was a NotSupported stub on Windows. Implement it the same way the scanner registers a discovered device (create a Peripheral from the address and add it to the manager), matching the Android backend, so a bonded or already connected device can be reached by address without an advertisement. Also adds the symmetric From<PeripheralId> for BDAddr.
|
The failing linux check is not from this PR. This branch only changes That loop returns on its first iteration, so clippy's This is pre-existing under newer stable clippy (1.96, edition 2024): the most recent Rust run on master is already failing the same way. I kept the bluez code untouched to keep the PR scoped to winrtble. Glad to rerun once it is sorted, or to send a separate one-line fix for |
What
Implement the WinRT Central::add_peripheral, which currently returns Err(NotSupported). It creates a Peripheral from the given PeripheralId the same way the scanner registers a discovered device, and returns an already-known entry if present. Also adds the symmetric From for BDAddr.
Why
add_peripheral was added to the Central trait in 0.12.0 for Android but left unimplemented on Windows. Without it, a device the OS already knows (bonded, or connected to another central such as a phone) cannot be reached on Windows unless it happens to be advertising. This brings WinRT to parity with Android: get a Peripheral by address, then call connect(), which already uses FromBluetoothAddressAsync.
Tested on hardware: connects to a bonded device that is connected to another central and is not advertising, then reads and writes its GATT.