Crates.io | aircontrol |
lib.rs | aircontrol |
version | 1.0.0 |
source | src |
created_at | 2024-02-04 17:59:34.414568 |
updated_at | 2024-02-04 17:59:34.414568 |
description | 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. |
homepage | |
repository | https://github.com/DJE98/aircontrol |
max_upload_size | |
id | 1126544 |
size | 132,904 |
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.
hidapi
library, ensuring compatibility across different operating systems.To add this module in your project, use the following command:
cargo add aircontrol
Here is a simple example of how to use this interface to monitor environmental parameters:
use aircontrol::AirControl;
fn main() {
let mut air_control = AirControl::new().expect("Failed to initialize the AirControl interface");
// The new result will be printed with every update.
air_control.register_callback(Box::new(|time, co2, temperature, humidity| {
println!("{} - CO2: {} ppm, Temp: {}°C, Humidity: {}%", time, co2, temperature, humidity);
}));
// The monitoring runs on a separate thread and will invoke the callback with new data.
air_control.start_monitoring();
// Remember to gracefully stop the monitoring when your application is closing or when you need to stop it.
air_control.stop_monitoring();
}
Contributions to this project are welcome. Please adhere to the following guidelines:
This project is licensed under the MIT License - see the LICENSE file for details.
This library is developed by @DJE98. Thanks to the hidapi
library developers and contributors for providing a robust cross-platform HID communication solution.