pub struct Peripheral {
pub id: u32,
pub parent_node: u32,
pub peripheral_type: PeripheralType,
pub callsign: [u8; 12],
pub health: HealthStatus,
pub last_event: Option<PeripheralEvent>,
pub timestamp: u64,
}Expand description
A peripheral device attached to a Node (soldier)
Peripherals are sub-tier devices that augment a soldier’s capabilities with sensors and input (e.g., M5Stack Core2 wearable).
Fields§
§id: u32Unique peripheral ID (derived from device MAC or similar)
parent_node: u32Parent Node ID this peripheral is attached to (0 if not paired)
peripheral_type: PeripheralTypeType of peripheral
callsign: [u8; 12]Callsign/name (inherited from parent or configured)
health: HealthStatusCurrent health status
last_event: Option<PeripheralEvent>Most recent event (if any)
timestamp: u64Last update timestamp
Implementations§
Source§impl Peripheral
impl Peripheral
Sourcepub fn new(id: u32, peripheral_type: PeripheralType) -> Self
pub fn new(id: u32, peripheral_type: PeripheralType) -> Self
Create a new peripheral
Sourcepub fn with_callsign(self, callsign: &str) -> Self
pub fn with_callsign(self, callsign: &str) -> Self
Set the callsign (truncated to 12 bytes)
Sourcepub fn callsign_str(&self) -> &str
pub fn callsign_str(&self) -> &str
Get callsign as string
Sourcepub fn with_parent(self, parent_node: u32) -> Self
pub fn with_parent(self, parent_node: u32) -> Self
Set parent node
Sourcepub fn clear_event(&mut self)
pub fn clear_event(&mut self)
Clear the last event
Trait Implementations§
Source§impl Clone for Peripheral
impl Clone for Peripheral
Source§fn clone(&self) -> Peripheral
fn clone(&self) -> Peripheral
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Peripheral
impl Debug for Peripheral
Source§impl Default for Peripheral
impl Default for Peripheral
Source§fn default() -> Peripheral
fn default() -> Peripheral
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Peripheral
impl RefUnwindSafe for Peripheral
impl Send for Peripheral
impl Sync for Peripheral
impl Unpin for Peripheral
impl UnwindSafe for Peripheral
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more