/// Accepts requests over the `fuchsia.bluetooth.bredr.Profile` service and stores the search
/// and advertising handles in the `env`.
/// All search and advertisement requests over the Profile service will be accepted and stored.
/// Connection requests aren't required to unit test the successful launching of profiles, so
/// they are ignored.
Accepts requests over the `fuchsia.bluetooth.bredr.Profile` service and stores the search
and advertising handles in the `env`.
All search and advertisement requests over the Profile service will be accepted and stored.
Connection requests aren't required to unit test the successful launching of profiles, so
they are ignored.
Accepts requests over the ` fuchsia . bluetooth . bredr . Profile ` service and stores the search and advertising handles in the ` env ` . All search and advertisement requests over the Profile service will be accepted and stored . Connection requests aren ' t required to unit test the successful launching of profiles so they are ignored .
fn handle_profile_requests(
        mut stream: bredr::ProfileRequestStream,
        env: Arc<Mutex<TestEnvironment>>,
    ) {
        fasync::Task::local(async move {
            while let Some(request) = stream.next().await {
                if let Ok(req) = request {
                    match req {
                        bredr::ProfileRequest::Advertise { receiver, responder, .. } => {
                            let proxy = receiver.into_proxy().unwrap();
                            let mut w_env = env.lock().await;
                            w_env.add_advertisement(proxy, responder);
                        }
                        bredr::ProfileRequest::Search { results, .. } => {
                            let proxy = results.into_proxy().unwrap();
                            let mut w_env = env.lock().await;
                            w_env.add_search(proxy);
                        }
                        bredr::ProfileRequest::Connect { .. } => {}
                        bredr::ProfileRequest::ConnectSco { .. } => {}
                    }
                }
            }
        })
        .detach();
    }
fn handle_profile_requests ( mut stream : bredr :: ProfileRequestStream , env : Arc < Mutex < TestEnvironment > > , ) { fasync :: Task :: local ( async move { while let Some ( request ) = stream . next ( ) . await { if let Ok ( req ) = request { match req { bredr :: ProfileRequest :: Advertise { receiver , responder , .. } => { let proxy = receiver . into_proxy ( ) . unwrap ( ) ; let mut w_env = env . lock ( ) . await ; w_env . add_advertisement ( proxy , responder ) ; } bredr :: ProfileRequest :: Search { results , .. } => { let proxy = results . into_proxy ( ) . unwrap ( ) ; let mut w_env = env . lock ( ) . await ; w_env . add_search ( proxy ) ; } bredr :: ProfileRequest :: Connect { .. } => { } bredr :: ProfileRequest :: ConnectSco { .. } => { } } } } } ) . detach ( ) ; }
Accepts requests over the `fuchsia.bluetooth.bredr.Profile` service and stores the search
and advertising handles in the `env`.
Accepts requests over the ` fuchsia . bluetooth . bredr . Profile ` service and stores the search and advertising handles in the ` env ` .
stream
bredr::ProfileRequestStream
env
Arc<Mutex<TestEnvironment>>