diff --git a/satrs-core/src/lib.rs b/satrs-core/src/lib.rs index 51ee886..f4e0a9d 100644 --- a/satrs-core/src/lib.rs +++ b/satrs-core/src/lib.rs @@ -34,5 +34,6 @@ pub mod pus; pub mod res_code; pub mod seq_count; pub mod tmtc; +pub mod power; pub use spacepackets; diff --git a/satrs-core/src/power.rs b/satrs-core/src/power.rs new file mode 100644 index 0000000..cc00e2b --- /dev/null +++ b/satrs-core/src/power.rs @@ -0,0 +1,28 @@ + +pub trait PowerSwitch { + fn switch_on(&mut self); + fn switch_off(&mut self); + + fn is_switch_on(&self) -> bool { + self.switch_state() == SwitchState::On + } + + fn switch_state(&self) -> SwitchState; +} + +pub enum SwitchState { + Off = 0, + On = 1, + Unknown = 2 +} + +pub trait PowerSwitcher { + fn send_switch_on_cmd(&mut self, switch_nr: u16); + fn send_switch_off_cmd(&mut self, switch_nr: u16); + + fn get_switch_state(&mut self, switch_nr: u16) -> SwitchState; + + fn get_is_switch_on(&mut self) -> bool { + self.get_switch_state() == SwitchState::On + } +} \ No newline at end of file