async fn add_profile<'a>(
    builder: &mut RealmBuilder,
    spec: &'a mut PiconetMemberSpec,
    server_moniker: String,
    profile_url: String,
    additional_capabilities: Vec<CapabilityRoute>,
) -> Result<(), Error> {
    let mock_piconet_member_name = interposer_name_for_profile(&spec.name);
    add_mock_piconet_component(
        builder,
        mock_piconet_member_name.clone(),
        spec.id,
        bredr::ProfileMarker::SERVICE_NAME.to_string(),
        spec.observer.take(),
    )
    .await?;

    // set up the profile
    {
        let _ = builder
            .add_eager_component(spec.name.to_string(), ComponentSource::Url(profile_url))
            .await?;
    }

    // Route:
    //   * Profile from mock piconet member to profile under test
    //   * ProfileTest from Mock Piconet Server to mock piconet member
    //   * LogSink from parent to the profile under test + mock piconet member.
    //   * Additional capabilities from the profile under test to AboveRoot to be
    //     accessible via the test realm service directory.
    {
        builder.add_protocol_route::<bredr::ProfileMarker>(
            RouteEndpoint::component(mock_piconet_member_name.clone()),
            vec![RouteEndpoint::component(spec.name.to_string())],
        )?;

        builder.add_protocol_route::<bredr::ProfileTestMarker>(
            RouteEndpoint::component(&server_moniker),
            vec![RouteEndpoint::component(mock_piconet_member_name.clone())],
        )?;

        builder.add_protocol_route::<LogSinkMarker>(
            RouteEndpoint::AboveRoot,
            vec![
                RouteEndpoint::component(spec.name.to_string()),
                RouteEndpoint::component(mock_piconet_member_name.clone()),
            ],
        )?;

        for route in additional_capabilities {
            builder.add_route(route)?;
        }
    }
    Ok(())
}
/// Adds a profile. This also creates a component that sits between the profile
/// and the Mock Piconet Server. This node acts as a facade between the profile
/// under test and the Test Server. If the PiconetMemberSpec passed in contains
/// a Channel then PeerObserver events will be forwarded to that channel.
/// `additional_capabilities` specifies capability routings for any protocols used/exposed
/// by the profile.
Adds a profile. This also creates a component that sits between the profile
and the Mock Piconet Server. This node acts as a facade between the profile
under test and the Test Server. If the PiconetMemberSpec passed in contains
a Channel then PeerObserver events will be forwarded to that channel.
`additional_capabilities` specifies capability routings for any protocols used/exposed
by the profile.
Adds a profile . This also creates a component that sits between the profile and the Mock Piconet Server . This node acts as a facade between the profile under test and the Test Server . If the PiconetMemberSpec passed in contains a Channel then PeerObserver events will be forwarded to that channel . ` additional_capabilities ` specifies capability routings for any protocols used / exposed by the profile .
async fn add_profile<'a>(
    builder: &mut RealmBuilder,
    spec: &'a mut PiconetMemberSpec,
    server_moniker: String,
    profile_url: String,
    additional_capabilities: Vec<CapabilityRoute>,
) -> Result<(), Error> {
    let mock_piconet_member_name = interposer_name_for_profile(&spec.name);
    add_mock_piconet_component(
        builder,
        mock_piconet_member_name.clone(),
        spec.id,
        bredr::ProfileMarker::SERVICE_NAME.to_string(),
        spec.observer.take(),
    )
    .await?;
    // set up the profile
    {
        let _ = builder
            .add_eager_component(spec.name.to_string(), ComponentSource::Url(profile_url))
            .await?;
    }
    // Route:
    //   * Profile from mock piconet member to profile under test
    //   * ProfileTest from Mock Piconet Server to mock piconet member
    //   * LogSink from parent to the profile under test + mock piconet member.
    //   * Additional capabilities from the profile under test to AboveRoot to be
    //     accessible via the test realm service directory.
    {
        builder.add_protocol_route::<bredr::ProfileMarker>(
            RouteEndpoint::component(mock_piconet_member_name.clone()),
            vec![RouteEndpoint::component(spec.name.to_string())],
        )?;
        builder.add_protocol_route::<bredr::ProfileTestMarker>(
            RouteEndpoint::component(&server_moniker),
            vec![RouteEndpoint::component(mock_piconet_member_name.clone())],
        )?;
        builder.add_protocol_route::<LogSinkMarker>(
            RouteEndpoint::AboveRoot,
            vec![
                RouteEndpoint::component(spec.name.to_string()),
                RouteEndpoint::component(mock_piconet_member_name.clone()),
            ],
        )?;
        for route in additional_capabilities {
            builder.add_route(route)?;
        }
    }
    Ok(())
}
async fn add_profile < ' a > ( builder : & mut RealmBuilder , spec : & ' a mut PiconetMemberSpec , server_moniker : String , profile_url : String , additional_capabilities : Vec < CapabilityRoute > , ) -> Result < ( ) , Error > { let mock_piconet_member_name = interposer_name_for_profile ( & spec . name ) ; add_mock_piconet_component ( builder , mock_piconet_member_name . clone ( ) , spec . id , bredr :: ProfileMarker :: SERVICE_NAME . to_string ( ) , spec . observer . take ( ) , ) . await ? ; // set up the profile { let _ = builder . add_eager_component ( spec . name . to_string ( ) , ComponentSource :: Url ( profile_url ) ) . await ? ; } // Route: //   * Profile from mock piconet member to profile under test //   * ProfileTest from Mock Piconet Server to mock piconet member //   * LogSink from parent to the profile under test + mock piconet member. //   * Additional capabilities from the profile under test to AboveRoot to be //     accessible via the test realm service directory. { builder . add_protocol_route :: < bredr :: ProfileMarker > ( RouteEndpoint :: component ( mock_piconet_member_name . clone ( ) ) , vec ! [ RouteEndpoint component ( spec name to_string ( ) ) ] , ) ? ; builder . add_protocol_route :: < bredr :: ProfileTestMarker > ( RouteEndpoint :: component ( & server_moniker ) , vec ! [ RouteEndpoint component ( mock_piconet_member_name clone ( ) ) ] , ) ? ; builder . add_protocol_route :: < LogSinkMarker > ( RouteEndpoint :: AboveRoot , vec ! [ RouteEndpoint component ( spec name to_string ( ) ) RouteEndpoint component ( mock_piconet_member_name clone ( ) ) ] , ) ? ; for route in additional_capabilities { builder . add_route ( route ) ? ; } } Ok ( ( ) ) }
Adds a profile.
Adds a profile .
builder
&mut RealmBuilder
spec
&'a mut PiconetMemberSpec
server_moniker
String
profile_url
String
additional_capabilities
Vec<CapabilityRoute>
builder
&mut RealmBuilder
spec
&'a mut PiconetMemberSpec
server_moniker
String
profile_url
String
additional_capabilities
Vec<CapabilityRoute>