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
impl Peer
Sourcepub fn take_request_stream(&self) -> RequestStream
pub fn take_request_stream(&self) -> RequestStream
Take the event listener for this peer. Panics if the stream is already held.
Sourcepub fn discover(&self) -> impl Future<Output = Result<Vec<StreamInformation>>>
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.
Sourcepub fn get_capabilities(
&self,
stream_id: &StreamEndpointId,
) -> impl Future<Output = Result<Vec<ServiceCapability>>>
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.
Sourcepub fn get_all_capabilities(
&self,
stream_id: &StreamEndpointId,
) -> impl Future<Output = Result<Vec<ServiceCapability>>>
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.
Sourcepub fn set_configuration(
&self,
stream_id: &StreamEndpointId,
local_stream_id: &StreamEndpointId,
capabilities: &[ServiceCapability],
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn get_configuration(
&self,
stream_id: &StreamEndpointId,
) -> impl Future<Output = Result<Vec<ServiceCapability>>>
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.
Sourcepub fn reconfigure(
&self,
stream_id: &StreamEndpointId,
capabilities: &[ServiceCapability],
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn open(
&self,
stream_id: &StreamEndpointId,
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn start(
&self,
stream_ids: &[StreamEndpointId],
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn close(
&self,
stream_id: &StreamEndpointId,
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn suspend(
&self,
stream_ids: &[StreamEndpointId],
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn abort(
&self,
stream_id: &StreamEndpointId,
) -> impl Future<Output = Result<()>>
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.
Sourcepub fn delay_report(
&self,
stream_id: &StreamEndpointId,
delay: u16,
) -> impl Future<Output = Result<()>>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)