power_abstractions + request id schedule implementation #32

Merged
muellerr merged 8 commits from power_abstractions into main 2023-02-14 16:00:19 +01:00
Showing only changes of commit be1299e7d6 - Show all commits

View File

@ -47,10 +47,13 @@ pub trait PowerSwitcher {
}
/// Retrieve the switch state
fn get_switch_state(&mut self, switch_id: SwitchId) -> SwitchState;
fn get_switch_state(&mut self, switch_id: SwitchId) -> Result<SwitchState, Self::Error>;
fn get_is_switch_on(&mut self, switch_id: SwitchId) -> bool {
self.get_switch_state(switch_id) == SwitchState::On
fn get_is_switch_on(&mut self, switch_id: SwitchId) -> Result<bool, ()> {
match self.get_switch_state(switch_id) {
Ok(switch_state) => { Ok(switch_state == SwitchState::On) }
Err(_) => { Err(()) }
}
}
/// The maximum delay it will take to change a switch.