pub trait DisplayController: Send + Sync {
// Required methods
fn get_state(&self) -> ControllerState;
fn refresh_sliders(&self) -> Result<(), ControllerError>;
fn sync_all_sliders(&self) -> Result<(), ControllerError>;
fn set_dimming(&self, level: i32) -> Result<(), ControllerError>;
fn set_dimming_percent(&self, percent: i32) -> Result<(), ControllerError>;
fn get_current_mode(&self) -> Result<Box<dyn DisplayMode>, ControllerError>;
fn set_mode(&self, mode: &dyn DisplayMode) -> Result<(), ControllerError>;
fn toggle_e_reading(&self) -> Result<Box<dyn DisplayMode>, ControllerError>;
}Expand description
Trait for display controller implementations.
This allows for mock implementations in tests.
Required Methods§
Sourcefn get_state(&self) -> ControllerState
fn get_state(&self) -> ControllerState
Get a snapshot of the current controller state.
Sourcefn refresh_sliders(&self) -> Result<(), ControllerError>
fn refresh_sliders(&self) -> Result<(), ControllerError>
Refresh slider values from the device.
Sourcefn sync_all_sliders(&self) -> Result<(), ControllerError>
fn sync_all_sliders(&self) -> Result<(), ControllerError>
Sync all slider values from hardware.
Sourcefn set_dimming(&self, level: i32) -> Result<(), ControllerError>
fn set_dimming(&self, level: i32) -> Result<(), ControllerError>
Set the display dimming level (40-100 in splendid units).
Sourcefn set_dimming_percent(&self, percent: i32) -> Result<(), ControllerError>
fn set_dimming_percent(&self, percent: i32) -> Result<(), ControllerError>
Set dimming using percentage (0-100).
Sourcefn get_current_mode(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
fn get_current_mode(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
Get the current display mode.
Sourcefn set_mode(&self, mode: &dyn DisplayMode) -> Result<(), ControllerError>
fn set_mode(&self, mode: &dyn DisplayMode) -> Result<(), ControllerError>
Set a display mode.
Sourcefn toggle_e_reading(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
fn toggle_e_reading(&self) -> Result<Box<dyn DisplayMode>, ControllerError>
Toggle e-reading mode on/off.