pub struct TCPLoggerStream { /* private fields */ }Expand description
Simple TCP Logger Stream - connects to data stream only, no control
Implementations§
Source§impl TCPLoggerStream
impl TCPLoggerStream
Sourcepub fn new(
addr: &str,
stream_port: u16,
) -> Result<TCPLoggerStream, NanonisError>
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.
Sourcepub fn spawn_background_reader(
self,
) -> (Receiver<SignalFrame>, JoinHandle<Result<(), NanonisError>>)
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_framecall fails (returnsErr(NanonisError))
Sourcepub fn read_frame(&mut self) -> Result<SignalFrame, NanonisError>
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.
Sourcepub fn read_frame_raw(&mut self) -> Result<SignalFrame, NanonisError>
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.