27 lines
720 B
Rust
27 lines
720 B
Rust
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) {}
|
|
} |