lj_rust/src/device/dummy.rs

45 lines
1012 B
Rust

use crate::device::{Device, PlaybackState, Status};
use crate::errors::LJResult;
use crate::point::{Color, Point};
use log::debug;
pub struct DummyDevice {
state: PlaybackState,
}
impl DummyDevice {
pub fn new() -> LJResult<Self> {
Ok(Self {
state: PlaybackState::IDLE,
})
}
}
impl Device for DummyDevice {
fn status(&mut self) -> Status {
Status {
last_traced_at: "never".to_string(),
properties: vec!["foo".to_string()],
playback_state: self.state,
capacity: 0,
lack: "lack".to_string(),
}
}
fn draw(&mut self, line: Vec<Point>, speed: u32) -> LJResult<()> {
debug!("Draw Line at speed {speed} : {:?}", line);
Ok(())
}
fn stop(&mut self) -> LJResult<()> {
Ok(())
}
fn grid(&mut self) -> Vec<Point> {
vec![Point {
x: 0 as f32,
y: 0 as f32,
color: Color { r: 0, g: 0, b: 0 },
}]
}
}