org.openni
Interface OpenNI.DeviceConnectedListener
- Enclosing class:
- OpenNI
public static interface OpenNI.DeviceConnectedListener
The OpenNI.DeviceConnectedListener interface provides a means of registering for, and
responding to when a device is connected.
onDeviceConnected is called whenever a new device is connected to the system (ie this event
would be triggered when a new sensor is manually plugged into the host system running the
application)
To use this class, you should write a new class that inherits from it, and override the
onDeviceConnected method. Once you instantiate your class, use the
OpenNI.addDeviceConnectedListener(org.openni.OpenNI.DeviceConnectedListener)
function to add your listener object to OpenNI's list of listeners. Your handler function will
then be called whenever the event occurs. A
OpenNI.removeDeviceConnectedListener(org.openni.OpenNI.DeviceConnectedListener)
function is also provided, if you want to have your class stop listening to these events for
any reason.
onDeviceConnected
void onDeviceConnected(DeviceInfo info)
- Callback function for the onDeviceConnected event. This function will be called whenever this
event occurs. When this happens, a pointer to the
DeviceInfo
object for the newly
connected device will be supplied. Note that once a device is removed, if it was opened by a
Device
object, that object can no longer be used to access the device, even if it was
reconnected. Once a device was reconnected, Device.open(String)
should be
called again in order to use this device.
If you wish to open the new device as it is connected, simply query the provided DeviceInfo
object to obtain the URI of the device, and pass this URI to the
Device.open(String)
function.