async fn piconet_member(
    handles: mock::MockHandles,
    id: bt_types::PeerId,
    profile_svc_path: String,
    peer_observer: bredr::PeerObserverProxy,
) -> Result<(), Error> {
    // connect to the profile service to drive the mock peer
    let pro_test = handles.connect_to_service::<bredr::ProfileTestMarker>()?;
    let mut fs = ServiceFs::new();

    fs.dir("svc").add_service_at(profile_svc_path, move |chan: zx::Channel| {
        let profile_test = pro_test.clone();
        let observer = peer_observer.clone();

        fasync::Task::local(async move {
            let (client, observer_req_stream) =
                register_piconet_member(&profile_test, id).await.unwrap();

            client.connect_proxy_(chan.into()).await.expect("failed to get mock peer service");
            // keep us running and hold on until termination to keep the mock alive
            fwd_observer_callbacks(observer_req_stream, &observer, id).await.unwrap();
        })
        .detach();
        Some(())
    });

    fs.serve_connection(handles.outgoing_dir.into_channel()).expect("failed to serve service fs");
    fs.collect::<()>().await;

    Ok(())
}
/// Drives the mock piconet member. This receives the open request for the
/// Profile service, attaches it to the Mock Piconet Server, and wires up the
/// the PeerObserver.
Drives the mock piconet member. This receives the open request for the
Profile service, attaches it to the Mock Piconet Server, and wires up the
the PeerObserver.
Drives the mock piconet member . This receives the open request for the Profile service attaches it to the Mock Piconet Server and wires up the the PeerObserver .
async fn piconet_member(
    handles: mock::MockHandles,
    id: bt_types::PeerId,
    profile_svc_path: String,
    peer_observer: bredr::PeerObserverProxy,
) -> Result<(), Error> {
    // connect to the profile service to drive the mock peer
    let pro_test = handles.connect_to_service::<bredr::ProfileTestMarker>()?;
    let mut fs = ServiceFs::new();
    fs.dir("svc").add_service_at(profile_svc_path, move |chan: zx::Channel| {
        let profile_test = pro_test.clone();
        let observer = peer_observer.clone();
        fasync::Task::local(async move {
            let (client, observer_req_stream) =
                register_piconet_member(&profile_test, id).await.unwrap();
            client.connect_proxy_(chan.into()).await.expect("failed to get mock peer service");
            // keep us running and hold on until termination to keep the mock alive
            fwd_observer_callbacks(observer_req_stream, &observer, id).await.unwrap();
        })
        .detach();
        Some(())
    });
    fs.serve_connection(handles.outgoing_dir.into_channel()).expect("failed to serve service fs");
    fs.collect::<()>().await;
    Ok(())
}
async fn piconet_member ( handles : mock :: MockHandles , id : bt_types :: PeerId , profile_svc_path : String , peer_observer : bredr :: PeerObserverProxy , ) -> Result < ( ) , Error > { // connect to the profile service to drive the mock peer let pro_test = handles . connect_to_service :: < bredr :: ProfileTestMarker > ( ) ? ; let mut fs = ServiceFs :: new ( ) ; fs . dir ( " " ) . add_service_at ( profile_svc_path , move | chan : zx :: Channel | { let profile_test = pro_test . clone ( ) ; let observer = peer_observer . clone ( ) ; fasync :: Task :: local ( async move { let ( client , observer_req_stream ) = register_piconet_member ( & profile_test , id ) . await . unwrap ( ) ; client . connect_proxy_ ( chan . into ( ) ) . await . expect ( " " ) ; // keep us running and hold on until termination to keep the mock alive fwd_observer_callbacks ( observer_req_stream , & observer , id ) . await . unwrap ( ) ; } ) . detach ( ) ; Some ( ( ) ) } ) ; fs . serve_connection ( handles . outgoing_dir . into_channel ( ) ) . expect ( " " ) ; fs . collect :: < ( ) > ( ) . await ; Ok ( ( ) ) }
Drives the mock piconet member.
Drives the mock piconet member .
handles
mock::MockHandles
id
bt_types::PeerId
profile_svc_path
String
peer_observer
bredr::PeerObserverProxy
handles
mock::MockHandles
id
bt_types::PeerId
profile_svc_path
String
peer_observer
bredr::PeerObserverProxy