diff --git a/water-pod-common/src/lib.rs b/water-pod-common/src/lib.rs index 85ea140..970bdfe 100644 --- a/water-pod-common/src/lib.rs +++ b/water-pod-common/src/lib.rs @@ -6,12 +6,14 @@ use jiff::{SignedDuration, Timestamp}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Request { TimeSync(TimeSyncMs), + FetchCommands, } #[derive(Debug, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Response { TimeSync(TimeSyncMs), + FetchCommands(Command), } impl Request { @@ -75,3 +77,11 @@ impl TimeSyncMs { original_ts.saturating_add(SignedDuration::from_millis(offset)) } } + +#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +pub struct Command { + #[serde(with = "postcard::fixint::le")] + pub time: i64, + pub duration: u8, +}