oaat-core 0.2.0

Core types, wire format, and protocol messages for OAAT (Open Advanced Audio Transport)
Documentation
use crate::session::SessionState;

#[derive(Debug, thiserror::Error)]
pub enum OaatError {
    #[error("unknown audio format wire ID: 0x{0:02x}")]
    UnknownFormat(u8),

    #[error("invalid packet flags: 0x{0:02x}")]
    InvalidPacketFlags(u8),

    #[error("invalid clock sync type: 0x{0:02x}")]
    InvalidClockSyncType(u8),

    #[error("invalid state transition: {from} -> {to}")]
    InvalidStateTransition {
        from: SessionState,
        to: SessionState,
    },

    #[error("invalid capability string: {0:?}")]
    InvalidCapabilityString(String),

    #[error("protocol version mismatch: expected {expected}, got {got}")]
    VersionMismatch { expected: u32, got: u32 },

    #[error("message too large: {0} bytes")]
    MessageTooLarge(usize),

    #[error("incomplete frame: need {need} bytes, have {have}")]
    IncompleteFrame { need: usize, have: usize },

    #[error("io: {0}")]
    Io(#[from] std::io::Error),

    #[error("json: {0}")]
    Json(#[from] serde_json::Error),

    #[error("protocol: {0}")]
    Protocol(String),
}