#[derive(Eq, PartialEq, Hash, Clone, Debug)]
pub struct DeviceInfo {
pub vid: u16,
pub pid: u16,
pub serial_number: String,
}
impl DeviceInfo {
pub fn new(vid: u16, pid: u16, serial_number: String) -> Self {
Self {
vid,
pid,
serial_number,
}
}
}
#[derive(Eq, PartialEq, Hash, Clone, Debug)]
pub enum DeviceLifecycleEvent {
Connected(DeviceInfo),
Disconnected(DeviceInfo),
}
#[derive(Clone, Debug)]
pub enum DeviceInput {
NoData,
ButtonStateChange(Vec<bool>),
EncoderStateChange(Vec<bool>),
EncoderTwist(Vec<i8>),
}
impl DeviceInput {
pub fn is_empty(&self) -> bool {
matches!(self, DeviceInput::NoData)
}
}
#[derive(Copy, Clone, Debug, Hash)]
pub struct ImageFormat {
pub mode: ImageMode,
pub size: (usize, usize),
pub rotation: ImageRotation,
pub mirror: ImageMirroring,
}
impl Default for ImageFormat {
fn default() -> Self {
Self {
mode: ImageMode::None,
size: (0, 0),
rotation: ImageRotation::Rot0,
mirror: ImageMirroring::None,
}
}
}
#[derive(Copy, Clone, Debug, Hash)]
pub enum ImageRotation {
Rot0,
Rot90,
Rot180,
Rot270,
}
#[derive(Copy, Clone, Debug, Hash)]
pub enum ImageMirroring {
None,
X,
Y,
Both,
}
#[derive(Copy, Clone, Debug, Hash)]
pub enum ImageMode {
None,
BMP,
JPEG,
}