aircontrol 1.0.0

This Rust module provides a high-level interface for interacting with Dostmann TFA AIRCO2NTROL Mini and Coach devices, focusing on monitoring environmental parameters like CO2 levels, temperature, and humidity. It utilizes the hidapi library for cross-platform HID communication, ensuring a structured and multithreaded approach to data acquisition and event handling.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use aircontrol::AirControl;
use std::thread;
use std::time::Duration;

fn main() {
    let mut monitor = AirControl::new().expect("Failed to initialize the AirControl Interface");
    monitor.register_callback(Box::new(|time, co2, temperature, humidity| {
        let formatted_time = time.format("%Y-%m-%d %H:%M:%S").to_string();
        println!("Time: {}, CO2: {}ppm, Temperature: {:.1}C, Humidity: {:.0}%", formatted_time, co2, temperature, humidity);
    }));
    monitor.start_monitoring();
    thread::sleep(Duration::from_secs(10));
    monitor.stop_monitoring();
}