pub fn send_avc_passthrough<'a>(
        &self,
        payload: &'a [u8; 2],
    ) -> impl Future<Output = Result<(), Error>> + 'a {
        let peer_id = self.peer.read().peer_id.clone();
        let avc_peer_result = self.peer.write().control_connection();
        async move {
            let avc_peer = avc_peer_result?;
            let response = avc_peer.send_avc_passthrough_command(payload).await;
            match response {
                Ok(AvcCommandResponse(AvcResponseType::Accepted, _)) => Ok(()),
                Ok(AvcCommandResponse(AvcResponseType::Rejected, _)) => {
                    fx_log_info!("avrcp command rejected {:?}: {:?}", peer_id, response);
                    Err(Error::CommandNotSupported)
                }
                Err(e) => {
                    fx_log_err!("error sending avc command to {:?}: {:?}", peer_id, e);
                    Err(Error::CommandFailed)
                }
                _ => {
                    fx_log_err!(
                        "error sending avc command. unhandled response {:?}: {:?}",
                        peer_id,
                        response
                    );
                    Err(Error::CommandFailed)
                }
            }
        }
    }
/// Sends a single passthrough keycode over the control channel.
Sends a single passthrough keycode over the control channel.
Sends a single passthrough keycode over the control channel .
pub fn send_avc_passthrough<'a>(
        &self,
        payload: &'a [u8; 2],
    ) -> impl Future<Output = Result<(), Error>> + 'a {
        let peer_id = self.peer.read().peer_id.clone();
        let avc_peer_result = self.peer.write().control_connection();
        async move {
            let avc_peer = avc_peer_result?;
            let response = avc_peer.send_avc_passthrough_command(payload).await;
            match response {
                Ok(AvcCommandResponse(AvcResponseType::Accepted, _)) => Ok(()),
                Ok(AvcCommandResponse(AvcResponseType::Rejected, _)) => {
                    fx_log_info!("avrcp command rejected {:?}: {:?}", peer_id, response);
                    Err(Error::CommandNotSupported)
                }
                Err(e) => {
                    fx_log_err!("error sending avc command to {:?}: {:?}", peer_id, e);
                    Err(Error::CommandFailed)
                }
                _ => {
                    fx_log_err!(
                        "error sending avc command. unhandled response {:?}: {:?}",
                        peer_id,
                        response
                    );
                    Err(Error::CommandFailed)
                }
            }
        }
    }
pub fn send_avc_passthrough < ' a > ( & self , payload : & ' a [ u8 ; 2 ] , ) -> impl Future < Output = Result < ( ) , Error > > + ' a { let peer_id = self . peer . read ( ) . peer_id . clone ( ) ; let avc_peer_result = self . peer . write ( ) . control_connection ( ) ; async move { let avc_peer = avc_peer_result ? ; let response = avc_peer . send_avc_passthrough_command ( payload ) . await ; match response { Ok ( AvcCommandResponse ( AvcResponseType :: Accepted , _ ) ) => Ok ( ( ) ) , Ok ( AvcCommandResponse ( AvcResponseType :: Rejected , _ ) ) => { fx_log_info ! ( " " peer_id response ) ; Err ( Error :: CommandNotSupported ) } Err ( e ) => { fx_log_err ! ( " " peer_id e ) ; Err ( Error :: CommandFailed ) } _ => { fx_log_err ! ( " " peer_id response ) ; Err ( Error :: CommandFailed ) } } } }
Sends a single passthrough keycode over the control channel.
Sends a single passthrough keycode over the control channel .
&self
payload
&'a [u8; 2]
&self
payload
&'a [u8; 2]