comparison rust/src/main.rs @ 611:f3e39e2107fd rust

still doesn't compile, improvements to TemplogError and tokio curl though
author Matt Johnston <matt@ucc.asn.au>
date Tue, 28 Feb 2017 22:58:47 +0800
parents 7bda01659426
children e1bab5b36352
comparison
equal deleted inserted replaced
610:af0dac00d40b 611:f3e39e2107fd
5 extern crate env_logger; 5 extern crate env_logger;
6 extern crate rustc_serialize; 6 extern crate rustc_serialize;
7 extern crate time; 7 extern crate time;
8 extern crate tokio_curl; 8 extern crate tokio_curl;
9 extern crate curl; 9 extern crate curl;
10 extern crate serde_json;
10 11
11 #[macro_use] 12 #[macro_use]
12 extern crate lazy_static; 13 extern crate lazy_static;
13 14
14 #[macro_use] 15 #[macro_use]
42 43
43 let mut paramh = ParamHolder::new(); 44 let mut paramh = ParamHolder::new();
44 let mut fridge = fridge::Fridge::new(&config, nowait, paramh.p, &handle); 45 let mut fridge = fridge::Fridge::new(&config, nowait, paramh.p, &handle);
45 46
46 let (fridge_reading_s, fridge_reading_r) = mpsc::channel(1); 47 let (fridge_reading_s, fridge_reading_r) = mpsc::channel(1);
47 let fridge_reading_r = fridge_reading_r.map_err(|_| io::Error::new(io::ErrorKind::Other, "Problem with fridge_reading_r channel")); 48 let fridge_reading_r = fridge_reading_r.map_err(|e| TemplogError::new("Problem with fridge_reading_r channel"));
48 49
49 let sensor_stream = if testmode { 50 let sensor_stream = if testmode {
50 sensor::TestSensor::new(config).stream(&handle) 51 sensor::TestSensor::new(config).stream(&handle)
51 } else { 52 } else {
52 sensor::OneWireSensor::new(config).stream(&handle) 53 sensor::OneWireSensor::new(config).stream(&handle)
68 }); 69 });
69 handle.spawn(t); 70 handle.spawn(t);
70 r 71 r
71 }); 72 });
72 73
73 let param_stream = paramwaiter::ParamWaiter::stream(&handle); 74 let param_stream = paramwaiter::ParamWaiter::new(config, &handle).stream();
74 let p = param_stream.map(|p| { 75 let p = param_stream.map(|p| {
75 fridge::Message::Params(p) 76 fridge::Message::Params(p)
76 }); 77 });
77 78
78 let timeouts = fridge.wakeups(); 79 let timeouts = fridge.wakeups();