« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.1.2 - OpenS

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_OpenS(
                      const char * DeviceType,
                      const char * ConnectionType,
                      const char * Identifier,
                      int * Handle)

Parameters

DeviceType [in]
A string containing the type of the device to be connected:
"ANY" - Open any supported LabJack device type
"T7" - Open a T7-series device
"DIGIT" - Open a Digit-series device
ConnectionType [in]
A string containing the type of connection desired (USB or TCP):
"ANY", "USB", "TCP", "ETHERNET", or "WIFI"
Additional UDP options:
"NETWORK_UDP", "ETHERNET_UDP", "WIFI_UDP"
Additional TCP or UDP options:
"NETWORK_ANY", "ETHERNET_ANY", "WIFI_ANY"
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.

Relevant Functions

LJM_OpenS and LJM_Open are essentially the same, except that LJM_Open uses integer parameters for DeviceType and ConnectionType rather than string  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#] Opening a T7 via TCP using LJM_OpenS

int LJMError;
int handle;
LJMError = LabJack.LJM.OpenS("T7", "Ethernet", "ANY", ref handle);

[C/C++] Opening a T7 via TCP using LJM_OpenS

int LJMError;
int handle;
LJMError = LJM_OpenS("T7", "TCP", "ANY", &handle);