pub struct SimNode {
pub spec: NodeSpec,
pub id: Option<u16>,
pub awake: bool,
pub powered: bool,
pub granted: Vec<SecurityClass>,
pub sensors: BTreeMap<u8, f64>,
pub switch_on: bool,
pub lifeline: Vec<u8>,
pub wake_interval: u32,
pub firmware: Vec<u8>,
pub params: BTreeMap<u8, (u8, i32)>,
pub received: Vec<Vec<u8>>,
/* private fields */
}Expand description
A simulated node’s state.
Fields§
§spec: NodeSpecWhat it is.
id: Option<u16>Its node id once included.
awake: boolAwake (sleeping nodes).
powered: boolPowered; a node without power answers nothing.
granted: Vec<SecurityClass>Classes it holds keys for after inclusion.
sensors: BTreeMap<u8, f64>Sensor readings by type.
switch_on: boolSwitch state.
lifeline: Vec<u8>Lifeline (association group 1).
wake_interval: u32Configured wake-up interval.
firmware: Vec<u8>The installed firmware image.
params: BTreeMap<u8, (u8, i32)>Configuration parameters: size and value.
received: Vec<Vec<u8>>Every command received, decrypted, for tests to inspect.
Implementations§
Source§impl SimNode
impl SimNode
Sourcepub fn unsolicited(&mut self, cmd: Command) -> Vec<Vec<u8>>
pub fn unsolicited(&mut self, cmd: Command) -> Vec<Vec<u8>>
Something the node sends on its own (a report to its lifeline).
Sourcepub fn receive(&mut self, frame: &[u8]) -> Vec<Vec<u8>>
pub fn receive(&mut self, frame: &[u8]) -> Vec<Vec<u8>>
Handles a frame from the controller; returns frames to send back.
Sourcepub fn sensor_report(&self, sensor_type: u8) -> Option<Command>
pub fn sensor_report(&self, sensor_type: u8) -> Option<Command>
A multilevel sensor report for sensor_type, as the node would send it.
Auto Trait Implementations§
impl Freeze for SimNode
impl RefUnwindSafe for SimNode
impl Send for SimNode
impl Sync for SimNode
impl Unpin for SimNode
impl UnsafeUnpin for SimNode
impl UnwindSafe for SimNode
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