public class Device
extends java.lang.Object
VideoStream
"VideoStreams" -- you will
need a a Device in order to use the VideoStream.create() function. This, along with
configuration, is the primary use of this class for application developers.
Before devices can be created, OpenNI.initialize()
must have been run to make
the device drivers on the system available to the API.Constructor and Description |
---|
Device() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the device.
|
DeviceInfo |
getDeviceInfo()
Provides information about this device in the form of a DeviceInfo object.
|
long |
getHandle()
This function return device handle.
|
ImageRegistrationMode |
getImageRegistrationMode()
Gets the current image registration mode of this device.
|
PlaybackControl |
getPlaybackControl()
Gets an object through which playback of a file device can be controlled.
|
SensorInfo |
getSensorInfo(SensorType sensorType)
Get the
SensorInfo for a specific sensor type on this device. |
boolean |
hasSensor(SensorType sensorType)
This function checks to see if one of the specific sensor types defined in
SensorType
is available on this device. |
boolean |
isFile()
Checks whether this device is a file device (i.e.
|
boolean |
isImageRegistrationModeSupported(ImageRegistrationMode mode)
Checks to see if this device can support registration of color video and depth video.
|
static Device |
open()
Opens a any device.
|
static Device |
open(java.lang.String uri)
Opens a device.
|
void |
setDepthColorSyncEnabled(boolean isEnabled)
Used to turn the depth/color frame synchronization feature on and off.
|
void |
setImageRegistrationMode(ImageRegistrationMode mode)
Sets the image registration on this device.
|
public static Device open(java.lang.String uri)
open()
function. If multiple devices
are connected to the system, then one of them will be opened. This procedure is most useful
when it is known that exactly one device is (or can be) connected to the system. In that case,
requesting a list of all devices and iterating through it would be a waste of effort.
If multiple devices are (or may be) connected to a system, then a URI will be required to
select a specific device to open. There are two ways to obtain a URI: from a DeviceConnected
event, or by calling OpenNI.enumerateDevices()
.
In the case of a DeviceConnected event, the OpenNI.DeviceConnectedListener
will be
provided with a DeviceInfo object as an argument to its {}
OpenNI.DeviceConnectedListener.onDeviceConnected(DeviceInfo)
function. The
DeviceInfo.getUri()
function can then be used to obtain the URI.
If the application is not using event handlers, then it can also call the static function
OpenNI.enumerateDevices()
. This will return an array of DeviceInfo
objects, one for each device currently available to the system. The application can then
iterate through this list and select the desired device. The URI is again obtained via the
DeviceInfo.getUri()
function.
Standard codes of type Status are returned indicating whether opening was successful. For
opening a recording file, pass the file path as a uri.uri
- String containing the URI of the device to be opened.public static Device open()
public void close()
public final DeviceInfo getDeviceInfo()
public boolean hasSensor(SensorType sensorType)
SensorType
is available on this device. This allows an application to, for example, query for the presence
of a depth sensor, or color sensor.sensorType
- of sensor to query forpublic final SensorInfo getSensorInfo(SensorType sensorType)
SensorInfo
for a specific sensor type on this device. The SensorInfo
is
useful primarily for determining which video modes are supported by the sensor.sensorType
- of sensor to get information about.public long getHandle()
public PlaybackControl getPlaybackControl()
public boolean isImageRegistrationModeSupported(ImageRegistrationMode mode)
public ImageRegistrationMode getImageRegistrationMode()
ImageRegistrationMode
for possible return
values.public void setImageRegistrationMode(ImageRegistrationMode mode)
ImageRegistrationMode
for a list of valid settings to pass to this function.
It is a good practice to first check if the mode is supported by calling
isImageRegistrationModeSupported(ImageRegistrationMode)
.mode
- Desired new value for the image registration mode.public boolean isFile()
public void setDepthColorSyncEnabled(boolean isEnabled)
isEnabled
- Set to TRUE to enable synchronization, FALSE to disable it