Expand description
§idun-rs
Async Rust library and terminal UI for streaming EEG, IMU, and impedance data from IDUN Guardian earbuds over Bluetooth Low Energy.
§Supported hardware
| Model | BLE name | EEG | Impedance | IMU | Notes |
|---|---|---|---|---|---|
| Guardian Earbud 2.1a | IGEB | ✓ | ✓ | ✓ | Original model |
| Guardian Earbud 3.0a | IGE-XXXXXX | ✓ | ✓ | ✓ | Newer hardware |
§IDUN Cloud API token (optional)
The Guardian’s BLE wire format is proprietary. For authoritative EEG decoding you can use the IDUN Cloud WebSocket API as a fallback:
- Get an API token from https://idun.tech/
- Export it:
export IDUN_API_TOKEN="your_token" - Pass
--cloudto the CLI or usecloud::CloudDecoderin code
Local experimental decoding (--decode / local-decode feature) works
without any API token but may not be fully accurate.
§Quick start
use idun_rs::prelude::*;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = GuardianClient::new(GuardianClientConfig::default());
let (mut rx, handle) = client.connect().await?;
handle.start_recording().await?;
while let Some(event) = rx.recv().await {
match event {
GuardianEvent::Eeg(r) => println!("EEG idx={} ts={:.0}ms", r.index, r.timestamp),
GuardianEvent::Disconnected => break,
_ => {}
}
}
Ok(())
}§Module overview
| Module | Purpose |
|---|---|
prelude | One-line glob import of the most commonly needed types |
guardian_client | BLE scanning, connecting, and the GuardianHandle command API |
types | All event and data types (GuardianEvent, EegReading, etc.) |
protocol | GATT UUIDs, commands, config bytes, sampling constants |
parse | Binary decoders for EEG, IMU, and impedance packets |
cloud | IDUN Cloud WebSocket client for server-side EEG decoding (requires IDUN_API_TOKEN) |
Modules§
- cloud
- IDUN Cloud WebSocket client for server-side EEG decoding.
- guardian_
client - BLE client for IDUN Guardian EEG earbuds.
- parse
- Binary decoders for Guardian BLE notification payloads.
- prelude
- Convenience re-exports for downstream crates.
- protocol
- GATT UUIDs, sampling constants, and BLE wire-format helpers for IDUN Guardian earbuds.
- types
- Data types for events emitted by the IDUN Guardian BLE client.