pub struct StreamEndpoint { /* private fields */ }
Expand description

An AVDTP StreamEndpoint. StreamEndpoints represent a particular capability of the application to be a source of sink of media. Included here to aid negotiating the stream connection. See Section 5.3 of the AVDTP 1.3 Specification for more information about the Stream Endpoint Architecture.

Implementations§

source§

impl StreamEndpoint

source

pub fn new( id: u8, media_type: MediaType, endpoint_type: EndpointType, capabilities: Vec<ServiceCapability> ) -> AvdtpResult<StreamEndpoint>

Make a new StreamEndpoint. |id| must be in the valid range for a StreamEndpointId (0x01 - 0x3E). StreamEndpoints start in the Idle state.

source

pub fn as_new(&self) -> Self

source

pub fn set_update_callback( &mut self, callback: Option<StreamEndpointUpdateCallback> )

Pass update callback to StreamEndpoint that will be called anytime StreamEndpoint is modified.

source

pub fn from_info( info: &StreamInformation, capabilities: Vec<ServiceCapability> ) -> StreamEndpoint

Build a new StreamEndpoint from a StreamInformation and associated Capabilities. This makes it easy to build from AVDTP Discover and GetCapabilities procedures. StreamEndpooints start in the Idle state.

source

pub fn configure( &mut self, remote_id: &StreamEndpointId, capabilities: Vec<ServiceCapability> ) -> Result<(), (ServiceCategory, ErrorCode)>

Attempt to Configure this stream using the capabilities given. If the stream is not in an Idle state, fails with Err(InvalidState). Used for the Stream Configuration procedure, see Section 6.9

source

pub fn reconfigure( &mut self, capabilities: Vec<ServiceCapability> ) -> Result<(), (ServiceCategory, ErrorCode)>

Attempt to reconfigure this stream with the capabilities given. If any capability is not valid to set, fails with the first such category and InvalidCapabilities If the stream is not in the Open state, fails with Err((None, BadState)) Used for the Stream Reconfiguration procedure, see Section 6.15.

source

pub fn get_configuration(&self) -> Option<&Vec<ServiceCapability>>

Get the current configuration of this stream. If the stream is not configured, returns None. Used for the Steam Get Configuration Procedure, see Section 6.10

source

pub fn receive_channel(&mut self, c: Channel) -> AvdtpResult<bool>

When a L2CAP channel is received after an Open command is accepted, it should be delivered via receive_channel. Returns true if this Endpoint expects more channels to be established before streaming is started. Returns Err(InvalidState) if this Endpoint is not expecting a channel to be established, closing |c|.

source

pub fn establish(&mut self) -> Result<(), ErrorCode>

Begin opening this stream. The stream must be in a Configured state. See Stream Establishment, Section 6.11

source

pub async fn wait_for_channel_close( &self, timeout: Duration ) -> Result<(), Status>

Waits for the MediaTransport Channel to be closed up to Duration. Returns Err(Status::TIMED_OUT) if the channel didn’t close.

source

pub fn try_priority(&self, active: bool)

Attempts to set audio direction priority of the MediaTransport channel based on whether the stream is a source or sink endpoint if active is true. If active is false, set the priority to Normal instead. Does nothing on failure.

source

pub fn try_flush_timeout(&self, timeout: Duration)

Attempts to set the flush timeout for the MediaTransport channel, for source endpoints.

source

pub async fn release<'a>( &'a mut self, responder: SimpleResponder, peer: &'a Peer ) -> AvdtpResult<()>

Close this stream. This procedure checks that the media channels are closed. If the channels are not closed in 3 seconds, it initiates an abort procedure with the remote |peer| and completes when that finishes.

source

pub fn state(&self) -> &StreamState

Returns the current state of this endpoint.

source

pub fn start(&mut self) -> Result<(), ErrorCode>

Start this stream. This can be done only from the Open State. Used for the Stream Start procedure, See Section 6.12

source

pub fn suspend(&mut self) -> Result<(), ErrorCode>

Suspend this stream. This can be done only from the Streaming state. Used for the Stream Suspend procedure, See Section 6.14

source

pub async fn abort<'a>(&'a mut self, peer: Option<&'a Peer>)

Abort this stream. This can be done from any state, and will always return the state to Idle. If peer is not None, we are initiating this procedure and all our channels will be closed.

source

pub fn capabilities(&self) -> &Vec<ServiceCapability>

Capabilities of this StreamEndpoint. Provides support for the Get Capabilities and Get All Capabilities signaling procedures. See Sections 6.7 and 6.8

source

pub fn codec_type(&self) -> Option<&MediaCodecType>

Returns the CodecType of this StreamEndpoint. Returns None if there is no MediaCodec capability in the endpoint. Note: a MediaCodec capability is required by all endpoints by the spec.

source

pub fn local_id(&self) -> &StreamEndpointId

Returns the local StreamEndpointId for this endpoint.

source

pub fn remote_id(&self) -> Option<&StreamEndpointId>

Returns the remote StreamEndpointId for this endpoint, if it’s configured.

source

pub fn endpoint_type(&self) -> &EndpointType

Returns the EndpointType of this endpoint

source

pub fn information(&self) -> StreamInformation

Make a StreamInformation which represents the current state of this stream.

source

pub fn take_transport(&mut self) -> Option<MediaStream>

Take the media transport channel, which transmits (or receives) any media for this StreamEndpoint. Returns None if the channel is held already, or if the channel has not been opened.

Trait Implementations§

source§

impl Debug for StreamEndpoint

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> DebugExt for Twhere T: Debug,

§

fn debug(&self) -> String

§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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
§

impl<T> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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 = mem::align_of::<T>()

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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more