pub struct InjectionProxy { /* private fields */ }
Implementations§
Source§impl InjectionProxy
impl InjectionProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.test.audio/Injection.
Sourcepub fn take_event_stream(&self) -> InjectionEventStream
pub fn take_event_stream(&self) -> InjectionEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn write_input_audio(
&self,
index: i32,
audio_writer: Socket,
) -> Result<(), Error>
pub fn write_input_audio( &self, index: i32, audio_writer: Socket, ) -> Result<(), Error>
Set the audio to be injected at index
.
The first time this is called, an empty vector will be created, subsequent calls will
append to audio_data
to the same vector.
Use ClearInputAudio
to clear audio input data stored at index
.
Further requests on the same Injection connection are blocked until the audio_writer socket is drained completely. To determine when injection is complete, users may initiate a call to GetInputAudioSize immediately following the call to this method.
- request
index
refers a specificaudio_data
input record. We can have multiple records. - request
audio_writer
socket where audio data will be loaded from.
Sourcepub fn get_input_audio_size(
&self,
index: i32,
) -> QueryResponseFut<InjectionGetInputAudioSizeResult, DefaultFuchsiaResourceDialect>
pub fn get_input_audio_size( &self, index: i32, ) -> QueryResponseFut<InjectionGetInputAudioSizeResult, DefaultFuchsiaResourceDialect>
Get the size of audio data stored at index
.
This method returns the number of bytes of input data stored at the given index.
If a WriteInputAudio
call is pending for the given index,
this method will block until the socket is drained and the data
is fully stored.
- request
index
refers to a specificaudio_data
input record.
- response
error
description of failure action to take.
Sourcepub fn clear_input_audio(
&self,
index: i32,
) -> QueryResponseFut<InjectionClearInputAudioResult, DefaultFuchsiaResourceDialect>
pub fn clear_input_audio( &self, index: i32, ) -> QueryResponseFut<InjectionClearInputAudioResult, DefaultFuchsiaResourceDialect>
Clears audio data stored at index
.
If no data exists at index
nothing will get cleared, but no error will be returned.
- request
index
refers a specificaudio_data
input record to clear.
- response
error
description of failure action to take.
Sourcepub fn wait_until_input_is_done(
&self,
) -> QueryResponseFut<InjectionWaitUntilInputIsDoneResult, DefaultFuchsiaResourceDialect>
pub fn wait_until_input_is_done( &self, ) -> QueryResponseFut<InjectionWaitUntilInputIsDoneResult, DefaultFuchsiaResourceDialect>
Wait until injected inputs are done playing.
This function returns only when all injected audio tracks are complete.
This is intended to be called after calling StartInputInjection
.
If no tracks have been started, or all started tracks have already completed,
then this function will immediately return without error.
- response
error
description of failure action to take.
Sourcepub fn start_input_injection(
&self,
index: i32,
) -> QueryResponseFut<InjectionStartInputInjectionResult, DefaultFuchsiaResourceDialect>
pub fn start_input_injection( &self, index: i32, ) -> QueryResponseFut<InjectionStartInputInjectionResult, DefaultFuchsiaResourceDialect>
Start injecting the incoming audio for this device, using the audio at index
.
Before calling this, use WriteInputAudio
to store audio data at the given index.
- request
index
refers a specificaudio_data
input record to play on the virtual microphone.
- response
error
description of failure action to take.
Sourcepub fn stop_input_injection(
&self,
) -> QueryResponseFut<InjectionStopInputInjectionResult, DefaultFuchsiaResourceDialect>
pub fn stop_input_injection( &self, ) -> QueryResponseFut<InjectionStopInputInjectionResult, DefaultFuchsiaResourceDialect>
Stop injecting audio data.
This stops playing all injected tracks.
This is intended to be called after calling StartInputInjection
.
If no tracks have been started, or if all started tracks have already completed,
then this function will immediately return without error.
- response
error
description of failure action to take.
Trait Implementations§
Source§impl Clone for InjectionProxy
impl Clone for InjectionProxy
Source§fn clone(&self) -> InjectionProxy
fn clone(&self) -> InjectionProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for InjectionProxy
impl Debug for InjectionProxy
Source§impl InjectionProxyInterface for InjectionProxy
impl InjectionProxyInterface for InjectionProxy
type GetInputAudioSizeResponseFut = QueryResponseFut<Result<u64, AudioTestError>>
type ClearInputAudioResponseFut = QueryResponseFut<Result<(), AudioTestError>>
type WaitUntilInputIsDoneResponseFut = QueryResponseFut<Result<(), AudioTestError>>
type StartInputInjectionResponseFut = QueryResponseFut<Result<(), AudioTestError>>
type StopInputInjectionResponseFut = QueryResponseFut<Result<(), AudioTestError>>
fn write_input_audio( &self, index: i32, audio_writer: Socket, ) -> Result<(), Error>
fn get_input_audio_size(&self, index: i32) -> Self::GetInputAudioSizeResponseFut
fn clear_input_audio(&self, index: i32) -> Self::ClearInputAudioResponseFut
fn wait_until_input_is_done(&self) -> Self::WaitUntilInputIsDoneResponseFut
fn start_input_injection( &self, index: i32, ) -> Self::StartInputInjectionResponseFut
fn stop_input_injection(&self) -> Self::StopInputInjectionResponseFut
Source§impl Proxy for InjectionProxy
impl Proxy for InjectionProxy
Source§type Protocol = InjectionMarker
type Protocol = InjectionMarker
Proxy
controls.