The constants are accessed in different ways, depending on which LJM language wrapper is being used.
C/C++: LJM constants begin with the prefix LJM_. For example, use LJM_READ.
LabVIEW: LJM constants begin with the prefix LJM_. For example, use LJM_READ.
Python: LJM constants are located in the namespace labjack.ljm.constants and do not begin with the LJM_ prefix. For example:
import labjack print(labjack.ljm.constants.READ) # Prints 0
Or, for a shorter version:
from labjack.ljm import constants as ljmc print(ljmc.READ) # Prints 0
.NET: LJM constants are located in the namespace LabJack.LJM.CONSTANTS and do not begin with the LJM_prefix. For example:
// C# import LabJack; // ... Console.WriteLine(LJM.CONSTANTS.READ); // Prints 0
' Visual Basic Imports LabJack ' ... Console.WriteLine(LJM.CONSTANTS.READ) ' Prints 0
Delphi: LJM constants begin with the prefix LJM_. For example, use LJM_READ.
Java: LJM constants are located in the namespace com.labjack.LJM.Constants and do not begin with the LJM_prefix. For example:
import com.labjack.LJM; // ... System.out.println(LJM.Constants.READ); // Prints 0
Node.js: LJM constants are located in ljswitchboard-ljm_driver_constants/lib/driver_constants.js and generally begin with the prefix LJM_. For example,
var ljmc = require('ljswitchboard-ljm_driver_constants'); console.log(ljmc.LJM_READ)
Visual Basic 6 and VBA: LJM constants begin with the prefix LJM_. For example, use LJM_READ.
The LJM configuration constants configure LJM behavior, such as timeouts. For more information, see the Library Configuration Functions.
Used to specify if reading or writing:
READ = 0
WRITE = 1
Used to specify data type for parameters:
UINT16 = 0
UINT32 = 1
INT32 = 2
FLOAT32 = 3
BYTE = 99
STRING = 98
The STRING data type has the following max size, not including the automatic null-terminator:
STRING_MAX_SIZE = 49
May be used to initialize the ErrorAddress parameter of the multiple value functions:
INVALID_NAME_ADDRESS = -1
The maximum size of the ErrorString of LJM_ErrorToString:
MAX_NAME_SIZE = 256
As an entry of the aData parameter of LJM_eStreamRead, indicates a value was skipped due to auto-recovery:
DUMMY_VALUE = -9999
Device types used to specify which LabJack device to open:
dtANY = 0
dtUE9 = 9
dtU3 = 3
dtU6 = 6
dtT4 = 4
dtT7 = 7
dtTSERIES = 84
dtSKYMOTE_BRIDGE = 1000
dtDIGIT = 200
Common connection types used to specify connect to be used when opening a device:
ctANY = 0
ctUSB = 1
ctTCP = 2 // Ethernet or WiFi
ctETHERNET = 3 // TCP
ctWIFI = 4 // TCP
Uncommon connection types:
ctNETWORK_UDP = 5
ctETHERNET_UDP = 6
ctWIFI_UDP = 7
ctNETWORK_ANY = 8 // TCP or UDP
ctETHERNET_ANY = 9 // TCP or UDP
ctWIFI_ANY = 10 // TCP or UDP
ctANY_UDP = 11 // Available in LJM 1.2100 and later
Constants related to opening devices:
NO_IP_ADDRESS = 0
NO_PORT = 0
TCP_PORT = 502
ETHERNET_UDP_PORT = 52362
WIFI_UDP_PORT = 502
UNKNOWN_IP_ADDRESS = -1
DEMO_MODE = "-2"
idANY = 0
The size of the arrays of LJM_ListAll:
LIST_ALL_SIZE = 128
Maximum packet sizes:
Timeout constants:
NO_TIMEOUT = 0
DEFAULT_USB_SEND_RECEIVE_TIMEOUT_MS = 2600
DEFAULT_ETHERNET_OPEN_TIMEOUT_MS = 1000
DEFAULT_ETHERNET_SEND_RECEIVE_TIMEOUT_MS = 2600
DEFAULT_WIFI_OPEN_TIMEOUT_MS = 1000
DEFAULT_WIFI_SEND_RECEIVE_TIMEOUT_MS = 4000
All timeouts are in units of milliseconds.
Open timeouts:
These timeouts control how long LJM waits for responses from a network broadcast.
LJM_OPEN_TCP_DEVICE_TIMEOUT_MS may be used to set both open timeouts at the same time.
Command-Response send / receive () timeouts:
These timeouts control the maximum amount of time LJM will wait for a response during command-response communication.
LJM_SEND_RECEIVE_TIMEOUT_MS may be used to set all three send / receive timeouts at the same time.
Stream receive timeout:
These configs control how LJM waits for packets during stream.
These configs are especially relevant to externally-clocked stream.
One command-response operation (as performed by a function like LJM_eReadName, for example) may take longer than the timeout for that connection type. This is because there are multiple timeout periods -- one to send the command and another to receive the response.
Setting a new timeout value will not affect pending timeouts.
Setting a timeout value to 0 sets an infinite timeout.
To read a timeout config, use LJM_ReadLibraryConfigS.
To write a timeout config, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, set LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, then read it again
char ErrorString[LJM_MAX_NAME_SIZE]; double Value = 0; int LJMError = LJM_ReadLibraryConfigS(LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("The default for LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is %.00f milliseconds\n", Value); Value = 3000; printf("Setting LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS to %.00f milliseconds\n", Value); LJMError = LJM_WriteLibraryConfigS(LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); } LJMError = LJM_ReadLibraryConfigS(LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is now %.00f milliseconds\n", Value);
Possible output:
The default for LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is 2000 milliseconds
Setting LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS to 3000 milliseconds
LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is now 3000 milliseconds
For more LJM configurations, see Library Configuration Functions.
LJM_ETHERNET_OPEN_TIMEOUT_MS is a numerical readable-writable LJM library configuration which sets how long in milliseconds LJM waits for a Ethernet-based TCP connection to be established.
The constant LJM_ETHERNET_OPEN_TIMEOUT_MS can be used interchangeably with the string "LJM_ETHERNET_OPEN_TIMEOUT_MS".
See Timeout Configs.
If the pending connection may be Ethernet or WiFi, LJM_WIFI_OPEN_TIMEOUT_MS is used.
For more LJM configurations, see Library Configuration Functions.
LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is a numerical readable-writable LJM library configuration which sets how long LJM waits for a Ethernet-connected TCP packet to be sent or received in milliseconds.
The constant LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS can be used interchangeably with the string "LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS".
The default is 2600 milliseconds.
See Timeout Configs.
For more LJM configurations, see Library Configuration Functions.
LJM 1.2100 and later: This timeout config affect the timeout for LJM_eStreamRead when the connection is via Ethernet.
Sets how stream data collection should time out.
LJM_STREAM_RECEIVE_TIMEOUT_MODE_CALCULATED = 1 (default)
LJM_STREAM_RECEIVE_TIMEOUT_MODE_MANUAL = 2
The constant LJM_STREAM_RECEIVE_TIMEOUT_MODE can be used interchangeably with the string "LJM_STREAM_RECEIVE_TIMEOUT_MODE".
LJM_STREAM_RECEIVE_TIMEOUT_MODE does not affect currently running or already initialized streams.
To read LJM_STREAM_RECEIVE_TIMEOUT_MODE, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_RECEIVE_TIMEOUT_MODE, use LJM_WriteLibraryConfigS orLJM_LoadConfigurationFile.
LJM_STREAM_RECEIVE_TIMEOUT_MODE affects the behavior of LJM_eStreamRead.
For more LJM configurations, see Library Configuration Functions.
Manually sets the timeout for LJM's stream data collection. Writing to this configuration sets LJM_STREAM_RECEIVE_TIMEOUT_MODE to LJM_STREAM_RECEIVE_TIMEOUT_MODE_MANUAL.
Writing a non-zero value to LJM_STREAM_RECEIVE_TIMEOUT_MS will manually set the timeout for LJM's stream data collection. Note that using LJM_STREAM_RECEIVE_TIMEOUT_MODE of LJM_STREAM_RECEIVE_TIMEOUT_MODE_CALCULATED is almost always better than using manual non-zero LJM_STREAM_RECEIVE_TIMEOUT_MS value.
Writing 0 to LJM_STREAM_RECEIVE_TIMEOUT_MS will cause LJM to never time out. This allows you to set up triggered stream or externally clocked stream on the T7. This is usually used in conjunction with LJM_STREAM_SCANS_RETURN set to LJM_STREAM_SCANS_RETURN_ALL_OR_NONE.
The constant LJM_STREAM_RECEIVE_TIMEOUT_MS can be used interchangeably with the string "LJM_STREAM_RECEIVE_TIMEOUT_MS".
LJM_STREAM_RECEIVE_TIMEOUT_MS does not affect currently running or already initialized streams.
To read LJM_STREAM_RECEIVE_TIMEOUT_MS, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_RECEIVE_TIMEOUT_MS, use LJM_WriteLibraryConfigS orLJM_LoadConfigurationFile.
LJM_STREAM_RECEIVE_TIMEOUT_MS affects the behavior of LJM_eStreamRead.
[C/C++] Set the LJM_STREAM_RECEIVE_TIMEOUT_MS mode to infinite.
char ErrorString[LJM_MAX_NAME_SIZE]; int LJMError = 0; LJMError = LJM_WriteLibraryConfigS( LJM_STREAM_RECEIVE_TIMEOUT_MS, 0 ); if (LJMError != LJME_NOERROR) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
LJM_USB_SEND_RECEIVE_TIMEOUT_MS is a numerical readable-writable LJM library configuration which sets how long LJM waits for a USB packet to be sent or received in milliseconds.
The constant LJM_USB_SEND_RECEIVE_TIMEOUT_MS can be used interchangeably with the string "LJM_USB_SEND_RECEIVE_TIMEOUT_MS".
The default is 2600 milliseconds.
See Timeout Configs.
For more LJM configurations, see Library Configuration Functions.
LJM 1.2100 and later: This timeout config affect the timeout for LJM_eStreamRead when the connection is via USB.
LJM_WIFI_OPEN_TIMEOUT_MS is a numerical readable-writable LJM library configuration which sets how long in milliseconds LJM waits for a WiFi-based TCP connection to be established.
The constant LJM_WIFI_OPEN_TIMEOUT_MS can be used interchangeably with the string "LJM_WIFI_OPEN_TIMEOUT_MS".
See Timeout Configs.
If the pending connection may be Ethernet or WiFi, LJM_WIFI_OPEN_TIMEOUT_MS is used.
For more LJM configurations, see Library Configuration Functions.
LJM_WIFI_SEND_RECEIVE_TIMEOUT_MS is a numerical readable-writable LJM library configuration which sets how long LJM waits for a WiFi-connected TCP packet to be sent or received in milliseconds.
The constant LJM_WIFI_SEND_RECEIVE_TIMEOUT_MS can be used interchangeably with the string "LJM_WIFI_SEND_RECEIVE_TIMEOUT_MS".
The default is 4000 milliseconds.
See Timeout Configs.
For more LJM configurations, see Library Configuration Functions.
LJM 1.2100 and later: This timeout config affect the timeout for LJM_eStreamRead when the connection is via WiFi.
LJM_OPEN_TCP_DEVICE_TIMEOUT_MS is a numerical readable-writable LJM library configuration which is a shortcut for setting the following configs:
The constant LJM_OPEN_TCP_DEVICE_TIMEOUT_MS can be used interchangeably with the string "LJM_OPEN_TCP_DEVICE_TIMEOUT_MS".
Reading LJM_OPEN_TCP_DEVICE_TIMEOUT_MS may be meaningless if it has not previously been written.
See Timeout Configs.
For more LJM configurations, see Library Configuration Functions.
LJM_SEND_RECEIVE_TIMEOUT_MS is a numerical readable-writable LJM library configuration which is a shortcut for setting the following configs:
The constant LJM_SEND_RECEIVE_TIMEOUT_MS can be used interchangeably with the string "LJM_SEND_RECEIVE_TIMEOUT_MS".
Reading LJM_SEND_RECEIVE_TIMEOUT_MS may be meaningless if it has not previously been written.
See Timeout Configs.
For more LJM configurations, see Library Configuration Functions.
LJM 1.2100 and later: These timeout configs affect the timeout for LJM_eStreamRead.
LJM 1.1500 adds the Auto IPs feature, which provides most of the benefit of specific IPs, but does so automatically. Most users should not need to edit the ljm_specific_ips.config file.
If LJM isn't finding an Ethernet or WiFi device during a search open (i.e. a non-specific open where "ANY" is passed for some parameters), use ljm_specific_ips.config to configure LJM to specially check specific IP addresses. LJM tries to open each IP address in ljm_specific_ips.config during relevant Open calls and ListAll calls.
Regardless of your computer's IP address, the following ljm_specific_ips.config file would trigger 192.168.2.207 and 10.0.0.123 to be checked:
// Have LJM connect to the static-IP T7...
// ...in the lab:
192.168.2.207
// ...in the kitchen:
10.0.0.123
File syntax:
//
are ignored.C:\ProgramData\LabJack\LJM\ljm_specific_ips.config
C:\Documents and Settings\All Users\Application Data\LabJack\LJM\ljm_specific_ips.config
/usr/local/share/LabJack/LJM/ljm_specific_ips.config
ljm_specific_ips.config is not overwritten by the installer.
For programmatically setting the file path, see LJM_SPECIFIC_IPS_FILE.
For checking if LJM has successfully read the specific IPs file, use LJM_GetSpecificIPsInfo.
Specific IPs are treated with higher priority than normal IP addresses. They checked before or during the regular UPD broadcast search and are more likely to be an Open result.
Contact your network administrator to ensure that each of the desired IPs will be reachable via TCP/UDP as a static IP address. You can also ping
each address to ensure that they are reachable.
LJM_SPECIAL_ADDRESSES_STATUS is deprecated. Please use LJM_GetSpecificIPsInfo instead.
Passing LJM_SPECIAL_ADDRESSES_STATUS to LJM_ReadLibraryConfigStringS returns a string that reports the current success or failure of parsing LJM_SPECIAL_ADDRESSES_FILE.
LJM_SPECIAL_ADDRESSES_STATUS is read-only.
The constant LJM_SPECIAL_ADDRESSES_STATUS can be used interchangeably with the string "LJM_SPECIAL_ADDRESSES_STATUS".
Below are some example values that may be reported as LJM_SPECIAL_ADDRESSES_STATUS. This feature is in development, so if you need to programmatically parse LJM_SPECIAL_ADDRESSES_STATUS, please contact us.
Success. File: file_path, IPs: [comma-separated_list_of_IP_addresses]
File load failure: file_path
See the Special Addresses Configs overview.
For more LJM configurations, see Library Configuration Functions.
LJM_SPECIFIC_IPS_FILE is an LJM configuration that describes the absolute or relative file path of the LJM specific IPs file.
To read, pass LJM_SPECIFIC_IPS_FILE to LJM_ReadLibraryConfigStringS to get a string containing the file path.
To write, pass LJM_SPECIFIC_IPS_FILE and string containing a file path to LJM_WriteLibraryConfigStringS, or use LJM_LoadConfigurationFile.
The constant LJM_SPECIFIC_IPS_FILE can be used interchangeably with the string "LJM_SPECIFIC_IPS_FILE".
To set LJM_SPECIFIC_IPS_FILE to the default location, set it to "default" or an empty string. For example, in C/C++:
int error = LJM_WriteLibraryConfigStringS(LJM_SPECIFIC_IPS_FILE, "default");
The default file path specified by LJM_SPECIFIC_IPS_FILE is only parsed on LJM startup, so changes made to the file will not affect running LJM processes unless LJM_WriteLibraryConfigStringS(LJM_SPECIFIC_IPS_FILE, ...)
is called.
LJM_SPECIFIC_IPS_FILE replaces the deprecated LJM_SPECIAL_ADDRESSES_FILE.
For more LJM configurations, see Library Configuration Functions.
If you need to change LJM's configs either globally or quickly, you can edit the ljm_startup_configs.json file.
C:\ProgramData\LabJack\LJM\ljm_startup_configs.json
C:\Documents and Settings\All Users\Application Data\LabJack\LJM\ljm_startup_configs.json
/usr/local/share/LabJack/LJM/ljm_startup_configs.json
Use the string "default" to load the default value for each config parameter. Otherwise, see the "type" for each config parameter for what kinds of values can be accepted. Please see LabJackM.h for more information about what each config parameter does.
Configs that are not included in ljm_startup_configs.json will be given the default value.
ljm_startup_configs.json is parsed by LJM case-insensitively. LJM ignores every key in the top-level JSON object except for LJM_CONFIG_VALUES, as well as ignoring every "description", "type", and "values" fields. Other fields in LJM_CONFIG_VALUES which are not recognized by LJM will generate errors/warnings. LJM will also ignore lines starting with "//".
Windows file paths must escape \ characters with \. For example, the path:
C:\ljm.log
Must be escaped as:
C:\\ljm.log
LJM automatically stores network connection information to file to help open connections to LabJack devices during relevant Open calls and ListAll calls.
Auto IPs functionality was added in LJM 1.1500.
For enabling or disabling LJM Auto IPs functionality, see LJM_AUTO_IPS.
For setting the file path, see LJM_AUTO_IP_FILE.
Auto IPs are added when a LabJack device responds to a normal LJM UDP discovery broadcast. If the device is successfully queried for its attributes, those attributes are added to the given auto IP entry. Auto IPs in the auto IPs file are made unique according to serial number combined with connection type. Auto IPs are also removed from the auto IPs file when they have not resulted in a successful open during 10 days. Auto IPs that have not recently had a successful open have a shorter open timeout.
LJM has a similar feature called Specific IPs with the main differences being:
LJM_AUTO_IPS sets whether or not LJM uses the auto IPs feature.
The constant LJM_AUTO_IPS can be used interchangeably with the string "LJM_AUTO_IPS".
0 - false/disabled
1 - true/enabled (Default)
To read LJM_AUTO_IPS, use LJM_ReadLibraryConfigS.
To write LJM_AUTO_IPS, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
For more LJM configurations, see Library Configuration Functions.
LJM_AUTO_IPS_FILE is an LJM configuration that describes the absolute or relative file path of the LJM auto IPs file.
To read, pass LJM_AUTO_IPS_FILE to LJM_ReadLibraryConfigStringS to get a string containing the file path.
To write, pass LJM_AUTO_IPS_FILE and string containing a file path to LJM_WriteLibraryConfigStringS, or use LJM_LoadConfigurationFile.
The constant LJM_AUTO_IPS_FILE can be used interchangeably with the string "LJM_AUTO_IPS_FILE".
C:\ProgramData\LabJack\LJM\ljm_auto_ips.json
C:\Documents and Settings\All Users\Application Data\LabJack\LJM\ljm_auto_ips.json
/usr/local/share/LabJack/LJM/ljm_auto_ips.json
To set LJM_AUTO_IPS_FILE to the default location, set it to "default" or an empty string. For example, in C/C++:
int error = LJM_WriteLibraryConfigStringS(LJM_AUTO_IPS_FILE, "default");
LJM will attempt to create the file specified by LJM_AUTO_IPS_FILE if it does not exist.
For more LJM configurations, see Library Configuration Functions.
LJM Deep Search is a LJM feature that searches IP address ranges for LabJack devices. It is meant to be used to find DHCP-enabled devices on networks where UDP broadcasts do not propagate to the device, such as when the device is on a separate subnet. Most users should not need to use LJM Deep Search, since the normal UDP broadcast discovery usually works.
Deep Search adds time to device searching. Though Deep Search can find devices with static IPs, Specific IPs is more suitable for that purpose because Specific IPs is quicker.
Deep Search is enabled by writing IP address range(s) to the LJM_DEEP_SEARCH_FILE.
When LJM_DEEP_SEARCH_FILE contains IP addresses ranges(s), Deep Search is triggered after the normal UDP broadcast discovery during for either of the following situations:
Deep Search stores results as Auto IPs, to speed up future open calls.
Regardless of you computer's IP address, the following ljm_deep_search.config file would trigger search of 155 IP addresses, including 192.168.2.100 and 192.168.2.254:
192.168.2.100-254
File syntax:
//
are ignored.C:\ProgramData\LabJack\LJM\ljm_deep_search.config
C:\Documents and Settings\All Users\Application Data\LabJack\LJM\ljm_deep_search.config
/usr/local/share/LabJack/LJM/ljm_deep_search.config
ljm_deep_search.config is not overwritten by the installer.
For programmatically setting the file path, see LJM_DEEP_SEARCH_FILE.
For checking if LJM has successfully read the Deep Search file, use LJM_GetDeepSearchInfo.
macOS Issue
macOS has a file limit, per Terminal shell. The default is low: 256. Deep Search opens many sockets in parallel, so opening any files (sockets) after 256 will fail. This can cause Deep Search to become rather useless unless the file limit is increased.
To increase the file limit to 2048 (which is typically sufficient for Deep Search), execute the following command in your shell:
ulimit -S -n 2048
This change only lasts for the current shell session. To make it permanent, you can add it to your shell's startup configurations. (E.g. .bashrc, .bash_profile, etc.)
LJM_DEEP_SEARCH_FILE is an LJM configuration that describes the absolute or relative file path of the LJM Deep Search file.
To read, pass LJM_DEEP_SEARCH_FILE to LJM_ReadLibraryConfigStringS to get a string containing the file path.
To write, pass LJM_DEEP_SEARCH_FILE and string containing a file path to LJM_WriteLibraryConfigStringS, or use LJM_LoadConfigurationFile.
The constant LJM_DEEP_SEARCH_FILE can be used interchangeably with the string "LJM_DEEP_SEARCH_FILE".
To set LJM_DEEP_SEARCH_FILE to the default location, set it to "default" or an empty string. For example, in C/C++:
int error = LJM_WriteLibraryConfigStringS(LJM_DEEP_SEARCH_FILE, "default");
The default file path specified by LJM_DEEP_SEARCH_FILE is only parsed on LJM startup, so changes made to the file will not affect running LJM processes unless LJM_WriteLibraryConfigStringS(LJM_DEEP_SEARCH_FILE, ...)
is called.
For more LJM configurations, see Library Configuration Functions.
When LJM searches for devices in the following situations:
The below parameters configure device search behavior.
Retries:
Concurrent searching:
Timeout:
Determines how long in milliseconds LJM waits for device responses:
Protocol:
Determines whether LJM initializes the connection via UDP (true) or TCP (false):
To read the above configs, use LJM_ReadLibraryConfigS.
To write the above configs, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
Other related device connection configurations:
LJM uses gRPC to coordinate device connections. This allows LJM to retrieve information about USB-connected LabJack devices.
The below parameters configure LJM RPC behavior.
LJM automatically attempts to reconnect when connections are discovered to be broken. See the LJME_RECONNECT_FAILED page for information about reconnection.
LJM_AUTO_RECONNECT_STICKY_CONNECTION is a numerical readable-writable LJM library configuration that sets whether or not LJM attempts to reconnect disrupted / disconnected connections according to same connection type as the original handle. When LJM_AUTO_RECONNECT_STICKY_CONNECTION is disabled, the ConnectionType that was used during the initial LJM_Open or LJM_OpenS call will be used to reconnect.
The constant LJM_AUTO_RECONNECT_STICKY_CONNECTION can be used interchangeably with the string "LJM_AUTO_RECONNECT_STICKY_CONNECTION".
0 - false/disabled - Reconnects according to the ConnectionType parameter that was passed to the Open call
1 - true/enabled (Default) - Reconnects via the actual connection type that was used to connect to the device
To read LJM_AUTO_RECONNECT_STICKY_CONNECTION, use LJM_ReadLibraryConfigS.
To write LJM_AUTO_RECONNECT_STICKY_CONNECTION, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
See also: LJM_AUTO_RECONNECT_STICKY_SERIAL.
For more LJM configurations, see Library Configuration Functions.
LJM_AUTO_RECONNECT_STICKY_SERIAL is a numerical readable-writable LJM library configuration that sets whether or not LJM attempts to reconnect disrupted / disconnected connections according to same serial number as the original handle. When LJM_AUTO_RECONNECT_STICKY_SERIAL is disabled, the Identifier that was used during the initial LJM_Open or LJM_OpenS call will be used to reconnect.
The constant LJM_AUTO_RECONNECT_STICKY_SERIAL can be used interchangeably with the string "LJM_AUTO_RECONNECT_STICKY_SERIAL".
0 - false/disabled
1 - true/enabled (Default)
To read LJM_AUTO_RECONNECT_STICKY_SERIAL, use LJM_ReadLibraryConfigS.
To write LJM_AUTO_RECONNECT_STICKY_SERIAL, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
See also: LJM_AUTO_RECONNECT_STICKY_CONNECTION.
For more LJM configurations, see Library Configuration Functions.
LJM_AUTO_RECONNECT_WAIT_MS is a numerical readable-writable LJM library configuration that sets how long in milliseconds LJM waits between attempts to reconnect when a device has been found to be disconnected. The default is 500 milliseconds.
The constant LJM_AUTO_RECONNECT_WAIT_MS can be used interchangeably with the string "LJM_AUTO_RECONNECT_WAIT_MS".
To read LJM_AUTO_RECONNECT_WAIT_MS, use LJM_ReadLibraryConfigS.
To write LJM_AUTO_RECONNECT_WAIT_MS, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
See also: How to deal with LJME_RECONNECT_FAILED.
For more LJM configurations, see Library Configuration Functions.
The LJM debug logger can output debug information to a file. See the debug logger page for more info.
LJM_DEBUG_LOG_FILE is a string-based readable-writable LJM library configuration which sets the absolute or relative path of the file to output log messages to.
The constant LJM_DEBUG_LOG_FILE can be used interchangeably with the string "LJM_DEBUG_LOG_FILE".
The configuration value of LJM_DEBUG_LOG_FILE is meaningless if LJM_DEBUG_LOG_MODE is in LJM_DEBUG_LOG_MODE_NEVER (which is the default).
See these debug logger parameters, especially LJM_DEBUG_LOG_MODE.
To read LJM_DEBUG_LOG_FILE, use LJM_ReadLibraryConfigStringS.
To write LJM_DEBUG_LOG_FILE, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.
For more information, see 2.7 Debugging Functions.
[C/C++] Set LJM to log to the log file "ljm_monday.log"
char ErrorString[LJM_MAX_NAME_SIZE]; char DebugLogFile[LJM_MAX_NAME_SIZE]; int LJMError; printf("Setting LJM_DEBUG_LOG_MODE to LJM_DEBUG_LOG_MODE_CONTINUOUS\n"); LJMError = LJM_WriteLibraryConfigS(LJM_DEBUG_LOG_MODE, LJM_DEBUG_LOG_MODE_CONTINUOUS); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); } printf("Setting LJM_DEBUG_LOG_FILE to ljm_monday.log\n"); LJMError = LJM_WriteLibraryConfigStringS(LJM_DEBUG_LOG_FILE, "ljm_monday.log"); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigStringS error: %s\n", ErrorString); } LJMError = LJM_ReadLibraryConfigStringS(LJM_DEBUG_LOG_FILE, DebugLogFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigStringS error: %s\n", ErrorString); } printf("LJM_DEBUG_LOG_FILE is now %s\n", DebugLogFile);
Possible output:
Setting LJM_DEBUG_LOG_MODE to LJM_DEBUG_LOG_MODE_CONTINUOUS
Setting LJM_DEBUG_LOG_FILE to ljm_monday.log
LJM_DEBUG_LOG_FILE is now ljm_monday.log
For more LJM configurations, see Library Configuration Functions.
LJM_DEBUG_LOG_FILE_MAX_SIZE is a numerical readable-writable LJM library configuration that limits the number of characters in the debug log file. Once the debug log file has exceeded LJM_DEBUG_LOG_FILE_MAX_SIZE characters, it will be reset to 0 characters and debug logging will continue. The largest LJM_DEBUG_LOG_FILE_MAX_SIZE you may use is the largest file size of your operating system. The default is 50000 characters.
The constant LJM_DEBUG_LOG_FILE_MAX_SIZE can be used interchangeably with the string "LJM_DEBUG_LOG_FILE_MAX_SIZE".
To read LJM_DEBUG_LOG_FILE_MAX_SIZE, use LJM_ReadLibraryConfigS.
To write LJM_DEBUG_LOG_FILE_MAX_SIZE, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Set LJM_DEBUG_LOG_FILE_MAX_SIZE to a larger-than-default size
char ErrorString[LJM_MAX_NAME_SIZE]; int LJMError; LJMError = LJM_WriteLibraryConfigS(LJM_DEBUG_LOG_FILE_MAX_SIZE, 123456789); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
LJM_DEBUG_LOG_LEVEL is a numerical readable-writable LJM library configuration with the following options:
The constant LJM_DEBUG_LOG_LEVEL can be used interchangeably with the string "LJM_DEBUG_LOG_LEVEL".
LJM_DEBUG_LOG_MODE must allow for logging in order for LJM_DEBUG_LOG_LEVEL to have any effect.
LJM_DEBUG_LOG_LEVEL determines which log messages are output. LJM outputs the debug messages that are of the current LJM_DEBUG_LOG_LEVEL and greater.
To read LJM_DEBUG_LOG_LEVEL, use LJM_ReadLibraryConfigS.
To write LJM_DEBUG_LOG_LEVEL, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
For more information, see 2.7 Debugging Functions.
[C/C++] Read LJM_DEBUG_LOG_LEVEL then set LJM_DEBUG_LOG_LEVEL to LJM_WARNING
char ErrorString[LJM_MAX_NAME_SIZE]; double value; int LJMError = LJM_ReadLibraryConfigS(LJM_DEBUG_LOG_LEVEL, &value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("The default for LJM_DEBUG_LOG_LEVEL is %.00f\n", value); value = LJM_WARNING; printf("Setting LJM_DEBUG_LOG_LEVEL to %.00f\n", value); LJMError = LJM_WriteLibraryConfigS(LJM_DEBUG_LOG_LEVEL, value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_DEBUG_LOG_LEVEL error: %s\n", ErrorString); }
Possible output:
The default for LJM_DEBUG_LOG_LEVEL is 7
Setting LJM_DEBUG_LOG_LEVEL to 8
For more LJM configurations, see Library Configuration Functions.
LJM_DEBUG_LOG_MODE is a numerical readable-writable LJM library configuration with the following options:
LJM_DEBUG_LOG_MODE_NEVER = 1
LJM_DEBUG_LOG_MODE_CONTINUOUS = 2
LJM_DEBUG_LOG_MODE_ON_ERROR = 3
The constant LJM_DEBUG_LOG_MODE can be used interchangeably with the string "LJM_DEBUG_LOG_MODE".
To read LJM_DEBUG_LOG_MODE, use LJM_ReadLibraryConfigS.
To write LJM_DEBUG_LOG_MODE, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
For more information, see 2.7 Debugging Functions.
[C/C++] Read LJM_DEBUG_LOG_MODE, set LJM_DEBUG_LOG_MODE, then read it again
char ErrorString[LJM_MAX_NAME_SIZE]; double Value = 0; int LJMError = LJM_ReadLibraryConfigS(LJM_DEBUG_LOG_MODE, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("The default for LJM_DEBUG_LOG_MODE is %.00f\n", Value); Value = LJM_DEBUG_LOG_MODE_CONTINUOUS; printf("Setting LJM_DEBUG_LOG_MODE to %.00f\n", Value); LJMError = LJM_WriteLibraryConfigS(LJM_DEBUG_LOG_MODE, Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); } LJMError = LJM_ReadLibraryConfigS(LJM_DEBUG_LOG_MODE, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("LJM_DEBUG_LOG_MODE is now %.00f\n", Value);
Possible output:
The default for LJM_DEBUG_LOG_MODE is 1
Setting LJM_DEBUG_LOG_MODE to 2
LJM_DEBUG_LOG_MODE is now 2
For more LJM configurations, see Library Configuration Functions.
LJM translates between register names and addresses and between errorcodes and error names. To do so, it loads .json data.
LJM_CONSTANTS_FILE is a string-based write-only LJM library configuration which sets the absolute or relative path of an existing file to read Modbus constants and error constants from. It is a shortcut for writing to both LJM_MODBUS_MAP_CONSTANTS_FILE and LJM_ERROR_CONSTANTS_FILE.
The constant LJM_CONSTANTS_FILE can be used interchangeably with the string "LJM_CONSTANTS_FILE".
LJM_MODBUS_MAP_CONSTANTS_FILE and LJM_ERROR_CONSTANTS_FILE
To write LJM_CONSTANTS_FILE, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.
Setting LJM_CONSTANTS_FILE may affect the output of the following functions:
[C/C++] Set LJM_CONSTANTS_FILE to "alternate_constants.json"
char ErrorString[LJM_MAX_NAME_SIZE]; int LJMError = LJM_WriteLibraryConfigStringS(LJM_CONSTANTS_FILE, "alternate_constants.json"); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigStringS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
LJM_ERROR_CONSTANTS_FILE is a string-based readable-writable LJM library configuration which sets the absolute or relative path of an existing file to use as error constants for use with the function LJM_ErrorToString.
The constant LJM_ERROR_CONSTANTS_FILE can be used interchangeably with the string "LJM_ERROR_CONSTANTS_FILE".
To set LJM_ERROR_CONSTANTS_FILE and LJM_MODBUS_MAP_CONSTANTS_FILE simultaneously, use LJM_CONSTANTS_FILE.
To read, use LJM_ReadLibraryConfigStringS.
To write, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_ERROR_CONSTANTS_FILE, then set it to "alternate_error_constants.json"
char ErrorString[LJM_MAX_NAME_SIZE]; char defaultErrorConstantsFile[LJM_MAX_NAME_SIZE]; char * newErrorConstantsFile = "alternate_error_constants.json"; int LJMError = LJM_ReadLibraryConfigStringS(LJM_ERROR_CONSTANTS_FILE, defaultErrorConstantsFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigStringS error: %s\n", ErrorString); } printf("The default for LJM_ERROR_CONSTANTS_FILE is %s\n", defaultErrorConstantsFile); printf("Setting LJM_ERROR_CONSTANTS_FILE to %s\n", newErrorConstantsFile); LJMError = LJM_WriteLibraryConfigStringS(LJM_ERROR_CONSTANTS_FILE, newErrorConstantsFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigStringS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
LJM_MODBUS_MAP_CONSTANTS_FILE is a string-based readable-writable LJM library configuration which sets the absolute or relative path of an existing file to use as Modbus constants for use with the functions that use the Modbus map constants, such as LJM_NamesToAddresses.
The constant LJM_MODBUS_MAP_CONSTANTS_FILE can be used interchangeably with the string "LJM_MODBUS_MAP_CONSTANTS_FILE".
To set LJM_ERROR_CONSTANTS_FILE and LJM_MODBUS_MAP_CONSTANTS_FILE simultaneously, use LJM_CONSTANTS_FILE.
To read, use LJM_ReadLibraryConfigStringS.
To write, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_MODBUS_MAP_CONSTANTS_FILE, then set to "alternate_modbus_constants.json"
char ErrorString[LJM_MAX_NAME_SIZE]; char defaultModbusConstantsFile[LJM_MAX_NAME_SIZE]; char * newModbusConstantsFile = "alternate_modbus_constants.json"; int LJMError = LJM_ReadLibraryConfigStringS(LJM_MODBUS_MAP_CONSTANTS_FILE, defaultModbusConstantsFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigStringS error: %s\n", ErrorString); } printf("The default for LJM_MODBUS_MAP_CONSTANTS_FILE is %s\n", defaultModbusConstantsFile); printf("Setting LJM_MODBUS_MAP_CONSTANTS_FILE to %s\n", newModbusConstantsFile); LJMError = LJM_WriteLibraryConfigStringS(LJM_MODBUS_MAP_CONSTANTS_FILE, newModbusConstantsFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigStringS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
See the LJM stream functions for more info about stream.
Sets whether LJM_eStreamRead will return calibrated or uncalibrated (binary) data.
Below, ScansPerRead is a parameter of LJM_eStreamStart.
LJM_STREAM_AIN_BINARY = 0 (default)
LJM_STREAM_AIN_BINARY = 1
The constant LJM_STREAM_AIN_BINARY can be used interchangeably with the string "LJM_STREAM_AIN_BINARY".
LJM_STREAM_AIN_BINARY does not affect currently running or already initialized streams.
To read LJM_STREAM_AIN_BINARY, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_AIN_BINARY, use LJM_WriteLibraryConfigS orLJM_LoadConfigurationFile.
LJM_STREAM_AIN_BINARY affects the behavior of LJM_eStreamRead.
For more LJM configurations, see Library Configuration Functions.
Requires LJM 1.2000 or later
LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is a numerical readable and writable LJM library configuration which sets how LJM handles auto-recovery when the first channel is not firmware-protected from returning 0xFFFF as a valid data value.
The constant LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED can be used interchangeably with the string "LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED".
0 (default) - Error detection is enabled:
If auto-recovery happens and the first channel is not firmware-protected from returning 0xFFFF (see list below), stream will be stopped and LJM_eStreamRead will return the error LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (errorcode 1320).
1 - Error detection is disabled:
LJM assumes the user has configured the first stream channel to not return 0xFFFF. However, if auto-recovery occurs and the first stream channel returns 0xFFFF, LJM may insert dummy scans in the wrong location in stream.
There are three ways to get rid of LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED.
Channels that never return 0xFFFF during stream:
Individual DIO registers like DIO2 also will never return 0xFFFF, but _STATE registers should be used instead because they're generally more efficient for communication bandwidth. LJM versions 1.2100 and prior mistakenly do not treat individual DIO registers as if they never return 0xFFFF.
Channels capable of returning 0xFFFF include:
Setting a new LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED value will not affect stream sessions that are already in progress.
The lowlevel streaming protocol uses one or more 0xFFFF values to indicate a gap in stream data. Such a gap happens because the device scan buffer ran out of space. LJM adds dummy scans to fill this gap. Some channels return 0xFFFF as a valid data value, so LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (errorcode 1320) happens when three conditions are true:
When those conditions are true, LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (errorcode 1320) is returned because dummy scans could be inserted at the wrong spot in the stream data.
To read LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED then set it to 1.
char ErrorString[LJM_MAX_NAME_SIZE]; double value; int LJMError = LJM_ReadLibraryConfigS(LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, &value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("The default for LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is %.00f\n", value); value = 1; printf("Setting LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to %.00f\n", value); LJMError = LJM_WriteLibraryConfigS(LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); }
Output:
The default for LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is 0 Setting LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to 1
For more LJM configurations, see Library Configuration Functions.
Requires LJM 1.2100 or later.
Windows-only. On Linux, chrt can be used to increase process priority: chrt --rr 1 ./my_test
Sets whether or not LJM elevates the process priority temporarily during stream.
LJM_STREAM_PROCESS_PRIORITY_ELEVATED = 1 (default)
LJM_STREAM_PROCESS_PRIORITY_UNALTERED = 2
The constant LJM_STREAM_PROCESS_PRIORITY_MODE can be used interchangeably with the string "LJM_STREAM_PROCESS_PRIORITY_MODE".
LJM_STREAM_PROCESS_PRIORITY_MODE does not affect currently running or already initialized streams.
If process priority cannot be set, a debug log message is generated.
See also the related LJM_STREAM_THREADS_PRIORITY_MODE, which sets priority for threads instead of for the process.
To read LJM_STREAM_PROCESS_PRIORITY_MODE, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_PROCESS_PRIORITY_MODE, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
Sets how LJM_eStreamRead will return data.
Below, ScansPerRead is a parameter of LJM_eStreamStart.
LJM_STREAM_SCANS_RETURN_ALL = 1 (default)
LJM_STREAM_SCANS_RETURN_ALL_OR_NONE = 2
The constant LJM_STREAM_SCANS_RETURN can be used interchangeably with the string "LJM_STREAM_SCANS_RETURN".
LJM_STREAM_SCANS_RETURN does not affect currently running or already initialized streams.
To read LJM_STREAM_SCANS_RETURN, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_SCANS_RETURN, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
LJM_STREAM_SCANS_RETURN affects the behavior of LJM_eStreamRead.
[C/C++] Set the LJM_STREAM_SCANS_RETURN mode to LJM_STREAM_SCANS_RETURN_ALL_OR_NONE.
char ErrorString[LJM_MAX_NAME_SIZE]; int LJMError = 0; LJMError = LJM_WriteLibraryConfigS( LJM_STREAM_SCANS_RETURN, LJM_STREAM_SCANS_RETURN_ALL_OR_NONE ); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
Requires LJM 1.2000 or later
Sets the TCP receive buffer size for LJM's stream data collection. This can reduce the frequency of auto-recovery. Behavior varies by platform.
For a background on the receive buffer, see LJM_GetStreamTCPReceiveBufferStatus.
Writing 0 to LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE will use the OS default receive buffer size, which probably includes auto-tuning. This is appropriate for most use cases. The default LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE is 0.
Writing a non-zero value to LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE will manually set the receive buffer size. Internally, setsockopt is called with SO_RCVBUF as the option parameter.
Since behavior for setting the receive buffer size varies by platform, you should try out different values of LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE until you find the maximum. For example, you should start with a small value like 65535 (which doesn't require window scaling) and exponentially increase it until an error occurs. Your test program should set LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE, then start stream and call LJM_GetStreamTCPReceiveBufferStatus, ensuring that the ReceiveBufferBytesSize is equivalent to your intended stream receive buffer size.
You may also wish to use Wireshark to capture packets to see what the maximum window size your host computer reports the window size to be. To do so, you can start a new capture with a filter like ip.addr == 192.168.1.207, where 192.168.1.207 is your LabJack's IP address, then find the first packet addressed to 192.168.1.207 with port 702. The window size and window scaling of that packet determines the window size as reported to the LabJack device.
Here are some known platform differences:
The constant LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE can be used interchangeably with the string "LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE".
LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE does not affect currently running or already initialized streams.
To read LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE, use LJM_WriteLibraryConfigS orLJM_LoadConfigurationFile.
LJM_STREAM_TCP_RECEIVE_BUFFER_SIZE affects the behavior of LJM_eStreamStart.
For more LJM configurations, see Library Configuration Functions.
Requires LJM 1.2100 or later.
Determines how LJM sets processor priority for LJM's internal stream threads.
LJM_STREAM_THREADS_PRIORITY_AUTO_ELEVATED = 1 (default)
LJM_STREAM_THREADS_PRIORITY_UNALTERED = 2
The constant LJM_STREAM_THREADS_PRIORITY_MODE can be used interchangeably with the string "LJM_STREAM_THREADS_PRIORITY_MODE".
LJM_STREAM_THREADS_PRIORITY_MODE does not affect currently running or already initialized streams.
If thread priority cannot be set, a debug log message is generated.
See also the related LJM_STREAM_PROCESS_PRIORITY_MODE, which sets priority for the process instead of for threads.
To read LJM_STREAM_THREADS_PRIORITY_MODE, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_THREADS_PRIORITY_MODE, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
LJM_STREAM_TRANSFERS_PER_SECOND is a numerical readable and writable LJM library configuration which sets how many times per second LJM's stream thread attempts to receive stream packet(s) from the device.
The constant LJM_STREAM_TRANSFERS_PER_SECOND can be used interchangeably with the string "LJM_STREAM_TRANSFERS_PER_SECOND".
LJM_STREAM_TRANSFERS_PER_SECOND is an advanced configuration. Modifying it is not recommended for most users.
Increasing LJM_STREAM_TRANSFERS_PER_SECOND to a higher value will allow for less latency in receiving stream data, since LJM will receive data from the device more often (in smaller quantities). Increasing the LJM_STREAM_TRANSFERS_PER_SECOND too much will cause the data contained in each packet to decrease, which will cause unnecessary overhead and potentially cause scans to be missed.
You can enable debug logging with LJM_TRACE as the LJM_DEBUG_LOG_LEVEL to see how stream is set up. After running a test stream, search the log file for the term "streaming initialized" to see what effects LJM_STREAM_TRANSFERS_PER_SECOND has on stream setup. Make sure to disable debug logging for your real stream sessions after finding settings for stream setup that looks reasonable, since debug logging consumes a significant amount of processing. LJM's stream setup is deterministic, so given the same parameters to LJM_eStreamStart and the same stream configurations, stream will be set up the same way every time.
Decreasing LJM_STREAM_TRANSFERS_PER_SECOND to a lower value will theoretically cause less overhead in stream, since LJM will receive data from the device less often (in larger quantities), but may have little to no effect. When decreasing LJM_STREAM_TRANSFERS_PER_SECOND, it is recommended to increase the size of the stream buffer on the device. See the Modbus register STREAM_BUFFER_SIZE_BYTES (address: 4012).
Setting a new LJM_STREAM_TRANSFERS_PER_SECOND value will not affect stream threads that are already in progress.
To read LJM_STREAM_TRANSFERS_PER_SECOND, use LJM_ReadLibraryConfigS.
To write LJM_STREAM_TRANSFERS_PER_SECOND, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_STREAM_TRANSFERS_PER_SECOND then set it to 100.
char ErrorString[LJM_MAX_NAME_SIZE]; double value; int LJMError = LJM_ReadLibraryConfigS(LJM_STREAM_TRANSFERS_PER_SECOND, &value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("The default for LJM_STREAM_TRANSFERS_PER_SECOND is %.00f\n", value); value = 100; printf("Setting LJM_STREAM_TRANSFERS_PER_SECOND to %.00f\n", value); LJMError = LJM_WriteLibraryConfigS(LJM_STREAM_TRANSFERS_PER_SECOND, value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); }
Possible output:
The default for LJM_STREAM_TRANSFERS_PER_SECOND is 25
Setting LJM_STREAM_TRANSFERS_PER_SECOND to 100
For more LJM configurations, see Library Configuration Functions.
These are configs that affect the packets that LJM sends to LabJack devices, or configs that determine error checking behavior before LJM sends packets to devices.
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is a numerical readable-writable LJM library configuration that determines whether or not LJM will automatically condense congruent address reads/writes into array reads/writes.
For example, if a call to LJM_eNames contains two frames next to each other that write to AIN0 then AIN1, LJM would automatically condense these frames into one frame that writes to both AIN0 and AIN1.
The constant LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES can be used interchangeably with the string "LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES".
0 - false/disabled
1 - true/enabled (Default)
To read LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, use LJM_ReadLibraryConfigS.
To write LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, set LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, then read it again
char ErrorString[LJM_MAX_NAME_SIZE]; double Value; int LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } if (Value == 0) { printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is disabled by default.\n"); } else { printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is enabled by default.\n"); } printf("Disabling LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES\n"); LJMError = LJM_WriteLibraryConfigS(LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, 0); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); } LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } if ((int)Value == 0) { printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is now disabled.\n"); } else { printf("LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is now enabled.\n"); }
Possible output:
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is enabled by default.
Disabling LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES
LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES is now disabled.
For more LJM configurations, see Library Configuration Functions.
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is a numerical readable-writable LJM library configuration that determines whether or not LJM will automatically perform multiple Feedback commands when the desired operations would exceed the maximum packet length.
For example, if a call to LJM_eNames would require a 68-byte packet but the connection can only take 64-byte packets, LJM would automatically separate the LJM_eNames call into 2 operations of less than 64 bytes each.
The constant LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS can be used interchangeably with the string "LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS".
0 - false/disabled
1 - true/enabled (Default)
To read LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, use LJM_ReadLibraryConfigS.
To write LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, set LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, then read it again
char ErrorString[LJM_MAX_NAME_SIZE]; double Value; int LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } if ((int)Value == 0) { printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is disabled by default.\n"); } else { printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is enabled by default.\n"); } printf("Disabling LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS\n"); LJMError = LJM_WriteLibraryConfigS(LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, 0); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); } LJMError = LJM_ReadLibraryConfigS(LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } if ((int)Value == 0) { printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is now disabled.\n"); } else { printf("LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is now enabled.\n"); }
Possible output:
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is enabled by default.
Disabling LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS is now disabled.
For more LJM configurations, see Library Configuration Functions.
LJM_OLD_FIRMWARE_CHECK is a numerical readable-writable LJM library configuration which sets whether or not LJM will check the Modbus constants file to make sure the firmware of the current device is compatible with the Modbus register(s) being read from or written to.
The constant LJM_OLD_FIRMWARE_CHECK can be used interchangeably with the string "LJM_OLD_FIRMWARE_CHECK".
0 - false/disabled
1 - true/enabled (default)
It is recommended to not disable LJM_OLD_FIRMWARE_CHECK.
For all Easy functions and for LJM_MBFBComm, each address being read from or written to that also exists in the Modbus constants file, LJM will compare the firmware version of the current device against the minimum firmware required for that address. If the device does not have adequate firmware, the function will abort before communicating with the device and return the error LJME_OLD_FIRMWARE (1307).
To read, use LJM_ReadLibraryConfigS.
To write, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
Affects the error checking of all Easy functions and also LJM_MBFBComm.
[C/C++] Read LJM_OLD_FIRMWARE_CHECK, then disable it.
char ErrorString[LJM_MAX_NAME_SIZE]; double value; int LJMError = LJM_ReadLibraryConfigS(LJM_OLD_FIRMWARE_CHECK, &value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("The default for LJM_OLD_FIRMWARE_CHECK is %.00f\n", value); value = 0; printf("Setting LJM_OLD_FIRMWARE_CHECK to %.00f\n", value); LJMError = LJM_WriteLibraryConfigS(LJM_OLD_FIRMWARE_CHECK, value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.
LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP is a numerical readable-writable LJM library configuration that sets whether LJM will use UDP or TCP for T7 WiFi connection initialization when ConnectionType is TCP.
The constant LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP can be used interchangeably with the string "LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP".
LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP was added in LJM 1.1500.
0 - false/disabled - Use UDP
1 - true/enabled (Default) - Use TCP
To read LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP, use LJM_ReadLibraryConfigS.
To write LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
For more LJM configurations, see Library Configuration Functions.
See the StartInterval function for information on interval timing.
Requires LJM 1.2100 or later.
Sets which type of clock LJM_StartInterval initializes for a given IntervalHandle. LJM_WaitForNextInterval will then use the given clock type for that IntervalHandle.
LJM_INTERVAL_CLOCK_TYPE_STEADY = 1 (default)
LJM_INTERVAL_CLOCK_TYPE_SYSTEM = 2
The constant LJM_INTERVAL_CLOCK_TYPE can be used interchangeably with the string "LJM_INTERVAL_CLOCK_TYPE".
LJM_INTERVAL_CLOCK_TYPE does not affect any previously initialized IntervalHandle.
To read LJM_INTERVAL_CLOCK_TYPE, use LJM_ReadLibraryConfigS.
To write LJM_INTERVAL_CLOCK_TYPE, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.
[C/C++] Set the LJM_INTERVAL_CLOCK_TYPE mode to LJM_INTERVAL_CLOCK_TYPE_SYSTEM:
int LJMError = 0; LJMError = LJM_WriteLibraryConfigS( LJM_INTERVAL_CLOCK_TYPE, LJM_INTERVAL_CLOCK_TYPE_SYSTEM ); ErrorCheck(LJMError, "LJM_WriteLibraryConfigS"); int SkippedIntervals; const int INTERVAL_HANDLE = 1; const int ONE_SECOND = 1000 * 1000; // One second in microseconds LJMError = LJM_StartInterval(INTERVAL_HANDLE, ONE_SECOND); ErrorCheck(LJMError, "LJM_StartInterval"); for (int loop = 0; loop < 100; loop++) { ReadAndOutput(handle, "AIN0"); LJMError = LJM_WaitForNextInterval(INTERVAL_HANDLE, &SkippedIntervals); ErrorCheck(LJMError, "LJM_WaitForNextInterval"); if (SkippedIntervals > 0) { printf("SkippedIntervals: %d\n", SkippedIntervals); } }
For more LJM configurations, see Library Configuration Functions.
LJM_LIBRARY_VERSION is a numerical read-only LJM library configuration which is used to read the current LJM version.
The constant LJM_LIBRARY_VERSION can be used interchangeably with the string "LJM_LIBRARY_VERSION".
To read LJM_LIBRARY_VERSION, use LJM_ReadLibraryConfigS.
[C/C++] Read and display LJM_LIBRARY_VERSION, then display LJM_VERSION
char ErrorString[LJM_MAX_NAME_SIZE]; double Value = 0; int LJMError = LJM_ReadLibraryConfigS(LJM_LIBRARY_VERSION, &Value); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString); } printf("LJM_LIBRARY_VERSION is the version of LJM that is\n"); printf(" running and it is %.04f\n", Value); printf("LJM_VERSION is the version of LJM that this program\n"); printf(" was compiled with and it is %.04f\n", LJM_VERSION);
Possible output:
LJM_LIBRARY_VERSION is the version of LJM that is
running and it is 1.0203
LJM_VERSION is the version of LJM that this program
was compiled with and it is 1.0203
For more LJM configurations, see Library Configuration Functions.