File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Unreleased
4+
5+ ### New features
6+
7+ - Added ` pair_with_timeout ` and ` cancel_pairing ` to ` BluetoothSession ` .
8+
39## 0.8.0
410
511### Breaking changes
Original file line number Diff line number Diff line change @@ -707,13 +707,31 @@ impl BluetoothSession {
707707 . unwrap_or ( Err ( BluetoothError :: ServiceDiscoveryTimedOut ) )
708708 }
709709
710+ /// Connect to the given Bluetooth device and initiate pairing, with the specified timeout.
711+ pub async fn pair_with_timeout (
712+ & self ,
713+ id : & DeviceId ,
714+ timeout : Duration ,
715+ ) -> Result < ( ) , BluetoothError > {
716+ self . device ( id, timeout) . pair ( ) . await ?;
717+ self . await_service_discovery ( id) . await
718+ }
719+
720+ /// Cancel a pairing operation with the given Bluetooth device.
721+ pub async fn cancel_pairing ( & self , id : & DeviceId ) -> Result < ( ) , BluetoothError > {
722+ Ok ( self
723+ . device ( id, DBUS_METHOD_CALL_TIMEOUT )
724+ . cancel_pairing ( )
725+ . await ?)
726+ }
727+
710728 /// Connect to the given Bluetooth device.
711729 pub async fn connect ( & self , id : & DeviceId ) -> Result < ( ) , BluetoothError > {
712730 self . connect_with_timeout ( id, DBUS_METHOD_CALL_TIMEOUT )
713731 . await
714732 }
715733
716- /// Connect to the given Bluetooth device with specified timeout.
734+ /// Connect to the given Bluetooth device with the specified timeout.
717735 pub async fn connect_with_timeout (
718736 & self ,
719737 id : & DeviceId ,
You can’t perform that action at this time.
0 commit comments