« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.1.1 - Open

Opens a desired LabJack and associates a device handle number (connection ID).  The device handle may then be passed as an input to other functions.

Syntax

LJM_ERROR_RETURN LJM_Open(
                      int DeviceType,
                      int ConnectionType,
                      const char * Identifier,
                      int * Handle)

Parameters

DeviceType [in]
An integer containing the type of the device to be connected:
LJM_dtANY (0) - Open any supported LabJack device type
LJM_dtT7 (7) - Open a T7-series device
LJM_dtDIGIT (200) - Open a Digit-series device
ConnectionType [in]
An integer containing the type of connection desired:
LJM_ctANY (0), LJM_ctUSB (1), LJM_ctTCP (2), LJM_ctETHERNET (3), LJM_ctWIFI (4)
Other UDP options:
LJM_ctNETWORK_UDP (5), LJM_ctETHERNET_UDP (6), LJM_ctWIFI_UDP (7)
Other TCP or UDP options:
LJM_ctNETWORK_ANY (8), LJM_ctETHERNET_ANY (9), LJM_ctWIFI_ANY (10)
Identifier [in]
A string that may identify the device to be connected.  To open any device, use LJM_idANY (or the string "ANY").  To specify an identifier, use a serial number, IP address, or device name.  See Identifier Parameter for more information.
Handle [out]
The new handle that represents the device connection.  

Returns

LJM errorcode or 0 for no error.

Related Functions

LJM_Open and LJM_OpenS are essentially the same, except that LJM_OpenS uses string parameters for DeviceType and ConnectionType rather than integer parameters.

See LJM_GetHandleInfo to retrieve information about a handle.

See LJM_ListAll or LJM_ListAllS to find multiple devices.

Remarks

See the notes in Opening and Closing.

When the ConnectionType parameter of this function is network-based, this function will check the IP addresses listed in LJM_SPECIAL_ADDRESSES_FILE.

Examples

[C/C++] Opening the first found T7, using LJM_Open

int LJMError;
int handle;
LJMError = LJM_Open(7, 0, "ANY", &handle);