Hi Setu,
Here is a solution that I have been playing to return back an array of clusters
typedef struct
{
int32 dimSize;
uInt8 array[1];
} LVU8;
typedef LVU8 **LVU8Hdl;
typedef struct
{
U32 DeviceId;
U32 VendorId;
U32 BusNumber;
U32 SlotNumber;
LVU8Hdl SerialNumber;
} LVDEVICE_LOCATION;
typedef LVDEVICE_LOCATION **LVDEV_LOC_HANDLE;
typedef struct
{
int32 dimSize;
LVDEVICE_LOCATION cluster_array[1];
} LVDEV_LOC_ARRAY;
typedef LVDEV_LOC_ARRAY **LVDEV_LOC_ARRAY_HANDLE;
LVPLX_API void GetAllDevices(LVDEV_LOC_ARRAY_HANDLE cluster_array)
{
int i,j;
int numDevices = 3;
DSSetHandleSize(cluster_array, sizeof(int32)+3*(sizeof(LVDEV_LOC_ARRAY)+(sizeof(int32)+16*sizeof(L
VU8))));
(*cluster_array)->dimSize = 3;
(*((*cluster_array)->cluster_array[0]).SerialNumber)->dimSize =16;
(*((*cluster_array)->cluster_array[1]).SerialNumber)->dimSize =16;
(*((*cluster_array)->cluster_array[2]).SerialNumber)->dimSize =16;
for(i=0; i<3; i++)
{
((*cluster_array)->cluster_array[i]).BusNumber = i;
((*cluster_array)->cluster_array[i]).VendorId = i*5;
for(j=0;j<16;j++)
(*((*cluster_array)->cluster_array[i]).SerialNumber)->array[j] = (10*j)+i;
}
}
The code doesnt do much but returns back 3*cluster which the array in my cluster is sized for 16. The problem I've been having , was ensuring I have allocated enough memory to handle the complete structure. This works for me, now all I have to do is put the real code in which get my array of data from the instruments.
Hope it helps
Regards
Ray Farmer
Regards
Ray Farmer