OpenNI/OpenNI2 — pull request #33 by tomoto (2013-08-19 00:35:51+00:00)
Title: Extended property support for Kinect Driver (on top of #32 Mirror Mode support)

This patch includes exactly the same changes in #32 plus extended properties for Kinect Driver. The only addition to #32 is commit 20eb30f and below is the description.

* Supported properties
* 3D sensing properties: Near Mode, IR Emitter On/Off
* Non- 3D sensing properties: Camera Elevation, Accelerometer, Audio Array ID
* API header KinectProperties.h is added. This is a sibling of other private property headers
such as PrimeSense.h, PS1080.h, etc.
(Suffix "Properties" is included in the file name for more clarity.)
* The first 4 hex digits of these properties are 0x045e, taken from Microsoft's USB vendor ID.
* NiViewer's toggleCloseRange now supports Kinect using these properties.
* IR emitter on/off is added ('t' key) to NiViewer for both PS1080 and Kinect.
* Design notes
* I struggled if I should reuse the properties of the same meanings in PS1080.h
(i.e. XN_STREAM_PROPERTY_CLOSE_RANGE and XN_MODULE_PROPERTY_EMITTER_STATE).
The confusion was, although PS1080.h seemed to be private for PS1080 Driver,
it was included and used in Kinect Driver also (e.g. XN_STREAM_PROPERTY_CONST_SHIFT).
I eventually decided not to reuse them assuming PS1080.h was actually supposed to be
private, and its use in Kinect Driver was a "hidden hack" to make NiTE work.
If my reading was wrong, please let me know. I will be more than happy to fix.
* Or, do we want to "promote" these properties (i.e. CLOSE_RANGE and EMITTER_STATE)
as a member of ONI properties? It may not be a bad idea.
* Passing a bool type value to setProperty for an OniBool type property may fail
because bool and OniBool are actually different in size (1 byte vs. 4 bytes).
You can workaround this issue by explicitly specifying the data type like
setProperty(). For the same reason, you cannot get an OniBool type
property into a bool type variable.
(This is confusing and hope we can improve this in the future.)
* Fixed a bug in XnDeviceModule.cpp that caused a crash when reading
XN_MODULE_PROPERTY_EMITTER_STATE from a PS1080 device, which I found
while enhancing NiViewer.

Thanks again to KHeresy who created #22 which I used as a reference.