Skip to main content

TCPLoggerStream

Struct TCPLoggerStream 

Source
pub struct TCPLoggerStream { /* private fields */ }
Expand description

Simple TCP Logger Stream - connects to data stream only, no control

Implementations§

Source§

impl TCPLoggerStream

Source

pub fn new( addr: &str, stream_port: u16, ) -> Result<TCPLoggerStream, NanonisError>

Connect to TCP Logger data stream only

Creates a simple connection to the TCP data stream without any control operations. All control (start/stop/configure) should be handled externally.

§Arguments
  • addr - Server address (e.g., “127.0.0.1”)
  • stream_port - TCP Logger data stream port (typically 6590)
§Returns

Connected TCPLoggerStream ready to read data frames.

Source

pub fn spawn_background_reader( self, ) -> (Receiver<SignalFrame>, JoinHandle<Result<(), NanonisError>>)

Spawn background reader thread.

Creates a named background thread that continuously reads TCP Logger data frames and sends them through a channel. Returns both the receiver and a JoinHandle so the caller can detect why the thread exited (clean shutdown vs. I/O error).

The thread exits when:

  • The receiver is dropped (clean shutdown, returns Ok(()))
  • A read_frame call fails (returns Err(NanonisError))
Source

pub fn read_frame(&mut self) -> Result<SignalFrame, NanonisError>

Read a single data frame from the stream.

Automatically skips the initial metadata frame (counter == 0) that the Nanonis TCP logger sends when first started. This frame contains signal index information rather than measurement data and is not useful to callers.

§Returns

A SignalFrame containing the frame counter and channel data.

§Frame Format

Each frame is 18 bytes header + (num_channels * 4) bytes of f32 data.

Source

pub fn read_frame_raw(&mut self) -> Result<SignalFrame, NanonisError>

Read a single raw frame from the stream without filtering.

Unlike [read_frame], this returns every frame including the counter-0 metadata frame. Use this only if you need to inspect the signal index metadata.

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.