hermes_ble/lib.rs
1// SPDX-License-Identifier: GPL-3.0-or-later
2// Copyright © 2026 Eugene Hauptmann, Frédéric Simard
3
4//! # hermes-ble
5//!
6//! Async Rust library and terminal UI for streaming EEG data from
7//! Hermes V1 headsets over Bluetooth Low Energy.
8//!
9//! ## Supported hardware
10//!
11//! | Model | ADC | EEG channels | IMU | Notes |
12//! |---|---|---|---|---|
13//! | Hermes V1 | ADS1299 | 8 | 9-DOF (accel + gyro + mag) | 250 Hz EEG, 24-bit resolution |
14//!
15//! ## Quick start
16//!
17//! ```no_run
18//! use hermes_ble::prelude::*;
19//!
20//! #[tokio::main]
21//! async fn main() -> anyhow::Result<()> {
22//! let client = HermesClient::new(HermesClientConfig::default());
23//! let (mut rx, handle) = client.connect().await?;
24//! handle.start().await?;
25//!
26//! while let Some(event) = rx.recv().await {
27//! match event {
28//! HermesEvent::Eeg(s) => println!("EEG ch0={:.2} µV", s.channels[0]),
29//! HermesEvent::Disconnected => break,
30//! _ => {}
31//! }
32//! }
33//! Ok(())
34//! }
35//! ```
36//!
37//! ## Module overview
38//!
39//! | Module | Purpose |
40//! |---|---|
41//! | [`prelude`] | One-line glob import of the most commonly needed types |
42//! | [`hermes_client`] | BLE scanning, connecting, and the [`hermes_client::HermesHandle`] command API |
43//! | [`types`] | All event and data types produced by the client |
44//! | [`protocol`] | GATT UUIDs, sampling constants, ADS1299 conversion, and command builders |
45//! | [`parse`] | Low-level byte-to-sample decoders for EEG and IMU packets |
46
47pub mod hermes_client;
48pub mod parse;
49pub mod protocol;
50pub mod tui_app;
51pub mod types;
52
53/// Convenience re-exports for downstream crates.
54pub mod prelude {
55 pub use crate::hermes_client::{HermesClient, HermesClientConfig, HermesDevice, HermesHandle};
56 pub use crate::types::{
57 ConfigResponse, DeviceEvent, EegSample, HermesEvent, MotionData, XyzSample,
58 };
59 pub use crate::protocol::{
60 EEG_CHANNEL_NAMES, EEG_FREQUENCY, EEG_NUM_CHANNELS, ADS1299_GAIN, ADS1299_VREF,
61 };
62}