pub mod client;
pub mod connection;
pub mod listener;
pub mod protocol;
pub use client::MuxClient;
pub use listener::MuxEvent;
use crate::mux::protocol::DeviceEntryRaw;
#[derive(Debug, Clone)]
pub struct MuxDevice {
pub device_id: u32,
pub serial_number: String, pub connection_type: String,
pub product_id: u16,
}
impl MuxDevice {
pub(crate) fn from_raw(raw: DeviceEntryRaw) -> Self {
Self {
device_id: raw.device_id,
serial_number: raw.properties.serial_number,
connection_type: raw.properties.connection_type,
product_id: raw.properties.product_id.unwrap_or(0),
}
}
}
#[derive(Debug, thiserror::Error)]
pub enum MuxError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("protocol error: {0}")]
Protocol(String),
#[error("device not found: {0}")]
DeviceNotFound(String),
}