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
impl StreamEndpoint
Sourcepub fn new(
id: u8,
media_type: MediaType,
endpoint_type: EndpointType,
capabilities: Vec<ServiceCapability>,
) -> AvdtpResult<StreamEndpoint>
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.
pub fn as_new(&self) -> Self
Sourcepub fn set_update_callback(
&mut self,
callback: Option<StreamEndpointUpdateCallback>,
)
pub fn set_update_callback( &mut self, callback: Option<StreamEndpointUpdateCallback>, )
Pass update callback to StreamEndpoint that will be called anytime StreamEndpoint
is
modified.
Sourcepub fn from_info(
info: &StreamInformation,
capabilities: Vec<ServiceCapability>,
) -> StreamEndpoint
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.
Sourcepub fn configure(
&mut self,
remote_id: &StreamEndpointId,
capabilities: Vec<ServiceCapability>,
) -> Result<(), (ServiceCategory, ErrorCode)>
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
Sourcepub fn reconfigure(
&mut self,
capabilities: Vec<ServiceCapability>,
) -> Result<(), (ServiceCategory, ErrorCode)>
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.
Sourcepub fn get_configuration(&self) -> Option<&Vec<ServiceCapability>>
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
Sourcepub fn receive_channel(&mut self, c: Channel) -> AvdtpResult<bool>
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|.
Sourcepub fn establish(&mut self) -> Result<(), ErrorCode>
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
Sourcepub fn try_priority(&self, active: bool)
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.
Sourcepub fn try_flush_timeout(&self, timeout: MonotonicDuration)
pub fn try_flush_timeout(&self, timeout: MonotonicDuration)
Attempts to set the flush timeout for the MediaTransport channel, for source endpoints.
Sourcepub fn release(
&mut self,
responder: SimpleResponder,
peer: &Peer,
) -> AvdtpResult<()>
pub fn release( &mut self, responder: SimpleResponder, peer: &Peer, ) -> AvdtpResult<()>
Close this stream. This procedure will wait until media channels are closed before transitioning to Idle. If the channels are not closed in 3 seconds, we initiate an abort procedure with the remote |peer| to force a transition to Idle.
Sourcepub fn state(&self) -> StreamState
pub fn state(&self) -> StreamState
Returns the current state of this endpoint.
Sourcepub fn start(&mut self) -> Result<(), ErrorCode>
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
Sourcepub fn suspend(&mut self) -> Result<(), ErrorCode>
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
Sourcepub async fn initiate_abort<'a>(&'a mut self, peer: &'a Peer)
pub async fn initiate_abort<'a>(&'a mut self, peer: &'a Peer)
Abort this stream. This can be done from any state, and will always return the state to Idle. We are initiating this procedure so will wait for a response and all our channels will be closed.
Sourcepub fn abort(&mut self)
pub fn abort(&mut self)
Abort this stream. This can be done from any state, and will always return the state to Idle. We are receiving this abort from the peer, and all our channels will close.
Sourcepub fn capabilities(&self) -> &Vec<ServiceCapability>
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
Sourcepub fn codec_type(&self) -> Option<&MediaCodecType>
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.
Sourcepub fn local_id(&self) -> &StreamEndpointId
pub fn local_id(&self) -> &StreamEndpointId
Returns the local StreamEndpointId for this endpoint.
Sourcepub fn remote_id(&self) -> Option<&StreamEndpointId>
pub fn remote_id(&self) -> Option<&StreamEndpointId>
Returns the remote StreamEndpointId for this endpoint, if it’s configured.
Sourcepub fn endpoint_type(&self) -> &EndpointType
pub fn endpoint_type(&self) -> &EndpointType
Returns the EndpointType of this endpoint
Sourcepub fn information(&self) -> StreamInformation
pub fn information(&self) -> StreamInformation
Make a StreamInformation which represents the current state of this stream.
Sourcepub fn take_transport(&mut self) -> Option<MediaStream>
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.