PacketStreamControlProxy

Struct PacketStreamControlProxy 

Source
pub struct PacketStreamControlProxy { /* private fields */ }

Implementations§

Source§

impl PacketStreamControlProxy

Source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.

Source

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.

Source

pub fn get_properties( &self, ) -> QueryResponseFut<PacketStreamProperties, DefaultFuchsiaResourceDialect>

Accessor for top level static properties.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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:

  1. App writes audio data to a registered VMO.
  2. App flushes the cache for the written region (if needs_cache_flush_or_invalidate is true).
  3. App calls PacketStreamSink.PutPacket with the location of the data.
  4. 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.

Source

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:

  1. Driver writes audio data to a registered VMO.
  2. Driver calls PacketStreamSink.PutPacket with the location of the data.
  3. App receives PutPacket.
  4. App invalidates the cache for the region (if needs_cache_flush_or_invalidate is true).
  5. 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.

Source

pub fn start( &self, ) -> QueryResponseFut<PacketStreamControlStartResult, DefaultFuchsiaResourceDialect>

Start the packet-stream.

Returns ZX_ERR_BAD_STATE if:

  • Buffers have not been allocated (if DRIVER_OWNED was specified) and/or registered (if CLIENT_OWNED was specified). This is not applicable if INLINE is supported.
  • The stream is already started.
Source

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.PutPacket requests will remain pending until Start is called again. Clients may call PacketStreamSink.FlushPackets after Stop to discard these pending packets.
  • Input: The driver stops producing packets. No further PacketStreamSink.PutPacket calls will be made by the driver until Start is 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.PutPacket calls may complete successfully after Stop has returned.
  • For Input, some in-flight PacketStreamSink.PutPacket calls may arrive at the client after Stop has returned.

Returns ZX_ERR_BAD_STATE if the stream is not started.

Trait Implementations§

Source§

impl Clone for PacketStreamControlProxy

Source§

fn clone(&self) -> PacketStreamControlProxy

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PacketStreamControlProxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PacketStreamControlProxyInterface for PacketStreamControlProxy

Source§

impl Proxy for PacketStreamControlProxy

Source§

type Protocol = PacketStreamControlMarker

The protocol which this Proxy controls.
Source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
Source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
Source§

fn as_channel(&self) -> &AsyncChannel

Get a reference to the proxy’s underlying channel. Read more
Source§

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
Source§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
Source§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromClient for T
where T: Proxy,

Source§

type Protocol = <T as Proxy>::Protocol

The protocol.
Source§

fn from_client(value: ClientEnd<<T as FromClient>::Protocol>) -> T

Converts from a client.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ProxyHasDomain for T
where T: Proxy,

Source§

fn domain(&self) -> ZirconClient

Get a “client” for this proxy. This is just an object which has methods for a few common handle creation operations.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.