extern crate rzw;
extern crate enum_primitive;
use std::{thread, time};
static DEVICE: &'static str = "/dev/tty.usbmodem1421";
static NODE: u8 = 3;
fn main() {
if DEVICE == "" {
println!("Please define a path to your controller in the source code");
return;
}
let mut zwave = rzw::open(DEVICE).unwrap();
println!("Set the powerlevel to minus5dBm");
zwave.node(NODE).map(|n| n.powerlevel_set(rzw::basic::PowerLevelStatus::minus5dBm, 5)).unwrap().unwrap();
thread::sleep(time::Duration::from_secs(2));
println!("Powerlevel status: {:?}", zwave.node(NODE).map(|n| n.powerlevel_get()));
thread::sleep(time::Duration::from_secs(5));
println!("Set the powerlevel test node to minus5dBm");
zwave.node(NODE).map(|n| n.powerlevel_test_node_set(NODE, rzw::basic::PowerLevelStatus::minus5dBm, 5 as u16)).unwrap().unwrap();
thread::sleep(time::Duration::from_secs(2));
println!("Powerlevel test node status: {:?}", zwave.node(NODE).map(|n| n.powerlevel_test_node_get()));
}