#![recursion_limit = "128"]
use std::result;
use thiserror::Error;
mod avc;
mod avctp;
pub use crate::avctp::{
Command as AvctpCommand, CommandStream as AvctpCommandStream, MessageType as AvctpMessageType,
PacketType as AvctpPacketType, Peer as AvctpPeer,
};
pub use crate::avc::{
Command as AvcCommand, CommandResponse as AvcCommandResponse,
CommandStream as AvcCommandStream, CommandType as AvcCommandType, OpCode as AvcOpCode,
PacketType as AvcPacketType, Peer as AvcPeer, ResponseType as AvcResponseType,
};
#[derive(Error, Debug, PartialEq)]
pub enum Error {
#[error("Value was out of range")]
OutOfRange,
#[error("Invalid profile id")]
InvalidProfileId,
#[error("Invalid Header for a AVCTP message")]
InvalidHeader,
#[error("Failed to parse AVCTP message contents")]
InvalidMessage,
#[error("Command timed out")]
Timeout,
#[error("Peer has disconnected")]
PeerDisconnected,
#[error("Command Response has already been received")]
AlreadyReceived,
#[error("Encountered an IO error reading from the peer: {}", _0)]
PeerRead(zx::Status),
#[error("Encountered an IO error writing to the peer: {}", _0)]
PeerWrite(zx::Status),
#[error("Encountered an error encoding a message")]
Encoding,
#[error("Invalid request detected")]
RequestInvalid,
#[error("Command type is not a response")]
ResponseTypeInvalid,
#[error("Response command type is unexpected")]
UnexpectedResponse,
#[doc(hidden)]
#[error("__Nonexhaustive error should never be created.")]
__Nonexhaustive,
}
pub(crate) type Result<T> = result::Result<T, Error>;