Example Dioxus/Rust application monitoring sensor devices using the BleuIO dongle
This is a desktop application developed in Rust using the Dioxus framework (v0.7). It monitors Bluetooth LE sensor data via a BleuIO USB dongle.
The application is specifically designed to monitor sensors from Smart Sensor Devices AB, primarily the HibouAIR series.
The application parses advertisement data from HibouAIR sensors, supporting various metrics depending on the sensor model:
- Environment: Temperature, Humidity, Barometric Pressure, Ambient Light.
- Air Quality: CO2 (Carbon Dioxide), VOC (Volatile Organic Compounds), PM1.0, PM2.5, PM10.
- Other: PIR (Motion), Noise levels.
- Discovery: The app searches for a USB device matching the BleuIO Vendor ID and Product ID.
- Serial Connection: It opens the corresponding USB Serial port using
serialport5andserial2-tokio. - Initialization:
- Turns echo off (
ATE0). - Enables verbose mode (
ATV1).
- Turns echo off (
- Scanning: Starts scanning for specific sensor advertisement data using the command
AT+FINDSCANDATA=FF5B07(where5B07is the HibouAIR manufacturer ID). - Persistence: The application uses
confyto remember window size and position across restarts.
- Rust: Install Rust
- Dioxus CLI:
cargo install dioxus-cli
- System Dependencies (Linux/Raspberry Pi):
You may need
libudevdevelopment headers:Ensure your user has permission to access the serial port:sudo apt-get install pkg-config libudev-dev
(Log out and back in for changes to take effect)sudo usermod -a -G dialout $USER
To run in development mode with hot-reloading:
dx serveTo build for release:
dx build --release --platform desktopThe project follows a modular Dioxus 0.7 structure:
src/
├── components/ # UI Components
│ ├── dashboard.rs # Main layout and sensor grid
│ ├── sensor_panel.rs # Individual sensor display cards
│ └── mod.rs
├── hooks/ # Custom Reactive Hooks
│ ├── use_bleuio.rs # Serial port communication & data stream
│ ├── use_window_config.rs # Window state persistence
│ └── mod.rs
├── models/ # Data Logic & Parsing
│ ├── bleuio.rs # Dongle responses and AT commands
│ ├── hibouair.rs # HibouAir binary protocol parsing (using zerocopy)
│ ├── sensor_data.rs # Unified sensor state models
│ ├── config.rs # App configuration (window size, etc.)
│ └── mod.rs
└── main.rs # App entry point and window configuration
The application has been tested and verified on:
- macOS (with
macos-app-napprevention) - Raspberry Pi 5 (latest Debian Trixie)
MIT

