LJM Library Configuration Functions
This section describes how to configure the LJM library's behavior and interpretation constants. Whenever LJM is started up, it is loaded with default values, so any desired configurations must be applied each time LJM is started.
Behavioral Parameters
The functions LJM_WriteLibraryConfigS and LJM_WriteLibraryConfigStringS are good for setting a few configurations, while LJM_LoadConfigurationFile is more convenient for setting many configurations or for sharing a configuration between programs.
Interpretation Constants
LJM also provides interpretation of Modbus map constants and error constants.
The Modbus map constants affect Name functions that use Name interpretation, such as LJM_eReadName
. These Name functions have "Name" in their name and have a const char * Name
parameter or const char ** aNames
parameter. For each name passed to one of these functions, it is interpreted according to the loaded constants. The Modbus map constants affect the behavior of other functions as well, such as when LJM_OLD_FIRMWARE_CHECK
is enabled.
The Error constants affects the LJM_ErrorToString
function. The loaded Error constants will be interpreted from an integer error code to a error string. Custom application error codes can be loaded in the 3900-3999
range.
Configuration Parameters
The following parameters are constants defined in the header file LabJackM.h. Each parameter's name is the same as it's value; e.g. LJM_LIBRARY_VERSION
is a constant of the string LJM_LIBRARY_VERSION
.
Informational parameters
- LJM_LIBRARY_VERSION - Read the current LJM version. (Read-only)
Timeout parameters
- LJM_SEND_RECEIVE_TIMEOUT_MS - How long LJM waits for a packet to be sent or received.
- LJM_OPEN_TCP_DEVICE_TIMEOUT_MS - How long LJM waits for a device to respond to a connection request.
Device search parameters
- LJM_AUTO_IPS - Sets whether or not LJM attempts to use the auto IPs feature. The auto IP feature reads and writes to the
LJM_AUTO_IPS_FILE
to help open network connections to LabJack devices. - LJM_AUTO_IPS_FILE - The file LJM uses for the auto IPs feature.
- LJM_SPECIFIC_IPS_FILE - The file that specifies Specific IPs, which are IP addresses that are specifically checked for possible LabJack device TCP connections.
- Other device search parameters
Reconnection parameters
LJM_AUTO_RECONNECT_STICKY_CONNECTION
- Sets whether or not LJM attempts to reconnect disrupted / disconnected connections according to same connection type as the original handle.LJM_AUTO_RECONNECT_STICKY_SERIAL
- Sets whether or not LJM attempts to reconnect disrupted / disconnected connections according to same serial number as the original handle.LJM_AUTO_RECONNECT_WAIT_MS
- Determines how long in milliseconds LJM waits between attempts to reconnect when a device has been found to be disconnected.
Packet parameters
LJM_ALLOWS_AUTO_MULTIPLE_FEEDBACKS
- Whether or not LJM will automatically perform multiple Feedback commands when the desired operations would exceed the maximum packet length.LJM_ALLOWS_AUTO_CONDENSE_ADDRESSES
- Whether or not LJM will automatically condense congruent address reads/writes into array reads/writes.LJM_RETRY_ON_TRANSACTION_ID_MISMATCH
- Whether or not LJM automatically retries an operation if anLJME_TRANSACTION_ID_ERR
occurs.LJM_OLD_FIRMWARE_CHECK
- Whether or not LJM will check the Modbus constants file (see LJM_MODBUS_MAP_CONSTANTS_FILE) to make sure the firmware of the current device is compatible with the Modbus register(s) being read from or written to.LJM_USE_TCP_INIT_FOR_T7_WIFI_TCP
- Sets/gets whether LJM will use UDP or TCP for T7 WiFi connection initialization whenConnectionType
is TCP.LJM_ZERO_LENGTH_ARRAY_MODE
- Determines the behavior of array read/write functions when the array size is 0.
Constants file parameters
LJM_MODBUS_MAP_CONSTANTS_FILE
- The absolute or relative path of the constants file to use for that use the LJM Name functionality.LJM_ERROR_CONSTANTS_FILE
- The absolute or relative path of the constants file to use forLJM_ErrorToString
.LJM_CONSTANTS_FILE
- For setting bothLJM_MODBUS_MAP_CONSTANTS_FILE
andLJM_ERROR_CONSTANTS_FILE
. (Write-only)
Debug logger parameters
LJM_DEBUG_LOG_FILE
- The absolute or relative path of the file to output log messages to.LJM_DEBUG_LOG_MODE
- What conditions will cause LJM to output log messages.LJM_DEBUG_LOG_LEVEL
- What priority of log messages are output.LJM_DEBUG_LOG_BUFFER_MAX_SIZE
- How many messages the log buffer can hold.LJM_DEBUG_LOG_SLEEP_TIME_MS
- How often the logger thread will run.LJM_DEBUG_LOG_FILE_MAX_SIZE
- The maximum size of the log file in number of characters.
Stream parameters
- LJM_STREAM_AIN_BINARY - Sets whether data returned from
LJM_eStreamRead
will be calibrated or uncalibrated. - LJM_STREAM_RECEIVE_TIMEOUT_MODE - Sets how stream data collection should time out.
- LJM_STREAM_RECEIVE_TIMEOUT_MS - Manually sets the timeout for LJM's stream data collection.
- LJM_STREAM_SCANS_RETURN - How
LJM_eStreamRead
behaves when the full read amount is not ready. - LJM_STREAM_TRANSFERS_PER_SECOND - How often stream threads attempt to read from the stream.
- LJM_STREAM_THREADS_PRIORITY_MODE - Determines how LJM sets processor priority for LJM's internal stream threads.
- LJM_STREAM_PROCESS_PRIORITY_MODE - Sets whether or not LJM elevates the process priority temporarily during stream.
LJM_INTERVAL_CLOCK_TYPE
- Sets which type of clock LJM_StartInterval initializes for a givenIntervalHandle
. LJM_WaitForNextInterval will then use the given clock type for that IntervalHandle.
Altering Configurations
Functions for setting the behavioral configurations of LJM:
- LJM_WriteLibraryConfigS - Set one numerical configuration value.
- LJM_WriteLibraryConfigStringS - Set one string-based configuration value.
- LJM_LoadConfigurationFile - Load all the configuration values in a specified file.
Altering Modbus Map Constants or Error Constants
Functions for setting the Modbus and/or Error interpretation maps:
- LJM_LoadConstants - Manually loads or reloads the constants file.
- LJM_LoadConstantsFromFile - Loads a specified file as the Modbus map and Error constants.
- LJM_LoadConstantsFromString - Loads a string as the Modbus map and/or Error constants.
Reading Configurations
Functions for getting the behavioral configurations of LJM:
- LJM_ReadLibraryConfigS - Read one numerical configuration value.
- LJM_ReadLibraryConfigStringS - Read one string-based configuration value.