This function takes an already initialized USB device list and disposes it.
Due to the fact that we are coding C# here, the device list can or cannot be erased; this is in the scope of the garbage collector and it cannot be forced by the user. Sometimes it is erased instantly, some other times it is never erased, until the user closes the application program that uses this data.
Note | |||||
---|---|---|---|---|---|
After this function is called this USBDeviceList (and its own derived TE_USB_FX2_Device variables) should never be used again. Users may use this function only just before exiting their applications. If users use this function anywhere else, they should
USBdevList is disposed by garbage collector, not set to null. |
The reason of this behavior is due to the CyUSB.dll as explained by Cypress document CyUSB.NET.pdf, pages 132-133 and pages 139-140: "You should never invoke the Dispose() method of a USBDevice directly. Rather, the appropriate technique is to call the Dispose() method of the USBDeviceList object that contains the USBDevice objects".
In the code, it is possible to call TE_USB_FX2_Close() where TE0300_Close() is used, but
Note | ||||
---|---|---|---|---|
| ||||
Managed C# TE_USB_FX2_Close() of TE_USB_FX2_CyUSB.dll disposes USBdevList.
|
Code Block | ||
---|---|---|
| ||
public static bool TE_USB_FX2_Close(ref USBDeviceList USBdevList); |
Your application program shall call this function like this:
Code Block | ||
---|---|---|
| ||
TE_USB_FX2.TE_USB_FX2.TE_USB_FX2_Close(ref USBdevList); |
Code Block | ||
---|---|---|
| ||
ref USBDeviceList USBdevList |
USBDeviceList is a type defined in CyUSB.dll. USBdevList is the list of Trenz Electronic USB FX2 devices attached to the USB bus host computer. This parameter is passed by reference (ref). See page 139-140 of CyUSB.NET.pdf (Cypress CyUSB .NET DLL Programmer's Reference).
bool : logical type
This function returns true if it is able to dispose the list. If unable to do so, it returns false.