Expand description
§gtec
Rust library and terminal UI for the g.tec Unicorn Hybrid Black 8-channel EEG headset via the Unicorn C API, loaded at runtime.
§Cross-platform
Works on Windows and Linux (x86_64). The Unicorn.dll /
libunicorn.so shared library is loaded at runtime via libloading —
no build-time C dependencies.
§Quick start
ⓘ
use gtec::prelude::*;
let serials = UnicornDevice::scan(true)?;
let mut device = UnicornDevice::open(&serials[0])?;
println!("Info: {:?}", device.device_info()?);
let scans = device.capture(UNICORN_SAMPLING_RATE * 4)?;
for s in &scans[..5] {
println!("EEG: {:?}", s.eeg());
}§Using as a library
[dependencies]
gtec = "0.0.1"
gtec = { version = "0.0.1", default-features = false }§Module overview
| Module | Purpose |
|---|---|
ffi | Runtime-loaded Unicorn C API for Hybrid Black (16/16 functions) |
ffi_ble | Runtime-loaded libgtecble BLE API for BCI Core-8 (9/9 functions) |
[ble] | Pure-Rust BLE backend for BCI Core-8 via btleplug (all OS, no native lib) |
types | #[repr(C)] types matching unicorn.h |
protocol | Pure-Rust BT protocol (Hybrid Black, no native lib needed) |
device | High-level device API |
verify | SHA-256 integrity verification |
sandbox | OS-level network sandboxing |
error | Error types |
prelude | Convenience re-exports |
Modules§
- device
- High-level device abstraction for the Unicorn Hybrid Black.
- error
- Error types for the g.tec Unicorn API wrapper.
- ffi
- Runtime-loaded FFI bindings to the Unicorn C API.
- ffi_ble
- Runtime-loaded FFI bindings to the
libgtecbleBLE library. - prelude
- Convenience re-exports.
- protocol
- Unicorn Hybrid Black Bluetooth protocol implementation.
- sandbox
- Process-level network sandboxing (same as brainbit-rs).
- types
- FFI types matching
unicorn.hfrom the Unicorn C API. - verify
- SHA-256 integrity verification for the Unicorn native library.