[−][src]Crate lsl
Rust API for the Lab Streaming Layer (LSL).
The lab streaming layer is a peer-to-peer pub/sub system on the local network that allows for real-time exchange of multi-channel time series (plus their meta-data) between applications and machines, with built-in cross-device time synchronization.
The most common use case is in lab spaces to make, e.g., instrument data from different pieces of hardware (e.g., sensors) accessible in real time to client programs (e.g., experimentation scripts, recording programs, stream viewers, or live processing software). One of the main features of LSL is the uniform API that allows clients to read formatted multi-channel data from many device types (such as EEG, eye tracking, audio, human interface devices, events, etc.) with the same few lines of code.
The API covers two areas:
- The "push API" (aka publish) allows to create stream outlets and to push data (regular or irregular measurement time series, event data, coded audio/video frames, etc.) into them.
- The "pull API" (aka subscribe) allows to create stream inlets and read time-synched experiment data from them (for recording, viewing or experiment control).
This crate provides safe bindings to the liblsl library via the
low-level/raw lsl-sys
crate.
Examples: this library comes with example scripts for all common use cases (found in the crate's github repository).
Errors
Operations that allocate OS resources (e.g., memory, sockets, etc) such as the new()
functions of
the main objects (StreamInfo
, StreamOutlet
, StreamInlet
, ContinuousResolver
) may return
Error::ResourceCreation
variants.
Structs
ContinuousResolver | A convenience class that resolves streams continuously in the background. |
StreamInfo | The |
StreamInlet | A stream inlet. Inlets are used to receive streaming data (and meta-data) from the lab network. |
StreamOutlet | A stream outlet. Outlets are used to make streaming data (and the meta-data) available on the lab network. |
XMLElement | A lightweight XML element tree; models the |
Enums
ChannelFormat | Data format of a channel (each transmitted sample holds an array of channels). |
Error | Error type for all errors that can be returned by this library. |
ProcessingOption | Post-processing options for stream inlets. |
Constants
DEDUCED_TIMESTAMP | Constant to indicate that a sample has the next successive time stamp. |
FOREVER | A very large time duration (> 1 year) for timeout values. |
IRREGULAR_RATE | Constant to indicate that a stream has variable sampling rate. |
Traits
ExPushable | A trait that enables the methods |
Pullable | A trait that enables the methods |
Pushable | A trait that enables the methods |
Functions
library_info | Get a string containing library/build information. |
library_version | Version number of the liblsl library. |
local_clock | Obtain a local system time stamp in seconds. |
protocol_version | Protocol version number. |
resolve_bypred | Resolve all streams that match a given predicate. |
resolve_byprop | Resolve all streams with a specific value for a given property. |
resolve_streams | Resolve all streams on the network. |