Skip to main content

Crate frenz

Crate frenz 

Source
Expand description

Async client for the FRENZ brainband over Bluetooth LE.

use frenz::{Band, ConnectOptions, Event};
use frenz::proto::Packet;

let band = Band::connect("FRENZA12", ConnectOptions::default()).await?;
let mut events = band.subscribe();
while let Ok(event) = events.recv().await {
    if let Event::Packet { packet, .. } = event {
        if let Packet::Eeg(eeg) = packet.as_ref() {
            println!("{:?}", eeg.samples[0]);
        }
    }
}

Notifications are timestamped on arrival and handed to a decoder task; nothing on the Bluetooth callback path parses or blocks. Every irregularity (decode error, sequence gap, counter restart, lagging subscriber, disconnect) is an explicit Event and is counted in Health. Nothing is deduplicated, reordered, or invented.

Re-exports§

pub use band::Band;
pub use band::BandInfo;
pub use band::ConnectOptions;
pub use band::Discovered;
pub use band::ReplayOptions;
pub use band::StartSequence;
pub use band::scan;
pub use error::Error;
pub use event::Decoder;
pub use event::Event;
pub use event::Health;
pub use event::RawRecord;
pub use record::RecordSummary;
pub use record::Recorder;
pub use frenz_proto as proto;

Modules§

band
Discovering, connecting to, and commanding a band.
clock
Host clocks. All timestamps in this crate are taken from one process-wide monotonic anchor.
error
Client errors.
event
Events, raw records, and stream health.
record
Lossless, crash-safe recording of everything the band sends, to one SQLite file per session.
synth
Synthetic recordings: the same file format a real session produces, filled with generated signals. Useful for trying the tools without a band and for end-to-end tests.