Device enumeration
The complete device handling is done by the API internally. It manages the resources of all enumerated devices and offers either a device pointer or handle to API users. Calling Init() prepares the API itself, while DeInit() does a complete cleanup and invalidates all device pointers and handles.
To find supported devices and work with them, Enumerate() must be called after Init(). Enumerate() can be called multiple times for either finding devices of different types or to find newly plugged devices (primary USB at the moment). One important thing is the following: Enumerate() does never remove a device from the internal device list and so invalidate any pointer, it just add new ones or does nothing, even if a USB device is removed. For a clean detection of a device removal, calling DeInit(), Init() and Enumerate() (in exactly that order) will build a new, clean device list, but invalidates all previous created device pointers and handles.
To identify devices in a unique way, each device gets a UID, which is a combination of device type name and connection point, so even after a complete cleanup and new enumeration, devices can be exactly identified by this value.
Methods/Functions
Init
API | Code |
C++ | static void ceDevice::Init() |
CCE_RESULT Init()
.NET | static void ceDevice.Init() |
Prepare internal structures, must be the first call to the UDK API. Can be called after invoking DeInit() again, see top of this section.
DeInit
API | Code |
C++ | static void ceDevice::DeInit() |
CCE_RESULT DeInit()
.NET | static void ceDevice.DeInit() |
Free up all internal allocated data, there must no subsequent call to the UDK API after this call, except Init() is called again. All retrieved device pointers and handles are invalid after this point.
USBS6 / |
| http://www.cesys.com/ |
User Doc V0.3 | preliminary |