SessantaquattroReader

Struct SessantaquattroReader 

Source
pub struct SessantaquattroReader {
    pub(crate) host: String,
    pub(crate) port: u16,
    pub(crate) connection_timeout__s: u64,
    pub(crate) data_timeout__s: u64,
    pub(crate) sampling_frequency: SamplingFrequency,
    pub(crate) channel_count: ChannelCount,
    pub(crate) working_mode: WorkingMode,
    pub(crate) high_res: bool,
    pub(crate) hpf: bool,
    pub(crate) gain: Gain,
    pub(crate) apply_conversion: bool,
    pub(crate) lsl_uuid: String,
}
Expand description

A TCP server that connects to Sessantaquattro devices and streams data via LSL.

Fields§

§host: String§port: u16§connection_timeout__s: u64§data_timeout__s: u64§sampling_frequency: SamplingFrequency§channel_count: ChannelCount§working_mode: WorkingMode§high_res: bool§hpf: bool§gain: Gain§apply_conversion: bool§lsl_uuid: String

Implementations§

Source§

impl SessantaquattroReader

Source

pub fn new() -> Self

Source

pub fn host(self, host: &str) -> Self

Source

pub fn port(self, port: u16) -> Self

Source

pub fn connection_timeout(self, timeout_s: u64) -> Self

Source

pub fn data_timeout(self, timeout_s: u64) -> Self

Source

pub fn sampling_frequency(self, freq: SamplingFrequency) -> Self

Source

pub fn channel_count(self, count: ChannelCount) -> Self

Source

pub fn working_mode(self, mode: WorkingMode) -> Self

Source

pub fn high_res(self, high_res: bool) -> Self

Source

pub fn hpf(self, hpf: bool) -> Self

Source

pub fn gain(self, gain: Gain) -> Self

Source

pub fn apply_conversion(self, apply_conversion: bool) -> Self

Source

pub fn lsl_uuid(self, lsl_uuid: &str) -> Self

Source

pub(crate) fn get_actual_sampling_frequency(&self) -> f64

Returns the actual sampling frequency, accounting for mode-specific multipliers In accelerometers mode, FSAMP encoding represents 4x the normal frequency

Source

pub(crate) fn get_conversion_factor(&self) -> f32

Returns the conversion factor from ADC values to microvolts Accounts for both internal preamp gain and external gain (e.g., AD4x8SP)

Source

pub(crate) fn convert_data__f32(&self, raw_data: &[i32]) -> Vec<f32>

Converts raw ADC values to microvolts

Source

pub(crate) fn convert_data__i32(&self, raw_data: &[i32]) -> Vec<i32>

Returns raw ADC values without conversion

Source

pub(crate) fn create_stream_info( &self, ) -> Result<StreamInfo, SessantaquattroError>

Creates LSL stream info with proper channel metadata

Source

pub(crate) fn wait_for_connection( &self, ) -> Result<TcpStream, SessantaquattroError>

Waits for a TCP connection from the Sessantaquattro device

Source

pub(crate) fn configure_device( &self, stream: &mut TcpStream, ) -> Result<(), SessantaquattroError>

Sends device configuration command

Source

pub fn run(&self) -> Result<(), SessantaquattroError>

Runs the main acquisition loop

Trait Implementations§

Source§

impl Default for SessantaquattroReader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.