1
0
Fork 0
mirror of https://codeberg.org/icewind/mitemp-rs.git synced 2026-06-03 17:24:08 +02:00

switch from channel api to iterator

this allows the api consumer to controll the threading
This commit is contained in:
Robin Appelman 2020-12-12 15:06:00 +01:00
commit 16cf74d09f
2 changed files with 28 additions and 31 deletions

View file

@ -7,9 +7,8 @@ fn main() -> Result<(), btleplug::Error> {
let addr = BDAddr::from_str("00:1A:7D:DA:71:08").unwrap();
let adapter = adapter_by_mac(addr)?;
let rx = listen(adapter)?;
loop {
let data = rx.recv().unwrap();
println!("{}: {:?}", data.mac, data.data);
for sensor in listen(adapter)? {
println!("{}: {:?}", sensor.mac, sensor.data);
}
Ok(())
}