Skip to main content

open_streamer_labjack_from_env

Function open_streamer_labjack_from_env 

Source
pub fn open_streamer_labjack_from_env() -> Result<i32, LJMError>
Expand description

Opens, verifies, and self-tests the LabJack configured by environment.

Opens a T7 over Ethernet at the configured IP address, then checks the device type, the IP reported by the handle (skipped when LJM reports none), and the optional serial number. As a self-test it reads STREAM_SETTLING_US and writes the same value back. If a stale active stream blocks the write, it sends stream_stop once and retries. If any check fails, the handle is closed before the error is returned.

§Returns

The LJM device handle. The caller owns it and must close it.

§Errors

Returns LJMError::LibraryError if no IP address is configured, the device cannot be opened, the handle info cannot be read, the device is not a T7, its IP or serial number does not match, or the self-test read or write fails (including after stream_stop, or if stream_stop itself fails).