comparison rust/src/sensor.rs @ 595:e87655ed8429 rust

add config
author Matt Johnston <matt@ucc.asn.au>
date Thu, 05 Jan 2017 23:26:00 +0800
parents aff50ee77252
children ca8102feaca6
comparison
equal deleted inserted replaced
594:aff50ee77252 595:e87655ed8429
15 fn stream(handle: &Handle) 15 fn stream(handle: &Handle)
16 -> Box<Stream<Item=Readings, Error=io::Error>>; 16 -> Box<Stream<Item=Readings, Error=io::Error>>;
17 } 17 }
18 18
19 pub struct OneWireSensor { 19 pub struct OneWireSensor {
20 master_dir: String,
20 } 21 }
21 22
22 impl OneWireSensor { 23 impl OneWireSensor {
23 fn new() -> OneWireSensor { 24 fn new() -> OneWireSensor {
24 OneWireSensor {} 25 OneWireSensor {
26 master_dir: String::new(), // XXX
27
28 }
25 // todo 29 // todo
26 } 30 }
27 31
28 fn step(&mut self) -> Readings { 32 fn step(&mut self) -> Readings {
29 let mut r = Readings::new(); 33 let mut r = Readings::new();
30 r.add("ambient", Some(31.2)); 34 r.add("ambient", Some(31.2));
31 r.add("wort_todo", Some(8.0)); 35 r.add("wort_todo", Some(8.0));
32 debug!("sensor step {:?}", r); 36 debug!("sensor step {:?}", r);
33 r 37 r
38 }
39
40 fn sensor_names(self) -> Vec<String> {
41 let mut names = vec![];
42 names
34 } 43 }
35 } 44 }
36 45
37 impl Sensor for OneWireSensor { 46 impl Sensor for OneWireSensor {
38 fn stream(handle: &Handle) 47 fn stream(handle: &Handle)