async fn listen_to_audio_events(
    invocation: Invocation,
    volume_change_handler: VolumeChangeEarconsHandler,
    common_earcons_params: CommonEarconsParams,
) {
    let switchboard_client = invocation.context.switchboard_client.clone();
    let common_earcons_params_clone = common_earcons_params.clone();
    let listen_result = switchboard_client
        .clone()
        .listen(
            SettingType::Audio,
            Arc::new(move |setting| {
                // Connect to the SoundPlayer the first time an earcons event occurs.
                connect_to_sound_player(
                    common_earcons_params.service_context.clone(),
                    common_earcons_params.sound_player_connection.clone(),
                );

                volume_change_handler.get_volume_info(switchboard_client.clone(), setting);
            }),
        )
        .await;
    assert!(listen_result.is_ok());

    // Store the listen session so it doesn't get dropped and cancel the connection.
    if let Ok(session) = listen_result {
        let mut listen_session_holder_lock =
            common_earcons_params_clone.listen_session_holder.lock().await;
        listen_session_holder_lock.listen_session = Some(session);
    }
}
// Listen to all the events on the switchboard that come through on the Audio setting
// type. Make corresponding requests on the corresponding handlers to get the necessary state.
Listen to all the events on the switchboard that come through on the Audio setting
type. Make corresponding requests on the corresponding handlers to get the necessary state.
Listen to all the events on the switchboard that come through on the Audio setting type . Make corresponding requests on the corresponding handlers to get the necessary state .
async fn listen_to_audio_events(
    invocation: Invocation,
    volume_change_handler: VolumeChangeEarconsHandler,
    common_earcons_params: CommonEarconsParams,
) {
    let switchboard_client = invocation.context.switchboard_client.clone();
    let common_earcons_params_clone = common_earcons_params.clone();
    let listen_result = switchboard_client
        .clone()
        .listen(
            SettingType::Audio,
            Arc::new(move |setting| {
                // Connect to the SoundPlayer the first time an earcons event occurs.
                connect_to_sound_player(
                    common_earcons_params.service_context.clone(),
                    common_earcons_params.sound_player_connection.clone(),
                );
                volume_change_handler.get_volume_info(switchboard_client.clone(), setting);
            }),
        )
        .await;
    assert!(listen_result.is_ok());
    // Store the listen session so it doesn't get dropped and cancel the connection.
    if let Ok(session) = listen_result {
        let mut listen_session_holder_lock =
            common_earcons_params_clone.listen_session_holder.lock().await;
        listen_session_holder_lock.listen_session = Some(session);
    }
}
async fn listen_to_audio_events ( invocation : Invocation , volume_change_handler : VolumeChangeEarconsHandler , common_earcons_params : CommonEarconsParams , ) { let switchboard_client = invocation . context . switchboard_client . clone ( ) ; let common_earcons_params_clone = common_earcons_params . clone ( ) ; let listen_result = switchboard_client . clone ( ) . listen ( SettingType :: Audio , Arc :: new ( move | setting | { // Connect to the SoundPlayer the first time an earcons event occurs. connect_to_sound_player ( common_earcons_params . service_context . clone ( ) , common_earcons_params . sound_player_connection . clone ( ) , ) ; volume_change_handler . get_volume_info ( switchboard_client . clone ( ) , setting ) ; } ) , ) . await ; assert ! ( listen_result is_ok ( ) ) ; // Store the listen session so it doesn't get dropped and cancel the connection. if let Ok ( session ) = listen_result { let mut listen_session_holder_lock = common_earcons_params_clone . listen_session_holder . lock ( ) . await ; listen_session_holder_lock . listen_session = Some ( session ) ; } }
Listen to all the events on the switchboard that come through on the Audio setting
type.
Listen to all the events on the switchboard that come through on the Audio setting type .
invocation
Invocation
volume_change_handler
VolumeChangeEarconsHandler
common_earcons_params
CommonEarconsParams
invocation
Invocation
volume_change_handler
VolumeChangeEarconsHandler
common_earcons_params
CommonEarconsParams