File tree Expand file tree Collapse file tree 6 files changed +27
-0
lines changed Expand file tree Collapse file tree 6 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,9 @@ pub trait Central: Send + Sync + Clone {
355355 /// Add a [`Peripheral`] from a MAC address without a scan result. Not supported on all Bluetooth systems.
356356 async fn add_peripheral ( & self , address : & PeripheralId ) -> Result < Self :: Peripheral > ;
357357
358+ /// Clear the list of [`Peripheral`]s that have been discovered so far.
359+ async fn clear_peripherals ( & self ) -> Result < ( ) > ;
360+
358361 /// Get information about the Bluetooth adapter being used, such as the model or type.
359362 ///
360363 /// The details of this are platform-specific andyou should not attempt to parse it, but it may
Original file line number Diff line number Diff line change @@ -101,6 +101,11 @@ impl Central for Adapter {
101101 ) )
102102 }
103103
104+ async fn clear_peripherals ( & self ) -> Result < ( ) > {
105+ self . manager . clear_peripherals ( ) ;
106+ Ok ( ( ) )
107+ }
108+
104109 async fn adapter_info ( & self ) -> Result < String > {
105110 let adapter_info = self . session . get_adapter_info ( & self . adapter ) . await ?;
106111 Ok ( format ! ( "{} ({})" , adapter_info. id, adapter_info. modalias) )
Original file line number Diff line number Diff line change 6666 self . peripherals . insert ( peripheral. id ( ) , peripheral) ;
6767 }
6868
69+ pub fn clear_peripherals ( & self ) {
70+ self . peripherals . clear ( ) ;
71+ }
72+
6973 pub fn peripherals ( & self ) -> Vec < PeripheralType > {
7074 self . peripherals
7175 . iter ( )
Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ impl Central for Adapter {
117117 ) )
118118 }
119119
120+ async fn clear_peripherals ( & self ) -> Result < ( ) > {
121+ self . manager . clear_peripherals ( ) ;
122+ Ok ( ( ) )
123+ }
124+
120125 async fn adapter_info ( & self ) -> Result < String > {
121126 // TODO: Get information about the adapter.
122127 Ok ( "CoreBluetooth" . to_string ( ) )
Original file line number Diff line number Diff line change @@ -167,6 +167,11 @@ impl Central for Adapter {
167167 async fn add_peripheral ( & self , address : & PeripheralId ) -> Result < Peripheral > {
168168 self . add ( address. 0 )
169169 }
170+
171+ async fn clear_peripherals ( & self ) -> Result < ( ) > {
172+ self . manager . clear_peripherals ( ) ;
173+ Ok ( ( ) )
174+ }
170175}
171176
172177pub ( crate ) fn adapter_report_scan_result_internal (
Original file line number Diff line number Diff line change @@ -96,6 +96,11 @@ impl Central for Adapter {
9696 ) )
9797 }
9898
99+ async fn clear_peripherals ( & self ) -> Result < ( ) > {
100+ self . manager . clear_peripherals ( ) ;
101+ Ok ( ( ) )
102+ }
103+
99104 async fn adapter_info ( & self ) -> Result < String > {
100105 // TODO: Get information about the adapter.
101106 Ok ( "WinRT" . to_string ( ) )
You can’t perform that action at this time.
0 commit comments