3 - Constants | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 

3 - Constants

A note on language wrapper differences

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.

LJM Configuration Constants

The LJM configuration constants configure LJM behavior, such as timeouts. For more information, see the Library Configuration Functions.

LJM Constants

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:

  • Max USB packet bytes = 64
  • Max TCP packet bytes = 1400

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