In our Q & A blog series, we’ve addressed some of the most important and technical questions about our Lab Bricks. We hope these answers give you a better understanding of how our products work.
Note: Many customers control their Lab Brick products using Python. If you’re one of them, please make sure to use the attenuator SDK with ANSI-C style function names from the Vaunix FTP site. It should be straightforward to call the functions from Python using the “types” extension. The following question is one that you may also have:
Q. We are able to retrieve the number of devices that are attached using the function fnLDA_GetNumDevices().We are planning to control two devices at a time, but we cannot find a function that fetches the DEV IDs of all the connected devices. Using Python, what is the procedure to fetch the DEV ID of Lab Brick devices?
A. The call that you are likely looking for is:
Here is some information about this as well as the calls required to get the model name and serial numbers.
VNX_ATTEN_API int fnLDA_GetDevInfo(DEVID *ActiveDevices)
This function fills in the ActiveDevices array with the device IDs for the connected attenuators. The array must be large enough to hold a device ID for the number of devices returned by fnLDA_GetNumDevices. The function also returns the number of active devices, which in some cases can be less than the number of devices returned in the previous call to fnLDA_GetNumDevices.
The device IDs identify each device and are used in the rest of the functions to select the device. While the device IDs may be small integers and may in some cases seem numerically related to the connected devices they should only be used as opaque handles.
VNX_ATTEN_API int fnLDA_GetModelName(DEVID deviceID, char *ModelName)
This function is used to get the model name of the attenuator. If the function is called with a null pointer it returns only the length of the model-name string. If the function is called with a non-null string pointer it copies the model name into the string and returns the length of the string. The string length will never be greater than the constant MAX_MODELNAME which is defined in VNX_atten.h. This function can be used regardless of whether the attenuator has been initialized with the fnLDA_InitDevice function.
VNX_ATTEN_API int fnLDA_GetSerialNumber(DEVID deviceID)
This function is used to obtain the serial number of the attenuator. It can be called regardless of whether the attenuator has been initialized with the fnLDA_InitDevice function. If your system has multiple attenuators, your software should use each device’s serial number to keep track of each specific device. Do not rely on the order in which the devices appear in the table of active devices. In a typical system the individual attenuators will be found in the same order but there is no guarantee that this will be the case.
If you have any questions about operating or programming Vaunix products or other topics, please contact our technical support team.