Skip to main content

Module labjack

Module labjack 

Source
Expand description

LabJack T7 connection and handle-inspection helpers for the streamer binary.

The streamer only supports direct Ethernet opens by IP address; it never runs LJM device discovery. These helpers handle environment parsing, device verification, stale stream cleanup, and conversion of LabJack handle metadata into readable values.

ยงConfiguration

  • LABJACK_IP - IPv4 address of the T7. Required unless LABJACK_IDENTIFIER holds an IPv4 address.
  • LABJACK_IDENTIFIER - Fallback for LABJACK_IP, used only when it parses as an IPv4 address.
  • LABJACK_SERIAL - Expected serial number. When set, a device with another serial is rejected. ANY or a non-numeric value disables the check.
  • LABJACK_NAME - Logical device name. Only logged.

For all of these, surrounding whitespace is trimmed, and an empty value or ANY (any case) counts as unset.

Constantsยง

STREAM_IS_ACTIVE_ERROR ๐Ÿ”’
LJM error code returned when a stream is already active on the handle (STREAM_IS_ACTIVE).

Functionsยง

env_identifier ๐Ÿ”’
Returns an environment identifier unless it is empty or the wildcard ANY.
env_var ๐Ÿ”’
Returns a trimmed environment variable value when set and non-empty.
handle_info
Reads LabJack metadata for an open handle.
handle_ip_address
Converts the signed IPv4 bits in LabJack handle info to dotted decimal text.
is_stream_active_error ๐Ÿ”’
Returns true when an LJM error indicates a stale active stream.
ljm_error_code ๐Ÿ”’
Extracts the numeric LJM code from an LJMError when present.
open_labjack_from_env
Opens the configured LabJack for the default streamer path.
open_streamer_labjack_from_env
Opens, verifies, and self-tests the LabJack configured by environment.
parse_ipv4 ๐Ÿ”’
Parses an IPv4 string used by the direct Ethernet LabJack path.
requested_labjack_serial_from_env ๐Ÿ”’
Reads an optional expected LabJack serial number from LABJACK_SERIAL.
required_labjack_ip_from_env ๐Ÿ”’
Reads the required LabJack IP address from environment variables.