@@ -17,7 +17,7 @@ use super::{
1717 future:: { BtlePlugFuture , BtlePlugFutureStateShared } ,
1818 utils:: { core_bluetooth:: cbuuid_to_uuid, nsstring:: nsstring_to_string, nsuuid_to_uuid} ,
1919} ;
20- use crate :: api:: { CharPropFlags , Characteristic , Service , WriteType } ;
20+ use crate :: api:: { CharPropFlags , Characteristic , ScanFilter , Service , WriteType } ;
2121use crate :: Error ;
2222use futures:: channel:: mpsc:: { self , Receiver , Sender } ;
2323use futures:: select;
@@ -258,7 +258,9 @@ impl Debug for CoreBluetoothInternal {
258258
259259#[ derive( Debug ) ]
260260pub enum CoreBluetoothMessage {
261- StartScanning ,
261+ StartScanning {
262+ filter : ScanFilter ,
263+ } ,
262264 StopScanning ,
263265 ConnectDevice {
264266 peripheral_uuid : Uuid ,
@@ -762,7 +764,7 @@ impl CoreBluetoothInternal {
762764 adapter_msg = self . message_receiver. select_next_some( ) => {
763765 trace!( "Adapter message!" ) ;
764766 match adapter_msg {
765- CoreBluetoothMessage :: StartScanning => self . start_discovery( ) ,
767+ CoreBluetoothMessage :: StartScanning { filter } => self . start_discovery( filter ) ,
766768 CoreBluetoothMessage :: StopScanning => self . stop_discovery( ) ,
767769 CoreBluetoothMessage :: ConnectDevice { peripheral_uuid, future} => {
768770 trace!( "got connectdevice msg!" ) ;
@@ -793,14 +795,15 @@ impl CoreBluetoothInternal {
793795 }
794796 }
795797
796- fn start_discovery ( & mut self ) {
798+ fn start_discovery ( & mut self , _filter : ScanFilter ) {
797799 trace ! ( "BluetoothAdapter::start_discovery" ) ;
798800 let options = ns:: mutabledictionary ( ) ;
799801 // NOTE: If duplicates are not allowed then a peripheral will not show
800802 // up again once connected and then disconnected.
801803 ns:: mutabledictionary_setobject_forkey ( options, ns:: number_withbool ( YES ) , unsafe {
802804 cb:: CENTRALMANAGERSCANOPTIONALLOWDUPLICATESKEY
803805 } ) ;
806+ // TODO: set cb::CBCENTRALMANAGERSCANOPTIONSOLICITEDSERVICEUUIDSKEY with filter.services
804807 cb:: centralmanager_scanforperipherals_options ( * self . manager , options) ;
805808 }
806809
0 commit comments