Skip to Navigation

Reply to comment

4.2.2 - OpenLabJack()

Call OpenLabJack() before communicating with a device. This function can be called multiple times, however, once a LabJack is open, it remains open until your application ends (or the DLL is unloaded). If OpenLabJack is called repeatedly with the same parameters, thus requesting the same type of connection to the same LabJack, the driver will simply return the same LJ_HANDLE every time. Internally, nothing else happens. This includes when the device is reset, or disconnected. Once the device is reconnected, the driver will maintain the same handle. If an open call is made for USB, and then Ethernet, a different handle will be returned for each connection type and both connections will be open.

OpenLabJackS() is a special version of open where DeviceType and ConnectionType are strings rather than longs. This is useful for passing string constants in languages that cannot include the header file. The strings should contain the constant name as indicated in the header file (such as “LJ_dtU3” and ”LJ_ctUSB”). The declaration for the S version of open is the same as below except for (const char *pDeviceType, const char *pConnectionType, …).

Declaration:


LJ_ERROR _stdcall OpenLabJack (  long DeviceType,
                                 long ConnectionType,
                                 const char *pAddress,
                                 long FirstFound,
                                 LJ_HANDLE *pHandle)

Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:

  • DeviceType – The type of LabJack to open. Constants are in the labjackud.h file.
  • ConnectionType – Enter the constant for the type of connection. USB only for the U3.
  • pAddress – Pass the local ID or serial number of the desired LabJack. If FirstFound is true, Address is ignored.
  • FirstFound – If true, then the Address and ConnectionType parameters are ignored and the driver opens the first LabJack found with the specified DeviceType. Generally only recommended when a single LabJack is connected.

Outputs:

  • pHandle – A pointer to a handle for a LabJack.
tags:

Reply

Totally secret. Used only if you want to be notified of new comments.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <p> <br>
  • Lines and paragraphs break automatically.

More information about formatting options