/// Given an AvctpCommand header and body:
///
/// 1) Decodes the packet body to create an `BrowsePreamble`.
/// 2) Extracts the PduId from the BrowsePreamble.
///
/// Returns the decoded PduId and the packet body.
Given an AvctpCommand header and body:
1) Decodes the packet body to create an `BrowsePreamble`.
2) Extracts the PduId from the BrowsePreamble.

Returns the decoded PduId and the packet body.
Given an AvctpCommand header and body : 1 ) Decodes the packet body to create an ` BrowsePreamble ` . 2 ) Extracts the PduId from the BrowsePreamble . Returns the decoded PduId and the packet body .
fn decode_command(command: &AvctpCommand) -> Result<(PduId, Vec<u8>), Error> {
        let packet_body = command.body();
        if !command.header().is_type(&avctp::AvctpMessageType::Command) {
            // Invalid header type. Send back general reject.
            warn!("Received invalid AVCTP request{:?}", command.header());
            return Err(Error::InvalidMessage);
        }
        let packet = match BrowsePreamble::decode(packet_body) {
            Err(e) => {
                // There was an issue parsing the AVCTP Preamble.
                warn!("Invalid AVCTP Preamble: {:?}", e);
                return Err(Error::InvalidMessage);
            }
            Ok(p) => p,
        };
        let pdu_id = match PduId::try_from(packet.pdu_id) {
            Err(e) => {
                warn!("Received unsupported PduId {:?}: {:?}", packet.pdu_id, e);
                // There was an issue parsing the packet PDU ID.
                return Err(Error::InvalidParameter);
            }
            Ok(id) => id,
        };
        Ok((pdu_id, packet.body))
    }
fn decode_command ( command : & AvctpCommand ) -> Result < ( PduId , Vec < u8 > ) , Error > { let packet_body = command . body ( ) ; if ! command . header ( ) . is_type ( & avctp :: AvctpMessageType :: Command ) { // Invalid header type. Send back general reject. warn ! ( " " command header ( ) ) ; return Err ( Error :: InvalidMessage ) ; } let packet = match BrowsePreamble :: decode ( packet_body ) { Err ( e ) => { // There was an issue parsing the AVCTP Preamble. warn ! ( " " e ) ; return Err ( Error :: InvalidMessage ) ; } Ok ( p ) => p , } ; let pdu_id = match PduId :: try_from ( packet . pdu_id ) { Err ( e ) => { warn ! ( " " packet pdu_id e ) ; // There was an issue parsing the packet PDU ID. return Err ( Error :: InvalidParameter ) ; } Ok ( id ) => id , } ; Ok ( ( pdu_id , packet . body ) ) }
Given an AvctpCommand header and body:
1) Decodes the packet body to create an `BrowsePreamble`.
Given an AvctpCommand header and body : 1 ) Decodes the packet body to create an ` BrowsePreamble ` .
command
&AvctpCommand