Skip to Navigation

4.2.1 - ListAll()

Returns all the devices found of a given DeviceType and ConnectionType. Currently only USB is supported.

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_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 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. Currently, only USB is supported for this function.
  • 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.

tags:

Comments

#1

Would it be appropriate to make the 128 "magic number" a constant? Based on things I 

read earlier in the manual, specifically section 4.1.1

Personally I prefer to pass the array sizes into the method for added flexibility.

p.s. This is my first read through of the manual so I'll try to comment on things I notice.

#2

Generally speaking we use constants to reflect values passed into functions but the addition of this one would be pretty easy so we will consider adding it into the next driver.