#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Model {
MicArrayV2,
Xvf3800,
Lite,
}
impl Model {
pub const fn product_id(self) -> u16 {
match self {
Self::MicArrayV2 => crate::PRODUCT_ID_V2,
Self::Xvf3800 => crate::PRODUCT_ID_XVF3800,
Self::Lite => crate::PRODUCT_ID_LITE,
}
}
pub const fn label(self) -> &'static str {
match self {
Self::MicArrayV2 => "ReSpeaker Mic Array v2.0 (XVF-3000)",
Self::Xvf3800 => "reSpeaker XVF3800",
Self::Lite => "reSpeaker Lite (XU316)",
}
}
pub const fn has_usb_control(self) -> bool {
match self {
Self::MicArrayV2 | Self::Xvf3800 => true,
Self::Lite => false,
}
}
}
impl std::fmt::Display for Model {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.label())
}
}