« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.1 - ListAll()

Returns all the devices found of a given DeviceType and ConnectionType. Searching over Ethernet relies on the DiscoveryUDP function (Section 5.2.3), which might not work on certain network configurations.

ListAllS() is a special version 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_dtUE9” 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 ListAll (  long DeviceType,
                             long ConnectionType,
                             long *pNumFound,
                             long *pSerialNumbers,
                             long *pIDs,
                             double *pAddresses)

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

  • DeviceType – The type of LabJack to search for. Constants are in the labjackud.h file.
  • ConnectionType – Enter the constant for the type of connection to use in the search.
  • pSerialNumbers – Must pass a pointer to a buffer with at least 128 elements.
  • pIDs – Must pass a pointer to a buffer with at least 128 elements.
  • pAddresses – Must pass a pointer to a buffer with at least 128 elements.

Outputs:

  • pNumFound – Returns the number of devices found, and thus the number of valid elements in the return arrays.
  • pSerialNumbers – Array contains serial numbers of any found devices.
  • pIDs – Array contains local IDs of any found devices.
  • pAddresses – Array contains IP addresses of any found devices. The function DoubleToStringAddress() is useful to convert these to string notation.

2 comments

I'm using the LJUD.ListAll function in my C# program for I can identify one of two connect U3s. Like so....

 

It returns 2 for the number found and the following data

idx sernums ids address

0 320064201 1 0.0

1 320062387 1 0.0

Now I want to connect the Labjack with serial number 320064201 but the ids and addresses are the same for both.

If I instance a U3 like so...

u3 = new U3(LJUD.CONNECTION.USB,strSN,true);

what do I put int strSN? Or is there another way?

If the local IDs (pIDs) are the same (the addresses from pAddress do not apply to the U3), then you will need to specify the serial number to open the specific device. In the U3 constructor, the third parameter indicates whether to use the first found U3 or not regardless of the serial number or local ID passed (second parameter), so set that to false. For example:

//Open and get an instance to the U3 with serial number 320064201
strSN = "320064201";
u3 = new U3(LJUD.CONNECTION.USB, strSN, false);

 

Afterwards you can change the local ID if you want. For example:

//Set the local ID to 2
LJUD.ePut (u3.ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.LOCALID, 2, 0);