Struct bt_avdtp::Peer

source ·
pub struct Peer { /* private fields */ }
Expand description

An AVDTP signaling peer can send commands to another peer, receive requests and send responses. Media transport is not handled by this peer.

Requests from the distant peer are delivered through the request stream available through take_request_stream(). Only one RequestStream can be active at a time. Only valid requests are sent to the request stream - invalid formats are automatically rejected.

Responses are sent using responders that are included in the request stream from the connected peer.

Implementations§

source§

impl Peer

source

pub fn new(signaling: Channel) -> Self

Create a new peer from a signaling channel.

source

pub fn take_request_stream(&self) -> RequestStream

Take the event listener for this peer. Panics if the stream is already held.

source

pub fn discover(&self) -> impl Future<Output = Result<Vec<StreamInformation>>>

Send a Stream End Point Discovery (Sec 8.6) command to the remote peer. Asynchronously returns a the reply in a vector of endpoint information. Error will be RemoteRejected if the remote peer rejected the command.

source

pub fn get_capabilities( &self, stream_id: &StreamEndpointId ) -> impl Future<Output = Result<Vec<ServiceCapability>>>

Send a Get Capabilities (Sec 8.7) command to the remote peer for the given stream_id. Asynchronously returns the reply which contains the ServiceCapabilities reported. In general, Get All Capabilities should be preferred to this command if is supported. Error will be RemoteRejected if the remote peer rejects the command.

source

pub fn get_all_capabilities( &self, stream_id: &StreamEndpointId ) -> impl Future<Output = Result<Vec<ServiceCapability>>>

Send a Get All Capabilities (Sec 8.8) command to the remote peer for the given stream_id. Asynchronously returns the reply which contains the ServiceCapabilities reported. Error will be RemoteRejected if the remote peer rejects the command.

source

pub fn set_configuration( &self, stream_id: &StreamEndpointId, local_stream_id: &StreamEndpointId, capabilities: &[ServiceCapability] ) -> impl Future<Output = Result<()>>

Send a Stream Configuration (Sec 8.9) command to the remote peer for the given remote stream_id, communicating the association to a local local_stream_id and the required stream capabilities. Panics if capabilities is empty. Error will be RemoteRejected if the remote refused. ServiceCategory will be set on RemoteReject with the indicated issue category.

source

pub fn get_configuration( &self, stream_id: &StreamEndpointId ) -> impl Future<Output = Result<Vec<ServiceCapability>>>

Send a Get Stream Configuration (Sec 8.10) command to the remote peer for the given remote stream_id. Asynchronously returns the set of ServiceCapabilities previously configured between these two peers. Error will be RemoteRejected if the remote peer rejects this command.

source

pub fn reconfigure( &self, stream_id: &StreamEndpointId, capabilities: &[ServiceCapability] ) -> impl Future<Output = Result<()>>

Send a Stream Reconfigure (Sec 8.11) command to the remote peer for the given remote stream_id, to reconfigure the Application Service capabilities in capabilities. Note: Per the spec, only the Media Codec and Content Protection capabilities will be accepted in this command. Panics if there are no capabilities to configure. Error will be RemoteRejected if the remote refused. ServiceCategory will be set on RemoteReject with the indicated issue category.

source

pub fn open( &self, stream_id: &StreamEndpointId ) -> impl Future<Output = Result<()>>

Send a Open Stream Command (Sec 8.12) to the remote peer for the given stream_id. Error will be RemoteRejected if the remote peer rejects the command.

source

pub fn start( &self, stream_ids: &[StreamEndpointId] ) -> impl Future<Output = Result<()>>

Send a Start Stream Command (Sec 8.13) to the remote peer for all the streams in stream_ids. Returns Ok(()) if the command is accepted, and RemoteStreamRejected with the stream endpoint id and error code reported by the remote if the remote signals a failure.

source

pub fn close( &self, stream_id: &StreamEndpointId ) -> impl Future<Output = Result<()>>

Send a Close Stream Command (Sec 8.14) to the remote peer for the given stream_id. Error will be RemoteRejected if the remote peer rejects the command.

source

pub fn suspend( &self, stream_ids: &[StreamEndpointId] ) -> impl Future<Output = Result<()>>

Send a Suspend Command (Sec 8.15) to the remote peer for all the streams in stream_ids. Error will be RemoteRejected if the remote refused, with the stream endpoint identifier indicated by the remote set in the RemoteReject.

source

pub fn abort( &self, stream_id: &StreamEndpointId ) -> impl Future<Output = Result<()>>

Send an Abort (Sec 8.16) to the remote peer for the given stream_id. Returns Ok(()) if the command is accepted, and Err(Timeout) if the remote timed out. The remote peer is not allowed to reject this command, and commands that have invalid stream_id will timeout instead.

source

pub fn delay_report( &self, stream_id: &StreamEndpointId, delay: u16 ) -> impl Future<Output = Result<()>>

Send a Delay Report (Sec 8.19) to the remote peer for the given stream_id. delay is in tenths of milliseconds. Error will be RemoteRejected if the remote peer rejects the command.

Trait Implementations§

source§

impl Clone for Peer

source§

fn clone(&self) -> Peer

Returns a copy 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 Peer

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Peer

§

impl !RefUnwindSafe for Peer

§

impl Send for Peer

§

impl Sync for Peer

§

impl Unpin for Peer

§

impl !UnwindSafe for Peer

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
§

impl<T> DebugExt for T
where 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

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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