pub struct PacketStreamControlProxy { /* private fields */ }Implementations§
Source§impl PacketStreamControlProxy
impl PacketStreamControlProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
Sourcepub fn take_event_stream(&self) -> PacketStreamControlEventStream
pub fn take_event_stream(&self) -> PacketStreamControlEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn get_properties(
&self,
) -> QueryResponseFut<PacketStreamProperties, DefaultFuchsiaResourceDialect>
pub fn get_properties( &self, ) -> QueryResponseFut<PacketStreamProperties, DefaultFuchsiaResourceDialect>
Accessor for top level static properties.
Sourcepub fn allocate_vmos(
&self,
payload: &AllocateVmosConfig,
) -> QueryResponseFut<PacketStreamControlAllocateVmosResult, DefaultFuchsiaResourceDialect>
pub fn allocate_vmos( &self, payload: &AllocateVmosConfig, ) -> QueryResponseFut<PacketStreamControlAllocateVmosResult, DefaultFuchsiaResourceDialect>
Request the driver to allocate VMOs for data transfer. Returns the allocated VMOs and their assigned IDs.
The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP. If the packet stream is an output stream, then the handle must also include ZX_RIGHT_WRITE.
Returns ZX_ERR_INVALID_ARGS if min_vmo_size is zero or vmo_count is zero.
Returns ZX_ERR_NO_MEMORY if the driver cannot allocate the requested VMOs.
Returns ZX_ERR_BAD_STATE if VMOs are already allocated or registered, or if the
stream is already started. Call DeallocateVmos or UnregisterVmos first to
reconfigure.
Sourcepub fn deallocate_vmos(
&self,
) -> QueryResponseFut<PacketStreamControlDeallocateVmosResult, DefaultFuchsiaResourceDialect>
pub fn deallocate_vmos( &self, ) -> QueryResponseFut<PacketStreamControlDeallocateVmosResult, DefaultFuchsiaResourceDialect>
Releases all VMOs previously allocated via AllocateVmos.
This also occurs automatically when the PacketStreamControl channel is closed.
Returns ZX_ERR_BAD_STATE if VMOs are not currently allocated, or if the stream is
not stopped.
Sourcepub fn register_vmos(
&self,
payload: RegisterVmosConfig,
) -> QueryResponseFut<PacketStreamControlRegisterVmosResult, DefaultFuchsiaResourceDialect>
pub fn register_vmos( &self, payload: RegisterVmosConfig, ) -> QueryResponseFut<PacketStreamControlRegisterVmosResult, DefaultFuchsiaResourceDialect>
Registers client-allocated VMOs with the driver.
The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP. If the packet stream is an input stream, then the handle must also include ZX_RIGHT_WRITE.
Returns ZX_ERR_INVALID_ARGS if vmo_infos is empty, or if any VMO handle is invalid,
or if duplicate vmo_ids are found.
Returns ZX_ERR_ACCESS_DENIED if any VMO does not have the required rights.
Returns ZX_ERR_BAD_STATE if VMOs are already registered or allocated, or if the
stream is already started. Call UnregisterVmos or DeallocateVmos first to
reconfigure.
Sourcepub fn unregister_vmos(
&self,
) -> QueryResponseFut<PacketStreamControlUnregisterVmosResult, DefaultFuchsiaResourceDialect>
pub fn unregister_vmos( &self, ) -> QueryResponseFut<PacketStreamControlUnregisterVmosResult, DefaultFuchsiaResourceDialect>
Unregisters all VMOs previously registered via RegisterVmos.
This also occurs automatically when the PacketStreamControl channel is closed.
Returns ZX_ERR_BAD_STATE if VMOs are not currently registered, or if the stream is
not stopped.
Sourcepub fn get_packet_stream_sink(
&self,
) -> QueryResponseFut<PacketStreamControlGetPacketStreamSinkResult, DefaultFuchsiaResourceDialect>
pub fn get_packet_stream_sink( &self, ) -> QueryResponseFut<PacketStreamControlGetPacketStreamSinkResult, DefaultFuchsiaResourceDialect>
Connects to the data sink implemented by the driver. This is used for audio Output where the driver consumes data.
Flow:
- App writes audio data to a registered VMO.
- App flushes the cache for the written region (if
needs_cache_flush_or_invalidateis true). - App calls
PacketStreamSink.PutPacketwith the location of the data. - Driver consumes the data.
If this method is called multiple times, the previous PacketStreamSink channel is closed,
and any pending requests on that channel are discarded. The new channel replaces the old
one.
Returns ZX_ERR_NOT_SUPPORTED if the stream is an input stream, or if the driver does
not support this method.
Sourcepub fn set_packet_stream_sink(
&self,
payload: PacketStreamControlSetPacketStreamSinkRequest,
) -> QueryResponseFut<PacketStreamControlSetPacketStreamSinkResult, DefaultFuchsiaResourceDialect>
pub fn set_packet_stream_sink( &self, payload: PacketStreamControlSetPacketStreamSinkRequest, ) -> QueryResponseFut<PacketStreamControlSetPacketStreamSinkResult, DefaultFuchsiaResourceDialect>
Provides a data sink to the driver. This is used for audio Input where the driver produces data.
Flow:
- Driver writes audio data to a registered VMO.
- Driver calls
PacketStreamSink.PutPacketwith the location of the data. - App receives
PutPacket. - App invalidates the cache for the region (if
needs_cache_flush_or_invalidateis true). - App reads the data.
If this method is called multiple times, the driver closes the previous PacketStreamSink
channel. The new channel replaces the old one.
Returns ZX_ERR_NOT_SUPPORTED if the stream is an output stream, or if the driver does
not support this method.
Sourcepub fn start(
&self,
) -> QueryResponseFut<PacketStreamControlStartResult, DefaultFuchsiaResourceDialect>
pub fn start( &self, ) -> QueryResponseFut<PacketStreamControlStartResult, DefaultFuchsiaResourceDialect>
Start the packet-stream.
Returns ZX_ERR_BAD_STATE if:
- Buffers have not been allocated (if
DRIVER_OWNEDwas specified) and/or registered (ifCLIENT_OWNEDwas specified). This is not applicable ifINLINEis supported. - The stream is already started.
Sourcepub fn stop(
&self,
) -> QueryResponseFut<PacketStreamControlStopResult, DefaultFuchsiaResourceDialect>
pub fn stop( &self, ) -> QueryResponseFut<PacketStreamControlStopResult, DefaultFuchsiaResourceDialect>
Stop the packet-stream.
Once the response is received, the stream is halted.
Behavior depends on the stream direction:
- Output: The driver stops consuming packets. Any pending
PacketStreamSink.PutPacketrequests will remain pending untilStartis called again. Clients may callPacketStreamSink.FlushPacketsafterStopto discard these pending packets. - Input: The driver stops producing packets. No further
PacketStreamSink.PutPacketcalls will be made by the driver untilStartis called again.
Note that since PacketStreamSink uses a separate channel, there is no strict ordering
guarantee between Stop and PacketStreamSink.PutPacket:
- For Output, some in-flight
PacketStreamSink.PutPacketcalls may complete successfully afterStophas returned. - For Input, some in-flight
PacketStreamSink.PutPacketcalls may arrive at the client afterStophas returned.
Returns ZX_ERR_BAD_STATE if the stream is not started.
Trait Implementations§
Source§impl Clone for PacketStreamControlProxy
impl Clone for PacketStreamControlProxy
Source§fn clone(&self) -> PacketStreamControlProxy
fn clone(&self) -> PacketStreamControlProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PacketStreamControlProxy
impl Debug for PacketStreamControlProxy
Source§impl PacketStreamControlProxyInterface for PacketStreamControlProxy
impl PacketStreamControlProxyInterface for PacketStreamControlProxy
type GetPropertiesResponseFut = QueryResponseFut<PacketStreamProperties>
type AllocateVmosResponseFut = QueryResponseFut<Result<Vec<VmoInfo>, i32>>
type DeallocateVmosResponseFut = QueryResponseFut<Result<(), i32>>
type RegisterVmosResponseFut = QueryResponseFut<Result<(), i32>>
type UnregisterVmosResponseFut = QueryResponseFut<Result<(), i32>>
type GetPacketStreamSinkResponseFut = QueryResponseFut<Result<PacketStreamControlGetPacketStreamSinkResponse, i32>>
type SetPacketStreamSinkResponseFut = QueryResponseFut<Result<(), i32>>
type StartResponseFut = QueryResponseFut<Result<(), i32>>
type StopResponseFut = QueryResponseFut<Result<(), i32>>
fn get_properties(&self) -> Self::GetPropertiesResponseFut
fn allocate_vmos( &self, payload: &AllocateVmosConfig, ) -> Self::AllocateVmosResponseFut
fn deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut
fn register_vmos( &self, payload: RegisterVmosConfig, ) -> Self::RegisterVmosResponseFut
fn unregister_vmos(&self) -> Self::UnregisterVmosResponseFut
fn get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut
fn set_packet_stream_sink( &self, payload: PacketStreamControlSetPacketStreamSinkRequest, ) -> Self::SetPacketStreamSinkResponseFut
fn start(&self) -> Self::StartResponseFut
fn stop(&self) -> Self::StopResponseFut
Source§impl Proxy for PacketStreamControlProxy
impl Proxy for PacketStreamControlProxy
Source§type Protocol = PacketStreamControlMarker
type Protocol = PacketStreamControlMarker
Proxy controls.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
Source§fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
Source§fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>
fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>
PEER_CLOSED signal.