Bootstrap DD3 Rust port workspace with host-first compatibility tests
This commit is contained in:
27
crates/dd3_core/src/traits.rs
Normal file
27
crates/dd3_core/src/traits.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use std::vec::Vec;
|
||||
|
||||
pub trait Clock {
|
||||
fn now_ms(&self) -> u64;
|
||||
fn now_utc(&self) -> u32;
|
||||
fn is_time_synced(&self) -> bool;
|
||||
}
|
||||
|
||||
pub trait Radio {
|
||||
fn send_frame(&mut self, frame: &[u8]) -> bool;
|
||||
fn recv_frame(&mut self, window_ms: u32, now_ms: u64) -> Option<Vec<u8>>;
|
||||
}
|
||||
|
||||
pub trait Publisher {
|
||||
fn publish_state(&mut self, device_id: &str, payload: &str);
|
||||
fn publish_faults(&mut self, device_id: &str, payload: &str);
|
||||
fn publish_discovery(&mut self, device_id: &str, payload: &str);
|
||||
}
|
||||
|
||||
pub trait Storage {
|
||||
fn append_csv(&mut self, device_id: &str, line: &str);
|
||||
}
|
||||
|
||||
pub trait StatusSink {
|
||||
fn sender_phase(&mut self, _phase: &str) {}
|
||||
fn receiver_status(&mut self, _status: &str) {}
|
||||
}
|
||||
Reference in New Issue
Block a user