ADU  Series - USB Data Acquisition Interface SDK 

GetAduDeviceList  ( requires DLL V2.1.0.0 or higher)

The GetAduDeviceList function accepts an empty list of ADU_DEVICE_IDs, and populates it with all currently connected ADU devices. Call this function to obtain a list of ADU Product IDs and Serial Numbers of connected ADU devices.

C Declaration:

void __stdcall GetAduDeviceList(ADU_DEVICE_ID*  pAduDeviceList,
                                                          unsigned short  iAduDeviceListBufferSize,
                                                          unsigned long   iTimeoutMillisec,
                                                          unsigned short* pNumDevicesFound,
                                                          BOOL*              pResult);


NOTE:  This function is not compatible with Visual Basic. VB users must use ADUCount and GetADU functions to accomplish the same task.

Arguments:

Argument Type Value Description
pAduDeviceList ADU_DEVICE_ID* List of device IDs (supplied empty) Receives list of connected ADU devices
iAduDeviceListBufferSize unsigned short  Numeric  (supplied by caller) Number of ADU devices that can be stored in pAduDeviceList
iTimeoutMillisec unsigned long  Numeric  (supplied by caller) Number of milliseconds before the drive should timeout
pNumDevicesFound unsigned short*  Numeric  (supplied empty)  Receives the number of ADU devices in pAduDeviceList
pResult   BOOL*  boolean (supplied empty) Receives TRUE if the function was successful, FALSE otherwise

 

Return Codes:

Return code is supplied by the driver via bResult argument. bResult will be TRUE if pAduDeviceList was populated, FALSE if something went wrong. See “Notes” below.


Notes:

If the number of devices specified by iAduDeviceListBufferSize is smaller than the number of currently connected ADU devices, the result value will be FALSE. In this case, the data contained in pAduDeviceList should not be trusted, and the function should be called with a larger list of ADU_DEVICE_IDs.

iAduDeviceListBufferSize should always be the number of ADU_DEVICE_IDs declared in pAduDeviceList.

Example:

/* 
   The following code will:
   - retrieve a list of ADU devices from the AduHid.dll (or AduHid64.dll) driver;
   - step through the list identifying each ADU's Product ID & Serial Number;
   - build a string list of all connected ADUs;
   - display the list in a Message Box.
*/

// Max number of ADUs in the device list
const int      ADU_DEVICE_MAX = 128;

// Allocating space for the driver to return data
ADU_DEVICE_ID  pAduDevices[ADU_DEVICE_MAX];
unsigned short nNumDevicesFound;
BOOL        bResult;

// To provide the driver with a time limit
unsigned long  nTimeoutMillisec = 100;

// For displaying a list of devices
CString        strProductID;
CString       strSerialNum;
CString        strOutputBuffer;
CString        strOutputString;

// Call the Driver DLL to retrieve a list of connected ADU devices.
GetAduDeviceList(pAduDevices, ADU_DEVICE_MAX, nTimeoutMillisec, &nNumDevicesFound, &bResult);

// bResult is FALSE if there was an error, or more than ADU_DEVICE_MAX devices
if(bResult == TRUE) 
{
// nNumDevicesFound contains the number of ADUs returned by the driver
strOutputString.Format(_T("Devices found: %i\n"), nNumDevicesFound);

// now stepping through each device
for (int x = 0; x < nNumDevicesFound; x++) 
{
// Obtain the ADU's product ID & serial number
strProductID.Format(_T("%d"), pAduDevices[x].iProductId);
strSerialNum = pAduDevices[x].szSerialNumber;

// Format the ADU index, Product ID & SNo, then add it to the output string
strOutputBuffer.Format(_T("%i: %s, %s\n"), x, strProductID, strSerialNum);
strOutputString.Append(strOutputBuffer);
}
// Show our device list in a Message Box
MessageBox (strOutputString);
}