Self Devices
Module classes containing the API functions use the device created by the WMX3Api object that is passed to the constructors of these classes. These classes can also be instantiated using the default constructor with no arguments. In this case, the class is instantiated with a self device.
The module classes of the standard modules are as follows.
Module |
Class |
|---|---|
CoreMotion |
|
Log |
|
ApiBuffer |
|
CyclicBuffer |
|
Compensation |
|
IO |
|
Event |
|
AdvancedMotion |
|
UserMemory |
|
PMMotion |
A self device is a device that is created in the constructor of a module class. The self device is not associated with a WMX3Api object instantiated by the user. The self device cannot be accessed directly, but allows the module class to call API functions without passing in a WMX3Api object to the constructor.
The self device is closed in the destructor of the module class.
A self device cannot be created if the engine is not running when the constructor is called. The engine must first be started by creating a normal device elsewhere or calling the StartEngine function. (The StartEngine function can be called without creating a device.)
To determine if a self device has been successfully created, call the IsDeviceValid function of the module class (the previous link links to the function of the CoreMotion module class) after the constructor is called. If this function returns TRUE, a self device has been successfully created.