diff --git a/Bin/SensorKinect-Win32-5.0.0.exe b/Bin/SensorKinect-Win32-5.0.0.exe
deleted file mode 100644
index 824a019..0000000
Binary files a/Bin/SensorKinect-Win32-5.0.0.exe and /dev/null differ
diff --git a/Bin/SensorKinect091-Bin-Linux32-v5.1.0.25.tar.bz2 b/Bin/SensorKinect091-Bin-Linux32-v5.1.0.25.tar.bz2
new file mode 100644
index 0000000..2375fd9
Binary files /dev/null and b/Bin/SensorKinect091-Bin-Linux32-v5.1.0.25.tar.bz2 differ
diff --git a/Bin/SensorKinect091-Bin-Linux64-v5.1.0.25.tar.bz2 b/Bin/SensorKinect091-Bin-Linux64-v5.1.0.25.tar.bz2
new file mode 100644
index 0000000..8d269dc
Binary files /dev/null and b/Bin/SensorKinect091-Bin-Linux64-v5.1.0.25.tar.bz2 differ
diff --git a/Bin/SensorKinect091-Bin-MacOSX-v5.1.0.25.tar.bz2 b/Bin/SensorKinect091-Bin-MacOSX-v5.1.0.25.tar.bz2
new file mode 100644
index 0000000..ec38e59
Binary files /dev/null and b/Bin/SensorKinect091-Bin-MacOSX-v5.1.0.25.tar.bz2 differ
diff --git a/Bin/SensorKinect091-Bin-Win32-v5.1.0.25.msi b/Bin/SensorKinect091-Bin-Win32-v5.1.0.25.msi
new file mode 100644
index 0000000..54f6f73
Binary files /dev/null and b/Bin/SensorKinect091-Bin-Win32-v5.1.0.25.msi differ
diff --git a/Bin/SensorKinect091-Bin-Win64-v5.1.0.25.msi b/Bin/SensorKinect091-Bin-Win64-v5.1.0.25.msi
new file mode 100644
index 0000000..8c04e89
Binary files /dev/null and b/Bin/SensorKinect091-Bin-Win64-v5.1.0.25.msi differ
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..d06a965
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,138 @@
+Detailed Change log:
+--------------------
+
+Version 5.1.0.25 (Unstable version - Dec 18th 2011)
+---------------------------------------------------
+ * Bug Fix: server-client didn't always work due to an uninitialized member.
+ * Installer bug fix: versions were compared by string instead of by number.
+ * Added Support for FW 5.5:
+ 1) Support product ID 0601.
+ 2) ISO and BULK interfaces are now switched.
+ 3) AudioGenerator is no longer supported.
+ * Enumeration Bug Fix: From now on, a generator will not return on enumeration if one already exists from the same device.
+ * Android: makefiles now match ndk v7.
+ * Bug Fix: client-server did not pass timestamp correct in the NewDataAvailbale event, causing FrameSync to malfunction.
+ * Bug Fix: Enumeration for ImageGenerator could cause a crash.
+ * Default UsbInterface is now BULK on Arm (for performance reasons) and ISO on all other platforms.
+ * Default Image format is now uncompressed in ISO, and compressed in BULK.
+ * Server (Multiprocess) is not on by default on Arm.
+ * BC Bug fix: XnVInitStreamPropertiesInternal::IsProperty did not function correctly.
+ * BC Bug Fix: XnVDepthRepresentation would not set correct Y resolution.
+ * Added support for FW 5.6 (no audio)
+ * Added Android support to open source.
+ * Temporary patch for MacOSX: Cache the device path's since running enum on the MAC takes several seconds!
+
+Version 5.0.5.1 (Unstable version - Nov 17th 2011)
+--------------------------------------------------
+ * Removed support for very old 2.0 devices.
+ * Linux: XnSensorServer dependency was missing.
+ * Bug Fix: AllowMultiUsers property was not handled correctly.
+
+Version 5.0.4.4 (Unstable version - Nov 7th 2011)
+-------------------------------------------------
+ * Added YUV input in high res for FW 5.3.28 and above.
+ * Added grayscale 8 input format.
+ * Added automatic setting of input format, and automatic checking of modes.
+ * Updated to newer common makefiles
+ * Sensor client-server on windows: Allow starting server and client in different sessions (requires a special setting in GlobalDefaults.ini, as this causes things not to work properly if running on a machine with UAC on).
+ * Changed Engine changed to Sensor in the final installation files.
+ * Renamed Linux-x86 to "Linux" (supports x86, x64, Arm and MacOSX).
+ * Allow better cross compiling.
+ * Bug Fix: old XNS files would not set their IsGenerating property (and so it is left FALSE, even if node has frames).
+ * Updated the value of the UsbInterface property once endpoints are opened.
+
+Version 5.0.4.3 (Stable version - Sep 18th 2011)
+------------------------------------------------
+ * Some minor windows installer UI fix (title position).
+ * Fixed buffer overflow bugs in the software registration.
+ * Support for firmware 5.4.x: New TEC and extended serial number commands.
+ * On newer FWs (5.4+) high-res image output does not always have to be bayer so this rule will only be enforced on older versions.
+ * Preliminary Android Support.
+ * Preliminary ARM Support.
+ * Win32: Added the /MP (MultiProcess Compiling) flag to all projects to save build time.
+ * Bug Fix: Image Generator always said it supports JPEG (without checking the sensor itself).
+ * Fix a memory leak (about 180 bytes per generator).
+
+Version 5.0.3.4 (Stable version - Jul 5th 2011)
+-----------------------------------------------
+ * Windows Redist: Support for 64-bit systems.
+ * Control mutex is now per sensor and not global to all sensors.
+
+Version 5.0.3.3 (Stable version - Jul 5th 2011)
+-----------------------------------------------
+ * Linux: Allow installation to a different directory (for cross-compilation mainly).
+ * Workaround firmware bug: if no depth, IR timestamps are corrupt. Use host clock for timestamps instead.
+ * Bug Fix: unregistering USB event callback when destroying sensor to prevent crash when unplugging device.
+ * XnExportedSensorDevice now only enumerates devices that weren't created in the context yet.
+
+Version 5.0.2.3 (Stable version - May 3rd 2011)
+-----------------------------------------------
+ * Fixed use of deprecated CreateProductionTree().
+ * Bug Fix: playing XNS files in applications using deprecated API might cause memory leaks.
+ * Bug Fix: serial number was in hex format instead of decimal one.
+ * Make sure SensorV2 nodes will only use SensorV2 device (up to now they only checked it's a PrimeSense device).
+
+Version 5.0.1.33 (Unstable version - Apr 18th 2011)
+---------------------------------------------------
+ * CE4100: adding support in makefiles, redist and install.
+ * CE4100: default is now BULK with compressed formats.
+
+Version 5.0.1.32 (Unstable version - Apr 11th 2011)
+---------------------------------------------------
+ * Fixing log prints of resolutions (-1 appeared as MAX_UINT64...) to the resolution name.
+ * Linux Bug Fix: Server creates two log files, one in the client folder and one in /var/log/primesense/XnSensorServer
+ * Fixed a memory leak when rewinding old XNS files.
+ * Win32: WIX installer (replacing NSIS)
+ * Fixed wrong version in XnDeviceFile
+
+Version 5.0.1.31 (Stable version - Apr 11th 2011)
+-------------------------------------------------
+ * Fix BULK timeout - it was too small...
+ * Bug Fix: IR only works in QVGA...
+ * Added 64bit support for the installers.
+ * Fix wrong uses of the XN_IS_STATUS_OK macro (value is evaluated twice).
+ * Adding support for MJPEG pass-through.
+ * Adding initial support for new CMOS interfaces
+ * Adding initial JPEG support
+ * Fix for UAC installer problems.
+ * Fixed uninstall without OpenNI.
+ * Set minimum OpenNI version check in the installer.
+ * Fix seeking to first frame in old XNS files.
+ * Bug Fix: Client would fail to connect if trying to connect while server is shutting down.
+ * Improving the timestamps algorithm.
+ * performance improvement when enumerating for image nodes - a sensor should only be checked once.
+ * improving error message for setting grayscale8 in low resolutions.
+ * Improve thread-safety when starting server
+ * Bug Fix: a crash when trying to open a non-existing XNS file.
+ * Bug Fix: a potential crash if Init of depth generator fails.
+ * Sensor now supports the Device Identification capability.
+ * Server: fixing a deadlock problem between closing a stream and getting new data from it. This was done by splitting the sensor lock into two locks: one for changes on the sensor and one for changing the stream collection.
+ * MultiProcess Bug Fix: the lock on a sensor didn't exist, so nothing was synchronized.
+ * ImageGenerator now also changes InputFormat when changing resolution if needed (when switching from hi-res to normal & vice versa).
+ * Adding frame IDs to Audio (just counting)
+ * restoring defaults to QVGA.
+ * Add support for sensors with no image CMOS.
+ * Updated low-bandwidth USB devices buffer information.
+ * Added the Asus WAVI auto-detection for Win32.
+ * Low bandwidth devices now use bigger USB delays.
+ * New defaults are now VGA, uncompressed.
+ * Initial support for low-band devices:
+ 1. Image, IR and audio does not enumerate.
+ 2. Defaults changed to QVGA, compressed.
+
+Version 5.0.0.25 (Unstable version - Jan 6th 2011)
+--------------------------------------------------
+ * Bug fix: infinite loop in server when a client tries to disconnect and streams can't be closed (usb timeout for example).
+ * Added MacOSX platform support.
+ * Added the unstable README file.
+ * Removed useless win32 prerequisites...
+ * Fixing audio to work properly in the client-server model.
+ * Server Bug Fix: a potential dead lock was solved.
+ * Sensor Server now supports multiple sensors.
+ * Refactored server to a better design, which should decrease deadlocks and make code more readable.
+ * Adding support for enumerating and opening different sensors.
+ * Bug Fix: GetStringProperty would always return XN_STATUS_ERROR.
+
+Version 5.0.0.24 (Stable version - Dec 8th 2010)
+------------------------------------------------
+ * Initial release...
\ No newline at end of file
diff --git a/Data/GlobalDefaults.ini b/Data/GlobalDefaultsKinect.ini
similarity index 84%
rename from Data/GlobalDefaults.ini
rename to Data/GlobalDefaultsKinect.ini
index 0e1833e..fcfec6c 100644
--- a/Data/GlobalDefaults.ini
+++ b/Data/GlobalDefaultsKinect.ini
@@ -1,6 +1,6 @@
[Core]
; 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default)
-LogLevel=0
+LogLevel=3
; leave empty for nothing (default). ALL - all masks
LogMasks=ALL
; 0 - No (default), 1 - Yes
@@ -17,9 +17,12 @@ LogWriteToFile=1
;---------------- Server Default Configuration -------------------
[Server]
-; Use a server to access sensor. 0 - No (single application), 1 - Yes (multiple applications, default)
+; Use a server to access sensor. 0 - No (single application), 1 - Yes (multiple applications). Default: Arm - 0, other platforms - 1. Not supported on Mac.
;EnableMultiProcess=0
+; When multi process is enabled, allows server and client running in different sessions. 0 - No (default), 1 - Yes
+;EnableMultiUsers=0
+
; The timeout in which a server goes down if no client is connected, in milliseconds
;ServerNoClientsTimeout=10000
@@ -53,7 +56,7 @@ LogWriteToFile=1
; Is APC enabled. 0 - Off, 1 - On (default)
;APCEnabled=1
-; USB interface to be used. 0 - FW Default (default), 1 - ISO endpoints, 2 - BULK endpoints
+; USB interface to be used. 0 - FW Default, 1 - ISO endpoints, 2 - BULK endpoints. Default: Arm - 2, other platforms - 1
;UsbInterface=2
[Depth]
@@ -75,14 +78,14 @@ LogWriteToFile=1
; Max depth cutoff. 0-10000 mm (default is 10000)
;MaxDepthValue=10000
-; Input format. 0 - Uncompressed 16-bit, 1 - PS Compression (default), 3 - Packed 11-bit
-InputFormat=3
+; Input format. 0 - Uncompressed 16-bit, 1 - PS Compression, 3 - Packed 11-bit (default)
+;InputFormat=1
; Registration. 0 - Off (default), 1 - On
;Registration=1
; Registration Type. 0 - Don't care (default), 1 - use hardware accelaration, 2 - perform in software
-RegistrationType=2
+;RegistrationType=0
; Hole Filler. 0 - Off, 1 - On (default)
;HoleFilter=1
@@ -136,8 +139,8 @@ RegistrationType=2
; Frames per second (default is 30)
;FPS=30
-; Input format. 0 - BAYER (1.3MP or 2.0MP only), 1 - Compressed YUV422 (default), 2 - Jpeg, 5 - Uncompressed YUV422, 6 - Uncompressed 8-bit BAYER
-InputFormat=6
+; Input format. 0 - BAYER (1.3MP or 2.0MP only), 1 - Compressed YUV422 (default in BULK), 2 - Jpeg, 5 - Uncompressed YUV422 (default in ISO), 6 - Uncompressed 8-bit BAYER
+;InputFormat=5
; Anti Flicker. 0 - Off (default), 50 - 50Hz, 60 - 60 Hz.
;Flicker=50
diff --git a/Include/XnCore.h b/Include/XnCore.h
index ea8dd7b..07bee6f 100644
--- a/Include/XnCore.h
+++ b/Include/XnCore.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_CORE_H_
#define _XN_CORE_H_
diff --git a/Include/XnDDK.h b/Include/XnDDK.h
index e5de4e7..2ed1258 100644
--- a/Include/XnDDK.h
+++ b/Include/XnDDK.h
@@ -1,36 +1,31 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DDK_H_
#define _XN_DDK_H_
#include
#include
#include
+#include
#ifdef __cplusplus
#ifdef XN_DDK_EXPORTS
@@ -80,4 +75,8 @@ XN_DDK_API XnStatus XnDDKInitFromINIFile(const XnChar* cpINIFileName);
*/
XN_DDK_API XnStatus XnDDKShutdown();
+XN_DDK_API XnResolutions XnDDKGetResolutionFromXY(XnUInt32 nXRes, XnUInt32 nYRes);
+XN_DDK_API XnBool XnDDKGetXYFromResolution(XnResolutions res, XnUInt32* pnXRes, XnUInt32* pnYRes);
+XN_DDK_API const XnChar* XnDDKGetResolutionName(XnResolutions res);
+
#endif //_XN_DDK_H_
diff --git a/Include/XnDDKStatus.h b/Include/XnDDKStatus.h
index 658d959..14dfdde 100644
--- a/Include/XnDDKStatus.h
+++ b/Include/XnDDKStatus.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DDK_STATUS_H_
#define _XN_DDK_STATUS_H_
diff --git a/Include/XnDevice.h b/Include/XnDevice.h
index 7621afd..e5400e5 100644
--- a/Include/XnDevice.h
+++ b/Include/XnDevice.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICE_H_
#define _XN_DEVICE_H_
diff --git a/Include/XnDeviceProto.inl b/Include/XnDeviceProto.inl
index 4acda35..ebb23dd 100644
--- a/Include/XnDeviceProto.inl
+++ b/Include/XnDeviceProto.inl
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
/**
* Gets the definition of a device.
*
diff --git a/Include/XnDeviceProxy.h b/Include/XnDeviceProxy.h
index 154216a..3472229 100644
--- a/Include/XnDeviceProxy.h
+++ b/Include/XnDeviceProxy.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_PROXY_H__
#define __XN_DEVICE_PROXY_H__
diff --git a/Include/XnEE.h b/Include/XnEE.h
index 7f4c5de..cab443d 100644
--- a/Include/XnEE.h
+++ b/Include/XnEE.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_COMMON_H_
#define _XN_EE_COMMON_H_
diff --git a/Include/XnEE/XnEEAlgorithms.h b/Include/XnEE/XnEEAlgorithms.h
index aabd916..5639049 100644
--- a/Include/XnEE/XnEEAlgorithms.h
+++ b/Include/XnEE/XnEEAlgorithms.h
@@ -1,31 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_ALGORITHMS_H_
#define _XN_EE_ALGORITHMS_H_
diff --git a/Include/XnEE/XnEECore.h b/Include/XnEE/XnEECore.h
index ce72bba..bf5b17f 100644
--- a/Include/XnEE/XnEECore.h
+++ b/Include/XnEE/XnEECore.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_CORE_H_
#define _XN_EE_CORE_H_
diff --git a/Include/XnEE/XnEEFramework.h b/Include/XnEE/XnEEFramework.h
index 5749f25..c332baa 100644
--- a/Include/XnEE/XnEEFramework.h
+++ b/Include/XnEE/XnEEFramework.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_FW_H_
#define _XN_EE_FW_H_
diff --git a/Include/XnEE/XnEEGeometry.h b/Include/XnEE/XnEEGeometry.h
index 889fbb4..e55ba9e 100644
--- a/Include/XnEE/XnEEGeometry.h
+++ b/Include/XnEE/XnEEGeometry.h
@@ -1,31 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_GEOMETRY_H_
#define _XN_EE_GEOMETRY_H_
diff --git a/Include/XnEE/XnEEMath.h b/Include/XnEE/XnEEMath.h
index 7fd0309..5950673 100644
--- a/Include/XnEE/XnEEMath.h
+++ b/Include/XnEE/XnEEMath.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_MATH_H_
#define _XN_EE_MATH_H_
diff --git a/Include/XnEE/XnEEObjects.h b/Include/XnEE/XnEEObjects.h
index c835425..a62ff63 100644
--- a/Include/XnEE/XnEEObjects.h
+++ b/Include/XnEE/XnEEObjects.h
@@ -1,31 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_EE_OBJECTS_H_
#define _XN_EE_OBJECTS_H_
diff --git a/Include/XnEE/XnV3DBox.h b/Include/XnEE/XnV3DBox.h
index d873b38..3a97d43 100644
--- a/Include/XnEE/XnV3DBox.h
+++ b/Include/XnEE/XnV3DBox.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_3DBOX_H_
#define _XNV_3DBOX_H_
diff --git a/Include/XnEE/XnV3DGeometry.h b/Include/XnEE/XnV3DGeometry.h
index 8aa827e..cf95927 100644
--- a/Include/XnEE/XnV3DGeometry.h
+++ b/Include/XnEE/XnV3DGeometry.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_3DGEOMETRY_H_
#define _XNV_3DGEOMETRY_H_
diff --git a/Include/XnEE/XnV3DVector.h b/Include/XnEE/XnV3DVector.h
index 1930794..2a0d7e5 100644
--- a/Include/XnEE/XnV3DVector.h
+++ b/Include/XnEE/XnV3DVector.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_3DVECTOR_H_
#define _XNV_3DVECTOR_H_
diff --git a/Include/XnEE/XnVAudioBuffer.h b/Include/XnEE/XnVAudioBuffer.h
index 08b97d1..fdea982 100644
--- a/Include/XnEE/XnVAudioBuffer.h
+++ b/Include/XnEE/XnVAudioBuffer.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_AUDIO_BUFFER_H_
#define _XNV_AUDIO_BUFFER_H_
diff --git a/Include/XnEE/XnVBodyPart.h b/Include/XnEE/XnVBodyPart.h
index 586546c..63f6c10 100644
--- a/Include/XnEE/XnVBodyPart.h
+++ b/Include/XnEE/XnVBodyPart.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_BODY_PART_H
#define _XNV_BODY_PART_H
diff --git a/Include/XnEE/XnVBoundingBox.h b/Include/XnEE/XnVBoundingBox.h
index 23270af..c3a4028 100644
--- a/Include/XnEE/XnVBoundingBox.h
+++ b/Include/XnEE/XnVBoundingBox.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_BOUNDING_BOX_H_
#define _XNV_BOUNDING_BOX_H_
diff --git a/Include/XnEE/XnVCenterOfMass.h b/Include/XnEE/XnVCenterOfMass.h
index b4bd137..72e0251 100644
--- a/Include/XnEE/XnVCenterOfMass.h
+++ b/Include/XnEE/XnVCenterOfMass.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_CENTER_OF_MASS_H_
#define _XNV_CENTER_OF_MASS_H_
diff --git a/Include/XnEE/XnVClosestPointFinder.h b/Include/XnEE/XnVClosestPointFinder.h
index 1781b48..9eca0b1 100644
--- a/Include/XnEE/XnVClosestPointFinder.h
+++ b/Include/XnEE/XnVClosestPointFinder.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_CLOSEST_POINT_FINDER_H_
#define _XNV_CLOSEST_POINT_FINDER_H_
diff --git a/Include/XnEE/XnVConnectedComponentDetector.h b/Include/XnEE/XnVConnectedComponentDetector.h
index 4562a67..6543bf9 100644
--- a/Include/XnEE/XnVConnectedComponentDetector.h
+++ b/Include/XnEE/XnVConnectedComponentDetector.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_CONNECTED_COMPONENT_DETECTOR_H_
#define _XNV_CONNECTED_COMPONENT_DETECTOR_H_
diff --git a/Include/XnEE/XnVContainer.h b/Include/XnEE/XnVContainer.h
index 69ab678..98fcbe9 100644
--- a/Include/XnEE/XnVContainer.h
+++ b/Include/XnEE/XnVContainer.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_CONTAINER_H_
#define _XNV_CONTAINER_H_
diff --git a/Include/XnEE/XnVDepthMap.h b/Include/XnEE/XnVDepthMap.h
index 8be7f1c..54b2657 100644
--- a/Include/XnEE/XnVDepthMap.h
+++ b/Include/XnEE/XnVDepthMap.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_DEPTH_MAP_H_
#define _XNV_DEPTH_MAP_H_
diff --git a/Include/XnEE/XnVDepthMatrix.h b/Include/XnEE/XnVDepthMatrix.h
index b74b75a..ec00a37 100644
--- a/Include/XnEE/XnVDepthMatrix.h
+++ b/Include/XnEE/XnVDepthMatrix.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_DEPTH_MATRIX_H_
#define _XNV_DEPTH_MATRIX_H_
diff --git a/Include/XnEE/XnVDepthRepresentation.h b/Include/XnEE/XnVDepthRepresentation.h
index f404ec9..9f32b5a 100644
--- a/Include/XnEE/XnVDepthRepresentation.h
+++ b/Include/XnEE/XnVDepthRepresentation.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_DEPTH_REPRESENTATION_H_
#define _XNV_DEPTH_REPRESENTATION_H_
diff --git a/Include/XnEE/XnVDevice.h b/Include/XnEE/XnVDevice.h
index fd8cf1d..b18b333 100644
--- a/Include/XnEE/XnVDevice.h
+++ b/Include/XnEE/XnVDevice.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_DEVICE_H_
#define _XNV_DEVICE_H_
diff --git a/Include/XnEE/XnVDeviceCallbackHandler.h b/Include/XnEE/XnVDeviceCallbackHandler.h
index 459636e..b9eea92 100644
--- a/Include/XnEE/XnVDeviceCallbackHandler.h
+++ b/Include/XnEE/XnVDeviceCallbackHandler.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_DEVICE_CALLBACK_HANDLER_H_
#define _XNV_DEVICE_CALLBACK_HANDLER_H_
diff --git a/Include/XnEE/XnVDeviceRecorder.h b/Include/XnEE/XnVDeviceRecorder.h
index 1d1e6d7..6e8618e 100644
--- a/Include/XnEE/XnVDeviceRecorder.h
+++ b/Include/XnEE/XnVDeviceRecorder.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_V_DEVICE_RECORDER_H__
#define __XN_V_DEVICE_RECORDER_H__
diff --git a/Include/XnEE/XnVDownscale.h b/Include/XnEE/XnVDownscale.h
index ac1f7ac..7042ec9 100644
--- a/Include/XnEE/XnVDownscale.h
+++ b/Include/XnEE/XnVDownscale.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_DOWNSCALE_H_
#define _XNV_DOWNSCALE_H_
diff --git a/Include/XnEE/XnVEventHandlers.h b/Include/XnEE/XnVEventHandlers.h
index 760ae34..cd80eb2 100644
--- a/Include/XnEE/XnVEventHandlers.h
+++ b/Include/XnEE/XnVEventHandlers.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_V_EVENT_HANDLERS_H__
#define __XN_V_EVENT_HANDLERS_H__
diff --git a/Include/XnEE/XnVExtremes.h b/Include/XnEE/XnVExtremes.h
index b0a476a..d62acfa 100644
--- a/Include/XnEE/XnVExtremes.h
+++ b/Include/XnEE/XnVExtremes.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_EXTREMES_H_
#define _XNV_EXTREMES_H_
diff --git a/Include/XnEE/XnVGeneralStaticMap.h b/Include/XnEE/XnVGeneralStaticMap.h
index e42490b..d9a3c75 100644
--- a/Include/XnEE/XnVGeneralStaticMap.h
+++ b/Include/XnEE/XnVGeneralStaticMap.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_GENERAL_STATIC_MAP_H_
#define _XNV_GENERAL_STATIC_MAP_H_
diff --git a/Include/XnEE/XnVHand.h b/Include/XnEE/XnVHand.h
index 0343149..eb86ec4 100644
--- a/Include/XnEE/XnVHand.h
+++ b/Include/XnEE/XnVHand.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_HAND_H
#define _XNV_HAND_H
diff --git a/Include/XnEE/XnVHead.h b/Include/XnEE/XnVHead.h
index 83ec8a1..8f7f617 100644
--- a/Include/XnEE/XnVHead.h
+++ b/Include/XnEE/XnVHead.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_HEAD_H
#define _XNV_HEAD_H
diff --git a/Include/XnEE/XnVHumanStretch.h b/Include/XnEE/XnVHumanStretch.h
index a743e9a..bec70ef 100644
--- a/Include/XnEE/XnVHumanStretch.h
+++ b/Include/XnEE/XnVHumanStretch.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_HUMAN_STRETCH_H_
#define _XNV_HUMAN_STRETCH_H_
diff --git a/Include/XnEE/XnVImageMap.h b/Include/XnEE/XnVImageMap.h
index b40905c..f0f78f2 100644
--- a/Include/XnEE/XnVImageMap.h
+++ b/Include/XnEE/XnVImageMap.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_IMAGE_MAP_H_
#define _XNV_IMAGE_MAP_H_
diff --git a/Include/XnEE/XnVImageMatrix.h b/Include/XnEE/XnVImageMatrix.h
index 51357f0..c14a4be 100644
--- a/Include/XnEE/XnVImageMatrix.h
+++ b/Include/XnEE/XnVImageMatrix.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_IMAGE_MATRIX_H_
#define _XNV_IMAGE_MATRIX_H_
diff --git a/Include/XnEE/XnVInitStreamProperties.h b/Include/XnEE/XnVInitStreamProperties.h
index 63e652d..d607b1e 100644
--- a/Include/XnEE/XnVInitStreamProperties.h
+++ b/Include/XnEE/XnVInitStreamProperties.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_INIT_STREAM_PROPERTIES_H
#define _XNV_INIT_STREAM_PROPERTIES_H
diff --git a/Include/XnEE/XnVLabelMatrix.h b/Include/XnEE/XnVLabelMatrix.h
index 28e5333..dc799d6 100644
--- a/Include/XnEE/XnVLabelMatrix.h
+++ b/Include/XnEE/XnVLabelMatrix.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_LABEL_MATRIX_H_
#define _XNV_LABEL_MATRIX_H_
diff --git a/Include/XnEE/XnVLabelPruner.h b/Include/XnEE/XnVLabelPruner.h
index 53d5217..62fa484 100644
--- a/Include/XnEE/XnVLabelPruner.h
+++ b/Include/XnEE/XnVLabelPruner.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_LABEL_PRUNER_H_
#define _XNV_LABEL_PRUNER_H_
diff --git a/Include/XnEE/XnVLabeledObject.h b/Include/XnEE/XnVLabeledObject.h
index 86dbdb9..f9debfe 100644
--- a/Include/XnEE/XnVLabeledObject.h
+++ b/Include/XnEE/XnVLabeledObject.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_LABELED_OBJECT_H_
#define _XNV_LABELED_OBJECT_H_
diff --git a/Include/XnEE/XnVMathCommon.h b/Include/XnEE/XnVMathCommon.h
index 12704b3..77cdac6 100644
--- a/Include/XnEE/XnVMathCommon.h
+++ b/Include/XnEE/XnVMathCommon.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_MATH_COMMON_H_
#define _XNV_MATH_COMMON_H_
diff --git a/Include/XnEE/XnVMatrix.h b/Include/XnEE/XnVMatrix.h
index 0041fd7..055774c 100644
--- a/Include/XnEE/XnVMatrix.h
+++ b/Include/XnEE/XnVMatrix.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_MATRIX_H_
#define _XNV_MATRIX_H_
diff --git a/Include/XnEE/XnVMatrix3X3.h b/Include/XnEE/XnVMatrix3X3.h
index 1f9db0f..260a4e6 100644
--- a/Include/XnEE/XnVMatrix3X3.h
+++ b/Include/XnEE/XnVMatrix3X3.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_MATRIX3X3_H_
#define _XNV_MATRIX3X3_H_
diff --git a/Include/XnEE/XnVModule.h b/Include/XnEE/XnVModule.h
index 354fe29..93a37d4 100644
--- a/Include/XnEE/XnVModule.h
+++ b/Include/XnEE/XnVModule.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_MODULE_H_
#define _XNV_MODULE_H_
diff --git a/Include/XnEE/XnVObject.h b/Include/XnEE/XnVObject.h
index f180034..518ac19 100644
--- a/Include/XnEE/XnVObject.h
+++ b/Include/XnEE/XnVObject.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_OBJECT_H_
#define _XNV_OBJECT_H_
diff --git a/Include/XnEE/XnVPixelStreamData.h b/Include/XnEE/XnVPixelStreamData.h
index dde3e67..91dbb29 100644
--- a/Include/XnEE/XnVPixelStreamData.h
+++ b/Include/XnEE/XnVPixelStreamData.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_V_PIXEL_STREAM_DATA_H__
#define __XN_V_PIXEL_STREAM_DATA_H__
diff --git a/Include/XnEE/XnVPoint.h b/Include/XnEE/XnVPoint.h
index 9e93bf3..a2d9e63 100644
--- a/Include/XnEE/XnVPoint.h
+++ b/Include/XnEE/XnVPoint.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_POINT_H_
#define _XNV_POINT_H_
diff --git a/Include/XnEE/XnVPointContainer.h b/Include/XnEE/XnVPointContainer.h
index 471ddb0..d6ceca3 100644
--- a/Include/XnEE/XnVPointContainer.h
+++ b/Include/XnEE/XnVPointContainer.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_POINT_CONTAINER_H_
#define _XNV_POINT_CONTAINER_H_
diff --git a/Include/XnEE/XnVPropertySet.h b/Include/XnEE/XnVPropertySet.h
index cc0fb43..a888e09 100644
--- a/Include/XnEE/XnVPropertySet.h
+++ b/Include/XnEE/XnVPropertySet.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_V_PROPERTY_SET_H__
#define __XN_V_PROPERTY_SET_H__
diff --git a/Include/XnEE/XnVRealObject.h b/Include/XnEE/XnVRealObject.h
index 14b87ab..3eea457 100644
--- a/Include/XnEE/XnVRealObject.h
+++ b/Include/XnEE/XnVRealObject.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_REAL_OBJECT_H_
#define _XNV_REAL_OBJECT_H_
diff --git a/Include/XnEE/XnVRealWorldTranslator.h b/Include/XnEE/XnVRealWorldTranslator.h
index be49cf2..0016197 100644
--- a/Include/XnEE/XnVRealWorldTranslator.h
+++ b/Include/XnEE/XnVRealWorldTranslator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_REAL_WORLD_TRANSLATOR_H_
#define _XNV_REAL_WORLD_TRANSLATOR_H_
diff --git a/Include/XnEE/XnVSkeleton.h b/Include/XnEE/XnVSkeleton.h
index 246a20f..3733ba9 100644
--- a/Include/XnEE/XnVSkeleton.h
+++ b/Include/XnEE/XnVSkeleton.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef XNV_SKELETON_H
#define XNV_SKELETON_H
diff --git a/Include/XnEE/XnVSphere.h b/Include/XnEE/XnVSphere.h
index d99083b..b1feb92 100644
--- a/Include/XnEE/XnVSphere.h
+++ b/Include/XnEE/XnVSphere.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_SPHERE_H_
#define _XNV_SPHERE_H_
diff --git a/Include/XnEE/XnVStaticMap.h b/Include/XnEE/XnVStaticMap.h
index aafede5..79fb09b 100644
--- a/Include/XnEE/XnVStaticMap.h
+++ b/Include/XnEE/XnVStaticMap.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_STATIC_SHIFT_MAP_H_
#define _XNV_STATIC_SHIFT_MAP_H_
diff --git a/Include/XnEE/XnVStatus.h b/Include/XnEE/XnVStatus.h
index af8a256..4e17583 100644
--- a/Include/XnEE/XnVStatus.h
+++ b/Include/XnEE/XnVStatus.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_STATUS_H_
#define _XNV_STATUS_H_
diff --git a/Include/XnEE/XnVStream.h b/Include/XnEE/XnVStream.h
index 1dff329..6f4c0d7 100644
--- a/Include/XnEE/XnVStream.h
+++ b/Include/XnEE/XnVStream.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_STREAM_H
#define _XNV_STREAM_H
diff --git a/Include/XnEE/XnVStreamContainer.h b/Include/XnEE/XnVStreamContainer.h
index 9f7d978..bb77ab9 100644
--- a/Include/XnEE/XnVStreamContainer.h
+++ b/Include/XnEE/XnVStreamContainer.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_STREAM_CONTAINER_H_
#define _XNV_STREAM_CONTAINER_H_
diff --git a/Include/XnEE/XnVStreamData.h b/Include/XnEE/XnVStreamData.h
index 19ad626..2f547d9 100644
--- a/Include/XnEE/XnVStreamData.h
+++ b/Include/XnEE/XnVStreamData.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_V_STREAM_OUTPUT_H__
#define __XN_V_STREAM_OUTPUT_H__
diff --git a/Include/XnEE/XnVTorso.h b/Include/XnEE/XnVTorso.h
index 9f88cd4..25e71d7 100644
--- a/Include/XnEE/XnVTorso.h
+++ b/Include/XnEE/XnVTorso.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef XNV_TORSO_H
#define XNV_TORSO_H
diff --git a/Include/XnEE/XnVUpscale.h b/Include/XnEE/XnVUpscale.h
index 5e8bddf..72263ed 100644
--- a/Include/XnEE/XnVUpscale.h
+++ b/Include/XnEE/XnVUpscale.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_UPSCALE_H_
#define _XNV_UPSCALE_H_
diff --git a/Include/XnEE/XnVUserExtractor.h b/Include/XnEE/XnVUserExtractor.h
index 13ec360..dfbedb4 100644
--- a/Include/XnEE/XnVUserExtractor.h
+++ b/Include/XnEE/XnVUserExtractor.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_USER_EXTRACTOR_H_
#define _XNV_USER_EXTRACTOR_H_
diff --git a/Include/XnEE/XnVVirtualObject.h b/Include/XnEE/XnVVirtualObject.h
index a15bd05..1df3db1 100644
--- a/Include/XnEE/XnVVirtualObject.h
+++ b/Include/XnEE/XnVVirtualObject.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XNV_VIRTUAL_OBJECT_H_
#define _XNV_VIRTUAL_OBJECT_H_
diff --git a/Include/XnFormatsStatus.h b/Include/XnFormatsStatus.h
index 0b81f07..9ef8bdb 100644
--- a/Include/XnFormatsStatus.h
+++ b/Include/XnFormatsStatus.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_FORMATS_STATUS_H_
#define _XN_FORMATS_STATUS_H_
@@ -64,6 +58,7 @@ XN_STATUS_MESSAGE(XN_STATUS_IO_INVALID_STREAM_DEPTH_BUFFER_SIZE, "Invalid Xiron
XN_STATUS_MESSAGE(XN_STATUS_IO_INVALID_STREAM_IMAGE_BUFFER_SIZE, "Invalid Xiron I/O stream image buffer size!")
XN_STATUS_MESSAGE(XN_STATUS_IO_INVALID_STREAM_MISC_BUFFER_SIZE, "Invalid Xiron I/O stream misc buffer size!")
XN_STATUS_MESSAGE(XN_STATUS_IO_INVALID_STREAM_AUDIO_BUFFER_SIZE, "Invalid Xiron I/O stream audio buffer size!")
+XN_STATUS_MESSAGE(XN_STATUS_INVALID_OUTPUT_FORMAT_FOR_RESOLUTION, "Pixel format is not supported for this resolution!")
XN_PS_STATUS_MESSAGE_MAP_END(XN_ERROR_GROUP_FORMATS)
#endif //_XN_FORMATS_STATUS_H_
diff --git a/Include/XnIOFileStream.h b/Include/XnIOFileStream.h
index a448f65..68229f3 100644
--- a/Include/XnIOFileStream.h
+++ b/Include/XnIOFileStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IO_FILE_STREAM_H__
#define __XN_IO_FILE_STREAM_H__
@@ -47,8 +42,8 @@ class XN_CORE_CPP_API XnIOFileStream : public XnIOStream
virtual XnStatus Init();
virtual XnStatus Free();
- XnStatus Tell(XnUInt32* pnOffset);
- XnStatus Seek(XnUInt32 nOffset);
+ XnStatus Tell(XnUInt64* pnOffset);
+ XnStatus Seek(XnUInt64 nOffset);
private:
const XnChar* m_pcsFileName;
diff --git a/Include/XnIONetworkStream.h b/Include/XnIONetworkStream.h
index 4ba5b6f..4170314 100644
--- a/Include/XnIONetworkStream.h
+++ b/Include/XnIONetworkStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IO_NETWORK_STREAM_H__
#define __XN_IO_NETWORK_STREAM_H__
diff --git a/Include/XnIOParams.h b/Include/XnIOParams.h
index bed373f..003fa73 100644
--- a/Include/XnIOParams.h
+++ b/Include/XnIOParams.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_IO_PARAMS_H_
#define _XN_IO_PARAMS_H_
diff --git a/Include/XnIOStream.h b/Include/XnIOStream.h
index 7d1f83c..8cf8a83 100644
--- a/Include/XnIOStream.h
+++ b/Include/XnIOStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IO_STREAM_H__
#define __XN_IO_STREAM_H__
diff --git a/Include/XnPlatformBC.h b/Include/XnPlatformBC.h
index ac47afb..425fa20 100644
--- a/Include/XnPlatformBC.h
+++ b/Include/XnPlatformBC.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PS_PLATFORM_H__
#define __XN_PS_PLATFORM_H__
diff --git a/Include/XnPropertySet.h b/Include/XnPropertySet.h
index 3e783cd..a0c9d8a 100644
--- a/Include/XnPropertySet.h
+++ b/Include/XnPropertySet.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PROPERTY_SET_H__
#define __XN_PROPERTY_SET_H__
diff --git a/Include/XnPsVersion.h b/Include/XnPsVersion.h
index f2c5461..966e9ca 100644
--- a/Include/XnPsVersion.h
+++ b/Include/XnPsVersion.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_PS_VERSION_H_
#define _XN_PS_VERSION_H_
@@ -39,11 +33,11 @@
/** Xiron major version. */
#define XN_PS_MAJOR_VERSION 5
/** Xiron minor version. */
-#define XN_PS_MINOR_VERSION 0
+#define XN_PS_MINOR_VERSION 1
/** Xiron maintenance version. */
#define XN_PS_MAINTENANCE_VERSION 0
/** Xiron build version. */
-#define XN_PS_BUILD_VERSION 24
+#define XN_PS_BUILD_VERSION 25
/** Xiron version (in brief string format): "Major.Minor.Maintenance (Build)" */
#define XN_PS_BRIEF_VERSION_STRING \
diff --git a/Include/XnStream.h b/Include/XnStream.h
index 5642246..3c1a195 100644
--- a/Include/XnStream.h
+++ b/Include/XnStream.h
@@ -1,27 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_STREAM_H_
#define _XN_STREAM_H_
diff --git a/Include/XnStreamData.h b/Include/XnStreamData.h
index 89e6e66..dff99cc 100644
--- a/Include/XnStreamData.h
+++ b/Include/XnStreamData.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_OUTPUT_H__
#define __XN_STREAM_OUTPUT_H__
diff --git a/Include/XnStreamDataSet.h b/Include/XnStreamDataSet.h
index 4155ba7..18291ee 100644
--- a/Include/XnStreamDataSet.h
+++ b/Include/XnStreamDataSet.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_OUTPUT_SET_H__
#define __XN_STREAM_OUTPUT_SET_H__
diff --git a/Include/XnStreamFormats.h b/Include/XnStreamFormats.h
index 8308e91..db29fe9 100644
--- a/Include/XnStreamFormats.h
+++ b/Include/XnStreamFormats.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_FORMATS_H__
#define __XN_STREAM_FORMATS_H__
diff --git a/Include/XnStreamParams.h b/Include/XnStreamParams.h
index ac42799..9647fec 100644
--- a/Include/XnStreamParams.h
+++ b/Include/XnStreamParams.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_STREAM_PARAMS_H_
#define _XN_STREAM_PARAMS_H_
@@ -138,12 +132,19 @@
/** XnCropping */
#define XN_STREAM_PROPERTY_CROPPING "Cropping"
+/** Boolean */
+#define XN_STREAM_PROPERTY_WHITE_BALANCE_ENABLED "WhiteBalancedEnabled"
+/** Integer */
+#define XN_STREAM_PROPERTY_GAIN "Gain"
+/** Integer */
+#define XN_STREAM_PROPERTY_SUPPORT_MODES_COUNT "SupportedModesCount"
+/** General (XnCmosPreset array) */
+#define XN_STREAM_PROPERTY_SUPPORT_MODES "SupportedModes"
+
//---------------------------------------------------------------------------
// Depth Specific Properties
//---------------------------------------------------------------------------
/** Integer */
-#define XN_STREAM_PROPERTY_GAIN "Gain"
-/** Integer */
#define XN_STREAM_PROPERTY_HOLE_FILTER "HoleFilter"
/** Integer */
#define XN_STREAM_PROPERTY_MIN_DEPTH "MinDepthValue"
@@ -157,8 +158,6 @@
#define XN_STREAM_PROPERTY_REGISTRATION "Registration"
/** XnProcessingType */
#define XN_STREAM_PROPERTY_REGISTRATION_TYPE "RegistrationType"
-/** Boolean */
-#define XN_STREAM_PROPERTY_WHITE_BALANCE_ENABLED "WhiteBalancedEnabled"
/** XnDepthAGCBin* */
#define XN_STREAM_PROPERTY_AGC_BIN "AGCBin"
/** Integer */
@@ -183,6 +182,8 @@
#define XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE "ZPPS"
/** Real */
#define XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE "LDDIS"
+/** Real */
+#define XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE "DCRCDIS"
/** Boolean */
#define XN_STREAM_PROPERTY_GMC_MODE "GmcMode"
@@ -231,6 +232,28 @@
#define XN_STREAM_PROPERTY_FLICKER "Flicker"
/** Integer */
#define XN_STREAM_PROPERTY_QUALITY "Quality"
+/** Float */
+#define XN_STREAM_PROPERTY_BRIGHTNESS XN_CAPABILITY_BRIGHTNESS
+/** Float */
+#define XN_STREAM_PROPERTY_CONTRAST XN_CAPABILITY_CONTRAST
+/** Float */
+#define XN_STREAM_PROPERTY_SATURATION XN_CAPABILITY_SATURATION
+/** Float */
+#define XN_STREAM_PROPERTY_SHARPNESS XN_CAPABILITY_SHARPNESS
+/** Float */
+#define XN_STREAM_PROPERTY_COLOR_TEMPERATURE XN_CAPABILITY_COLOR_TEMPERATURE
+/** Float */
+#define XN_STREAM_PROPERTY_BACKLIGHT_COMPENSATION XN_CAPABILITY_BACKLIGHT_COMPENSATION
+/** Float */
+#define XN_STREAM_PROPERTY_ZOOM XN_CAPABILITY_ZOOM
+/** Integer (in microseconds) */
+#define XN_STREAM_PROPERTY_EXPOSURE XN_CAPABILITY_EXPOSURE
+/** Float */
+#define XN_STREAM_PROPERTY_PAN XN_CAPABILITY_PAN
+/** Float */
+#define XN_STREAM_PROPERTY_TILT XN_CAPABILITY_TILT
+/** Boolean */
+#define XN_STREAM_PROPERTY_LOW_LIGHT_COMPENSATION XN_CAPABILITY_LOW_LIGHT_COMPENSATION
//---------------------------------------------------------------------------
// Audio Specific Properties
@@ -263,6 +286,8 @@
#define XN_MODULE_PROPERTY_SDK_VERSION "SDKVersion"
/** String */
#define XN_MODULE_PROPERTY_DEVICE_NAME "DeviceName"
+/** String */
+#define XN_MODULE_PROPERTY_USB_PATH "USBPath"
/** Integer (XnSensorUsbInterface) */
#define XN_MODULE_PROPERTY_USB_INTERFACE "UsbInterface"
/** Integer */
@@ -317,6 +342,14 @@
#define XN_MODULE_PROPERTY_ERROR_STATE "ErrorState"
/** Boolean */
#define XN_MODULE_PROPERTY_ENABLE_MULTI_PROCESS "EnableMultiProcess"
+/** Boolean */
+#define XN_MODULE_PROPERTY_ENABLE_MULTI_USERS "EnableMultiUsers"
+/** String */
+#define XN_MODULE_PROPERTY_PHYSICAL_DEVICE_NAME "PhysicalDeviceName"
+/** String */
+#define XN_MODULE_PROPERTY_VENDOR_SPECIFIC_DATA "VendorSpecificData"
+/** Boolean */
+#define XN_MODULE_PROPERTY_AUDIO_SUPPORTED "AudioSupported"
//---------------------------------------------------------------------------
@@ -349,8 +382,18 @@ typedef enum XnResolutions
XN_RESOLUTION_VGA = 1, // 640x480
XN_RESOLUTION_SXGA = 2, // 1280x1024
XN_RESOLUTION_UXGA = 3, // 1600x1200
-
- XN_RESOLUTION_COUNT,
+ XN_RESOLUTION_QQVGA = 4, // 160x120
+ XN_RESOLUTION_QCIF = 5, // 176x144
+ XN_RESOLUTION_240P = 6, // 432x240
+ XN_RESOLUTION_CIF = 7, // 352x288
+ XN_RESOLUTION_WVGA = 8, // 640x360
+ XN_RESOLUTION_480P = 9, // 864x480
+ XN_RESOLUTION_800_448 = 10, // 800x448
+ XN_RESOLUTION_SVGA = 11, // 800x600
+ XN_RESOLUTION_576P = 12, // 1024x576
+ XN_RESOLUTION_DV = 13, // 960x720
+ XN_RESOLUTION_720P = 14, // 1280x720
+ XN_RESOLUTION_1280_960 = 15, // 1280x960
} XnResolutions;
typedef enum
@@ -365,6 +408,9 @@ typedef enum
XN_SENSOR_FW_VER_5_1 = 7,
XN_SENSOR_FW_VER_5_2 = 8,
XN_SENSOR_FW_VER_5_3 = 9,
+ XN_SENSOR_FW_VER_5_4 = 10,
+ XN_SENSOR_FW_VER_5_5 = 11,
+ XN_SENSOR_FW_VER_5_6 = 12,
} XnFWVer;
typedef enum
@@ -413,6 +459,7 @@ typedef enum
XN_IO_IMAGE_FORMAT_JPEG_MONO = 4,
XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422 = 5,
XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER = 6,
+ XN_IO_IMAGE_FORMAT_UNCOMPRESSED_GRAY8 = 7,
} XnIOImageFormats;
typedef enum
@@ -524,6 +571,13 @@ typedef struct XnDynamicSizeBuffer
XnUInt32 nDataSize;
} XnDynamicSizeBuffer;
+typedef struct XnCmosPreset
+{
+ XnUInt16 nFormat;
+ XnUInt16 nResolution;
+ XnUInt16 nFPS;
+} XnCmosPreset;
+
#pragma pack (pop)
diff --git a/NITE/Data/Sample-Scene.xml b/NITE/Data/Sample-Scene.xml
deleted file mode 100644
index f131fa0..0000000
--- a/NITE/Data/Sample-Scene.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/NITE/Data/Sample-Tracking.xml b/NITE/Data/Sample-Tracking.xml
deleted file mode 100644
index 59628e5..0000000
--- a/NITE/Data/Sample-Tracking.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/NITE/Data/Sample-User.xml b/NITE/Data/Sample-User.xml
deleted file mode 100644
index fad8b1d..0000000
--- a/NITE/Data/Sample-User.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OpenNI/Data/SamplesConfig.xml b/OpenNI/Data/SamplesConfig.xml
index a2b7adf..331a413 100644
--- a/OpenNI/Data/SamplesConfig.xml
+++ b/OpenNI/Data/SamplesConfig.xml
@@ -4,27 +4,33 @@
-->
-
+
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+ -->
+
+
+ "$(WIX)bin\heat.exe" dir "..\..\..\..\Redist" -cg EE_NIFiles -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION -var var.EE_NIFilesDir -out "$(ProjectDir)Fragments\FilesFragment.wxs"
+ "$(WIX)bin\setupbld.exe" -out EE_NI_setup.exe -msu "!(TargetPath)" -setup "$(ProjectDir)setup.exe" -title "EE_NI setup"
+
+
\ No newline at end of file
diff --git a/Platform/Win32/CreateRedist/EE_NI/EE_NI.wxs b/Platform/Win32/CreateRedist/EE_NI/EE_NI.wxs
new file mode 100644
index 0000000..f9460c2
--- /dev/null
+++ b/Platform/Win32/CreateRedist/EE_NI/EE_NI.wxs
@@ -0,0 +1,366 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NOT Installed
+
+
+ Not Installed
+ NOT Installed
+ NOT Installed
+ NOT Installed
+ NOT Installed
+
+
+
+ REMOVE ~= "ALL"
+ REMOVE ~= "ALL"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Platform/Win32/CreateRedist/EE_NI/Fragments/BinariesFragment.wxs b/Platform/Win32/CreateRedist/EE_NI/Fragments/BinariesFragment.wxs
new file mode 100644
index 0000000..248bbfb
--- /dev/null
+++ b/Platform/Win32/CreateRedist/EE_NI/Fragments/BinariesFragment.wxs
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi b/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi
new file mode 100644
index 0000000..d616e50
--- /dev/null
+++ b/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Platform/Win32/CreateRedist/EE_NI/Lang/en-us/Loc_en-us.wxl b/Platform/Win32/CreateRedist/EE_NI/Lang/en-us/Loc_en-us.wxl
new file mode 100644
index 0000000..639ec5d
--- /dev/null
+++ b/Platform/Win32/CreateRedist/EE_NI/Lang/en-us/Loc_en-us.wxl
@@ -0,0 +1,15 @@
+
+
+ 1033
+
+ PrimeSense Sensor KinectMod
+ for Windows
+ for Windows 64-bit
+ Sensor
+
+ PrimeSense
+ This application is is not supported on your current OS. Minimal OS supported is Windows XP SP2
+ .NET Framework 2.0 is required. Please install the .NET Framework then run this installer again.
+ A newer version of !(loc.ProductName) is already installed.
+ Choose the folder in which to install !(loc.ProductName)
+
\ No newline at end of file
diff --git a/Platform/Win32/CreateRedist/EE_NI/Resources/Header.bmp b/Platform/Win32/CreateRedist/EE_NI/Resources/Header.bmp
new file mode 100644
index 0000000..4caa2e7
Binary files /dev/null and b/Platform/Win32/CreateRedist/EE_NI/Resources/Header.bmp differ
diff --git a/Platform/Win32/CreateRedist/EE_NI/Resources/mainicon.ico b/Platform/Win32/CreateRedist/EE_NI/Resources/mainicon.ico
new file mode 100644
index 0000000..1e1d312
Binary files /dev/null and b/Platform/Win32/CreateRedist/EE_NI/Resources/mainicon.ico differ
diff --git a/Platform/Win32/CreateRedist/EE_NI/UI/CustomeInstallUI.wxs b/Platform/Win32/CreateRedist/EE_NI/UI/CustomeInstallUI.wxs
new file mode 100644
index 0000000..c3782a5
--- /dev/null
+++ b/Platform/Win32/CreateRedist/EE_NI/UI/CustomeInstallUI.wxs
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+ 1
+
+ 1
+ 1
+
+ 1
+
+ 1
+ 1
+ 1
+
+
+
+
+ NOT Installed
+
+
+
+
+
\ No newline at end of file
diff --git a/Platform/Win32/CreateRedist/EE_NI/checkVersion.vbs b/Platform/Win32/CreateRedist/EE_NI/checkVersion.vbs
new file mode 100644
index 0000000..9febe02
--- /dev/null
+++ b/Platform/Win32/CreateRedist/EE_NI/checkVersion.vbs
@@ -0,0 +1,24 @@
+Function CheckVersionNI()
+ set WSHShell = CreateObject("WScript.Shell")
+ arrMinVersion = Split("1.2.0.4", ".")
+ currOpenNiVer = Session.Property("OPENNIVERSION")
+
+ if currOpenNiVer = "" Then
+ WSHShell.PopUp("Please install OpenNI version 1.2.0.4 or higher!")
+ CheckVersionNI = 3
+ Exit Function
+ End If
+ arrCurrOpenNiVer = Split(currOpenNiVer, ".")
+
+ For index = 0 to 4
+ if CInt(arrMinVersion(index)) > CInt(arrCurrOpenNiVer(index)) Then
+ WSHShell.PopUp("Please install OpenNI version 1.2.0.4 and higher!")
+ CheckVersionNI = 3
+ Exit Function
+ ElseIf CInt(arrMinVersion(index)) < CInt(arrCurrOpenNiVer(index)) Then
+ CheckVersionNI = 0
+ Exit Function
+ End If
+ Next
+ CheckVerionNI = 0
+End Function
\ No newline at end of file
diff --git a/Platform/Win32/CreateRedist/EE_NI/setup.exe b/Platform/Win32/CreateRedist/EE_NI/setup.exe
new file mode 100644
index 0000000..a7b1b74
Binary files /dev/null and b/Platform/Win32/CreateRedist/EE_NI/setup.exe differ
diff --git a/Platform/Win32/CreateRedist/Engine.nsi b/Platform/Win32/CreateRedist/Engine.nsi
deleted file mode 100644
index 8dc6755..0000000
--- a/Platform/Win32/CreateRedist/Engine.nsi
+++ /dev/null
@@ -1,214 +0,0 @@
-;/****************************************************************************
-;* *
-;* PrimeSense Sensor 5.0 Alpha *
-;* Copyright (C) 2010 PrimeSense Ltd. *
-;* *
-;* This file is part of PrimeSense Common. *
-;* *
-;* PrimeSense Sensor is free software: you can redistribute it and/or modify*
-;* it under the terms of the GNU Lesser General Public License as published *
-;* by the Free Software Foundation, either version 3 of the License, or *
-;* (at your option) any later version. *
-;* *
-;* PrimeSense Sensor is distributed in the hope that it will be useful, *
-;* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-;* GNU Lesser General Public License for more details. *
-;* *
-;* You should have received a copy of the GNU Lesser General Public License *
-;* along with PrimeSense Sensor. If not, see .*
-;* *
-;****************************************************************************/
-;
-
-;
-
-
-;SetCompress off
-SetCompress auto
-SetCompressor ZLIB
-
-!include "MUI.nsh"
-!include "x64.nsh"
-!include "winmessages.nsh"
-!include LogicLib.nsh
-!include "FileFunc.nsh"
-;***************
-;*** General ***
-;***************
-!define EE_VER "5.0.0"
-!define EE_NAME "PrimeSensor ${EE_VER} for Windows (Kinect Mod)"
-!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
-!define OPENNI_VER "1.0.0"
-!define OPENNI_NAME "PrimeSense - OpenNI ${OPENNI_VER} for Windows"
-Var OPEN_NI_INST
-
-Name "${EE_NAME}"
-OutFile "Output\SensorKinect-Win32-${EE_VER}.exe"
-InstallDir "$PROGRAMFILES\Prime Sense\Sensor"
-
-;*******************************
-;*** face Configuration ***
-;*******************************
-!define MUI_HEADERIMAGE
-!define MUI_HEADERIMAGE_BITMAP "Header.bmp"
-!define MUI_ABORTWARNING
-
-;*************
-;*** Pages ***
-;*************
-;!insertmacro MUI_PAGE_LICENSE "License.txt" --- Not needed for now
-!insertmacro MUI_PAGE_COMPONENTS
-!insertmacro MUI_PAGE_DIRECTORY
-!insertmacro MUI_PAGE_INSTFILES
-!insertmacro MUI_UNPAGE_CONFIRM
-!insertmacro MUI_UNPAGE_INSTFILES
-
-;****************
-;*** Languages***
-;****************
-!insertmacro MUI_LANGUAGE "English"
-
-;***************
-;*** Install ***
-;***************
-
-; OpenNI Section
-Section "OpenNI"
-
- ; Section is mandatory
- SectionIn RO
-
- ClearErrors
- ReadRegStr $0 HKLM "Software\OpenNI" "Version"
- IfErrors NotInstalled
-
-
- ; Check the version
- ${If} $0 == ${OPENNI_VER}
- ; That version is already installed
- ${Else}
- ; Is installed with diferent version, install to the same directory
- ReadEnvStr $3 "OPEN_NI_INSTALL_PATH"
- ExecWait "OpenNI-Win32-${OPENNI_VER}.exe /D=$3"
- ${EndIf}
-
-
- Goto Done
-
- AddSize 121902
-
-
- NotInstalled:
- ExecWait "OpenNI-Win32-${OPENNI_VER}.exe"
-
- Done:
-
-SectionEnd
-
-
-
-; EE Section
-Section "Sensor" Sensor
-
- CreateDirectory $INSTDIR
- CreateDirectory "$INSTDIR\Bin"
- CreateDirectory "$INSTDIR\Data"
-
- ; Copy all the files from the redist dir
- File "/oname=$INSTDIR\GPL.txt" ..\redist\GPL.txt
- File "/oname=$INSTDIR\LGPL.txt" ..\redist\LGPL.txt
- File "/oname=$INSTDIR\Bin\XnCore.dll" ..\redist\Bin\XnCore.dll
- File "/oname=$INSTDIR\Bin\XnFormats.dll" ..\redist\Bin\XnFormats.dll
- File "/oname=$INSTDIR\Bin\XnDDK.dll" ..\redist\Bin\XnDDK.dll
- File "/oname=$INSTDIR\Bin\XnDeviceSensorV2.dll" ..\redist\Bin\XnDeviceSensorV2.dll
- File "/oname=$INSTDIR\Bin\XnDeviceFile.dll" ..\redist\Bin\XnDeviceFile.dll
- File "/oname=$INSTDIR\Bin\XnSensorServer.exe" ..\redist\Bin\XnSensorServer.exe
- File "/oname=$INSTDIR\Data\GlobalDefaults.ini" ..\redist\Data\GlobalDefaults.ini
-
- SetOutPath "$INSTDIR\Driver"
- File /r ..\driver\*.*
-
- SetOutPath "$INSTDIR\Tools"
- File /r ..\tools\*.*
-
- SetOutPath "$INSTDIR\SampleXMLs"
- File /r ..\..\..\NITE
- File /r ..\..\..\OPENNI
-
- ; Register it in OpenNI
- ReadRegStr $OPEN_NI_INST HKLM "Software\OpenNI" "InstallDir"
- ; Also add OPEN_NI_INSTALL_PATH to current environment (current environment is not updated by writing to registry)
- System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OPEN_NI_INSTALL_PATH", "$OPEN_NI_INST").r2'
- ExecWait '"$OPEN_NI_INST\Bin\niReg.exe" "$INSTDIR\Bin\XnDeviceFile.dll"'
- IfErrors FailedToRegister
- ExecWait '"$OPEN_NI_INST\Bin\niReg.exe" "$INSTDIR\Bin\XnDeviceSensorV2.dll" "$INSTDIR\Data"'
- IfErrors FailedToRegister
-
- ; Install the visual studio 2010 DLLs
- ExecWait '"$INSTDIR\Tools\vcredist_x86.exe" /q'
-
- ; Install the USB Driver
- ${If} ${RunningX64}
- ExecWait '"$INSTDIR\Driver\dpinst-amd64.exe" /sw /el'
- ${Else}
- ExecWait '"$INSTDIR\Driver\dpinst-x86.exe" /sw /el'
- ${EndIf}
-
- ; Create an uninstaller
- WriteUninstaller "$INSTDIR\Uninstall EE ${EE_VER}.exe"
-
- ; Register the .xns file type
- WriteRegStr HKCR ".xns" "" "PrimeSenseRecording"
- WriteRegStr HKCR "PrimeSenseRecording" "" "PrimeSense Recording File"
- WriteRegStr HKCR "PrimeSenseRecording\DefaultIcon" "" "$OPEN_NI_INST\Samples\Bin\Release\NiViewer.exe,0"
- WriteRegStr HKCR "PrimeSenseRecording\shell\open\command" "" '"$OPEN_NI_INST\Samples\Bin\Release\NiViewer.exe" "%1"'
-
- ; Add the uninstall option into the control panel add/remove
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${EE_NAME}" "DisplayName"\
- "${EE_NAME} (remove only)"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${EE_NAME}" "UninstallString" \
- "$INSTDIR\Uninstall EE ${EE_VER}.exe"
-
- WriteRegStr HKLM "Software\PrimeSense\EE" "Version" "${EE_VER}"
-
- ; Add Env Var
- WriteRegExpandStr ${env_hklm} XN_EE_INSTALL_PATH $INSTDIR
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
- Goto Done
-
- FailedToRegister:
- MessageBox MB_OK|MB_ICONSTOP "Installation Failed! Could not register module with OpenNI!"
- Abort "Installation Failed! Could not register module with OpenNI!"
-
- Done:
-
-SectionEnd
-
-
-;*****************
-;*** Uninstall ***
-;*****************
-Section "Uninstall"
- ; Unreg from OpenNI
- ReadEnvStr $0 "OPEN_NI_BIN"
- ExecWait '"$0\niReg.exe" -u "$INSTDIR\Bin\XnDeviceFile.dll"'
- ExecWait '"$0\niReg.exe" -u "$INSTDIR\Bin\XnDeviceSensorV2.dll"'
-
- ; Unregister the .xns file type
- DeleteRegKey HKCR ".xns"
- DeleteRegKey HKCR "PrimeSenseRecording"
-
- ; Delete the files
- RMDir /r /REBOOTOK $INSTDIR
- RMDir $INSTDIR
-
- ; Delete the uninstall option from the control panel add/remove
- DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${EE_NAME}"
- DeleteRegKey HKLM "Software\PrimeSense\EE"
-
- ; Remove the Env Var
- DeleteRegValue ${env_hklm} XN_EE_INSTALL_PATH
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
-SectionEnd
\ No newline at end of file
diff --git a/Platform/Win32/CreateRedist/Engine_Config.xml b/Platform/Win32/CreateRedist/Engine_Config.xml
new file mode 100644
index 0000000..8d793ce
--- /dev/null
+++ b/Platform/Win32/CreateRedist/Engine_Config.xml
@@ -0,0 +1,8 @@
+
+ EngineWin32
+ WIN32
+ 5.1.0
+ ..\..\..\
+ \Platform\Win32\Build\EngineWin32.sln
+ \Platform\Win32\Redist\Samples\Build\All_2008.sln
+
diff --git a/Platform/Win32/CreateRedist/Header.bmp b/Platform/Win32/CreateRedist/Header.bmp
deleted file mode 100644
index 026675e..0000000
Binary files a/Platform/Win32/CreateRedist/Header.bmp and /dev/null differ
diff --git a/Platform/Win32/CreateRedist/Redist.py b/Platform/Win32/CreateRedist/Redist.py
index 5e6b889..38b5ea7 100644
--- a/Platform/Win32/CreateRedist/Redist.py
+++ b/Platform/Win32/CreateRedist/Redist.py
@@ -1,24 +1,24 @@
-#/****************************************************************************
-#* *
-#* PrimeSense Sensor 5.0 Alpha *
-#* Copyright (C) 2010 PrimeSense Ltd. *
-#* *
-#* This file is part of PrimeSense Common. *
-#* *
-#* PrimeSense Sensor is free software: you can redistribute it and/or modify*
-#* it under the terms of the GNU Lesser General Public License as published *
-#* by the Free Software Foundation, either version 3 of the License, or *
-#* (at your option) any later version. *
-#* *
-#* PrimeSense Sensor is distributed in the hope that it will be useful, *
-#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-#* GNU Lesser General Public License for more details. *
-#* *
-#* You should have received a copy of the GNU Lesser General Public License *
-#* along with PrimeSense Sensor. If not, see .*
-#* *
-#****************************************************************************/
+#/***************************************************************************
+#* *
+#* PrimeSense Sensor 5.x Alpha *
+#* Copyright (C) 2011 PrimeSense Ltd. *
+#* *
+#* This file is part of PrimeSense Sensor. *
+#* *
+#* PrimeSense Sensor is free software: you can redistribute it and/or modif*
+#* it under the terms of the GNU Lesser General Public License as published*
+#* by the Free Software Foundation, either version 3 of the License, or *
+#* (at your option) any later version. *
+#* *
+#* PrimeSense Sensor is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU Lesser General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU Lesser General Public License*
+#* along with PrimeSense Sensor. If not, see *
+#* *
+#***************************************************************************/
#
#
@@ -26,12 +26,74 @@
import sys
import shutil
import win32con, pywintypes, win32api
+import re
+import subprocess
+from xml.dom.minidom import parse, parseString
+import platform
+
+def is_64_bit_platform():
+ result = False
+ import platform
+ (bits,linkage) = platform.architecture()
+ matchObject = re.search('64',bits)
+ result = matchObject is not None
+ return result
+
+is_64_bit_platform = is_64_bit_platform()
+
+
+
+#------------Check args---------------------------------------------#
+
+Make_Doxy=1
+vc_build_bits = "32"
+vc_build_type = "/Rebuild"
+VC_version = 9
+
+if len(sys.argv) in [4,5]:
+ if sys.argv[1] == 'n':
+ Make_Doxy=0
+ if sys.argv[2] == '64':
+ vc_build_bits = "64"
+ if sys.argv[3] == 'n':
+ vc_build_type = "/Build"
+ if len(sys.argv) > 4:
+ if sys.argv[4] == '10':
+ VC_version = 10
+
+CONFIG_XML = parse("Engine_Config.xml")
+SDK_VER = str(CONFIG_XML.getElementsByTagName("VERSION_NUMBER")[0].firstChild.data)
+
+output_dir__ = 'Output'+vc_build_bits
+final_dir__ = 'Final'+vc_build_bits
ROOT_DIR = os.path.abspath(os.path.dirname(sys.argv[0]))
REDIST_DIR = os.path.join(ROOT_DIR, "..", "Redist")
-OUTPUT_DIR = os.path.join(ROOT_DIR, "Output")
+OUTPUT_DIR = os.path.join(ROOT_DIR, output_dir__)
+path2final = os.path.join(ROOT_DIR,final_dir__)
SCRIPT_DIR = os.getcwd()
+print('work dir of redist.py:')
+print(SCRIPT_DIR)
+
+def finish_script(exit_code):
+ os.chdir(SCRIPT_DIR)
+ #logging.shutdown()
+ exit(exit_code)
+
+def regx_replace(findStr,repStr,filePath):
+ "replaces all findStr by repStr in file filePath using regualr expression"
+ findStrRegx = re.compile(findStr)
+ tempName=filePath+'~~~'
+ input = open(filePath)
+ output = open(tempName,'w')
+ for s in input:
+ output.write(findStrRegx.sub(repStr,s))
+ output.close()
+ input.close()
+ os.remove(filePath)
+ os.rename(tempName,filePath)
+
def get_reg_values(reg_key, value_list):
# open the reg key
try:
@@ -57,6 +119,9 @@ def get_reg_values(reg_key, value_list):
pass
return tuple(values)
+
+
+
# remove output dir
if os.path.exists(REDIST_DIR):
os.system("rmdir /S /Q \"" + REDIST_DIR + "\"")
@@ -64,27 +129,50 @@ def get_reg_values(reg_key, value_list):
os.system("rmdir /S /Q \"" + OUTPUT_DIR + "\"")
os.mkdir(REDIST_DIR)
os.mkdir(OUTPUT_DIR)
+if not os.path.exists(path2final):
+ os.makedirs(path2final)
-# build
-print("Building...")
try:
- MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\9.0")
- MSVC_VALUES = [("InstallDir", win32con.REG_SZ)]
- VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
- VS_NEED_UPGRADE = 0
+ VS_NEED_UPGRADE = 0
+ if not is_64_bit_platform:
+ MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\9.0")
+ else:
+ MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0")
+ #MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0")
+ MSVC_VALUES = [("InstallDir", win32con.REG_SZ)]
+ VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
except Exception as e:
- MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\10.0")
- MSVC_VALUES = [("InstallDir", win32con.REG_SZ)]
- VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
- VS_NEED_UPGRADE = 1
+ VC_version = 10
+
+if VC_version == 10:
+ VS_NEED_UPGRADE = 1
+ if not is_64_bit_platform:
+ MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\10.0")
+ else:
+ MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0")
+ MSVC_VALUES = [("InstallDir", win32con.REG_SZ)]
+ VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
+
+# build
+print("Building...")
os.chdir(os.path.join(ROOT_DIR, "..", "Build"))
+out_file = os.path.join('..\\CreateRedist',output_dir__,'build.log')
if VS_NEED_UPGRADE == 1:
- res = os.system("\"" + VS_INST_DIR + "devenv\" " + "Engine.sln" + " /upgrade > ..\\CreateRedist\\Output\\build.log")
- if res != 0:
- raise Exception("build failed!")
-res = os.system("\"" + VS_INST_DIR + "devenv\" " + "Engine.sln" + " /build Release > ..\\CreateRedist\\Output\\build.log")
+ #os.system("attrib -r * /s")
+ res = os.system("\"" + VS_INST_DIR + "devenv\" " + "Engine.sln" + " /upgrade > " + out_file)
+ if res != 0:
+ raise Exception("build failed!")
+build_cmd = "\"%s\" %s /Rebuild \"release|%s\" /out %s"%(os.path.join(VS_INST_DIR,'devenv'),'Engine.sln',
+ 'win32' if vc_build_bits == '32' else 'x64',out_file)
+#build_cmd = "\"%s\" %s /Rebuild \"Release|x%s\""%(os.path.join(VS_INST_DIR,'devenv.exe'),'Engine.sln',
+# '86' if vc_build_bits == '32' else '64')
+print(('building .. %s'%build_cmd))
+#res = os.system("\"" + VS_INST_DIR + "devenv\" " + "Engine.sln" + " /build Release > ..\\CreateRedist\\Output\\build.log")
+#res = os.system(build_cmd)
+res = subprocess.call(build_cmd)
+res = 0
if res != 0:
raise Exception("build failed!")
os.chdir(SCRIPT_DIR)
@@ -92,8 +180,12 @@ def get_reg_values(reg_key, value_list):
print("Copying into redist folder...")
# create folder structure
-os.mkdir(os.path.join(REDIST_DIR, "Bin"))
+os.mkdir(os.path.join(REDIST_DIR, "Bin" if vc_build_bits == "32" else "Bin64"))
os.mkdir(os.path.join(REDIST_DIR, "Data"))
+#--avin mod
+os.mkdir(os.path.join(REDIST_DIR, "Driver"))
+os.mkdir(os.path.join(REDIST_DIR, "Driver", "amd64"))
+os.mkdir(os.path.join(REDIST_DIR, "Driver", "x86"))
# copy EPL
shutil.copy(os.path.join(ROOT_DIR, "..", "..", "..", "GPL.txt"), REDIST_DIR)
@@ -102,25 +194,86 @@ def get_reg_values(reg_key, value_list):
shutil.copy(os.path.join(ROOT_DIR, "..", "..", "..", "LGPL.txt"), OUTPUT_DIR)
# copy binaries
-RELEASE_DIR = os.path.join(ROOT_DIR, "..", "Bin", "Release")
+RELEASE_DIR = os.path.join(ROOT_DIR, "..", "Bin" if vc_build_bits == "32" else "Bin64", "Release")
for file in os.listdir(RELEASE_DIR):
if os.path.splitext(file)[1] in [".dll", ".exe"]:
- shutil.copy(os.path.join(RELEASE_DIR, file), os.path.join(REDIST_DIR, "Bin"))
+ shutil.copy(os.path.join(RELEASE_DIR, file), os.path.join(REDIST_DIR, "Bin" if vc_build_bits == "32" else "Bin64"))
# copy data
DATA_DIR = os.path.join(ROOT_DIR, "..", "..", "..", "Data")
for file in os.listdir(DATA_DIR):
shutil.copy(os.path.join(DATA_DIR, file), os.path.join(REDIST_DIR, "Data"))
+
+#if vc_build_bits == '64':
+# print 'Finishing without creating the installer'
+# exit(0)
+
+#--avin mod
+# copy driver
+DRIVER_DIR = os.path.join(ROOT_DIR, "..", "Driver")
+for file in os.listdir(DRIVER_DIR):
+ try:
+ shutil.copy(os.path.join(DRIVER_DIR, file), os.path.join(REDIST_DIR, "Driver"))
+ except IOError:
+ pass
+
+DRIVER_DIRX86 = os.path.join(ROOT_DIR, "..", "Driver", "x86")
+for file in os.listdir(DRIVER_DIRX86):
+ shutil.copy(os.path.join(DRIVER_DIRX86, file), os.path.join(REDIST_DIR, "Driver", "x86"))
+
+DRIVER_DIRAMD64 = os.path.join(ROOT_DIR, "..", "Driver", "amd64")
+for file in os.listdir(DRIVER_DIRAMD64):
+ shutil.copy(os.path.join(DRIVER_DIRAMD64, file), os.path.join(REDIST_DIR, "Driver", "amd64"))
# create installer
print("Creating installer...")
-NSIS_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NSIS")
-NSIS_VALUES = [("InstallLocation", win32con.REG_EXPAND_SZ)]
-NSIS_INST_DIR = get_reg_values(NSIS_KEY, NSIS_VALUES)[0]
-# make installer
-os.chdir(ROOT_DIR)
-res = os.system("\"" + NSIS_INST_DIR + "\\makensis.exe\" " + "Engine.nsi" + " > ..\\CreateRedist\\Output\\nsis.log")
+os.chdir(SCRIPT_DIR + "\\EE_NI")
+#print "* move XnLeanDeviceSensorV2.dll"
+#os.system("move /Y " + WORK_DIR + "\\Platform\\Win32\\Bin\\XnLeanDeviceSensorV2.dll \\Platform\\Win32\\Bin\\XnDeviceSensorV2.dll")
+
+print("* Set BinaryOnlyRedist=True")
+os.system("attrib -r Includes\\EENIVariables.wxi")
+regx_replace("BinaryOnlyRedist=(.*)", "BinaryOnlyRedist=True?>", "Includes\\EENIVariables.wxi")
+
+logFilename = "BuildEngine"
+
+
+
+print("* Build EE_NI.wixproj")
+
+wix_out_file = os.path.join(SCRIPT_DIR,output_dir__, logFilename + ".txt")
+if VS_NEED_UPGRADE == 1:
+ res = subprocess.call("\""+VS_INST_DIR + "devenv\" EE_NI.sln /upgrade /out %s"%wix_out_file,close_fds=True)
+ if res != 0:
+ raise Exception("Failed upgrade installer!")
+
+
+wix_build_cmd = '"%s" %s /Build "release|%s" /out %s'%(os.path.join(VS_INST_DIR,'devenv'), 'EE_NI.wixproj' ,'x86' if vc_build_bits == '32' else 'x64',
+ wix_out_file)
+print(("wix_build_cmd=%s"%wix_build_cmd))
+res = subprocess.call(wix_build_cmd)
+#res = subprocess.call("\""+VS_INST_DIR + "devenv\" EE_NI.wixproj /build \"release|x86"\
+# +"\" /out "+SCRIPT_DIR+"\\Output\\" + logFilename + ".txt",close_fds=True)
if res != 0:
raise Exception("Failed creating installer!")
+currDir = os.getcwd()
+print(currDir)
+target_path = os.path.join(SCRIPT_DIR, final_dir__,"Sensor-Win-OpenSource" + str(vc_build_bits) + "-" + SDK_VER + ".msi")
+moveCmd = "move bin\\Release\\en-US\\EE_NI.msi %s"%target_path
+print((moveCmd + "..."))
+os.system(moveCmd)
+#print "* Move installers"
+#os.system("move .\\Output\\*.msi " + SCRIPT_DIR + "\\Output")
+
+#NSIS_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NSIS")
+#NSIS_VALUES = [("InstallLocation", win32con.REG_EXPAND_SZ)]
+#NSIS_INST_DIR = get_reg_values(NSIS_KEY, NSIS_VALUES)[0]
+# make installer
+#os.chdir(ROOT_DIR)
+#res = os.system("\"" + NSIS_INST_DIR + "\\makensis.exe\" " + "Engine.nsi" + " > ..\\CreateRedist\\Output\\nsis.log")
+#if res != 0:
+ #raise Exception("Failed creating installer!")
+
print("Done.")
+finish_script(0)
diff --git a/Platform/Win32/CreateRedist/x64.nsh b/Platform/Win32/CreateRedist/x64.nsh
deleted file mode 100644
index e694c1e..0000000
--- a/Platform/Win32/CreateRedist/x64.nsh
+++ /dev/null
@@ -1,54 +0,0 @@
-; ---------------------
-; x64.nsh
-; ---------------------
-;
-; A few simple macros to handle installations on x64 machines.
-;
-; RunningX64 checks if the installer is running on x64.
-;
-; ${If} ${RunningX64}
-; MessageBox MB_OK "running on x64"
-; ${EndIf}
-;
-; DisableX64FSRedirection disables file system redirection.
-; EnableX64FSRedirection enables file system redirection.
-;
-; SetOutPath $SYSDIR
-; ${DisableX64FSRedirection}
-; File some.dll # extracts to C:\Windows\System32
-; ${EnableX64FSRedirection}
-; File some.dll # extracts to C:\Windows\SysWOW64
-;
-
-!ifndef ___X64__NSH___
-!define ___X64__NSH___
-
-!include LogicLib.nsh
-
-!macro _RunningX64 _a _b _t _f
- !insertmacro _LOGICLIB_TEMP
- System::Call kernel32::GetCurrentProcess()i.s
- System::Call kernel32::IsWow64Process(is,*i.s)
- Pop $_LOGICLIB_TEMP
- !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
-!macroend
-
-!define RunningX64 `"" RunningX64 ""`
-
-!macro DisableX64FSRedirection
-
- System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
-
-!macroend
-
-!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
-
-!macro EnableX64FSRedirection
-
- System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
-
-!macroend
-
-!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
-
-!endif # !___X64__NSH___
diff --git a/Platform/Win32/Driver/amd64/psdrv3.sys b/Platform/Win32/Driver/amd64/psdrv3.sys
index ab90ecb..5a81639 100644
Binary files a/Platform/Win32/Driver/amd64/psdrv3.sys and b/Platform/Win32/Driver/amd64/psdrv3.sys differ
diff --git a/Platform/Win32/Driver/dpinst-amd64.exe b/Platform/Win32/Driver/dpinst-amd64.exe
index 0507e73..0096441 100644
Binary files a/Platform/Win32/Driver/dpinst-amd64.exe and b/Platform/Win32/Driver/dpinst-amd64.exe differ
diff --git a/Platform/Win32/Driver/dpinst-x86.exe b/Platform/Win32/Driver/dpinst-x86.exe
index 41a890d..410a135 100644
Binary files a/Platform/Win32/Driver/dpinst-x86.exe and b/Platform/Win32/Driver/dpinst-x86.exe differ
diff --git a/Platform/Win32/Driver/dpinst.xml b/Platform/Win32/Driver/dpinst.xml
index d50f5a6..cc0ff24 100644
--- a/Platform/Win32/Driver/dpinst.xml
+++ b/Platform/Win32/Driver/dpinst.xml
@@ -3,14 +3,14 @@
- PrimeSensor Device Driver Installer
+ PrimeSense Sensor Device Driver Installer
- Welcome to the PrimeSensor Device Driver Installer!
- This wizard will walk you through updating the drivers for your PrimeSensor device.
+ Welcome to the PrimeSense Sensor Device Driver Installer!
+ This wizard will walk you through updating the drivers for your PrimeSense Sensor device.
- Installing the software for your PrimeSensor device...
+ Installing the software for your PrimeSense Sensor device...
- Congratulations! You have finished installing your PrimeSensor device drivers!
+ Congratulations! You have finished installing your PrimeSense Sensor device drivers!
psdrv3.ico
diff --git a/Platform/Win32/Driver/psdrv3.cat b/Platform/Win32/Driver/psdrv3.cat
index 225a0b1..05ed698 100644
Binary files a/Platform/Win32/Driver/psdrv3.cat and b/Platform/Win32/Driver/psdrv3.cat differ
diff --git a/Platform/Win32/Driver/psdrv3.inf b/Platform/Win32/Driver/psdrv3.inf
index d9d3665..4e57fbb 100644
--- a/Platform/Win32/Driver/psdrv3.inf
+++ b/Platform/Win32/Driver/psdrv3.inf
@@ -1,6 +1,6 @@
;/****************************************************************************
;* *
-;* PrimeSensor Device Driver v3.x INF *
+;* PrimeSense Sensor Device Driver v3.x INF *
;* *
;* Author: Ziv Hendel *
;* *
@@ -19,18 +19,18 @@
[Version]
Signature="$WINDOWS NT$"
-Class=PrimeSensor
-ClassGuid={dce97d75-aef7-1980-1909-531357633001}
+Class=PrimeSense
+ClassGuid={dce97d75-aef7-1980-1909-531357633222}
Provider=%PS%
-DriverVer=07/13/2010,3.1.0.4
+DriverVer=02/16/2011,3.1.2.0
CatalogFile=psdrv3.cat
; ================= Class section =====================
[ClassInstall32]
-Addreg=PrimeSensorClassReg
+Addreg=PrimeSenseClassReg
-[PrimeSensorClassReg]
+[PrimeSenseClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,"-20"
@@ -53,8 +53,14 @@ DefaultDestDir = 12 ; Driver Dir
%USB\VID_1D27&PID_0500.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0500
%USB\VID_1D27&PID_0600.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0600&MI_00
%USB\VID_1D27&PID_0600.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0600
+%USB\VID_1D27&PID_2100.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_2100&MI_00
+%USB\VID_1D27&PID_2100.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_2100
+%USB\VID_1D27&PID_F9DB.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_F9DB&MI_00
+%USB\VID_1D27&PID_F9DB.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_F9DB
%USB\VID_045E&PID_02B0.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02B0&MI_00
%USB\VID_045E&PID_02B0.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02B0
+%USB\VID_045E&PID_02AD.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AD&MI_00
+%USB\VID_045E&PID_02AD.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AD
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE&MI_00
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE
@@ -69,8 +75,14 @@ DefaultDestDir = 12 ; Driver Dir
%USB\VID_1D27&PID_0500.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0500
%USB\VID_1D27&PID_0600.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0600&MI_00
%USB\VID_1D27&PID_0600.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_0600
+%USB\VID_1D27&PID_2100.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_2100&MI_00
+%USB\VID_1D27&PID_2100.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_2100
+%USB\VID_1D27&PID_F9DB.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_F9DB&MI_00
+%USB\VID_1D27&PID_F9DB.DeviceDesc%=psdrv3.Dev, USB\VID_1D27&PID_F9DB
%USB\VID_045E&PID_02B0.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02B0&MI_00
%USB\VID_045E&PID_02B0.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02B0
+%USB\VID_045E&PID_02AD.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AD&MI_00
+%USB\VID_045E&PID_02AD.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AD
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE&MI_00
%USB\VID_045E&PID_02AE.DeviceDesc%=psdrv3.Dev, USB\VID_045E&PID_02AE
@@ -141,13 +153,16 @@ KmdfLibraryVersion = 1.9
[Strings]
PS = "PrimeSense"
MfgName = "PrimeSense Ltd."
-Disk_Description= "PrimeSensor Device Driver Installation Disk v3.x"
-psdrv3.SvcDesc = "PrimeSensor Device Driver Service v3.x"
-ClassName = "PrimeSensor"
-USB\VID_1D27&PID_0200.DeviceDesc="PrimeSensor Development Kit 2.x"
-USB\VID_1D27&PID_0300.DeviceDesc="PrimeSensor Development Kit 3.x"
-USB\VID_1D27&PID_0400.DeviceDesc="PrimeSensor Development Kit 4.x"
-USB\VID_1D27&PID_0500.DeviceDesc="PrimeSensor Development Kit 5.x"
-USB\VID_1D27&PID_0600.DeviceDesc="PrimeSensor Reference Design 1.08x"
+Disk_Description= "PrimeSense Sensor Device Driver Installation Disk v3.x"
+psdrv3.SvcDesc = "PrimeSense Sensor Device Driver Service v3.x"
+ClassName = "PrimeSense"
+USB\VID_1D27&PID_0200.DeviceDesc="PrimeSense Sensor Development Kit 2.x"
+USB\VID_1D27&PID_0300.DeviceDesc="PrimeSense Sensor Development Kit 3.x"
+USB\VID_1D27&PID_0400.DeviceDesc="PrimeSense Sensor Development Kit 4.x"
+USB\VID_1D27&PID_0500.DeviceDesc="PrimeSense Sensor Development Kit 5.x"
+USB\VID_1D27&PID_0600.DeviceDesc="PrimeSense PS1080"
+USB\VID_1D27&PID_2100.DeviceDesc="PrimeSense Sensor Development Kit NG"
+USB\VID_1D27&PID_F9DB.DeviceDesc="PrimeSense Sensor Development Kit NG Debug"
USB\VID_045E&PID_02B0.DeviceDesc="Kinect Motor"
+USB\VID_045E&PID_02AD.DeviceDesc="Kinect Audio"
USB\VID_045E&PID_02AE.DeviceDesc="Kinect Camera"
\ No newline at end of file
diff --git a/Platform/Win32/Driver/x86/psdrv3.sys b/Platform/Win32/Driver/x86/psdrv3.sys
index 086bf87..95b2dc5 100644
Binary files a/Platform/Win32/Driver/x86/psdrv3.sys and b/Platform/Win32/Driver/x86/psdrv3.sys differ
diff --git a/Platform/Win32/Tools/vcredist_x86.exe b/Platform/Win32/Tools/vcredist_x86.exe
deleted file mode 100644
index 57e15c0..0000000
Binary files a/Platform/Win32/Tools/vcredist_x86.exe and /dev/null differ
diff --git a/README b/README
index 1725f1a..5f7e496 100644
--- a/README
+++ b/README
@@ -1,10 +1,40 @@
-SensorKinect Module for OpenNI
-------------------------------
+PrimeSense Sensor Module for OpenNI (Version 5.1.0.25 version - Dec 18th 2011)
+------------------------------------------------------------------------------
Kinect Mod:
-----------
+***** Important notice: *****
+You must use this kinect mod version with the unstable OpenNI release which is available at:
+http://www.openni.org/Downloads/OpenNIModules.aspx
+
Changes:
+v0.91:
+ 1) Removed an unnecessary USB set interface command that caused timeout problems on Linux & Mac.
+
+v0.9:
+ 1) Updated codebase to the latest OpenNI / Sensor version (1.5.2.7 / 5.1.0.25)
+ 2) Changed the Bayer-to-RGB function to use the ROS (www.ros.org) code as requested by many community members.
+ (Thanks to Suat Gedikli from Willow Garage for writing the code and to Raphael Dumusc for the OpenNI adaptation!)
+
+v0.8:
+ 1) Updated codebase to the latest OpenNI / Sensor version (1.4.0.2 / 5.0.5.1)
+
+v0.7:
+ 1) Updated codebase to the latest OpenNI / Sensor version (1.3.2.3 / 5.0.3.34)
+ 2) Added a 64-bit binary installer for Windows.
+
+v0.6:
+ 1) Updated codebase to the latest OpenNI / Sensor version (1.3.2.1 / 5.0.3.33)
+
+v0.5:
+ 1) Updated codebase to the latest OpenNI / Sensor version (1.1.0.39 / 5.0.1.32)
+ 2) Changed to install directory from Sensor to SensorKinect to co-exist with the original PrimeSense Sensor module.
+
+v0.4:
+ 1) Merged code with the new unstable sensor driver from PrimeSense that adds MacOSX and multiple sensor support.
+ 2) Added precompiled binaries for Linux & MacOSX.
+
v0.3:
1) Added support for high-res 1280x1024 IR and Image (at ~10 FPS)
Checkout the file OPENNI\Data\SamplesConfig.xml for usage example.
@@ -21,21 +51,53 @@ v0.1:
3) Changed the image format from YUV to 8-bit uncompressed bayer in the GlobalDefaults.ini file.
4) Fixed the software depth-to-RGB registration. (Thanks ROS.org for that!)
-PrimeSense NITE algorithm:
- If you want to try it please do the following:
-
- 1) Install OpenNI (from www.openni.org)
+Install notes:
+ 1) Install unstable OpenNI (http://www.openni.org/Downloads/OpenNIModules.aspx)
+ On Linux/Mac please do: ./sudo install.sh
2) Install Sensor (this version...)
- 3) Install NITE (from www.openni.org)
- 4) Run the NiViewer sample to make sure depth & image streams are working.
- 5) Run the OpenNI/NiUserTracker sample play with the skeleton. Don't forget to start with the calibration pose! (Explained in the PDFs)
- 6) Try the NITE/Sample-PointViewer sample for the hand tracking demo.
-
- Note: All of the NITE samples are using 320x240 resolution. You need to change it to 640x480 in the XML files inside the Data directory.
- I have prepared preconfigured XMLs in the "NITE\Data" dir. Just copy them to "c:\Program Files\Prime Sense\NITE\Data".
+ On Linux/Mac please do: ./sudo install.sh
+ 3) Install unstable NITE (http://www.openni.org/downloadfiles/opennimodules/openni-compliant-middleware-binaries/33-latest-unstable)
+ On Linux/Mac please do: ./sudo install.sh
+ 4) Test #1: Run the NiViewer sample to make sure depth & image streams are working.
+ 5) Test #2: Run the OpenNI/NiUserTracker sample play with the skeleton.
+ 6) Test #3: Try the NITE/Sample-PointViewer sample for the hand tracking demo.
+ For Mac/Linux, you will need to install the latest LibUSB.
+ Linux:
+ 1) Run: sudo apt-get install libusb-1.0-0-dev
+ 2) Run: sudo apt-get install freeglut3-dev
+ MaxOSX:
+ 1) Install MacPorts from: http://distfiles.macports.org/MacPorts/MacPorts-1.9.2-10.6-SnowLeopard.dmg
+ 2) Run: sudo port install libtool
+ 3) Run: sudo port install libusb-devel +universal
+ Note: Do not forget the +universal, it's very important!!
+ If you're previously already installed libusb-devel then use "sudo port uninstall libusb-devel" and reinstall it again with the +universal flag.
TIPs:
- 1) If you want to see the IR stream, edit the "OpenNI\Data\SamplesConfig.xml" file and change all the "Image" words into "IR".
+ 1) If the driver is installed correctly you should see "Kinect Camera" and "Kinect Motor" under the "PrimeSensor" category in the device manager.
+ If not, try to install the driver manually by running the dp-inst files from the Driver directory.
+
+Todo:
+ 1) Add motor & led control.
+ 2) Add audio.
+
+The source code for this version is available at:
+https://github.com/avin2/SensorKinect
+
+-------------------------- ORIGINAL README BELOW --------------------------
+
+Website: http://www.primesense.com
+Forum: http://groups.google.com/group/openni-dev
+Wiki: http://wiki.openni.org
+
+Binaries are available at:
+http://www.openni.org/Downloads/OpenNIModules.aspx
+(The "OpenNI Compliant Hardware Binaries" section)
+
+Sources are available at:
+https://github.com/PrimeSense/Sensor
+or
+https://github.com/PrimeSense/Sensor/tree/unstable
+for the unstable branch
Release Notes:
--------------
@@ -44,55 +106,127 @@ Release Notes:
(A good hint for this error is that you encounter an "illegal instructions" messages)
* By default, the linux kernel mounts unknown USB devices with write permissions to root only, and read-only permissions to other users.
When not running as root, this prevents communicating with the device. To fix this issue:
- - Navigate to Platform/Linux-x86/Build
+ - Navigate to Platform/Linux/Build
- run 'make install-usb-rules'
- if the device was connected, unplug and reconnect it.
This part is done automatically by the install script, but you will need to do it manually if you choose not to use the automated install.
-* The device driver contains a thread for reading from the USB device. This thread should have high priority in order to function correctly. Each process using the device driver should have the CAP_SYS_NICE capability in order to raise thread priority. Failing to have that capability, will cause a failure in setting priority, consequently causing loss of data.
+* Linux: The device driver contains a thread for reading from the USB device. This thread should have high priority in order to function correctly. Each process using the device driver should have the CAP_SYS_NICE capability in order to raise thread priority. Failing to have that capability, will cause a failure in setting priority, consequently causing loss of data.
+* MacOSX: Only OSX 10.6 (Snow Leopard) and above with a 64-bit Intel based CPU is currently supported.
+ Client/Server is not supported yet so do not attempt to access the sensor with more then one application.
+
Build Notes:
------------
Windows:
Requirements:
1) Microsoft Visual Studio 2008/2010
- 2) Python 2.x/3.x (must be at least 2.6 and above)
- 3) PyWin32
- 4) NSIS 2.46
- 5) NSIS-2.46-strlen_8192.zip patch (An important patch to fix problems with adding strings to the path. you can find it in the Platform\Win32\Build\Prerequisites\ directory)
- 6) Doxygen & GraphViz (to create docs...)
- 7) OpenNI 1.x
-
+ From: http://msdn.microsoft.com/en-us/vstudio/bb984878.aspx
+ 2) Python 2.6+/3.x
+ From: http://www.python.org/download/
+ 3) PyWin32
+ From: http://sourceforge.net/projects/pywin32/files/pywin32/
+ Please make sure you download the version that matches your exact python version.
+ 4) WIX 3.5
+ From: http://wix.codeplex.com/releases/view/60102
+ 5) OpenNI 1.3.x.x
+ From: http://www.openni.org/Downloads/OpenNIModules.aspx
+
+ Optional Requirements (To build the documentation):
+ 1) Doxygen
+ From: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc
+ 2) GraphViz
+ From: http://www.graphviz.org/Download_windows.php
+
Building Sensor:
- 1) Go into the directory: "Platform\Win32\CreateRedist". Run the script: "Redist.py". This will compile and prepare the redist exe files that includes everything.
- 2) Install the exe you've just made which is located in Platform\Win32\CreateRedist\Output\Sensor-Win32-5.0.0.exe
+ 1) Go to the directory: "Platform\Win32\CreateRedist".
+ Run the script: "Redist.py".
+ This will compile and prepare the redist exe files that includes everything.
+ 2) Install the exe you've just made which is located in Platform\Win32\CreateRedist\FinalXX\Sensor-Win32-5.x.x.x.exe
+ (XX being the number of bits: 32 or 64)
The installer will also automatically register all the modules into OpenNI via the NiReg utility.
The visual studio solution is located in: Platform\Win32\Build\EngineWin32.sln.
- Important: Please note that even though the directory is called Win32, you can also use it to compile it for 64-bit targets (AMD64/x64).
-
+ Important: Please note that even though the directory is called Win32, you can also use it to compile it for 64-bit targets (AMD64/x64).
+
Linux:
Requirements:
1) GCC 4.x
- 2) Python 2.6/2.7/3.0/3.1
- 3) libusb 1.0.8 (libusb-1.0-0-dev)
- 4) freeglut3 (freeglut3-dev)
- 5) Doxygen & GraphViz (to create docs...)
- 6) OpenNI 1.x
-
+ From: http://gcc.gnu.org/releases.html
+ Or via apt:
+ sudo apt-get install g++
+ 2) Python 2.6+/3.x
+ From: http://www.python.org/download/
+ Or via apt:
+ sudo apt-get install python
+ 3) OpenNI 1.3.x.x
+ From: http://www.openni.org/Downloads/OpenNIModules.aspx
+
Building Sensor:
- 1) Go into the directory: "Platform/Linux-x86/CreateRedist". Run the script: "RedistMaker". This will compile everything and create a redist package in the "Platform/Linux-x86/Redist" directory.
- 2) Go into the directory: "Platform/Linux-x86/Redist". Run the script: "sudo ./install.sh" (needs to run as root)
+ 1) Go into the directory: "Platform/Linux/CreateRedist".
+ Run the script: "./RedistMaker".
+ This will compile everything and create a redist package in the "Platform/Linux/Redist" directory.
+ It will also create a distribution in the "Platform/Linux/CreateRedist/Final" directory.
+ 2) Go into the directory: "Platform/Linux/Redist".
+ Run the script: "sudo ./install.sh" (needs to run as root)
+
+ The install script copies key files to the following location:
+ Libs into: /usr/lib
+ Bins into: /usr/bin
+ Config files into: /usr/etc/primesense
+ USB rules into: /etc/udev/rules.d
+ Logs will be created in: /var/log/primesense
+
+ To build the package manually, you can run "make" in the "Platform\Linux\Build" directory.
- The install script copies key files to the following location:
- Libs into: /usr/lib
- Bins into: /usr/bin
- Config files: /usr/etc/primesense
- USB rules: /etc/udev/rules.d
- Logs will be created in: /var/log/primesense
+ Important: Please note that even though the directory is called Linux, you can also use it to compile it for 64-bit targets and pretty much any other linux based environment.
+
+ Building Sensor using a cross-compiler:
+ 1) Make sure to define two environment variables:
+ - _CXX - the name of the cross g++ for platform
+ - _STAGING - a path to the staging dir (a directory which simulates the target root filesystem).
+ Note that should be upper cased.
+ For example, if wanting to compile for ARM from a x86 machine, ARM_CXX and ARM_STAGING should be defined.
+ 2) Go into the directory: "Platform/Linux/CreateRedist".
+ Run: "./RedistMaker " (for example: "./RedistMake Arm").
+ This will compile everything and create a redist package in the "Platform/Linux/Redist" directory.
+ It will also create a distribution in the "Platform/Linux/CreateRedist/Final" directory.
+ 3) To install OpenNI files on the target file system:
+ Go into the directory: "Platform/Linux/Redist".
+ Run the script: "./install.sh -c $_STAGING" (for example: "./install.sh -c $ARM_STAGING").
+
+ The install script copies key files to the following location:
+ Libs into: STAGING/usr/lib
+ Bins into: STAGING/usr/bin
+ Config files into: STAGING/usr/etc/primesense
+ USB rules into: STAGING/etc/udev/rules.d
+ Logs will be created in: STAGING/var/log/primesense
- To build the package manually, you can run make in the "Platform\Linux-x86\Build" directory.
- (You can also find a SlickEdit project there...)
+ To build the package manually, you can run "make PLATFORM=" in the "Platform\Linux\Build" directory.
+ If you wish to build the Mono wrappers, also run "make PLATFORM= mono_wrapper" and "make PLATFORM= mono_samples".
- Important: Please note that even though the directory is called Linux-x86, you can also use it to compile it for 64-bit targets and pretty much any other linux based environment.
-
\ No newline at end of file
+MacOSX:
+ Requirements:
+ 1) Xcode 3.2.6
+ From: http://developer.apple.com/devcenter/mac/index.action
+ http://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg
+ Please note that you need to register as a mac developer (It's free!).
+ 2) OpenNI 1.3.x.x
+ From: http://www.openni.org/Downloads/OpenNIModules.aspx
+
+ Building Sensor:
+ 1) Go into the directory: "Platform/Linux/CreateRedist".
+ Run the script: "./RedistMaker".
+ This will compile everything and create a redist package in the "Platform/Linux/Redist" directory.
+ It will also create a distribution in the "Platform/Linux/CreateRedist/Final" directory.
+ 2) Go into the directory: "Platform/Linux/Redist".
+ Run the script: "sudo ./install.sh" (needs to run as root)
+
+ The install script copies key files to the following location:
+ Libs into: /usr/lib
+ Bins into: /usr/bin
+ Config files into: /usr/etc/primesense
+ USB rules into: /etc/udev/rules.d
+ Logs will be created in: /var/log/primesense
+
+ To build the package manually, you can run "make" in the "Platform\Linux\Build" directory.
diff --git a/Source/External/LibJPEG/jconfig.h b/Source/External/LibJPEG/jconfig.h
index fbc67c3..56860d8 100644
--- a/Source/External/LibJPEG/jconfig.h
+++ b/Source/External/LibJPEG/jconfig.h
@@ -4,10 +4,9 @@
#elif SN_TARGET_PS3
#include "jconfig.ps3"
#include
-#elif (linux && i386)
+#elif ((linux) || (__APPLE__))
#include "jconfig.lnx86"
#include
#else
- #include "jconfig.lnx86"
- #include
+ #error "LibJPEG: Unsupported Platform!"
#endif
diff --git a/Source/Utils/XnSensorServer/SensorServer.cpp b/Source/Utils/XnSensorServer/SensorServer.cpp
index d81e64d..affc7a3 100644
--- a/Source/Utils/XnSensorServer/SensorServer.cpp
+++ b/Source/Utils/XnSensorServer/SensorServer.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -62,13 +56,13 @@ int main(int argc, char* argv[])
nRetVal = XnSensorServerGetGlobalConfigFile(strConfigDir, strConfigFile, XN_FILE_MAX_PATH);
XN_CHECK_RC(nRetVal, "Resolving global config file");
- nRetVal = XnFormatsInitFromINIFile(strConfigFile);
- XN_CHECK_RC(nRetVal, "Initializing DDK");
-
-#if (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
+#if (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_MACOSX)
xnLogSetOutputFolder("/var/log/primesense/XnSensorServer/");
#endif
+ nRetVal = XnFormatsInitFromINIFile(strConfigFile);
+ XN_CHECK_RC(nRetVal, "Initializing DDK");
+
printf("Running...\n");
nRetVal = XnSensorServerRun(strConfigFile);
XN_CHECK_RC(nRetVal, "starting sensor server");
diff --git a/Source/XnCommon/XnCommon.h b/Source/XnCommon/XnCommon.h
index ef5b9ee..3789ad4 100644
--- a/Source/XnCommon/XnCommon.h
+++ b/Source/XnCommon/XnCommon.h
@@ -21,10 +21,6 @@
*****************************************************************************/
-
-
-
-
#ifndef __XN_COMMON_H__
#define __XN_COMMON_H__
@@ -59,4 +55,4 @@ typedef enum XnPrimeSenseErrorModules
#define XN_PS_STATUS_MESSAGE_MAP_END(module) \
XN_STATUS_MESSAGE_MAP_END_FROM(XN_ERROR_GROUP_PRIMESENSE, module)
-#endif // __XN_COMMON_H__
\ No newline at end of file
+#endif // __XN_COMMON_H__
diff --git a/Source/XnCore/XnBuffer.cpp b/Source/XnCore/XnBuffer.cpp
index 5119aa3..57330ae 100644
--- a/Source/XnCore/XnBuffer.cpp
+++ b/Source/XnCore/XnBuffer.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnCore/XnBuffer.h b/Source/XnCore/XnBuffer.h
index 3b32ec7..a021109 100644
--- a/Source/XnCore/XnBuffer.h
+++ b/Source/XnCore/XnBuffer.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_BUFFER_H__
#define __XN_BUFFER_H__
diff --git a/Source/XnCore/XnCore.cpp b/Source/XnCore/XnCore.cpp
index 2462419..da5e49d 100644
--- a/Source/XnCore/XnCore.cpp
+++ b/Source/XnCore/XnCore.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnCore/XnCoreGlobals.h b/Source/XnCore/XnCoreGlobals.h
index d0a8198..df2de09 100644
--- a/Source/XnCore/XnCoreGlobals.h
+++ b/Source/XnCore/XnCoreGlobals.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_COREGLOBALS_H_
#define _XN_COREGLOBALS_H_
diff --git a/Source/XnCore/XnCoreStatus.cpp b/Source/XnCore/XnCoreStatus.cpp
index 40ea4e5..dcfcbd3 100644
--- a/Source/XnCore/XnCoreStatus.cpp
+++ b/Source/XnCore/XnCoreStatus.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnCore/XnIOFileStream.cpp b/Source/XnCore/XnIOFileStream.cpp
index 4c11580..f4272b2 100644
--- a/Source/XnCore/XnIOFileStream.cpp
+++ b/Source/XnCore/XnIOFileStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -74,12 +68,12 @@ XnStatus XnIOFileStream::ReadData(XnUChar *pData, XnUInt32 nDataSize)
return (XN_STATUS_OK);
}
-XnStatus XnIOFileStream::Tell(XnUInt32* pnOffset)
+XnStatus XnIOFileStream::Tell(XnUInt64* pnOffset)
{
- return xnOSTellFile(m_hFile, pnOffset);
+ return xnOSTellFile64(m_hFile, pnOffset);
}
-XnStatus XnIOFileStream::Seek(XnUInt32 nOffset)
+XnStatus XnIOFileStream::Seek(XnUInt64 nOffset)
{
- return xnOSSeekFile(m_hFile, XN_OS_SEEK_SET, nOffset);
+ return xnOSSeekFile64(m_hFile, XN_OS_SEEK_SET, nOffset);
}
diff --git a/Source/XnCore/XnIONetworkStream.cpp b/Source/XnCore/XnIONetworkStream.cpp
index b154043..7db02b2 100644
--- a/Source/XnCore/XnIONetworkStream.cpp
+++ b/Source/XnCore/XnIONetworkStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnCore/XnVersion.cpp b/Source/XnCore/XnVersion.cpp
index 8df08aa..069b9db 100644
--- a/Source/XnCore/XnVersion.cpp
+++ b/Source/XnCore/XnVersion.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/IXnDevice.h b/Source/XnDDK/IXnDevice.h
index 5cc4308..073dcdf 100644
--- a/Source/XnDDK/IXnDevice.h
+++ b/Source/XnDDK/IXnDevice.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __IXN_DEVICE_BASE_H__
#define __IXN_DEVICE_BASE_H__
diff --git a/Source/XnDDK/XnActualGeneralProperty.cpp b/Source/XnDDK/XnActualGeneralProperty.cpp
index cd9c398..ad853ec 100644
--- a/Source/XnDDK/XnActualGeneralProperty.cpp
+++ b/Source/XnDDK/XnActualGeneralProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -65,12 +59,12 @@ void XnActualGeneralProperty::SetAsBufferOwner(XnBool bOwner)
m_bOwner = bOwner;
}
-XnStatus XnActualGeneralProperty::SetCallback(XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XnActualGeneralProperty::SetCallback(XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* /*pCookie*/)
{
return pSender->UnsafeUpdateValue(gbValue);
}
-XnStatus XnActualGeneralProperty::GetCallback(const XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XnActualGeneralProperty::GetCallback(const XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* /*pCookie*/)
{
if (gbValue.nDataSize != pSender->GetValue().nDataSize)
{
diff --git a/Source/XnDDK/XnActualGeneralProperty.h b/Source/XnDDK/XnActualGeneralProperty.h
index 1c9f5ab..9b5d105 100644
--- a/Source/XnDDK/XnActualGeneralProperty.h
+++ b/Source/XnDDK/XnActualGeneralProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_ACTUAL_GENERAL_PROPERTY_H__
#define __XN_ACTUAL_GENERAL_PROPERTY_H__
diff --git a/Source/XnDDK/XnActualIntProperty.cpp b/Source/XnDDK/XnActualIntProperty.cpp
index d9b26c2..46579d2 100644
--- a/Source/XnDDK/XnActualIntProperty.cpp
+++ b/Source/XnDDK/XnActualIntProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -41,12 +35,12 @@ XnActualIntProperty::XnActualIntProperty(const XnChar* strName, XnUInt64 nInitia
UpdateGetCallback(GetCallback, this);
}
-XnStatus XN_CALLBACK_TYPE XnActualIntProperty::SetCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnActualIntProperty::SetCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* /*pCookie*/)
{
return pSender->UnsafeUpdateValue(nValue);
}
-XnStatus XN_CALLBACK_TYPE XnActualIntProperty::GetCallback(const XnActualIntProperty* pSender, XnUInt64* pnValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnActualIntProperty::GetCallback(const XnActualIntProperty* pSender, XnUInt64* pnValue, void* /*pCookie*/)
{
*pnValue = pSender->GetValue();
return XN_STATUS_OK;
diff --git a/Source/XnDDK/XnActualIntProperty.h b/Source/XnDDK/XnActualIntProperty.h
index dc90168..223d84e 100644
--- a/Source/XnDDK/XnActualIntProperty.h
+++ b/Source/XnDDK/XnActualIntProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_ACTUAL_INT_PROPERTY_H__
#define __XN_ACTUAL_INT_PROPERTY_H__
diff --git a/Source/XnDDK/XnActualPropertiesHash.cpp b/Source/XnDDK/XnActualPropertiesHash.cpp
index fcd0b1c..f0e4e64 100644
--- a/Source/XnDDK/XnActualPropertiesHash.cpp
+++ b/Source/XnDDK/XnActualPropertiesHash.cpp
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#include "XnActualPropertiesHash.h"
#include "XnActualIntProperty.h"
diff --git a/Source/XnDDK/XnActualPropertiesHash.h b/Source/XnDDK/XnActualPropertiesHash.h
index 8d30852..0061dac 100644
--- a/Source/XnDDK/XnActualPropertiesHash.h
+++ b/Source/XnDDK/XnActualPropertiesHash.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_ACTUAL_PROPERTIES_HASH_H__
#define __XN_ACTUAL_PROPERTIES_HASH_H__
diff --git a/Source/XnDDK/XnActualPropertyFactory.cpp b/Source/XnDDK/XnActualPropertyFactory.cpp
index 5b41f9f..1ffe1d2 100644
--- a/Source/XnDDK/XnActualPropertyFactory.cpp
+++ b/Source/XnDDK/XnActualPropertyFactory.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -40,8 +34,7 @@
//---------------------------------------------------------------------------
XnStatus XnActualPropertyFactory::CreateProperty(XnPropertyType nType, const XnChar* strName, XnProperty** ppProperty, XnUInt32 nSize /* = 0 */)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
+
switch (nType)
{
case XN_PROPERTY_TYPE_INTEGER:
@@ -67,8 +60,6 @@ XnStatus XnActualPropertyFactory::CreateProperty(XnPropertyType nType, const XnC
XnStatus XnActualPropertyFactory::FreeProperty(XnProperty* pProperty)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (pProperty->GetType() == XN_PROPERTY_TYPE_GENERAL)
{
XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProperty;
diff --git a/Source/XnDDK/XnActualPropertyFactory.h b/Source/XnDDK/XnActualPropertyFactory.h
index 3f38514..b788297 100644
--- a/Source/XnDDK/XnActualPropertyFactory.h
+++ b/Source/XnDDK/XnActualPropertyFactory.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_ACTUAL_PROPERTY_FACTORY_H__
#define __XN_ACTUAL_PROPERTY_FACTORY_H__
diff --git a/Source/XnDDK/XnActualRealProperty.cpp b/Source/XnDDK/XnActualRealProperty.cpp
index 01417bc..bbff73a 100644
--- a/Source/XnDDK/XnActualRealProperty.cpp
+++ b/Source/XnDDK/XnActualRealProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -41,12 +35,12 @@ XnActualRealProperty::XnActualRealProperty(const XnChar* strName, XnDouble dInit
UpdateGetCallback(GetCallback, this);
}
-XnStatus XnActualRealProperty::SetCallback(XnActualRealProperty* pSender, XnDouble dValue, void* pCookie)
+XnStatus XnActualRealProperty::SetCallback(XnActualRealProperty* pSender, XnDouble dValue, void* /*pCookie*/)
{
return pSender->UnsafeUpdateValue(dValue);
}
-XnStatus XN_CALLBACK_TYPE XnActualRealProperty::GetCallback(const XnActualRealProperty* pSender, XnDouble* pdValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnActualRealProperty::GetCallback(const XnActualRealProperty* pSender, XnDouble* pdValue, void* /*pCookie*/)
{
*pdValue = pSender->GetValue();
return XN_STATUS_OK;
diff --git a/Source/XnDDK/XnActualRealProperty.h b/Source/XnDDK/XnActualRealProperty.h
index a98a0ac..2232af6 100644
--- a/Source/XnDDK/XnActualRealProperty.h
+++ b/Source/XnDDK/XnActualRealProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_ACTUAL_REAL_PROPERTY_H__
#define __XN_ACTUAL_REAL_PROPERTY_H__
diff --git a/Source/XnDDK/XnActualStringProperty.cpp b/Source/XnDDK/XnActualStringProperty.cpp
index 8610ba6..d0deab5 100644
--- a/Source/XnDDK/XnActualStringProperty.cpp
+++ b/Source/XnDDK/XnActualStringProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -41,12 +35,12 @@ XnActualStringProperty::XnActualStringProperty(const XnChar* strName, const XnCh
UpdateGetCallback(GetCallback, this);
}
-XnStatus XnActualStringProperty::SetCallback(XnActualStringProperty* pSender, const XnChar* strValue, void* pCookie)
+XnStatus XnActualStringProperty::SetCallback(XnActualStringProperty* pSender, const XnChar* strValue, void* /*pCookie*/)
{
return pSender->UnsafeUpdateValue(strValue);
}
-XnStatus XnActualStringProperty::GetCallback(const XnActualStringProperty* pSender, XnChar* csValue, void* pCookie)
+XnStatus XnActualStringProperty::GetCallback(const XnActualStringProperty* pSender, XnChar* csValue, void* /*pCookie*/)
{
strncpy(csValue, pSender->GetValue(), XN_DEVICE_MAX_STRING_LENGTH);
return XN_STATUS_OK;
diff --git a/Source/XnDDK/XnActualStringProperty.h b/Source/XnDDK/XnActualStringProperty.h
index 2998ae0..26ce989 100644
--- a/Source/XnDDK/XnActualStringProperty.h
+++ b/Source/XnDDK/XnActualStringProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_ACTUAL_STRING_PROPERTY_H__
#define __XN_ACTUAL_STRING_PROPERTY_H__
diff --git a/Source/XnDDK/XnAudioStream.cpp b/Source/XnDDK/XnAudioStream.cpp
index 33028dc..6003857 100644
--- a/Source/XnDDK/XnAudioStream.cpp
+++ b/Source/XnDDK/XnAudioStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -89,8 +83,6 @@ XnStatus XnAudioStream::SetNumberOfChannels(XnUInt32 nNumberOfChannels)
XnStatus XnAudioStream::CalcRequiredSize(XnUInt32* pnRequiredSize) const
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnUInt32 nSampleSize = 2 * m_nMaxNumberOfChannels; // 16-bit per channel (2 bytes)
XnUInt32 nSamples = (XnUInt32)(GetSampleRate() * XN_AUDIO_STREAM_BUFFER_SIZE_IN_SECONDS);
@@ -99,13 +91,13 @@ XnStatus XnAudioStream::CalcRequiredSize(XnUInt32* pnRequiredSize) const
return (XN_STATUS_OK);
}
-XnStatus XnAudioStream::SetSampleRateCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XnAudioStream::SetSampleRateCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnAudioStream* pStream = (XnAudioStream*)pCookie;
return pStream->SetSampleRate((XnSampleRate)nValue);
}
-XnStatus XnAudioStream::SetNumberOfChannelsCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XnAudioStream::SetNumberOfChannelsCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnAudioStream* pStream = (XnAudioStream*)pCookie;
return pStream->SetNumberOfChannels((XnUInt32)nValue);
diff --git a/Source/XnDDK/XnAudioStream.h b/Source/XnDDK/XnAudioStream.h
index a9bb13e..b597a67 100644
--- a/Source/XnDDK/XnAudioStream.h
+++ b/Source/XnDDK/XnAudioStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_AUDIO_STREAM_H__
#define __XN_AUDIO_STREAM_H__
diff --git a/Source/XnDDK/XnBackwardsCompatibility36.cpp b/Source/XnDDK/XnBackwardsCompatibility36.cpp
index b6fc095..fa3a69c 100644
--- a/Source/XnDDK/XnBackwardsCompatibility36.cpp
+++ b/Source/XnDDK/XnBackwardsCompatibility36.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -37,8 +31,6 @@
//---------------------------------------------------------------------------
XnStatus XnBCDepthFormatToOutputFormat(XnStreamDepthFormat nDepthFormat, XnOutputFormats* pnOutputFormat)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
switch (nDepthFormat)
{
case XN_DEPTH_FORMAT_RAW10:
@@ -57,8 +49,6 @@ XnStatus XnBCDepthFormatToOutputFormat(XnStreamDepthFormat nDepthFormat, XnOutpu
XnStatus XnBCOutputFormatToDepthFormat(XnOutputFormats nOutputFormat, XnStreamDepthFormat* pnDepthFormat)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
switch (nOutputFormat)
{
case XN_OUTPUT_FORMAT_DEPTH_VALUES:
@@ -76,8 +66,6 @@ XnStatus XnBCOutputFormatToDepthFormat(XnOutputFormats nOutputFormat, XnStreamDe
XnStatus XnBCImageFormatToOutputFormat(XnStreamImageFormat nImageFormat, XnOutputFormats* pnOutputFormat)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
switch (nImageFormat)
{
case XN_IMAGE_FORMAT_GRAYSCALE8:
@@ -98,8 +86,6 @@ XnStatus XnBCImageFormatToOutputFormat(XnStreamImageFormat nImageFormat, XnOutpu
XnStatus XnBCOutputFormatToImageFormat(XnOutputFormats nOutputFormat, XnStreamImageFormat* pnImageFormat)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
switch (nOutputFormat)
{
case XN_OUTPUT_FORMAT_GRAYSCALE8:
@@ -123,8 +109,6 @@ XnStatus XnBCOutputFormatToImageFormat(XnOutputFormats nOutputFormat, XnStreamIm
XnStatus XnBCAudioFormatToOutputFormat(XnStreamAudioFormat nAudioFormat, XnOutputFormats* pnOutputFormat)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
switch (nAudioFormat)
{
case XN_AUDIO_FORMAT_PCM:
@@ -139,8 +123,6 @@ XnStatus XnBCAudioFormatToOutputFormat(XnStreamAudioFormat nAudioFormat, XnOutpu
XnStatus XnBCOutputFormatToAudioFormat(XnOutputFormats nOutputFormat, XnStreamAudioFormat* pnAudioFormat)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
switch (nOutputFormat)
{
case XN_OUTPUT_FORMAT_PCM:
diff --git a/Source/XnDDK/XnBackwardsCompatibility36.h b/Source/XnDDK/XnBackwardsCompatibility36.h
index e48f096..01ed564 100644
--- a/Source/XnDDK/XnBackwardsCompatibility36.h
+++ b/Source/XnDDK/XnBackwardsCompatibility36.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_BACKWARDS_COMPATIBILITY36_H__
#define __XN_BACKWARDS_COMPATIBILITY36_H__
diff --git a/Source/XnDDK/XnBufferPool.cpp b/Source/XnDDK/XnBufferPool.cpp
index 20bad25..d626cf6 100644
--- a/Source/XnDDK/XnBufferPool.cpp
+++ b/Source/XnDDK/XnBufferPool.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -38,7 +32,7 @@ XnBufferPool::XnBufferPool(XnUInt32 nBufferCount) :
m_nBufferCount(nBufferCount),
m_nBufferSize(0),
m_hLock(NULL),
- m_dump(XN_DUMP_CLOSED)
+ m_dump(NULL)
{}
XnBufferPool::~XnBufferPool()
@@ -50,7 +44,7 @@ XnStatus XnBufferPool::Init(XnUInt32 nBufferSize)
{
XnStatus nRetVal = XN_STATUS_OK;
- xnDumpInit(&m_dump, "BufferPool", "", "bufferpool_%x.txt", this);
+ m_dump = xnDumpFileOpen("BufferPool", "bufferpool_%x.txt", this);
nRetVal = xnOSCreateCriticalSection(&m_hLock);
XN_IS_STATUS_OK(nRetVal);
@@ -75,7 +69,7 @@ XnStatus XnBufferPool::ChangeBufferSize(XnUInt32 nBufferSize)
{
XnStatus nRetVal = XN_STATUS_OK;
- xnDumpWriteString(m_dump, "changing buffer size to %d\n", nBufferSize);
+ xnDumpFileWriteString(m_dump, "changing buffer size to %d\n", nBufferSize);
xnOSEnterCriticalSection(&m_hLock);
@@ -95,8 +89,6 @@ XnStatus XnBufferPool::ChangeBufferSize(XnUInt32 nBufferSize)
void XnBufferPool::FreeAll(XnBool bForceDestroyOfLockedBuffers)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
// free existing buffers
XnBuffersList::Iterator it = m_AllBuffers.begin();
while (it != m_AllBuffers.end())
@@ -149,7 +141,7 @@ XnStatus XnBufferPool::GetBuffer(XnBuffer** ppBuffer)
}
pBuffer->m_nRefCount = 1;
- xnDumpWriteString(m_dump, "%u taken from pool\n", pBuffer->m_nID);
+ xnDumpFileWriteString(m_dump, "%u taken from pool\n", pBuffer->m_nID);
xnOSLeaveCriticalSection(&m_hLock);
@@ -169,7 +161,7 @@ void XnBufferPool::AddRef(XnBuffer* pBuffer)
XnBufferInPool* pBufferInPool = (XnBufferInPool*)pBuffer;
++pBufferInPool->m_nRefCount;
- xnDumpWriteString(m_dump, "%u add ref (%d)\n", pBufferInPool->m_nID, pBufferInPool->m_nRefCount);
+ xnDumpFileWriteString(m_dump, "%u add ref (%d)\n", pBufferInPool->m_nID, pBufferInPool->m_nRefCount);
xnOSLeaveCriticalSection(&m_hLock);
}
@@ -185,7 +177,7 @@ void XnBufferPool::DecRef(XnBuffer* pBuffer)
xnOSEnterCriticalSection(&m_hLock);
- xnDumpWriteString(m_dump, "%u dec ref (%d)", pBufInPool->m_nID, pBufInPool->m_nRefCount-1);
+ xnDumpFileWriteString(m_dump, "%u dec ref (%d)", pBufInPool->m_nID, pBufInPool->m_nRefCount-1);
if (--pBufInPool->m_nRefCount == 0)
{
@@ -197,18 +189,18 @@ void XnBufferPool::DecRef(XnBuffer* pBuffer)
m_AllBuffers.Remove(it);
// and free it
DestroyBuffer(pBufInPool);
- xnDumpWriteString(m_dump, "destroy!\n");
+ xnDumpFileWriteString(m_dump, "destroy!\n");
}
else
{
// return it to free buffers list
m_FreeBuffers.AddLast(pBufInPool);
- xnDumpWriteString(m_dump, "return to pool!\n");
+ xnDumpFileWriteString(m_dump, "return to pool!\n");
}
}
else
{
- xnDumpWriteString(m_dump, "\n");
+ xnDumpFileWriteString(m_dump, "\n");
}
xnOSLeaveCriticalSection(&m_hLock);
diff --git a/Source/XnDDK/XnBufferPool.h b/Source/XnDDK/XnBufferPool.h
index d6a3c1a..cfcc2f8 100644
--- a/Source/XnDDK/XnBufferPool.h
+++ b/Source/XnDDK/XnBufferPool.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_BUFFER_POOL_H__
#define __XN_BUFFER_POOL_H__
@@ -73,7 +67,7 @@ class XN_DDK_CPP_API XnBufferPool
inline void Lock() { xnOSEnterCriticalSection(&m_hLock); }
inline void Unlock() { xnOSLeaveCriticalSection(&m_hLock); }
- inline XnDump& Dump() { return m_dump; }
+ inline XnDumpFile* Dump() { return m_dump; }
protected:
XN_DECLARE_LIST(XnBufferInPool*, XnBuffersList);
@@ -89,7 +83,7 @@ class XN_DDK_CPP_API XnBufferPool
XnBuffersList m_AllBuffers;
XnBuffersList m_FreeBuffers; // a list of available buffers
XN_CRITICAL_SECTION_HANDLE m_hLock;
- XnDump m_dump;
+ XnDumpFile* m_dump;
};
#endif // __XN_BUFFER_POOL_H__
\ No newline at end of file
diff --git a/Source/XnDDK/XnCodecFactory.cpp b/Source/XnDDK/XnCodecFactory.cpp
index d65d649..8b809c5 100644
--- a/Source/XnDDK/XnCodecFactory.cpp
+++ b/Source/XnDDK/XnCodecFactory.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -40,7 +34,7 @@
//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
-XnStatus XnCodecFactory::Create(XnCompressionFormats nFormat, XnDeviceModule* pStream, const XnChar* StreamName, XnCodec** ppCodec)
+XnStatus XnCodecFactory::Create(XnCompressionFormats nFormat, XnDeviceModule* pStream, const XnChar* /*StreamName*/, XnCodec** ppCodec)
{
XnStatus nRetVal = XN_STATUS_OK;
XnCodec* pCodec = NULL;
diff --git a/Source/XnDDK/XnCodecFactory.h b/Source/XnDDK/XnCodecFactory.h
index 65c460d..df24d57 100644
--- a/Source/XnDDK/XnCodecFactory.h
+++ b/Source/XnDDK/XnCodecFactory.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_CODEC_FACTORY_H__
#define __XN_CODEC_FACTORY_H__
diff --git a/Source/XnDDK/XnDDK.cpp b/Source/XnDDK/XnDDK.cpp
index 1c2c67a..b4b75b0 100644
--- a/Source/XnDDK/XnDDK.cpp
+++ b/Source/XnDDK/XnDDK.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -32,6 +26,7 @@
#include
#include
#include "XnDeviceManager.h"
+#include
// The following line is needed to be once in *ALL* of the high level shared library modules. DO NOT REMOVE!!!
XN_API_EXPORT_INIT()
@@ -142,3 +137,136 @@ XN_DDK_API XnStatus XnDDKShutdown()
return (XN_STATUS_OK);
}
+XnResolution OldResToOpenNIRes(XnResolutions res)
+{
+ switch (res)
+ {
+ case XN_RESOLUTION_CUSTOM: return XN_RES_CUSTOM;
+ case XN_RESOLUTION_QVGA: return XN_RES_QVGA;
+ case XN_RESOLUTION_VGA: return XN_RES_VGA;
+ case XN_RESOLUTION_SXGA: return XN_RES_SXGA;
+ case XN_RESOLUTION_UXGA: return XN_RES_UXGA;
+ case XN_RESOLUTION_QQVGA: return XN_RES_QQVGA;
+ case XN_RESOLUTION_QCIF: return XN_RES_QCIF;
+ case XN_RESOLUTION_240P: return XN_RES_240P;
+ case XN_RESOLUTION_CIF: return XN_RES_CIF;
+ case XN_RESOLUTION_WVGA: return XN_RES_WVGA;
+ case XN_RESOLUTION_480P: return XN_RES_480P;
+ case XN_RESOLUTION_800_448: return XN_RES_CUSTOM;
+ case XN_RESOLUTION_SVGA: return XN_RES_SVGA;
+ case XN_RESOLUTION_576P: return XN_RES_576P;
+ case XN_RESOLUTION_DV: return XN_RES_DV;
+ case XN_RESOLUTION_720P: return XN_RES_720P;
+ case XN_RESOLUTION_1280_960: return XN_RES_CUSTOM;
+ default:
+ XN_ASSERT(FALSE);
+ return XN_RES_CUSTOM;
+ }
+}
+
+XnResolutions OpenNIResToOldRes(XnResolution res)
+{
+ switch (res)
+ {
+ case XN_RES_CUSTOM: return XN_RESOLUTION_CUSTOM;
+ case XN_RES_QQVGA: return XN_RESOLUTION_QQVGA;
+ case XN_RES_CGA: return XN_RESOLUTION_CUSTOM;
+ case XN_RES_QVGA: return XN_RESOLUTION_QVGA;
+ case XN_RES_VGA: return XN_RESOLUTION_VGA;
+ case XN_RES_SVGA: return XN_RESOLUTION_SVGA;
+ case XN_RES_XGA: return XN_RESOLUTION_CUSTOM;
+ case XN_RES_720P: return XN_RESOLUTION_720P;
+ case XN_RES_SXGA: return XN_RESOLUTION_SXGA;
+ case XN_RES_UXGA: return XN_RESOLUTION_UXGA;
+ case XN_RES_1080P: return XN_RESOLUTION_CUSTOM;
+ case XN_RES_QCIF: return XN_RESOLUTION_QCIF;
+ case XN_RES_240P: return XN_RESOLUTION_240P;
+ case XN_RES_CIF: return XN_RESOLUTION_CIF;
+ case XN_RES_WVGA: return XN_RESOLUTION_WVGA;
+ case XN_RES_480P: return XN_RESOLUTION_480P;
+ case XN_RES_576P: return XN_RESOLUTION_576P;
+ case XN_RES_DV: return XN_RESOLUTION_DV;
+ default:
+ XN_ASSERT(FALSE);
+ return XN_RESOLUTION_CUSTOM;
+ }
+}
+
+XN_DDK_API XnResolutions XnDDKGetResolutionFromXY(XnUInt32 nXRes, XnUInt32 nYRes)
+{
+ // check if this is a known OpenNI resolution
+ XnResolution res = xnResolutionGetFromXYRes(nXRes, nYRes);
+ if (res == XN_RES_CUSTOM)
+ {
+ // check if this is one of our special resolutions
+ if (nXRes == 800 && nYRes == 448)
+ {
+ return XN_RESOLUTION_800_448;
+ }
+ else if (nXRes == 1280 && nYRes == 960)
+ {
+ return XN_RESOLUTION_1280_960;
+ }
+ }
+
+ return OpenNIResToOldRes(res);
+}
+
+XN_DDK_API XnBool XnDDKGetXYFromResolution(XnResolutions res, XnUInt32* pnXRes, XnUInt32* pnYRes)
+{
+ // check if this is a known OpenNI resolution
+ XnResolution openRes = OldResToOpenNIRes(res);
+ if (openRes == XN_RES_CUSTOM)
+ {
+ // check if this is one of our special resolutions
+ if (res == XN_RESOLUTION_800_448)
+ {
+ *pnXRes = 800;
+ *pnYRes = 448;
+ return TRUE;
+ }
+ else if (res == XN_RESOLUTION_1280_960)
+ {
+ *pnXRes = 1280;
+ *pnYRes = 960;
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ *pnXRes = xnResolutionGetXRes(openRes);
+ *pnYRes = xnResolutionGetYRes(openRes);
+ return TRUE;
+ }
+}
+
+XN_DDK_API const XnChar* XnDDKGetResolutionName(XnResolutions res)
+{
+ // check if this is a known OpenNI resolution
+ XnResolution openRes = OldResToOpenNIRes(res);
+
+ if (openRes == XN_RES_CUSTOM)
+ {
+ // check if this is one of our special resolutions
+ if (res == XN_RESOLUTION_800_448)
+ {
+ return "800x448";
+ }
+ else if (res == XN_RESOLUTION_1280_960)
+ {
+ return "1280x960";
+ }
+ else
+ {
+ return "Custom";
+ }
+ }
+ else
+ {
+ return xnResolutionGetName(openRes);
+ }
+}
diff --git a/Source/XnDDK/XnDDKStatus.cpp b/Source/XnDDK/XnDDKStatus.cpp
index 07858c0..0ce9f68 100644
--- a/Source/XnDDK/XnDDKStatus.cpp
+++ b/Source/XnDDK/XnDDKStatus.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnDataPacker.cpp b/Source/XnDDK/XnDataPacker.cpp
index 1230dfd..2eb97f8 100644
--- a/Source/XnDDK/XnDataPacker.cpp
+++ b/Source/XnDDK/XnDataPacker.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -894,7 +888,7 @@ XnStatus XnDataPacker::FixReadBCObjects()
// It is old version. Fix it.
// read all module names (+ modules end marker)
- while (TRUE)
+ for (;;)
{
nRetVal = ReadNextObjectImpl();
XN_IS_STATUS_OK(nRetVal);
@@ -909,7 +903,7 @@ XnStatus XnDataPacker::FixReadBCObjects()
}
// read properties (+ properties end marker)
- while (TRUE)
+ for (;;)
{
nRetVal = ReadNextObjectImpl();
XN_IS_STATUS_OK(nRetVal);
@@ -964,7 +958,7 @@ XnStatus XnDataPacker::FixReadBCObjects()
// move back to start
m_nInternalBufferReadIndex = nStartReadIndex;
// update size accordingly
- pHeader->nSize = m_InternalBuffer.GetUnsafeWritePointer() - (XnUChar*)pHeader - sizeof(XnPackedDataHeader);
+ pHeader->nSize = (XnUInt32)(m_InternalBuffer.GetUnsafeWritePointer() - (XnUChar*)pHeader - sizeof(XnPackedDataHeader));
// now place header back at root object
m_pCurrentHeader = pHeader;
@@ -1035,7 +1029,7 @@ XnStatus XnDataPacker::WriteStringToBuffer(const XnChar* csString)
XnStatus nRetVal = XN_STATUS_OK;
// get length (including null termination)
- XnUInt32 nLength = strlen(csString) + 1;
+ XnUInt32 nLength = (XnUInt32)strlen(csString) + 1;
if (nLength >= XN_DEVICE_MAX_STRING_LENGTH)
return (XN_STATUS_INTERNAL_BUFFER_TOO_SMALL);
@@ -1079,7 +1073,7 @@ void XnDataPacker::StartWritingIntenalObject(XnUInt32 nType)
void XnDataPacker::EndWritingInternalObject()
{
- m_pCurrentHeader->nSize = m_InternalBuffer.GetUnsafeWritePointer() - (XnUChar*)m_pCurrentHeader - sizeof(XnPackedDataHeader);
+ m_pCurrentHeader->nSize = (XnUInt32)(m_InternalBuffer.GetUnsafeWritePointer() - (XnUChar*)m_pCurrentHeader - sizeof(XnPackedDataHeader));
}
XnStatus XnDataPacker::FlushInternalBuffer()
diff --git a/Source/XnDDK/XnDataPacker.h b/Source/XnDDK/XnDataPacker.h
index 064c469..7abd1e4 100644
--- a/Source/XnDDK/XnDataPacker.h
+++ b/Source/XnDDK/XnDataPacker.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DATA_PACKER_H__
#define __XN_DATA_PACKER_H__
@@ -40,6 +35,8 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+typedef XnUInt32 XnPackedDataType;
+
typedef enum
{
XN_PACKED_PROPERTY_SET = 1,
@@ -52,7 +49,7 @@ typedef enum
XN_PACKED_STREAM_DATA = 8,
XN_PACKED_END = 9,
XN_PACKED_CUSTOM_MESSAGE = 2000,
-} XnPackedDataType;
+} XnPredefinedPackedDataType;
struct XnPackedDataHeader; // Forward declaration
diff --git a/Source/XnDDK/XnDepthStream.cpp b/Source/XnDDK/XnDepthStream.cpp
index 06c8fc6..3435816 100644
--- a/Source/XnDDK/XnDepthStream.cpp
+++ b/Source/XnDDK/XnDepthStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -53,9 +47,9 @@ XnDepthStream::XnDepthStream(const XnChar* csName, XnBool bAllowCustomResolution
m_ZeroPlaneDistance(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE),
m_ZeroPlanePixelSize(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE),
m_EmitterDCmosDistance(XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE),
+ m_GetDCmosRCmosDistance(XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE),
m_NoDepthValue(XN_STREAM_PROPERTY_NO_SAMPLE),
- m_ShadowValue(XN_STREAM_PROPERTY_SHADOW),
- m_S2DHelper(this)
+ m_ShadowValue(XN_STREAM_PROPERTY_SHADOW)
{
m_MinDepth.UpdateSetCallback(SetMinDepthCallback, this);
m_MaxDepth.UpdateSetCallback(SetMaxDepthCallback, this);
@@ -72,9 +66,9 @@ XnStatus XnDepthStream::Init()
// add properties
XN_VALIDATE_ADD_PROPERTIES(this, &m_MinDepth, &m_MaxDepth, &m_ConstShift, &m_PixelSizeFactor,
&m_MaxShift, &m_ParamCoefficient, &m_ShiftScale, &m_ZeroPlaneDistance, &m_ZeroPlanePixelSize,
- &m_EmitterDCmosDistance, &m_NoDepthValue, &m_ShadowValue, &m_DeviceMaxDepth);
+ &m_EmitterDCmosDistance, &m_GetDCmosRCmosDistance, &m_NoDepthValue, &m_ShadowValue, &m_DeviceMaxDepth);
- nRetVal = m_S2DHelper.Init();
+ nRetVal = m_S2DHelper.Init(this);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -118,9 +112,7 @@ XnStatus XnDepthStream::SetMaxDepth(XnDepthPixel nMaxDepth)
XnStatus XnDepthStream::ValidateDepthValue(XnDepthPixel nDepth)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
- if (nDepth < 0 || nDepth > GetDeviceMaxDepth())
+ if (nDepth > GetDeviceMaxDepth())
{
return XN_STATUS_DEVICE_BAD_PARAM;
}
@@ -159,19 +151,19 @@ XnStatus XnDepthStream::OnOutputFormatChanged()
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnDepthStream::SetMinDepthCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDepthStream::SetMinDepthCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDepthStream* pStream = (XnDepthStream*)pCookie;
return pStream->SetMinDepth((XnDepthPixel)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnDepthStream::SetMaxDepthCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDepthStream::SetMaxDepthCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDepthStream* pStream = (XnDepthStream*)pCookie;
return pStream->SetMaxDepth((XnDepthPixel)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnDepthStream::OutputFormatValueChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDepthStream::OutputFormatValueChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnDepthStream* pStream = (XnDepthStream*)pCookie;
return pStream->OnOutputFormatChanged();
diff --git a/Source/XnDDK/XnDepthStream.h b/Source/XnDDK/XnDepthStream.h
index 75e7957..1bdc666 100644
--- a/Source/XnDDK/XnDepthStream.h
+++ b/Source/XnDDK/XnDepthStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEPTH_STREAM_H__
#define __XN_DEPTH_STREAM_H__
@@ -64,6 +59,7 @@ class XN_DDK_CPP_API XnDepthStream : public XnPixelStream
inline XnDepthPixel GetZeroPlaneDistance() const { return (XnDepthPixel)m_ZeroPlaneDistance.GetValue(); }
inline XnDouble GetZeroPlanePixelSize() const { return m_ZeroPlanePixelSize.GetValue(); }
inline XnDouble GetEmitterDCmosDistance() const { return m_EmitterDCmosDistance.GetValue(); }
+ inline XnDouble GetDCmosRCmosDistance() const { return m_GetDCmosRCmosDistance.GetValue(); }
inline XnDepthPixel GetNoDepthValue() const { return (XnDepthPixel)m_NoDepthValue.GetValue(); }
inline XnDepthPixel GetShadowValue() const { return (XnDepthPixel)m_ShadowValue.GetValue(); }
@@ -85,6 +81,7 @@ class XN_DDK_CPP_API XnDepthStream : public XnPixelStream
inline XnActualIntProperty& ZeroPlaneDistanceProperty() { return m_ZeroPlaneDistance; }
inline XnActualRealProperty& ZeroPlanePixelSizeProperty() { return m_ZeroPlanePixelSize; }
inline XnActualRealProperty& EmitterDCmosDistanceProperty() { return m_EmitterDCmosDistance; }
+ inline XnActualRealProperty& GetDCmosRCmosDistanceProperty() { return m_GetDCmosRCmosDistance; }
inline XnActualIntProperty& NoDepthValueProperty() { return m_NoDepthValue; }
inline XnActualIntProperty& ShadowValueProperty() { return m_ShadowValue; }
@@ -122,6 +119,7 @@ class XN_DDK_CPP_API XnDepthStream : public XnPixelStream
XnActualIntProperty m_ZeroPlaneDistance;
XnActualRealProperty m_ZeroPlanePixelSize;
XnActualRealProperty m_EmitterDCmosDistance;
+ XnActualRealProperty m_GetDCmosRCmosDistance;
XnActualIntProperty m_NoDepthValue;
XnActualIntProperty m_ShadowValue;
diff --git a/Source/XnDDK/XnDeviceBase.cpp b/Source/XnDDK/XnDeviceBase.cpp
index 959ed6f..fc375ba 100644
--- a/Source/XnDDK/XnDeviceBase.cpp
+++ b/Source/XnDDK/XnDeviceBase.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -96,7 +90,7 @@ XnDeviceBase::XnDeviceBase(const XnChar* csName, XnBool bStrictProperties) :
m_nLastReadFrameID(0),
m_nLastTimestamp(0),
m_nLastFrameID(0),
- m_StreamsDataDump(XN_DUMP_CLOSED)
+ m_StreamsDataDump(NULL)
{
// update set callbacks
m_PrimaryStream.UpdateSetCallback(SetPrimaryStreamCallback, this);
@@ -168,7 +162,7 @@ XnStatus XnDeviceBase::InitImpl(const XnDeviceConfig* pDeviceConfig)
XN_IS_STATUS_OK(nRetVal);
// init dump
- xnDumpInit(&m_StreamsDataDump, XN_DUMP_STREAMS_DATA, "", "%s.csv", XN_DUMP_STREAMS_DATA);
+ m_StreamsDataDump = xnDumpFileOpen(XN_DUMP_STREAMS_DATA, "%s.csv", XN_DUMP_STREAMS_DATA);
return (XN_STATUS_OK);
}
@@ -207,14 +201,13 @@ XnStatus XnDeviceBase::Destroy()
xnOSCloseEvent(&m_hNewDataEvent);
// close dump
- xnDumpClose(&m_StreamsDataDump);
+ xnDumpFileClose(m_StreamsDataDump);
return XN_STATUS_OK;
}
XnStatus XnDeviceBase::CreateModule(const XnChar* strName, XnDeviceModuleHolder** ppModuleHolder)
{
- XnStatus nRetVal = XN_STATUS_OK;
XnDeviceModule* pModule;
XnDeviceModuleHolder* pHolder;
@@ -323,8 +316,6 @@ XnStatus XnDeviceBase::SetHighresTimestamps(XnBool bHighRes)
XnStatus XnDeviceBase::GetSupportedStreams(const XnChar** aStreamNames, XnUInt32* pnStreamNamesCount)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_OUTPUT_PTR(pnStreamNamesCount);
// NOTE: we allow aStreamName to be NULL
@@ -429,7 +420,6 @@ XnStatus XnDeviceBase::CloseAllStreams()
// go over modules list, and look for closed streams
for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
{
- const XnChar* Name = it.Key();
XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
if (IsStream(pModuleHolder->GetModule()))
{
@@ -449,8 +439,6 @@ XnStatus XnDeviceBase::CloseAllStreams()
XnStatus XnDeviceBase::GetStreamNames(const XnChar** pstrNames, XnUInt32* pnNamesCount)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
// first we need to count them
XnUInt32 nCount = 0;
@@ -686,7 +674,7 @@ XnStatus XnDeviceBase::Read(XnStreamDataSet* pStreamOutputSet)
XnUInt64 nNow;
xnOSGetHighResTimeStamp(&nNow);
- xnDumpWriteString(m_StreamsDataDump, "%llu,Read Called\n", nNow);
+ xnDumpFileWriteString(m_StreamsDataDump, "%llu,Read Called\n", nNow);
// First thing to do is wait for primary stream to advance. We do this BEFORE checking streams
// because device streams might change during this wait.
@@ -694,7 +682,7 @@ XnStatus XnDeviceBase::Read(XnStreamDataSet* pStreamOutputSet)
XN_IS_STATUS_OK(nRetVal);
xnOSGetHighResTimeStamp(&nNow);
- xnDumpWriteString(m_StreamsDataDump, "%llu,Read Condition Met\n", nNow);
+ xnDumpFileWriteString(m_StreamsDataDump, "%llu,Read Condition Met\n", nNow);
// take the list of stream output objects
XnStreamData* apStreamOutputs[XN_DEVICE_BASE_MAX_STREAMS_COUNT];
@@ -793,8 +781,6 @@ XnStatus XnDeviceBase::Write(XnStreamDataSet* pStreamDataSet)
XnStatus XnDeviceBase::Tell(XnUInt64* pnTimestamp)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_OUTPUT_PTR(pnTimestamp);
*pnTimestamp = m_nLastTimestamp;
@@ -804,8 +790,6 @@ XnStatus XnDeviceBase::Tell(XnUInt64* pnTimestamp)
XnStatus XnDeviceBase::TellFrame(XnUInt32* pnFrameID)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_OUTPUT_PTR(pnFrameID);
*pnFrameID = m_nLastFrameID;
@@ -970,9 +954,9 @@ XnStatus XnDeviceBase::CreateStreamsFromFile(const XnChar* csINIFilePath, const
XnUInt32 nStreamIndex = 0;
XnChar csKeyName[XN_INI_MAX_LEN];
- while (TRUE)
+ for (;;)
{
- sprintf(csKeyName, "Stream%d_Type", nStreamIndex);
+ sprintf(csKeyName, "Stream%u_Type", nStreamIndex);
XnChar csStreamType[XN_INI_MAX_LEN];
XnChar csStreamName[XN_INI_MAX_LEN];
@@ -984,7 +968,7 @@ XnStatus XnDeviceBase::CreateStreamsFromFile(const XnChar* csINIFilePath, const
}
// check if the stream has a name
- sprintf(csKeyName, "Stream%d_Name", nStreamIndex);
+ sprintf(csKeyName, "Stream%u_Name", nStreamIndex);
nRetVal = xnOSReadStringFromINI(csINIFilePath, csSectionName, csKeyName, csStreamName, XN_INI_MAX_LEN);
if (nRetVal != XN_STATUS_OK)
{
@@ -1330,8 +1314,6 @@ XnStatus XnDeviceBase::CreateStreams(const XnPropertySet* pSet)
XnStatus XnDeviceBase::ValidateOnlyModule(const XnPropertySet* pSet, const XnChar* StreamName)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnPropertySetData::ConstIterator it = pSet->pData->begin();
if (it == pSet->pData->end())
{
@@ -1468,8 +1450,6 @@ XnStatus XnDeviceBase::CreateStreamImpl(const XnChar* strType, const XnChar* str
XnStatus XnDeviceBase::StreamAdded(XnDeviceStream* pStream)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
// register to the NewData event
if (m_ReadWriteMode.GetValue() == XN_DEVICE_MODE_READ)
{
@@ -1550,8 +1530,6 @@ XnStatus XnDeviceBase::GetModulesList(XnDeviceModuleHolder** apModules, XnUInt32
XnStatus XnDeviceBase::GetModulesList(XnDeviceModuleHolderList& list)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
list.Clear();
for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
@@ -1564,8 +1542,6 @@ XnStatus XnDeviceBase::GetModulesList(XnDeviceModuleHolderList& list)
XnStatus XnDeviceBase::GetStreamsList(XnDeviceModuleHolderList& list)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
list.Clear();
for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
@@ -1591,7 +1567,7 @@ void XnDeviceBase::OnNewStreamData(XnDeviceStream* pStream, XnUInt64 nTimestamp,
{
XnUInt64 nNow;
xnOSGetHighResTimeStamp(&nNow);
- xnDumpWriteString(m_StreamsDataDump, "%llu,%s,%llu,%u\n", nNow, pStream->GetName(), nTimestamp, nFrameID);
+ xnDumpFileWriteString(m_StreamsDataDump, "%llu,%s,%llu,%u\n", nNow, pStream->GetName(), nTimestamp, nFrameID);
if (strcmp(m_PrimaryStream.GetValue(), XN_PRIMARY_STREAM_ANY) == 0 ||
strcmp(m_PrimaryStream.GetValue(), XN_PRIMARY_STREAM_NONE) == 0)
@@ -1735,7 +1711,7 @@ XnStatus XnDeviceBase::WaitForPrimaryStream(XN_EVENT_HANDLE hNewDataEvent, XnStr
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnDeviceBase::PropertyValueChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceBase::PropertyValueChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnPropertyCallback* pUserCallback = (XnPropertyCallback*)pCookie;
@@ -1745,19 +1721,19 @@ XnStatus XN_CALLBACK_TYPE XnDeviceBase::PropertyValueChangedCallback(const XnPro
return XN_STATUS_OK;
}
-XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetPrimaryStreamCallback(XnActualStringProperty* pSender, const XnChar* strValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetPrimaryStreamCallback(XnActualStringProperty* /*pSender*/, const XnChar* strValue, void* pCookie)
{
XnDeviceBase* pThis = (XnDeviceBase*)pCookie;
return pThis->SetPrimaryStream(strValue);
}
-XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetMirrorCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetMirrorCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDeviceBase* pThis = (XnDeviceBase*)pCookie;
return pThis->SetMirror((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetHighresTimestampsCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetHighresTimestampsCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDeviceBase* pThis = (XnDeviceBase*)pCookie;
return pThis->SetHighresTimestamps((XnBool)nValue);
diff --git a/Source/XnDDK/XnDeviceBase.h b/Source/XnDDK/XnDeviceBase.h
index 50e1ab4..67019c8 100644
--- a/Source/XnDDK/XnDeviceBase.h
+++ b/Source/XnDDK/XnDeviceBase.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_BASE_H__
#define __XN_DEVICE_BASE_H__
@@ -307,7 +302,7 @@ class XN_DDK_CPP_API XnDeviceBase : public IXnDevice
NewStreamDataEvent m_OnNewStreamDataEvent;
XnSDKVersion m_SDKVersion;
- XnDump m_StreamsDataDump;
+ XnDumpFile* m_StreamsDataDump;
};
#endif //__XN_DEVICE_BASE_H__
diff --git a/Source/XnDDK/XnDeviceBaseProxy.cpp b/Source/XnDDK/XnDeviceBaseProxy.cpp
index 828efd5..b0aba03 100644
--- a/Source/XnDDK/XnDeviceBaseProxy.cpp
+++ b/Source/XnDDK/XnDeviceBaseProxy.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnDeviceBaseProxy.h b/Source/XnDDK/XnDeviceBaseProxy.h
index 6424fee..eb1bdb0 100644
--- a/Source/XnDDK/XnDeviceBaseProxy.h
+++ b/Source/XnDDK/XnDeviceBaseProxy.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_BASE_PROXY_H__
#define __XN_DEVICE_BASE_PROXY_H__
diff --git a/Source/XnDDK/XnDeviceFunctionsTypedefs.h b/Source/XnDDK/XnDeviceFunctionsTypedefs.h
index b864975..7edb94c 100644
--- a/Source/XnDDK/XnDeviceFunctionsTypedefs.h
+++ b/Source/XnDDK/XnDeviceFunctionsTypedefs.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_FUNCTIONS_TYPEDEFS_H__
#define __XN_DEVICE_FUNCTIONS_TYPEDEFS_H__
diff --git a/Source/XnDDK/XnDeviceInterfaceAdapter.h b/Source/XnDDK/XnDeviceInterfaceAdapter.h
index 2fae8f0..5459764 100644
--- a/Source/XnDDK/XnDeviceInterfaceAdapter.h
+++ b/Source/XnDDK/XnDeviceInterfaceAdapter.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_INTERFACE_ADAPTER_H__
#define __XN_DEVICE_INTERFACE_ADAPTER_H__
diff --git a/Source/XnDDK/XnDeviceInterfaceImpl.h b/Source/XnDDK/XnDeviceInterfaceImpl.h
index b725f7d..1aa3124 100644
--- a/Source/XnDDK/XnDeviceInterfaceImpl.h
+++ b/Source/XnDDK/XnDeviceInterfaceImpl.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
/**
* This file is intended to allow any IXnDevice derivative to export its interface for
* a "C" environment.
diff --git a/Source/XnDDK/XnDeviceManager.cpp b/Source/XnDDK/XnDeviceManager.cpp
index 188e77c..803c2c5 100644
--- a/Source/XnDDK/XnDeviceManager.cpp
+++ b/Source/XnDDK/XnDeviceManager.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -237,8 +231,6 @@ XnStatus XnDeviceManagerShutdown()
XnStatus XnDeviceManagerGetDeviceList(XnDeviceDefinition* aDeviceDefinitions, XnUInt32* pnCount)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
// check if device manager is initialized
if (g_pDeviceManager == NULL)
{
diff --git a/Source/XnDDK/XnDeviceManager.h b/Source/XnDDK/XnDeviceManager.h
index 20be6dc..ea9afba 100644
--- a/Source/XnDDK/XnDeviceManager.h
+++ b/Source/XnDDK/XnDeviceManager.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_MANAGER_H__
#define __XN_DEVICE_MANAGER_H__
diff --git a/Source/XnDDK/XnDeviceModule.cpp b/Source/XnDDK/XnDeviceModule.cpp
index d577714..60bf261 100644
--- a/Source/XnDDK/XnDeviceModule.cpp
+++ b/Source/XnDDK/XnDeviceModule.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -547,7 +541,7 @@ XnStatus XnDeviceModule::SetLockState(XnBool bLocked)
return (nRetVal);
}
-XnStatus XnDeviceModule::SetLockStateCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XnDeviceModule::SetLockStateCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDeviceModule* pThis = (XnDeviceModule*)pCookie;
return pThis->SetLockState(nValue != FALSE);
diff --git a/Source/XnDDK/XnDeviceModule.h b/Source/XnDDK/XnDeviceModule.h
index 45fbd92..b94bafd 100644
--- a/Source/XnDDK/XnDeviceModule.h
+++ b/Source/XnDDK/XnDeviceModule.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_MODULE_H__
#define __XN_DEVICE_MODULE_H__
@@ -112,11 +107,11 @@ class XN_DDK_CPP_API XnDeviceModule
};
#define XN_VALIDATE_ADD_PROPERTIES(pModule, ...) \
- do { \
+ { \
XnProperty* _aProps[] = { __VA_ARGS__ }; \
XnStatus _nRetVal = (pModule)->AddProperties(_aProps, sizeof(_aProps)/sizeof(XnProperty*)); \
- XN_IS_STATUS_OK(_nRetVal); \
- } while (0)
+ XN_IS_STATUS_OK(_nRetVal); \
+ }
#endif //__XN_DEVICE_MODULE_H__
diff --git a/Source/XnDDK/XnDeviceModuleHolder.cpp b/Source/XnDDK/XnDeviceModuleHolder.cpp
index 260fdc1..3616979 100644
--- a/Source/XnDDK/XnDeviceModuleHolder.cpp
+++ b/Source/XnDDK/XnDeviceModuleHolder.cpp
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#include "XnDeviceModuleHolder.h"
#include "XnActualIntProperty.h"
#include "XnActualRealProperty.h"
diff --git a/Source/XnDDK/XnDeviceModuleHolder.h b/Source/XnDDK/XnDeviceModuleHolder.h
index 3e0447b..4659370 100644
--- a/Source/XnDDK/XnDeviceModuleHolder.h
+++ b/Source/XnDDK/XnDeviceModuleHolder.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_MODULE_HOLDER_H__
#define __XN_DEVICE_MODULE_HOLDER_H__
diff --git a/Source/XnDDK/XnDeviceProxy.cpp b/Source/XnDDK/XnDeviceProxy.cpp
index 23ef5a9..eba9645 100644
--- a/Source/XnDDK/XnDeviceProxy.cpp
+++ b/Source/XnDDK/XnDeviceProxy.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -63,8 +57,6 @@ XnHash g_StreamOutputHash;
//---------------------------------------------------------------------------
XN_DDK_API XnStatus XnDeviceProxyGetDeviceList(XnDeviceDefinition* aDeviceDefinitions, XnUInt32* pnCount)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
// take definitions
return XnDeviceManagerGetDeviceList(aDeviceDefinitions, pnCount);
}
@@ -241,7 +233,6 @@ XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(Enumerate)(XnConnectionString* aConnec
XnUInt32 nDeviceCount = 0;
XnConnectionString* pDeviceConnectionStrings = NULL;
XnUInt32 nTotalCount = 0;
- XnDeviceDescriptor* pDescriptor = NULL;
XnChar csConnectionStringPrefix[XN_DEVICE_MAX_STRING_LENGTH];
XnUInt32 nBytesWritten = 0;
@@ -288,7 +279,7 @@ XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(Create)(XnDeviceHandle* pDeviceHandle,
// copy device name
XnChar csDeviceName[XN_DEVICE_MAX_STRING_LENGTH];
- nRetVal = xnOSStrNCopy(csDeviceName, pDeviceConfig->cpConnectionString, pSeparator - pDeviceConfig->cpConnectionString, XN_DEVICE_MAX_STRING_LENGTH);
+ nRetVal = xnOSStrNCopy(csDeviceName, pDeviceConfig->cpConnectionString, (XnUInt32)(pSeparator - pDeviceConfig->cpConnectionString), XN_DEVICE_MAX_STRING_LENGTH);
XN_IS_STATUS_OK(nRetVal);
csDeviceName[pSeparator - pDeviceConfig->cpConnectionString] = '\0';
diff --git a/Source/XnDDK/XnDeviceStream.cpp b/Source/XnDDK/XnDeviceStream.cpp
index 4aab57a..543265c 100644
--- a/Source/XnDDK/XnDeviceStream.cpp
+++ b/Source/XnDDK/XnDeviceStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -182,20 +176,10 @@ XnStatus XnDeviceStream::Read(XnStreamData* pStreamOutput)
// and that we don't have new info
m_bNewDataAvailable = FALSE;
}
- else
- {
- nRetVal = HandleNoNewData(pStreamOutput);
- XN_IS_STATUS_OK(nRetVal);
- }
return (XN_STATUS_OK);
}
-XnStatus XnDeviceStream::HandleNoNewData(XnStreamData* pStreamOutput)
-{
- return XN_STATUS_OK;
-}
-
XnStatus XnDeviceStream::Write(XnStreamData* pStreamData)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -244,13 +228,13 @@ XnStatus XnDeviceStream::UpdateRequiredSize()
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnDeviceStream::UpdateRequiredSizeCallback(const XnProperty* pSenser, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceStream::UpdateRequiredSizeCallback(const XnProperty* /*pSenser*/, void* pCookie)
{
XnDeviceStream* pStream = (XnDeviceStream*)pCookie;
return pStream->UpdateRequiredSize();
}
-XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetIsOpenCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetIsOpenCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDeviceStream* pStream = (XnDeviceStream*)pCookie;
if (nValue == TRUE)
@@ -263,13 +247,13 @@ XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetIsOpenCallback(XnActualIntProperty*
}
}
-XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetOutputFormatCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetOutputFormatCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDeviceStream* pStream = (XnDeviceStream*)pCookie;
return pStream->SetOutputFormat((XnOutputFormats)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetIsMirrorCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetIsMirrorCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnDeviceStream* pStream = (XnDeviceStream*)pCookie;
return pStream->SetMirror((XnBool)nValue);
diff --git a/Source/XnDDK/XnDeviceStream.h b/Source/XnDDK/XnDeviceStream.h
index 6eefd38..f3c5629 100644
--- a/Source/XnDDK/XnDeviceStream.h
+++ b/Source/XnDDK/XnDeviceStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_STREAM_H__
#define __XN_DEVICE_STREAM_H__
@@ -67,7 +62,7 @@ class XN_DDK_CPP_API XnDeviceStream : public XnDeviceModule
void SetNewDataCallback(NewDataCallbackPtr pFunc, void* pCookie);
/** Notifies new data is available in this stream. */
- void NewDataAvailable(XnUInt64 nTimestamp, XnUInt32 nFrameID);
+ virtual void NewDataAvailable(XnUInt64 nTimestamp, XnUInt32 nFrameID);
void ResetLastTimestampAndFrameID();
@@ -114,8 +109,6 @@ class XN_DDK_CPP_API XnDeviceStream : public XnDeviceModule
virtual XnStatus Mirror(XnStreamData* pStreamOutput) const = 0;
/** Calculates the required size. */
virtual XnStatus CalcRequiredSize(XnUInt32* pnRequiredSize) const = 0;
- /** Allows inheriting classes to do something when user called Read(), and there is no new data. */
- virtual XnStatus HandleNoNewData(XnStreamData* pStreamOutput);
//---------------------------------------------------------------------------
// Utility Functions
diff --git a/Source/XnDDK/XnFrameBufferManager.cpp b/Source/XnDDK/XnFrameBufferManager.cpp
index 816fca2..c92e462 100644
--- a/Source/XnDDK/XnFrameBufferManager.cpp
+++ b/Source/XnDDK/XnFrameBufferManager.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnFrameBufferManager.h b/Source/XnDDK/XnFrameBufferManager.h
index fafa842..8f88ab5 100644
--- a/Source/XnDDK/XnFrameBufferManager.h
+++ b/Source/XnDDK/XnFrameBufferManager.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_MULTI_FRAME_BUFFER_H__
#define __XN_MULTI_FRAME_BUFFER_H__
diff --git a/Source/XnDDK/XnFrameStream.cpp b/Source/XnDDK/XnFrameStream.cpp
index 15370a4..bd3fc2d 100644
--- a/Source/XnDDK/XnFrameStream.cpp
+++ b/Source/XnDDK/XnFrameStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -209,19 +203,6 @@ XnStatus XnFrameStream::ReadImpl(XnStreamData* pStreamOutput)
return XN_STATUS_OK;
}
-XnStatus XnFrameStream::HandleNoNewData(XnStreamData* pStreamOutput)
-{
-/* // No new data, but if triple buffer was reallocated, we want the user buffer to be replaced
- // (so that it has a buffer with a size that matches what he expects, even if no new data in it)
- if (m_bTripleBufferReallocated && !pStreamOutput->pInternal->bAllocated)
- {
- XnFrameBuffer* pStableBuffer = m_pBufferManager->ReadLastStableBuffer();
- pStreamOutput->pData = (void*)pStableBuffer->DataBuf.GetData();
- }
-*/
- return XN_STATUS_OK;
-}
-
XnStatus XnFrameStream::GetLastRawFrame(XnDynamicSizeBuffer* pBuffer)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -232,25 +213,25 @@ XnStatus XnFrameStream::GetLastRawFrame(XnDynamicSizeBuffer* pBuffer)
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnFrameStream::SetFPSCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnFrameStream::SetFPSCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnFrameStream* pThis = (XnFrameStream*)pCookie;
return pThis->SetFPS((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnFrameStream::RequiredSizeChangedCallback(const XnProperty* pSenser, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnFrameStream::RequiredSizeChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnFrameStream* pThis = (XnFrameStream*)pCookie;
return pThis->OnRequiredSizeChanging();
}
-void XN_CALLBACK_TYPE XnFrameStream::OnTripleBufferNewData(XnFrameBufferManager* pTripleBuffer, XnUInt64 nTimestamp, void* pCookie)
+void XN_CALLBACK_TYPE XnFrameStream::OnTripleBufferNewData(XnFrameBufferManager* /*pTripleBuffer*/, XnUInt64 nTimestamp, void* pCookie)
{
XnFrameStream* pThis = (XnFrameStream*)pCookie;
pThis->NewDataAvailable(nTimestamp, pThis->m_nLastReadFrame + 1);
}
-XnStatus XN_CALLBACK_TYPE XnFrameStream::GetLastRawFrameCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnFrameStream::GetLastRawFrameCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnDynamicSizeBuffer);
XnFrameStream* pThis = (XnFrameStream*)pCookie;
diff --git a/Source/XnDDK/XnFrameStream.h b/Source/XnDDK/XnFrameStream.h
index 51be57d..9cded71 100644
--- a/Source/XnDDK/XnFrameStream.h
+++ b/Source/XnDDK/XnFrameStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_FRAME_STREAM_H__
#define __XN_FRAME_STREAM_H__
@@ -78,14 +73,13 @@ class XN_DDK_CPP_API XnFrameStream : public XnDeviceStream
//---------------------------------------------------------------------------
// Virtual Methods
//---------------------------------------------------------------------------
- virtual XnStatus PostProcessFrame(XnStreamData* pFrameData) { return XN_STATUS_OK; }
+ virtual XnStatus PostProcessFrame(XnStreamData* /*pFrameData*/) { return XN_STATUS_OK; }
virtual XnStatus ReallocTripleFrameBuffer();
//---------------------------------------------------------------------------
// Overridden Methods
//---------------------------------------------------------------------------
XnStatus ReadImpl(XnStreamData* pStreamOutput);
- XnStatus HandleNoNewData(XnStreamData* pStreamOutput);
private:
XnStatus OnRequiredSizeChanging();
diff --git a/Source/XnDDK/XnGeneralProperty.cpp b/Source/XnDDK/XnGeneralProperty.cpp
index e1b58ab..20e2688 100644
--- a/Source/XnDDK/XnGeneralProperty.cpp
+++ b/Source/XnDDK/XnGeneralProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -82,7 +76,7 @@ XnStatus XnGeneralProperty::ReadValueFromFile(const XnChar* csINIFile, const XnC
return (XN_STATUS_OK);
}
-XnStatus XnGeneralProperty::AddToPropertySet(XnPropertySet* pSet)
+XnStatus XnGeneralProperty::AddToPropertySet(XnPropertySet* /*pSet*/)
{
return (XN_STATUS_ERROR);
}
diff --git a/Source/XnDDK/XnGeneralProperty.h b/Source/XnDDK/XnGeneralProperty.h
index 82ee343..6c2ba2d 100644
--- a/Source/XnDDK/XnGeneralProperty.h
+++ b/Source/XnDDK/XnGeneralProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_GENERAL_PROPERTY_H__
#define __XN_GENERAL_PROPERTY_H__
diff --git a/Source/XnDDK/XnIRStream.cpp b/Source/XnDDK/XnIRStream.cpp
index 9a69e06..009d1af 100644
--- a/Source/XnDDK/XnIRStream.cpp
+++ b/Source/XnDDK/XnIRStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnIRStream.h b/Source/XnDDK/XnIRStream.h
index 8c3acd4..2393540 100644
--- a/Source/XnDDK/XnIRStream.h
+++ b/Source/XnDDK/XnIRStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IR_STREAM_H__
#define __XN_IR_STREAM_H__
diff --git a/Source/XnDDK/XnImageStream.cpp b/Source/XnDDK/XnImageStream.cpp
index 558abcb..378a2a1 100644
--- a/Source/XnDDK/XnImageStream.cpp
+++ b/Source/XnDDK/XnImageStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnImageStream.h b/Source/XnDDK/XnImageStream.h
index a5313eb..c65fb8c 100644
--- a/Source/XnDDK/XnImageStream.h
+++ b/Source/XnDDK/XnImageStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IMAGE_STREAM_H__
#define __XN_IMAGE_STREAM_H__
diff --git a/Source/XnDDK/XnIntProperty.cpp b/Source/XnDDK/XnIntProperty.cpp
index b56ef65..d868b7d 100644
--- a/Source/XnDDK/XnIntProperty.cpp
+++ b/Source/XnDDK/XnIntProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnIntProperty.h b/Source/XnDDK/XnIntProperty.h
index 8e7f264..4592762 100644
--- a/Source/XnDDK/XnIntProperty.h
+++ b/Source/XnDDK/XnIntProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_INT_PROPERTY_H__
#define __XN_INT_PROPERTY_H__
diff --git a/Source/XnDDK/XnIntPropertySynchronizer.cpp b/Source/XnDDK/XnIntPropertySynchronizer.cpp
index 0cc726b..d76214c 100644
--- a/Source/XnDDK/XnIntPropertySynchronizer.cpp
+++ b/Source/XnDDK/XnIntPropertySynchronizer.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnIntPropertySynchronizer.h b/Source/XnDDK/XnIntPropertySynchronizer.h
index 0201c48..1627d90 100644
--- a/Source/XnDDK/XnIntPropertySynchronizer.h
+++ b/Source/XnDDK/XnIntPropertySynchronizer.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_INT_PROPERTY_SYNCHRONIZER_H__
#define __XN_INT_PROPERTY_SYNCHRONIZER_H__
diff --git a/Source/XnDDK/XnPixelStream.cpp b/Source/XnDDK/XnPixelStream.cpp
index db0f2cc..2417648 100644
--- a/Source/XnDDK/XnPixelStream.cpp
+++ b/Source/XnDDK/XnPixelStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -32,6 +26,7 @@
#include
#include
#include
+#include
//---------------------------------------------------------------------------
// XnPixelStream
@@ -44,9 +39,13 @@ XnPixelStream::XnPixelStream(const XnChar* csType, const XnChar* csName, XnBool
m_YRes(XN_STREAM_PROPERTY_Y_RES, XN_VGA_Y_RES),
m_BytesPerPixel(XN_STREAM_PROPERTY_BYTES_PER_PIXEL),
m_Cropping(XN_STREAM_PROPERTY_CROPPING, &m_CroppingData, sizeof(XnCropping), ReadCroppingFromFileCallback),
- m_bAllowCustomResolutions(bAllowCustomResolutions)
+ m_SupportedModesCount(XN_STREAM_PROPERTY_SUPPORT_MODES_COUNT, 0),
+ m_SupportedModes(XN_STREAM_PROPERTY_SUPPORT_MODES),
+ m_bAllowCustomResolutions(bAllowCustomResolutions),
+ m_supportedModesData(30)
{
xnOSMemSet(&m_CroppingData, 0, sizeof(XnCropping));
+ m_SupportedModes.UpdateGetCallback(GetSupportedModesCallback, this);
}
XnStatus XnPixelStream::Init()
@@ -64,7 +63,8 @@ XnStatus XnPixelStream::Init()
m_Cropping.UpdateSetCallback(SetCroppingCallback, this);
// add properties
- XN_VALIDATE_ADD_PROPERTIES(this, &m_IsPixelStream, &m_Resolution, &m_XRes, &m_YRes, &m_BytesPerPixel, &m_Cropping);
+ XN_VALIDATE_ADD_PROPERTIES(this, &m_IsPixelStream, &m_Resolution, &m_XRes, &m_YRes,
+ &m_BytesPerPixel, &m_Cropping, &m_SupportedModesCount, &m_SupportedModes);
// register required size properties
nRetVal = RegisterRequiredSizeProperty(&m_XRes);
@@ -93,6 +93,48 @@ XnStatus XnPixelStream::Init()
return (XN_STATUS_OK);
}
+XnStatus XnPixelStream::AddSupportedModes(XnCmosPreset* aPresets, XnUInt32 nCount)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_supportedModesData.AddLast(aPresets, nCount);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // update our general property
+ XnUInt32 nAllPresetsCount = m_supportedModesData.GetSize();
+
+ nRetVal = m_SupportedModesCount.UnsafeUpdateValue(nAllPresetsCount);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnPixelStream::ValidateSupportedMode(const XnCmosPreset& preset)
+{
+ for (XnUInt32 i = 0; i < m_supportedModesData.GetSize(); ++i)
+ {
+ if (preset.nFormat == m_supportedModesData[i].nFormat &&
+ preset.nResolution == m_supportedModesData[i].nResolution &&
+ preset.nFPS == m_supportedModesData[i].nFPS)
+ {
+ return (XN_STATUS_OK);
+ }
+ }
+
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DDK, "Mode is not supported (format: %d, resolution: %d, FPS: %d)!", preset.nFormat, preset.nResolution, preset.nFPS);
+}
+
+XnStatus XnPixelStream::GetSupportedModes(XnCmosPreset* aPresets, XnUInt32& nCount)
+{
+ if (nCount < m_supportedModesData.GetSize())
+ {
+ return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
+ }
+
+ xnOSMemCopy(aPresets, m_supportedModesData.GetData(), m_supportedModesData.GetSize() * sizeof(XnCmosPreset));
+ return XN_STATUS_OK;
+}
+
XnStatus XnPixelStream::SetResolution(XnResolutions nResolution)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -107,39 +149,18 @@ XnStatus XnPixelStream::SetXRes(XnUInt32 nXRes)
{
XnStatus nRetVal = XN_STATUS_OK;
- if (m_bAllowCustomResolutions)
+ XnResolutions res = XnDDKGetResolutionFromXY(nXRes, GetYRes());
+
+ // set resolution (this will also set X and Y resolution)
+ nRetVal = SetResolution(res);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (res == XN_RESOLUTION_CUSTOM)
{
- // just update the value
+ // update X res ourselves
nRetVal = m_XRes.UnsafeUpdateValue(nXRes);
XN_IS_STATUS_OK(nRetVal);
}
- else
- {
- // instead of updating XRes, we'll update the resolution, and XRes will be updated
- // via ValueChanged event
- XnResolutions nRes;
-
- switch (nXRes)
- {
- case XN_QVGA_X_RES:
- nRes = XN_RESOLUTION_QVGA;
- break;
- case XN_VGA_X_RES:
- nRes = XN_RESOLUTION_VGA;
- break;
- case XN_SXGA_X_RES:
- nRes = XN_RESOLUTION_SXGA;
- break;
- case XN_UXGA_X_RES:
- nRes = XN_RESOLUTION_UXGA;
- break;
- default:
- return (XN_STATUS_DEVICE_BAD_PARAM);
- }
-
- nRetVal = SetResolution(nRes);
- XN_IS_STATUS_OK(nRetVal);
- }
return (XN_STATUS_OK);
}
@@ -148,39 +169,18 @@ XnStatus XnPixelStream::SetYRes(XnUInt32 nYRes)
{
XnStatus nRetVal = XN_STATUS_OK;
- if (m_bAllowCustomResolutions)
+ XnResolutions res = XnDDKGetResolutionFromXY(GetXRes(), nYRes);
+
+ // set resolution (this will also set X and Y resolution)
+ nRetVal = SetResolution(res);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (res == XN_RESOLUTION_CUSTOM)
{
- // just update the value
+ // update Y res ourselves
nRetVal = m_YRes.UnsafeUpdateValue(nYRes);
XN_IS_STATUS_OK(nRetVal);
}
- else
- {
- // instead of updating YRes, we'll update the resolution, and YRes will be updated
- // via ValueChanged event
- XnResolutions nRes;
-
- switch (nYRes)
- {
- case XN_QVGA_Y_RES:
- nRes = XN_RESOLUTION_QVGA;
- break;
- case XN_VGA_Y_RES:
- nRes = XN_RESOLUTION_VGA;
- break;
- case XN_SXGA_Y_RES:
- nRes = XN_RESOLUTION_SXGA;
- break;
- case XN_UXGA_Y_RES:
- nRes = XN_RESOLUTION_UXGA;
- break;
- default:
- return (XN_STATUS_DEVICE_BAD_PARAM);
- }
-
- nRetVal = SetResolution(nRes);
- XN_IS_STATUS_OK(nRetVal);
- }
return (XN_STATUS_OK);
}
@@ -200,8 +200,6 @@ XnStatus XnPixelStream::SetCropping(const XnCropping* pCropping)
XnStatus XnPixelStream::ValidateCropping(const XnCropping* pCropping)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (pCropping->bEnabled)
{
if (pCropping->nXOffset > GetXRes() ||
@@ -225,30 +223,15 @@ XnStatus XnPixelStream::OnResolutionChanged()
{
XnStatus nRetVal = XN_STATUS_OK;
- if (m_Resolution.GetValue() != XN_RESOLUTION_CUSTOM)
+ XnResolutions res = (XnResolutions)m_Resolution.GetValue();
+ if (res != XN_RESOLUTION_CUSTOM)
{
// update XRes and YRes accordingly
XnUInt32 nXRes;
XnUInt32 nYRes;
-
- switch (m_Resolution.GetValue())
+ if (!XnDDKGetXYFromResolution(res, &nXRes, &nYRes))
{
- case XN_RESOLUTION_QVGA:
- nXRes = XN_QVGA_X_RES;
- nYRes = XN_QVGA_Y_RES;
- break;
- case XN_RESOLUTION_VGA:
- nXRes = XN_VGA_X_RES;
- nYRes = XN_VGA_Y_RES;
- break;
- case XN_RESOLUTION_UXGA:
- nXRes = XN_UXGA_X_RES;
- nYRes = XN_UXGA_Y_RES;
- break;
- case XN_RESOLUTION_SXGA:
- nXRes = XN_SXGA_X_RES;
- nYRes = XN_SXGA_Y_RES;
- break;
+ XN_ASSERT(FALSE);
}
nRetVal = m_XRes.UnsafeUpdateValue(nXRes);
@@ -358,8 +341,6 @@ XnStatus XnPixelStream::Mirror(XnStreamData* pStreamOutput) const
XnStatus XnPixelStream::CropImpl(XnStreamData* pStreamOutput, const XnCropping* pCropping)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnUChar* pPixelData = (XnUChar*)pStreamOutput->pData;
XnUInt32 nCurDataSize = 0;
@@ -378,43 +359,43 @@ XnStatus XnPixelStream::CropImpl(XnStreamData* pStreamOutput, const XnCropping*
return XN_STATUS_OK;
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::ResolutionValueChangedCallback(const XnProperty* pSenser, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::ResolutionValueChangedCallback(const XnProperty* /*pSenser*/, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
return pStream->OnResolutionChanged();
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::OutputFormatValueChangedCallback(const XnProperty* pSenser, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::OutputFormatValueChangedCallback(const XnProperty* /*pSenser*/, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
return pStream->OnOutputFormatChanged();
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::FixCroppingCallback(const XnProperty* pSenser, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::FixCroppingCallback(const XnProperty* /*pSenser*/, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
return pStream->FixCropping();
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::SetResolutionCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::SetResolutionCallback(XnActualIntProperty* /*pSenser*/, XnUInt64 nValue, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
return pStream->SetResolution((XnResolutions)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::SetXResCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::SetXResCallback(XnActualIntProperty* /*pSenser*/, XnUInt64 nValue, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
return pStream->SetXRes((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::SetYResCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::SetYResCallback(XnActualIntProperty* /*pSenser*/, XnUInt64 nValue, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
return pStream->SetYRes((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnPixelStream::SetCroppingCallback(XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnPixelStream::SetCroppingCallback(XnActualGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XnPixelStream* pStream = (XnPixelStream*)pCookie;
if (gbValue.nDataSize != sizeof(XnCropping))
@@ -448,10 +429,10 @@ XnStatus XN_CALLBACK_TYPE XnPixelStream::ReadCroppingFromFileCallback(XnGeneralP
XN_STATUS_OK == xnOSReadIntFromINI(csINIFile, csCroppingSection, "Enabled", &bEnabled))
{
XnCropping Cropping;
- Cropping.nXOffset = nOffsetX;
- Cropping.nYOffset = nOffsetY;
- Cropping.nXSize = nSizeX;
- Cropping.nYSize = nSizeY;
+ Cropping.nXOffset = (XnUInt16)nOffsetX;
+ Cropping.nYOffset = (XnUInt16)nOffsetY;
+ Cropping.nXSize = (XnUInt16)nSizeX;
+ Cropping.nYSize = (XnUInt16)nSizeY;
Cropping.bEnabled = bEnabled;
// set value
@@ -461,3 +442,35 @@ XnStatus XN_CALLBACK_TYPE XnPixelStream::ReadCroppingFromFileCallback(XnGeneralP
return (XN_STATUS_OK);
}
+
+XnStatus XN_CALLBACK_TYPE XnPixelStream::GetSupportedModesCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
+{
+ XnPixelStream* pThis = (XnPixelStream*)pCookie;
+ if ((gbValue.nDataSize % sizeof(XnCmosPreset)) != 0)
+ {
+ return XN_STATUS_INVALID_BUFFER_SIZE;
+ }
+
+ XnUInt32 nCount = gbValue.nDataSize / sizeof(XnCmosPreset);
+ if (pThis->m_SupportedModesCount.GetValue() != nCount)
+ {
+ return XN_STATUS_INVALID_BUFFER_SIZE;
+ }
+
+ return pThis->GetSupportedModes((XnCmosPreset*)gbValue.pData, nCount);
+}
+
+//---------------------------------------------------------------------------
+// XnResolutionProperty
+//---------------------------------------------------------------------------
+XnPixelStream::XnResolutionProperty::XnResolutionProperty(const XnChar* strName, XnUInt64 nInitialValue /* = 0 */, const XnChar* strModule /* = "" */) :
+ XnActualIntProperty(strName, nInitialValue, strModule)
+{
+}
+
+XnBool XnPixelStream::XnResolutionProperty::ConvertValueToString(XnChar* csValue, const void* pValue) const
+{
+ XnUInt64 nValue = *(XnUInt64*)pValue;
+ strcpy(csValue, XnDDKGetResolutionName((XnResolutions)nValue));
+ return TRUE;
+}
\ No newline at end of file
diff --git a/Source/XnDDK/XnPixelStream.h b/Source/XnDDK/XnPixelStream.h
index ff10b58..7c72dae 100644
--- a/Source/XnDDK/XnPixelStream.h
+++ b/Source/XnDDK/XnPixelStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PIXEL_STREAM_H__
#define __XN_PIXEL_STREAM_H__
@@ -32,6 +27,7 @@
//---------------------------------------------------------------------------
#include
#include
+#include
//---------------------------------------------------------------------------
// Types
@@ -59,6 +55,9 @@ class XN_DDK_CPP_API XnPixelStream : public XnFrameStream
inline const XnCropping* GetCropping() const { return (XnCropping*)m_Cropping.GetValue().pData; }
protected:
+ XnStatus AddSupportedModes(XnCmosPreset* aPresets, XnUInt32 nCount);
+ XnStatus ValidateSupportedMode(const XnCmosPreset& preset);
+
//---------------------------------------------------------------------------
// Properties Getters
//---------------------------------------------------------------------------
@@ -94,9 +93,17 @@ class XN_DDK_CPP_API XnPixelStream : public XnFrameStream
XnStatus ValidateCropping(const XnCropping* pCropping);
private:
+ class XN_DDK_CPP_API XnResolutionProperty : public XnActualIntProperty
+ {
+ public:
+ XnResolutionProperty(const XnChar* strName, XnUInt64 nInitialValue = 0, const XnChar* strModule = "");
+ XnBool ConvertValueToString(XnChar* csValue, const void* pValue) const;
+ };
+
XnStatus OnResolutionChanged();
XnStatus OnOutputFormatChanged();
XnStatus FixCropping();
+ XnStatus GetSupportedModes(XnCmosPreset* aPresets, XnUInt32& nCount);
static XnStatus XN_CALLBACK_TYPE SetResolutionCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetXResCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie);
@@ -106,12 +113,12 @@ class XN_DDK_CPP_API XnPixelStream : public XnFrameStream
static XnStatus XN_CALLBACK_TYPE OutputFormatValueChangedCallback(const XnProperty* pSenser, void* pCookie);
static XnStatus XN_CALLBACK_TYPE FixCroppingCallback(const XnProperty* pSenser, void* pCookie);
static XnStatus XN_CALLBACK_TYPE ReadCroppingFromFileCallback(XnGeneralProperty* pSender, const XnChar* csINIFile, const XnChar* csSection);
-
+ static XnStatus XN_CALLBACK_TYPE GetSupportedModesCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
//---------------------------------------------------------------------------
// Members
//---------------------------------------------------------------------------
XnActualIntProperty m_IsPixelStream;
- XnActualIntProperty m_Resolution;
+ XnResolutionProperty m_Resolution;
XnActualIntProperty m_XRes;
XnActualIntProperty m_YRes;
XnActualIntProperty m_BytesPerPixel;
@@ -119,6 +126,10 @@ class XN_DDK_CPP_API XnPixelStream : public XnFrameStream
XnCropping m_CroppingData;
+ XnActualIntProperty m_SupportedModesCount;
+ XnGeneralProperty m_SupportedModes;
+
+ XnArray m_supportedModesData;
XnBool m_bAllowCustomResolutions;
};
diff --git a/Source/XnDDK/XnProperty.cpp b/Source/XnDDK/XnProperty.cpp
index f84f329..42c548f 100644
--- a/Source/XnDDK/XnProperty.cpp
+++ b/Source/XnDDK/XnProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -67,8 +61,6 @@ XnStatus XnProperty::SetValue(const void* pValue)
if (m_LogSeverity != -1)
{
XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
- XnBool bValueString = FALSE;
-
if (ConvertValueToString(strValue, pValue))
{
xnLogWrite(XN_MASK_DDK, (XnLogSeverity)m_LogSeverity, __FILE__, __LINE__, "Setting %s.%s to %s...", GetModule(), GetName(), strValue);
@@ -79,8 +71,6 @@ XnStatus XnProperty::SetValue(const void* pValue)
}
}
- XnBool bShouldSet = TRUE;
-
if (!m_bAlwaysSet && IsActual() && IsEqual(m_pValueHolder, pValue))
{
xnLogWrite(XN_MASK_DDK, (XnLogSeverity)m_LogSeverity, __FILE__, __LINE__, "%s.%s value did not change.", GetModule(), GetName());
@@ -172,7 +162,7 @@ void XnProperty::UpdateGetCallback(GetFuncPtr pFunc, void* pCookie)
m_pGetCallbackCookie = pCookie;
}
-XnBool XnProperty::ConvertValueToString(XnChar* csValue, const void* pValue) const
+XnBool XnProperty::ConvertValueToString(XnChar* /*csValue*/, const void* /*pValue*/) const
{
return FALSE;
}
diff --git a/Source/XnDDK/XnProperty.h b/Source/XnDDK/XnProperty.h
index adf7f66..0edb96a 100644
--- a/Source/XnDDK/XnProperty.h
+++ b/Source/XnDDK/XnProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PROPERTY_H__
#define __XN_PROPERTY_H__
diff --git a/Source/XnDDK/XnPropertySet.cpp b/Source/XnDDK/XnPropertySet.cpp
index 8301d7d..c79a51e 100644
--- a/Source/XnDDK/XnPropertySet.cpp
+++ b/Source/XnDDK/XnPropertySet.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -39,8 +33,13 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+
struct XnPropertySetModuleEnumerator
{
+ XnPropertySetModuleEnumerator(XnPropertySetData* pModules) :
+ bFirst(TRUE), pModules(pModules), it(pModules->end())
+ {}
+
XnBool bFirst;
XnPropertySetData* pModules;
XnPropertySetData::ConstIterator it;
@@ -48,11 +47,17 @@ struct XnPropertySetModuleEnumerator
struct XnPropertySetEnumerator
{
+ XnPropertySetEnumerator(XnPropertySetData* pModules, const XnChar* strModule) :
+ bFirst(TRUE), pModules(pModules), itModule(pModules->end()), pItProp(NULL)
+ {
+ strncpy(this->strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH);
+ }
+
XnBool bFirst;
XnPropertySetData* pModules;
XnPropertySetData::ConstIterator itModule;
XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
- XnActualPropertiesHash::ConstIterator itProp;
+ XnActualPropertiesHash::ConstIterator* pItProp;
};
//---------------------------------------------------------------------------
@@ -61,8 +66,6 @@ struct XnPropertySetEnumerator
XN_DDK_API XnStatus XnPropertySetCreate(XnPropertySet** ppSet)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_OUTPUT_PTR(ppSet);
XnPropertySet* pSet;
@@ -82,8 +85,6 @@ XN_DDK_API XnStatus XnPropertySetCreate(XnPropertySet** ppSet)
XN_DDK_API XnStatus XnPropertySetDestroy(XnPropertySet** ppSet)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(ppSet);
XN_VALIDATE_INPUT_PTR(*ppSet);
@@ -259,7 +260,6 @@ XN_DDK_API XnStatus XnPropertySetRemoveProperty(XnPropertySet* pSet, const XnCha
XN_IS_STATUS_OK(nRetVal);
// remove the property
- XnProperty* pProp;
nRetVal = pModule->Remove(strProperty);
XN_IS_STATUS_OK(nRetVal);
@@ -268,17 +268,11 @@ XN_DDK_API XnStatus XnPropertySetRemoveProperty(XnPropertySet* pSet, const XnCha
XN_DDK_API XnStatus XnPropertySetGetModuleEnumerator(const XnPropertySet* pSet, XnPropertySetModuleEnumerator** ppEnumerator)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pSet);
XN_VALIDATE_OUTPUT_PTR(ppEnumerator);
XnPropertySetModuleEnumerator* pEnumer;
- XN_VALIDATE_ALLOC(pEnumer, XnPropertySetModuleEnumerator);
-
- pEnumer->bFirst = TRUE;
- pEnumer->it = pSet->pData->end();
- pEnumer->pModules = pSet->pData;
+ XN_VALIDATE_NEW(pEnumer, XnPropertySetModuleEnumerator, pSet->pData);
*ppEnumerator = pEnumer;
@@ -287,12 +281,10 @@ XN_DDK_API XnStatus XnPropertySetGetModuleEnumerator(const XnPropertySet* pSet,
XN_DDK_API XnStatus XnPropertySetModuleEnumeratorFree(XnPropertySetModuleEnumerator** ppEnumer)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(ppEnumer);
XN_VALIDATE_INPUT_PTR(*ppEnumer);
- xnOSFree(*ppEnumer);
+ XN_DELETE(*ppEnumer);
*ppEnumer = NULL;
return (XN_STATUS_OK);
@@ -300,8 +292,6 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorFree(XnPropertySetModuleEnumera
XN_DDK_API XnStatus XnPropertySetModuleEnumeratorMoveNext(XnPropertySetModuleEnumerator* pEnumerator, XnBool* pbEnd)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pbEnd);
@@ -326,8 +316,6 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorMoveNext(XnPropertySetModuleEnu
XN_DDK_API XnStatus XnPropertySetModuleEnumeratorGetCurrent(const XnPropertySetModuleEnumerator* pEnumer, const XnChar** pstrModuleName)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumer);
XN_VALIDATE_OUTPUT_PTR(pstrModuleName);
@@ -357,19 +345,8 @@ XN_DDK_API XnStatus XnPropertySetGetEnumerator(const XnPropertySet* pSet, XnProp
}
XnPropertySetEnumerator* pEnumer;
- XN_VALIDATE_ALLOC(pEnumer, XnPropertySetEnumerator);
+ XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator, pSet->pData, strModule == NULL ? "" : strModule);
- pEnumer->bFirst = TRUE;
- pEnumer->pModules = pSet->pData;
- if (strModule != NULL)
- {
- strncpy(pEnumer->strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH);
- }
- else
- {
- pEnumer->strModule[0] = '\0';
- }
-
*ppEnumerator = pEnumer;
return (XN_STATUS_OK);
@@ -398,12 +375,10 @@ XN_DDK_API XnStatus XnPropertySetFindProperty(const XnPropertySet* pSet, const X
// create enumerator
XnPropertySetEnumerator* pEnumer;
- XN_VALIDATE_ALLOC(pEnumer, XnPropertySetEnumerator);
+ XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator, pSet->pData, "");
pEnumer->itModule = itModule;
- pEnumer->itProp = itProp;
- pEnumer->pModules = pSet->pData;
- pEnumer->strModule[0] = '\0';
+ XN_VALIDATE_NEW(pEnumer->pItProp, XnActualPropertiesHash::ConstIterator, itProp);
pEnumer->bFirst = FALSE;
*ppEnumerator = pEnumer;
@@ -413,12 +388,11 @@ XN_DDK_API XnStatus XnPropertySetFindProperty(const XnPropertySet* pSet, const X
XN_DDK_API XnStatus XnPropertySetEnumeratorFree(XnPropertySetEnumerator** ppEnumerator)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(ppEnumerator);
XN_VALIDATE_INPUT_PTR(*ppEnumerator);
- xnOSFree(*ppEnumerator);
+ XN_DELETE((*ppEnumerator)->pItProp);
+ XN_DELETE(*ppEnumerator);
*ppEnumerator = NULL;
return (XN_STATUS_OK);
@@ -447,19 +421,19 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
}
XN_IS_STATUS_OK(nRetVal);
- pEnumerator->itProp = pEnumerator->itModule.Value()->begin();
+ XN_VALIDATE_NEW(pEnumerator->pItProp, XnActualPropertiesHash::ConstIterator, pEnumerator->itModule.Value()->begin());
}
- else if (pEnumerator->itProp == pEnumerator->itModule.Value()->end())
+ else if (*pEnumerator->pItProp == pEnumerator->itModule.Value()->end())
{
return XN_STATUS_ILLEGAL_POSITION;
}
else
{
// advance prop iterator
- pEnumerator->itProp++;
+ ++(*pEnumerator->pItProp);
}
- *pbEnd = (pEnumerator->itProp == pEnumerator->itModule.Value()->end());
+ *pbEnd = (*pEnumerator->pItProp == pEnumerator->itModule.Value()->end());
}
else // all modules
{
@@ -477,7 +451,7 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
// if we found one, take it's first property
if (pEnumerator->itModule != pEnumerator->pModules->end())
{
- pEnumerator->itProp = pEnumerator->itModule.Value()->begin();
+ XN_VALIDATE_NEW(pEnumerator->pItProp, XnActualPropertiesHash::ConstIterator, pEnumerator->itModule.Value()->begin());
*pbEnd = FALSE;
}
else
@@ -485,18 +459,21 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
*pbEnd = TRUE;
}
}
- else if (pEnumerator->itModule == pEnumerator->pModules->end())
+ else if (*pEnumerator->pItProp == pEnumerator->pModules->end())
{
return XN_STATUS_ILLEGAL_POSITION;
}
else
{
// move to next one
- pEnumerator->itProp++;
+ ++(*pEnumerator->pItProp);
// check if we reached end of module
- if (pEnumerator->itProp == pEnumerator->itModule.Value()->end())
+ if (*pEnumerator->pItProp == pEnumerator->itModule.Value()->end())
{
+ XN_DELETE(pEnumerator->pItProp);
+ pEnumerator->pItProp = NULL;
+
// move to next module with properties
do
{
@@ -507,7 +484,7 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
// if we found one, take it's first property
if (pEnumerator->itModule != pEnumerator->pModules->end())
{
- pEnumerator->itProp = pEnumerator->itModule.Value()->begin();
+ XN_VALIDATE_NEW(pEnumerator->pItProp, XnActualPropertiesHash::ConstIterator, pEnumerator->itModule.Value()->begin());
*pbEnd = FALSE;
}
else
@@ -527,14 +504,17 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
XN_DDK_API XnStatus XnPropertySetEnumeratorGetCurrentPropertyInfo(const XnPropertySetEnumerator* pEnumerator, XnPropertyType* pnType, const XnChar** pstrModule, const XnChar** pstrProp)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pnType);
XN_VALIDATE_OUTPUT_PTR(pstrModule);
XN_VALIDATE_OUTPUT_PTR(pstrProp);
- XnProperty* pProp = pEnumerator->itProp.Value();
+ if (pEnumerator->pItProp == NULL)
+ {
+ return XN_STATUS_ILLEGAL_POSITION;
+ }
+
+ XnProperty* pProp = pEnumerator->pItProp->Value();
*pnType = pProp->GetType();
*pstrModule = pProp->GetModule();
*pstrProp = pProp->GetName();
@@ -544,12 +524,15 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetCurrentPropertyInfo(const XnProper
XN_DDK_API XnStatus XnPropertySetEnumeratorGetIntValue(const XnPropertySetEnumerator* pEnumerator, XnUInt64* pnValue)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pnValue);
- XnProperty* pPropBase = pEnumerator->itProp.Value();
+ if (pEnumerator->pItProp == NULL)
+ {
+ return XN_STATUS_ILLEGAL_POSITION;
+ }
+
+ XnProperty* pPropBase = pEnumerator->pItProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_INTEGER)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -563,12 +546,15 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetIntValue(const XnPropertySetEnumer
XN_DDK_API XnStatus XnPropertySetEnumeratorGetRealValue(const XnPropertySetEnumerator* pEnumerator, XnDouble* pdValue)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pdValue);
- XnProperty* pPropBase = pEnumerator->itProp.Value();
+ if (pEnumerator->pItProp == NULL)
+ {
+ return XN_STATUS_ILLEGAL_POSITION;
+ }
+
+ XnProperty* pPropBase = pEnumerator->pItProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_REAL)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -582,12 +568,15 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetRealValue(const XnPropertySetEnume
XN_DDK_API XnStatus XnPropertySetEnumeratorGetStringValue(const XnPropertySetEnumerator* pEnumerator, const XnChar** pstrValue)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pstrValue);
- XnProperty* pPropBase = pEnumerator->itProp.Value();
+ if (pEnumerator->pItProp == NULL)
+ {
+ return XN_STATUS_ILLEGAL_POSITION;
+ }
+
+ XnProperty* pPropBase = pEnumerator->pItProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_STRING)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -601,12 +590,15 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetStringValue(const XnPropertySetEnu
XN_DDK_API XnStatus XnPropertySetEnumeratorGetGeneralValue(const XnPropertySetEnumerator* pEnumerator, XnGeneralBuffer* pgbValue)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pgbValue);
- XnProperty* pPropBase = pEnumerator->itProp.Value();
+ if (pEnumerator->pItProp == NULL)
+ {
+ return XN_STATUS_ILLEGAL_POSITION;
+ }
+
+ XnProperty* pPropBase = pEnumerator->pItProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_GENERAL)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -647,7 +639,7 @@ XN_DDK_API XnStatus XnPropertySetDataDetachModule(XnPropertySetData* pSetData, c
return (XN_STATUS_OK);
}
-XN_DDK_API XnStatus XnPropertySetCloneModule(XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName)
+XN_DDK_API XnStatus XnPropertySetCloneModule(const XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName)
{
XnStatus nRetVal = XN_STATUS_OK;
diff --git a/Source/XnDDK/XnPropertySetInternal.h b/Source/XnDDK/XnPropertySetInternal.h
index 2f3b287..f17932d 100644
--- a/Source/XnDDK/XnPropertySetInternal.h
+++ b/Source/XnDDK/XnPropertySetInternal.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PROPERTY_SET_INTERNAL_H__
#define __XN_PROPERTY_SET_INTERNAL_H__
@@ -58,6 +54,6 @@ class XnPropertySetData : public XnPropertySetDataInternal
XN_DDK_API XnStatus XnPropertySetDataAttachModule(XnPropertySetData* pSetData, const XnChar* strModuleName, XnActualPropertiesHash* pModule);
XN_DDK_API XnStatus XnPropertySetDataDetachModule(XnPropertySetData* pSetData, const XnChar* strModuleName, XnActualPropertiesHash** ppModule);
-XN_DDK_API XnStatus XnPropertySetCloneModule(XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName);
+XN_DDK_API XnStatus XnPropertySetCloneModule(const XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName);
#endif //__XN_PROPERTY_SET_INTERNAL_H__
diff --git a/Source/XnDDK/XnRealProperty.cpp b/Source/XnDDK/XnRealProperty.cpp
index 5980939..060b5d0 100644
--- a/Source/XnDDK/XnRealProperty.cpp
+++ b/Source/XnDDK/XnRealProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnRealProperty.h b/Source/XnDDK/XnRealProperty.h
index 2af3c24..13e553b 100644
--- a/Source/XnDDK/XnRealProperty.h
+++ b/Source/XnDDK/XnRealProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_REAL_PROPERTY_H__
#define __XN_REAL_PROPERTY_H__
diff --git a/Source/XnDDK/XnShiftToDepth.cpp b/Source/XnDDK/XnShiftToDepth.cpp
index 47a0394..bb87d49 100644
--- a/Source/XnDDK/XnShiftToDepth.cpp
+++ b/Source/XnDDK/XnShiftToDepth.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -88,7 +82,7 @@ XN_DDK_API XnStatus XnShiftToDepthUpdate(XnShiftToDepthTables* pShiftToDepth, co
for (nIndex = 1; nIndex < pConfig->nDeviceMaxShiftValue; nIndex++)
{
- nShiftValue = nIndex;
+ nShiftValue = (XnInt16)nIndex;
dFixedRefX = (XnDouble)(nShiftValue - nConstShift) / (XnDouble)pConfig->nParamCoeff;
dFixedRefX -= 0.375;
@@ -103,7 +97,7 @@ XN_DDK_API XnStatus XnShiftToDepthUpdate(XnShiftToDepthTables* pShiftToDepth, co
for (XnUInt16 i = nLastDepth; i < dDepth; i++)
pDepthToShiftTable[i] = nLastIndex;
- nLastIndex = nIndex;
+ nLastIndex = (XnUInt16)nIndex;
nLastDepth = (XnUInt16)dDepth;
}
}
diff --git a/Source/XnDDK/XnShiftToDepth.h b/Source/XnDDK/XnShiftToDepth.h
index cdfca90..d6dd97e 100644
--- a/Source/XnDDK/XnShiftToDepth.h
+++ b/Source/XnDDK/XnShiftToDepth.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_SHIFT_TO_DEPTH_H_
#define _XN_SHIFT_TO_DEPTH_H_
diff --git a/Source/XnDDK/XnShiftToDepthStreamHelper.cpp b/Source/XnDDK/XnShiftToDepthStreamHelper.cpp
index 27c6e2b..50da849 100644
--- a/Source/XnDDK/XnShiftToDepthStreamHelper.cpp
+++ b/Source/XnDDK/XnShiftToDepthStreamHelper.cpp
@@ -1,34 +1,30 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#include "XnShiftToDepthStreamHelper.h"
-XnShiftToDepthStreamHelper::XnShiftToDepthStreamHelper(XnDeviceModule* pModule) :
+XnShiftToDepthStreamHelper::XnShiftToDepthStreamHelper() :
m_ShiftToDepthTable(XN_STREAM_PROPERTY_S2D_TABLE, NULL, 0, NULL),
m_DepthToShiftTable(XN_STREAM_PROPERTY_D2S_TABLE, NULL, 0, NULL),
- m_pModule(pModule),
+ m_pModule(NULL),
m_bPropertiesAdded(FALSE)
{
m_ShiftToDepthTable.UpdateGetCallback(GetShiftToDepthTableCallback, this);
@@ -41,9 +37,12 @@ XnShiftToDepthStreamHelper::~XnShiftToDepthStreamHelper()
XnShiftToDepthStreamHelper::Free();
}
-XnStatus XnShiftToDepthStreamHelper::Init()
+XnStatus XnShiftToDepthStreamHelper::Init(XnDeviceModule* pModule)
{
XnStatus nRetVal = XN_STATUS_OK;
+
+ XN_VALIDATE_INPUT_PTR(pModule);
+ m_pModule = pModule;
// old depth streams did not have S2D tables as actual properties. Add these properties
XnBool bDoesExist = FALSE;
@@ -273,25 +272,25 @@ XnStatus XnShiftToDepthStreamHelper::GetDepthToShiftTableImpl(const XnGeneralBuf
return XN_STATUS_OK;
}
-XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::GetShiftToDepthTableCallback(const XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::GetShiftToDepthTableCallback(const XnActualGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XnShiftToDepthStreamHelper* pStream = (XnShiftToDepthStreamHelper*)pCookie;
return pStream->GetShiftToDepthTableImpl(gbValue);
}
-XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::GetDepthToShiftTableCallback(const XnActualGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::GetDepthToShiftTableCallback(const XnActualGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XnShiftToDepthStreamHelper* pStream = (XnShiftToDepthStreamHelper*)pCookie;
return pStream->GetDepthToShiftTableImpl(gbValue);
}
-XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::ShiftToDepthPropertyValueChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::ShiftToDepthPropertyValueChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnShiftToDepthStreamHelper* pStream = (XnShiftToDepthStreamHelper*)pCookie;
return pStream->OnShiftToDepthPropertyValueChanged();
}
-XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::DeviceS2DTablesSizeChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnShiftToDepthStreamHelper::DeviceS2DTablesSizeChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnShiftToDepthStreamHelper* pStream = (XnShiftToDepthStreamHelper*)pCookie;
return pStream->OnDeviceS2DTablesSizeChanged();
diff --git a/Source/XnDDK/XnShiftToDepthStreamHelper.h b/Source/XnDDK/XnShiftToDepthStreamHelper.h
index a409d75..ba68ef4 100644
--- a/Source/XnDDK/XnShiftToDepthStreamHelper.h
+++ b/Source/XnDDK/XnShiftToDepthStreamHelper.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SHIFT_TO_DEPTH_STREAM_HELPER_H__
#define __XN_SHIFT_TO_DEPTH_STREAM_HELPER_H__
@@ -32,10 +28,10 @@
class XN_DDK_CPP_API XnShiftToDepthStreamHelper
{
public:
- XnShiftToDepthStreamHelper(XnDeviceModule* pModule);
+ XnShiftToDepthStreamHelper();
virtual ~XnShiftToDepthStreamHelper();
- XnStatus Init();
+ XnStatus Init(XnDeviceModule* pModule);
XnStatus Free();
inline XnDepthPixel* GetShiftToDepthTable() const { return m_ShiftToDepthTables.pShiftToDepthTable; }
diff --git a/Source/XnDDK/XnSimpleBufferPool.cpp b/Source/XnDDK/XnSimpleBufferPool.cpp
index ea0e99f..c73bd5c 100644
--- a/Source/XnDDK/XnSimpleBufferPool.cpp
+++ b/Source/XnDDK/XnSimpleBufferPool.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnSimpleBufferPool.h b/Source/XnDDK/XnSimpleBufferPool.h
index 55ceb1f..b30e14d 100644
--- a/Source/XnDDK/XnSimpleBufferPool.h
+++ b/Source/XnDDK/XnSimpleBufferPool.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SIMPLE_BUFFER_POOL_H__
#define __XN_SIMPLE_BUFFER_POOL_H__
diff --git a/Source/XnDDK/XnStreamData.cpp b/Source/XnDDK/XnStreamData.cpp
index 0b6e425..2abfee7 100644
--- a/Source/XnDDK/XnStreamData.cpp
+++ b/Source/XnDDK/XnStreamData.cpp
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -36,8 +31,6 @@
//---------------------------------------------------------------------------
XN_DDK_API XnStatus XnStreamDataCreateNoBuffer(XnStreamData** ppStreamOutput, const XnChar* StreamName)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_OUTPUT_PTR(ppStreamOutput);
// allocate struct
@@ -87,8 +80,6 @@ XN_DDK_API XnStatus XnStreamDataCreate(XnStreamData** ppStreamOutput, const XnCh
XN_DDK_API XnStatus XnStreamDataUpdateSize(XnStreamData* pStreamOutput, XnUInt32 nAllocSize)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(pStreamOutput);
// allocate new memory
diff --git a/Source/XnDDK/XnStreamDataInternal.h b/Source/XnDDK/XnStreamDataInternal.h
index 510e756..f31cb65 100644
--- a/Source/XnDDK/XnStreamDataInternal.h
+++ b/Source/XnDDK/XnStreamDataInternal.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_DATA_INTERNAL_H__
#define __XN_STREAM_DATA_INTERNAL_H__
diff --git a/Source/XnDDK/XnStreamDataSet.cpp b/Source/XnDDK/XnStreamDataSet.cpp
index 9e21ba1..acd6960 100644
--- a/Source/XnDDK/XnStreamDataSet.cpp
+++ b/Source/XnDDK/XnStreamDataSet.cpp
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnStreamDataSetInternal.h b/Source/XnDDK/XnStreamDataSetInternal.h
index 331dd1c..ce22673 100644
--- a/Source/XnDDK/XnStreamDataSetInternal.h
+++ b/Source/XnDDK/XnStreamDataSetInternal.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_DATA_SET_INTERNAL_H__
#define __XN_STREAM_DATA_SET_INTERNAL_H__
diff --git a/Source/XnDDK/XnStreamDevice.cpp b/Source/XnDDK/XnStreamDevice.cpp
index c7d527e..2193ee0 100644
--- a/Source/XnDDK/XnStreamDevice.cpp
+++ b/Source/XnDDK/XnStreamDevice.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -67,12 +61,12 @@ void XnStreamDevice::DestroyImpl(XnBool bHasVTable)
}
}
-XnStatus XnStreamDevice::Seek(XnUInt64 nTimestamp)
+XnStatus XnStreamDevice::Seek(XnUInt64 /*nTimestamp*/)
{
return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED;
}
-XnStatus XnStreamDevice::SeekFrame(XnUInt32 nFrameID)
+XnStatus XnStreamDevice::SeekFrame(XnUInt32 /*nFrameID*/)
{
return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED;
}
diff --git a/Source/XnDDK/XnStreamDevice.h b/Source/XnDDK/XnStreamDevice.h
index a82ba21..7680da4 100644
--- a/Source/XnDDK/XnStreamDevice.h
+++ b/Source/XnDDK/XnStreamDevice.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_DEVICE_H__
#define __XN_STREAM_DEVICE_H__
diff --git a/Source/XnDDK/XnStreamDeviceStreamHolder.cpp b/Source/XnDDK/XnStreamDeviceStreamHolder.cpp
index febe781..5e070a5 100644
--- a/Source/XnDDK/XnStreamDeviceStreamHolder.cpp
+++ b/Source/XnDDK/XnStreamDeviceStreamHolder.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -225,7 +219,7 @@ XnStatus XnStreamDeviceStreamHolder::ChooseCodec()
return (XN_STATUS_OK);
}
-XnStatus XnStreamDeviceStreamHolder::CodecPropertyChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XnStreamDeviceStreamHolder::CodecPropertyChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnStreamDeviceStreamHolder* pThis = (XnStreamDeviceStreamHolder*)pCookie;
return pThis->ChooseCodec();
diff --git a/Source/XnDDK/XnStreamDeviceStreamHolder.h b/Source/XnDDK/XnStreamDeviceStreamHolder.h
index a01ed06..56e6ada 100644
--- a/Source/XnDDK/XnStreamDeviceStreamHolder.h
+++ b/Source/XnDDK/XnStreamDeviceStreamHolder.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_DEVICE_STREAM_HOLDER_H__
#define __XN_STREAM_DEVICE_STREAM_HOLDER_H__
diff --git a/Source/XnDDK/XnStreamReaderDevice.cpp b/Source/XnDDK/XnStreamReaderDevice.cpp
index d0f6dc0..cc5e37b 100644
--- a/Source/XnDDK/XnStreamReaderDevice.cpp
+++ b/Source/XnDDK/XnStreamReaderDevice.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -171,8 +165,6 @@ XnStatus XnStreamReaderDevice::SetInitialState(const XnDeviceConfig* pDeviceConf
XnStatus XnStreamReaderDevice::CreateStreamModule(const XnChar* StreamType, const XnChar* StreamName, XnDeviceModuleHolder** ppStreamHolder)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnStreamReaderStream* pStream;
XN_VALIDATE_NEW(pStream, XnStreamReaderStream, StreamType, StreamName);
@@ -485,7 +477,7 @@ XnStatus XnStreamReaderDevice::ReadStreamData()
return (XN_STATUS_OK);
}
-XnStatus XnStreamReaderDevice::HandleStreamData(XnStreamData* pDataProps, XnCompressionFormats nCompression, XnUInt32 nCompressedSize)
+XnStatus XnStreamReaderDevice::HandleStreamData(XnStreamData* pDataProps, XnCompressionFormats /*nCompression*/, XnUInt32 /*nCompressedSize*/)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -505,7 +497,7 @@ XnStatus XnStreamReaderDevice::HandleStreamData(XnStreamData* pDataProps, XnComp
nRetVal = GetDataPacker()->ReadStreamData(pStreamData, pStreamHolder->GetCodec());
XN_IS_STATUS_OK(nRetVal);
- pStream->NewDataAvailable();
+ pStream->NewDataAvailable(pStreamData->nTimestamp, pStreamData->nFrameID);
return (XN_STATUS_OK);
}
diff --git a/Source/XnDDK/XnStreamReaderDevice.h b/Source/XnDDK/XnStreamReaderDevice.h
index 6f91d17..ad46004 100644
--- a/Source/XnDDK/XnStreamReaderDevice.h
+++ b/Source/XnDDK/XnStreamReaderDevice.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_READER_DEVICE_H__
#define __XN_STREAM_READER_DEVICE_H__
diff --git a/Source/XnDDK/XnStreamReaderStream.cpp b/Source/XnDDK/XnStreamReaderStream.cpp
index 0b5f10d..60297a9 100644
--- a/Source/XnDDK/XnStreamReaderStream.cpp
+++ b/Source/XnDDK/XnStreamReaderStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -76,8 +70,6 @@ XnStatus XnStreamReaderStream::Free()
XnStatus XnStreamReaderStream::ReadImpl(XnStreamData* pStreamData)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
pStreamData->nFrameID = m_pLastData->nFrameID;
pStreamData->nTimestamp = m_pLastData->nTimestamp;
@@ -103,8 +95,9 @@ XnStatus XnStreamReaderStream::CalcRequiredSize(XnUInt32* pnRequiredSize) const
return XN_STATUS_OK;
}
-void XnStreamReaderStream::NewDataAvailable()
+void XnStreamReaderStream::NewDataAvailable(XnUInt64 nTimestamp, XnUInt32 /*nFrameID*/)
{
+ m_pLastData->nTimestamp = nTimestamp;
m_pLastData->nFrameID = ++m_nLastFrameIDFromStream;
XnDeviceStream::NewDataAvailable(m_pLastData->nTimestamp, m_pLastData->nFrameID);
}
@@ -135,7 +128,7 @@ XnStatus XnStreamReaderStream::OnRequiredSizeChanged()
return (XN_STATUS_OK);
}
-XnStatus XnStreamReaderStream::RequiredSizeChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XnStreamReaderStream::RequiredSizeChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnStreamReaderStream* pThis = (XnStreamReaderStream*)pCookie;
return pThis->OnRequiredSizeChanged();
diff --git a/Source/XnDDK/XnStreamReaderStream.h b/Source/XnDDK/XnStreamReaderStream.h
index 3f21763..1792bad 100644
--- a/Source/XnDDK/XnStreamReaderStream.h
+++ b/Source/XnDDK/XnStreamReaderStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_READER_STREAM_H__
#define __XN_STREAM_READER_STREAM_H__
@@ -45,14 +40,14 @@ class XN_DDK_CPP_API XnStreamReaderStream : public XnDeviceStream
XnStatus Free();
inline XnStreamData* GetStreamData() { return m_pLastData; }
- void NewDataAvailable();
+ virtual void NewDataAvailable(XnUInt64 nTimestamp, XnUInt32 nFrameID);
void ReMarkDataAsNew();
void Reset();
protected:
- XnStatus WriteImpl(XnStreamData* pStreamData) { return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED; }
+ XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED; }
XnStatus ReadImpl(XnStreamData* pStreamOutput);
- XnStatus Mirror(XnStreamData* pStreamData) const { return XN_STATUS_OK; }
+ XnStatus Mirror(XnStreamData* /*pStreamData*/) const { return XN_STATUS_OK; }
XnStatus CalcRequiredSize(XnUInt32* pnRequiredSize) const;
diff --git a/Source/XnDDK/XnStreamReaderStreamHolder.cpp b/Source/XnDDK/XnStreamReaderStreamHolder.cpp
index 63b948f..0f55cfa 100644
--- a/Source/XnDDK/XnStreamReaderStreamHolder.cpp
+++ b/Source/XnDDK/XnStreamReaderStreamHolder.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -52,8 +46,8 @@ XnStatus XnStreamReaderStreamHolder::Init(const XnActualPropertiesHash* pProps)
if (strcmp(GetStream()->GetType(), XN_STREAM_TYPE_DEPTH) == 0)
{
- XN_VALIDATE_NEW(m_pS2DHelper, XnShiftToDepthStreamHelper, GetStream());
- nRetVal = m_pS2DHelper->Init();
+ XN_VALIDATE_NEW(m_pS2DHelper, XnShiftToDepthStreamHelper);
+ nRetVal = m_pS2DHelper->Init(GetStream());
XN_IS_STATUS_OK(nRetVal);
}
@@ -62,8 +56,6 @@ XnStatus XnStreamReaderStreamHolder::Init(const XnActualPropertiesHash* pProps)
XnStatus XnStreamReaderStreamHolder::Free()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (m_pS2DHelper != NULL)
{
m_pS2DHelper->Free();
diff --git a/Source/XnDDK/XnStreamReaderStreamHolder.h b/Source/XnDDK/XnStreamReaderStreamHolder.h
index e48a049..af37c39 100644
--- a/Source/XnDDK/XnStreamReaderStreamHolder.h
+++ b/Source/XnDDK/XnStreamReaderStreamHolder.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_READER_STREAM_HOLDER_H__
#define __XN_STREAM_READER_STREAM_HOLDER_H__
diff --git a/Source/XnDDK/XnStreamWriterDevice.cpp b/Source/XnDDK/XnStreamWriterDevice.cpp
index 6bfa1c8..afe431e 100644
--- a/Source/XnDDK/XnStreamWriterDevice.cpp
+++ b/Source/XnDDK/XnStreamWriterDevice.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -310,8 +304,6 @@ XnStatus XnStreamWriterDevice::SetProperty(const XnChar* ModuleName, const XnCha
XnStatus XnStreamWriterDevice::CreateStreamModule(const XnChar* StreamType, const XnChar* StreamName, XnDeviceModuleHolder** ppStreamHolder)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnStreamWriterStream* pStream;
XN_VALIDATE_NEW(pStream, XnStreamWriterStream, StreamType, StreamName, GetDataPacker());
diff --git a/Source/XnDDK/XnStreamWriterDevice.h b/Source/XnDDK/XnStreamWriterDevice.h
index 2bd6f17..6b71fdd 100644
--- a/Source/XnDDK/XnStreamWriterDevice.h
+++ b/Source/XnDDK/XnStreamWriterDevice.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_WRITER_DEVICE_H__
#define __XN_STREAM_WRITER_DEVICE_H__
diff --git a/Source/XnDDK/XnStreamWriterStream.cpp b/Source/XnDDK/XnStreamWriterStream.cpp
index 2490775..ad75908 100644
--- a/Source/XnDDK/XnStreamWriterStream.cpp
+++ b/Source/XnDDK/XnStreamWriterStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnStreamWriterStream.h b/Source/XnDDK/XnStreamWriterStream.h
index 4c0c5fd..894c24f 100644
--- a/Source/XnDDK/XnStreamWriterStream.h
+++ b/Source/XnDDK/XnStreamWriterStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_WRITER_STREAM_H__
#define __XN_STREAM_WRITER_STREAM_H__
@@ -47,8 +42,8 @@ class XN_DDK_CPP_API XnStreamWriterStream : public XnDeviceStream
protected:
XnStatus WriteImpl(XnStreamData* pStreamData);
- XnStatus ReadImpl(XnStreamData* pStreamOutput) { return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED; }
- XnStatus Mirror(XnStreamData* pStreamData) const { return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED; }
+ XnStatus ReadImpl(XnStreamData* /*pStreamOutput*/) { return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED; }
+ XnStatus Mirror(XnStreamData* /*pStreamData*/) const { return XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED; }
XnStatus CalcRequiredSize(XnUInt32* pnRequiredSize) const;
diff --git a/Source/XnDDK/XnStreamingStream.cpp b/Source/XnDDK/XnStreamingStream.cpp
index e7d8fd2..55a3c8a 100644
--- a/Source/XnDDK/XnStreamingStream.cpp
+++ b/Source/XnDDK/XnStreamingStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -66,7 +60,7 @@ XnStatus XnStreamingStream::SetReadChunkSize(XnUInt32 nChunkSize)
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnStreamingStream::SetReadChunkSizeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnStreamingStream::SetReadChunkSizeCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnStreamingStream* pStream = (XnStreamingStream*)pCookie;
return pStream->SetReadChunkSize((XnUInt32)nValue);
diff --git a/Source/XnDDK/XnStreamingStream.h b/Source/XnDDK/XnStreamingStream.h
index fc5c7ab..49c34d8 100644
--- a/Source/XnDDK/XnStreamingStream.h
+++ b/Source/XnDDK/XnStreamingStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAMING_STREAM_H__
#define __XN_STREAMING_STREAM_H__
diff --git a/Source/XnDDK/XnStringProperty.cpp b/Source/XnDDK/XnStringProperty.cpp
index da2722d..c4d13b5 100644
--- a/Source/XnDDK/XnStringProperty.cpp
+++ b/Source/XnDDK/XnStringProperty.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDDK/XnStringProperty.h b/Source/XnDDK/XnStringProperty.h
index 49a58ff..bd5f103 100644
--- a/Source/XnDDK/XnStringProperty.h
+++ b/Source/XnDDK/XnStringProperty.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STRING_PROPERTY_H__
#define __XN_STRING_PROPERTY_H__
diff --git a/Source/XnDeviceFile/XnDeviceFile.cpp b/Source/XnDeviceFile/XnDeviceFile.cpp
index 344d3be..72d3942 100644
--- a/Source/XnDeviceFile/XnDeviceFile.cpp
+++ b/Source/XnDeviceFile/XnDeviceFile.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -51,7 +45,7 @@ XnStatus XnDeviceFile::GetDefinition(XnDeviceDefinition* pDeviceDefinition)
return (XN_STATUS_OK);
}
-XnStatus XnDeviceFile::Enumerate(XnConnectionString* aConnectionStrings, XnUInt32* pnCount)
+XnStatus XnDeviceFile::Enumerate(XnConnectionString* /*aConnectionStrings*/, XnUInt32* pnCount)
{
XN_VALIDATE_INPUT_PTR(pnCount);
diff --git a/Source/XnDeviceFile/XnDeviceFile.h b/Source/XnDeviceFile/XnDeviceFile.h
index a29e6bc..b3e2338 100644
--- a/Source/XnDeviceFile/XnDeviceFile.h
+++ b/Source/XnDeviceFile/XnDeviceFile.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICEFILE_H_
#define _XN_DEVICEFILE_H_
diff --git a/Source/XnDeviceFile/XnDeviceFileReader.cpp b/Source/XnDeviceFile/XnDeviceFileReader.cpp
index b45e10b..7139912 100644
--- a/Source/XnDeviceFile/XnDeviceFileReader.cpp
+++ b/Source/XnDeviceFile/XnDeviceFileReader.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -39,7 +33,7 @@
//---------------------------------------------------------------------------
typedef struct XnLastStreamData
{
- XnUInt32 nPosition;
+ XnUInt64 nPosition;
XnUInt32 nFrameID;
XnUInt64 nTimestamp;
} XnLastStreamData;
@@ -53,15 +47,15 @@ XnDeviceFileReader::XnDeviceFileReader() :
XnStreamReaderDevice(XN_DEVICE_NAME, XN_DEVICE_FILE_MAX_INTERNAL_BUFFER),
m_FrameDelay(XN_MODULE_PROPERTY_FRAME_DELAY, FALSE),
m_pBCData(NULL),
- m_nFileVersion(-1),
+ m_nFileVersion(0),
m_nReferenceTime(0),
m_nReferenceTimestamp(0),
m_bFileHasData(FALSE),
m_bStreamsCollectionChanged(FALSE),
- m_pThis(this),
- m_InstancePointer(XN_FILE_PROPERTY_INSTANCE_POINTER, &m_pThis, sizeof(m_pThis), NULL)
+ m_InstancePointer(XN_FILE_PROPERTY_INSTANCE_POINTER)
{
m_FrameDelay.UpdateSetCallbackToDefault();
+ m_InstancePointer.UpdateGetCallback(GetInstanceCallback, this);
}
XnDeviceFileReader::~XnDeviceFileReader()
@@ -188,7 +182,7 @@ XnStatus XnDeviceFileReader::ReadInitialState(XnPropertySet *pSet)
// now continue reading until we get to first data
XnPackedDataType nType;
XnBool bStateEnd = FALSE;
- XnUInt32 nPositionBefore;
+ XnUInt64 nPositionBefore;
while (!bStateEnd)
{
@@ -324,9 +318,9 @@ XnStatus XnDeviceFileReader::HandleStreamRemoved(const XnChar* strName)
XN_IS_STATUS_OK(nRetVal);
XnPackedDataType nType = XN_PACKED_STREAM_REMOVED;
- XnUInt32 nPositionBefore;
+ XnUInt64 nPositionBefore;
- while (TRUE)
+ for (;;)
{
nRetVal = GetIOStream()->Tell(&nPositionBefore);
XN_IS_STATUS_OK(nRetVal);
@@ -392,7 +386,7 @@ XnStatus XnDeviceFileReader::HandleStreamData(XnStreamData* pDataProps, XnCompre
{
XnStatus nRetVal = XN_STATUS_OK;
- XnUInt32 nPosition;
+ XnUInt64 nPosition;
nRetVal = GetIOStream()->Tell(&nPosition);
XN_IS_STATUS_OK(nRetVal);
@@ -405,7 +399,7 @@ XnStatus XnDeviceFileReader::HandleStreamData(XnStreamData* pDataProps, XnCompre
XN_IS_STATUS_OK(nRetVal);
XnStreamReaderStream* pStream = (XnStreamReaderStream*)pHolder->GetStream();
- pStream->NewDataAvailable();
+ pStream->NewDataAvailable(pDataProps->nTimestamp, pDataProps->nFrameID);
// and remove it from list
nRetVal = m_PositionsToIgnore.Remove(it);
@@ -556,7 +550,7 @@ void XnDeviceFileReader::FrameDelay(XnUInt64 nTimestamp)
}
}
-XnStatus XnDeviceFileReader::WaitForPrimaryStream(XN_EVENT_HANDLE hNewDataEvent, XnStreamDataSet* pSet)
+XnStatus XnDeviceFileReader::WaitForPrimaryStream(XN_EVENT_HANDLE /*hNewDataEvent*/, XnStreamDataSet* pSet)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -573,7 +567,7 @@ XnStatus XnDeviceFileReader::WaitForPrimaryStream(XN_EVENT_HANDLE hNewDataEvent,
return (XN_STATUS_OK);
}
-XnStatus XnDeviceFileReader::WaitForStream(XN_EVENT_HANDLE hNewDataEvent, XnDeviceStream* pStream)
+XnStatus XnDeviceFileReader::WaitForStream(XN_EVENT_HANDLE /*hNewDataEvent*/, XnDeviceStream* pStream)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -637,7 +631,7 @@ XnStatus XnDeviceFileReader::SeekTo(XnUInt64 nMinTimestamp, XnUInt32 nMinFrameID
XnBool bFoundNewData = FALSE;
// Keep current position.
- XnUInt32 nStartingPosition;
+ XnUInt64 nStartingPosition;
nRetVal = GetIOStream()->Tell(&nStartingPosition);
XN_IS_STATUS_OK(nRetVal);
@@ -651,19 +645,19 @@ XnStatus XnDeviceFileReader::SeekTo(XnUInt64 nMinTimestamp, XnUInt32 nMinFrameID
}
// start seeking forward until point is reached.
- XnUInt32 nFoundPosition;
+ XnUInt64 nFoundPosition;
XnLastStreamDataHash StreamsHash;
- while (TRUE)
+ for (;;)
{
- XnUInt32 nPositionBefore;
+ XnUInt64 nPositionBefore;
nRetVal = GetIOStream()->Tell(&nPositionBefore);
XN_IS_STATUS_OK(nRetVal);
nRetVal = GetDataPacker()->ReadNextObject(&nType);
XN_IS_STATUS_OK(nRetVal);
- XnUInt32 nPositionAfter;
+ XnUInt64 nPositionAfter;
nRetVal = GetIOStream()->Tell(&nPositionAfter);
XN_IS_STATUS_OK(nRetVal);
@@ -727,7 +721,7 @@ XnStatus XnDeviceFileReader::SeekTo(XnUInt64 nMinTimestamp, XnUInt32 nMinFrameID
if (bFoundNewData)
{
// read everything up to position
- XnUInt32 nPositionAfter = nStartingPosition;
+ XnUInt64 nPositionAfter = nStartingPosition;
while (nPositionAfter < nFoundPosition)
{
@@ -792,13 +786,13 @@ XnStatus XnDeviceFileReader::SeekFrame(XnUInt32 nFrameID)
return (XN_STATUS_OK);
}
-XnStatus XnDeviceFileReader::OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType)
+XnStatus XnDeviceFileReader::OnStreamCollectionChanged(const XnChar* /*StreamName*/, XnStreamsChangeEventType /*EventType*/)
{
m_bStreamsCollectionChanged = TRUE;
return XN_STATUS_OK;
}
-void XnDeviceFileReader::StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie)
+void XnDeviceFileReader::StreamCollectionChangedCallback(XnDeviceHandle /*DeviceHandle*/, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie)
{
XnDeviceFileReader* pThis = (XnDeviceFileReader*)pCookie;
pThis->OnStreamCollectionChanged(StreamName, EventType);
@@ -809,3 +803,15 @@ XnStatus XnDeviceFileReader::ReadNextData()
XnBool bDummy;
return ReadTillNextData(&bDummy);
}
+
+XnStatus XN_CALLBACK_TYPE XnDeviceFileReader::GetInstanceCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
+{
+ if (gbValue.nDataSize != sizeof(void*))
+ {
+ return XN_STATUS_DEVICE_PROPERTY_SIZE_DONT_MATCH;
+ }
+
+ *(void**)gbValue.pData = pCookie;
+ return XN_STATUS_OK;
+}
+
diff --git a/Source/XnDeviceFile/XnDeviceFileReader.h b/Source/XnDeviceFile/XnDeviceFileReader.h
index 8080202..4163957 100644
--- a/Source/XnDeviceFile/XnDeviceFileReader.h
+++ b/Source/XnDeviceFile/XnDeviceFileReader.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_FILE_READER_H__
#define __XN_DEVICE_FILE_READER_H__
@@ -41,7 +36,7 @@
// Types
//---------------------------------------------------------------------------
struct XnFileBCData;
-XN_DECLARE_DEFAULT_HASH(XnUInt32, XnValue, XnUIntHash);
+XN_DECLARE_DEFAULT_HASH(XnUInt64, XnValue, XnUIntHash);
class XnDeviceFileReader : public XnStreamReaderDevice
{
@@ -83,6 +78,7 @@ class XnDeviceFileReader : public XnStreamReaderDevice
XnStatus OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType);
static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE GetInstanceCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
// Some BC functions
XnStatus BCSeek(XnUInt64 nTimestamp);
@@ -103,8 +99,7 @@ class XnDeviceFileReader : public XnStreamReaderDevice
XnFileBCData* m_pBCData;
XnUIntHash m_PositionsToIgnore;
- XnDeviceFileReader* m_pThis;
- XnActualGeneralProperty m_InstancePointer;
+ XnGeneralProperty m_InstancePointer;
};
#endif //__XN_DEVICE_FILE_READER_H__
diff --git a/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp b/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp
index 59609a1..9075416 100644
--- a/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp
+++ b/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -272,6 +266,9 @@ XnStatus BCSetDepthProperties(XnPropertySet* pSet, XnStreamPropertiesV3* pStream
nRetVal = XnPropertySetAddStringProperty(pSet, XN_STREAM_NAME_DEPTH, XN_STREAM_PROPERTY_TYPE, XN_STREAM_TYPE_DEPTH);
XN_IS_STATUS_OK(nRetVal);
+ nRetVal = XnPropertySetAddIntProperty(pSet, XN_STREAM_NAME_DEPTH, XN_STREAM_PROPERTY_STATE, pStreamProperties->DepthFormat != XN_DEPTH_FORMAT_DISABLED);
+ XN_IS_STATUS_OK(nRetVal);
+
XnCropping cropping = {0};
XnGeneralBuffer gbCropping = XN_PACK_GENERAL_BUFFER(cropping);
nRetVal = XnPropertySetAddGeneralProperty(pSet, XN_STREAM_NAME_DEPTH, XN_STREAM_PROPERTY_CROPPING, &gbCropping);
@@ -391,6 +388,9 @@ XnStatus BCSetImageProperties(XnPropertySet* pSet, XnStreamPropertiesV3* pStream
nRetVal = XnPropertySetAddStringProperty(pSet, XN_STREAM_NAME_IMAGE, XN_STREAM_PROPERTY_TYPE, XN_STREAM_TYPE_IMAGE);
XN_IS_STATUS_OK(nRetVal);
+ nRetVal = XnPropertySetAddIntProperty(pSet, XN_STREAM_NAME_IMAGE, XN_STREAM_PROPERTY_STATE, pStreamProperties->ImageFormat != XN_IMAGE_FORMAT_DISABLED);
+ XN_IS_STATUS_OK(nRetVal);
+
XnCropping cropping = {0};
XnGeneralBuffer gbCropping = XN_PACK_GENERAL_BUFFER(cropping);
nRetVal = XnPropertySetAddGeneralProperty(pSet, XN_STREAM_NAME_IMAGE, XN_STREAM_PROPERTY_CROPPING, &gbCropping);
@@ -459,6 +459,9 @@ XnStatus BCSetAudioProperties(XnPropertySet* pSet, XnStreamPropertiesV3* pStream
nRetVal = XnPropertySetAddStringProperty(pSet, XN_STREAM_NAME_AUDIO, XN_STREAM_PROPERTY_TYPE, XN_STREAM_TYPE_AUDIO);
XN_IS_STATUS_OK(nRetVal);
+ nRetVal = XnPropertySetAddIntProperty(pSet, XN_STREAM_NAME_AUDIO, XN_STREAM_PROPERTY_STATE, pStreamProperties->AudioFormat != XN_AUDIO_FORMAT_DISABLED);
+ XN_IS_STATUS_OK(nRetVal);
+
nRetVal = XnPropertySetAddIntProperty(pSet, XN_STREAM_NAME_AUDIO, XN_STREAM_PROPERTY_NUMBER_OF_FRAMES, (XnUInt64)pStreamProperties->nNumOfFrames);
XN_IS_STATUS_OK(nRetVal);
@@ -541,8 +544,6 @@ XnStatus ConvertStreamPropertiesToPropertySet(XnStreamPropertiesV3* pStreamPrope
XnStatus XnDeviceFileReader::BCCalculatePackedBufferSize()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnStreamPropertiesV3* pStreamProperties = &m_pBCData->StreamProperties;
XnPackedStreamProperties* pPackedStreamProperties = &m_pBCData->PackedStreamProperties;
@@ -666,8 +667,6 @@ XnStatus XnDeviceFileReader::BCCalculatePackedBufferSize()
nBufferSize += sizeof(XnPackedStreamFrameHeaderV3);
return nBufferSize;
-
- return (XN_STATUS_OK);
}
XnStatus XnDeviceFileReader::BCReadInitialState(XnPropertySet* pSet)
@@ -818,7 +817,7 @@ XnStatus XnDeviceFileAdjustFileFrameHeaderV3(const XnDeviceFileFrameHeaderV3* pF
return XnIOAdjustStreamFramePropertiesV3(&pFileFrameHeaderV3->FrameProperties, &pFileFrameHeader->FrameProperties);
}
-XnStatus XnDeviceFileReader::BCSeek(XnUInt64 nTimestamp)
+XnStatus XnDeviceFileReader::BCSeek(XnUInt64 /*nTimestamp*/)
{
return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED);
}
@@ -925,7 +924,7 @@ XnStatus XnDeviceFileReader::BCSeekFrame(XnUInt32 nFrameID)
}
// Skip the frame data
- XnUInt32 nPosition;
+ XnUInt64 nPosition;
nRetVal = GetIOStream()->Tell(&nPosition);
XN_IS_STATUS_OK(nRetVal);
@@ -936,7 +935,7 @@ XnStatus XnDeviceFileReader::BCSeekFrame(XnUInt32 nFrameID)
for (XnDeviceModuleHolderList::Iterator it = streams.begin(); it != streams.end(); ++it)
{
XnStreamReaderStream* pStream = (XnStreamReaderStream*)(*it)->GetModule();
- pStream->NewDataAvailable();
+ pStream->NewDataAvailable(0, 0);
}
// Make sure frame ids are sequential
@@ -962,10 +961,6 @@ XnStatus XnDeviceFileReader::BCReadFrame(XnBool* pbWrapOccured)
// Local function variables
XnStatus nRetVal = XN_STATUS_OK;
XnDeviceFileFrameHeaderV3 FileFrameHeader;
- XnUInt64 nCurrTime = 0;
- XnUInt64 nDiffTime = 0;
- XnUInt64 nFramesDiffTime = 0;
- XnUInt32 nSleepTime = 0;
*pbWrapOccured = FALSE;
@@ -1087,7 +1082,7 @@ XnStatus XnDeviceFileReader::BCReadFrame(XnBool* pbWrapOccured)
pPackedBuffer += PackedStreamHeader.nCompDepthBufferSize;
- pStream->NewDataAvailable();
+ pStream->NewDataAvailable(pStreamData->nTimestamp, pStreamData->nFrameID);
}
// Image
@@ -1110,7 +1105,7 @@ XnStatus XnDeviceFileReader::BCReadFrame(XnBool* pbWrapOccured)
pPackedBuffer += PackedStreamHeader.nCompImageBufferSize;
- pStream->NewDataAvailable();
+ pStream->NewDataAvailable(pStreamData->nTimestamp, pStreamData->nFrameID);
}
// we do not support MISC
@@ -1136,7 +1131,7 @@ XnStatus XnDeviceFileReader::BCReadFrame(XnBool* pbWrapOccured)
pPackedBuffer += PackedStreamHeader.nCompAudioBufferSize;
- pStream->NewDataAvailable();
+ pStream->NewDataAvailable(pStreamData->nTimestamp, pStreamData->nFrameID);
}
// Increase the file frame position
diff --git a/Source/XnDeviceFile/XnDeviceFileReaderBC.h b/Source/XnDeviceFile/XnDeviceFileReaderBC.h
index 6cb0ed1..1e7aefe 100644
--- a/Source/XnDeviceFile/XnDeviceFileReaderBC.h
+++ b/Source/XnDeviceFile/XnDeviceFileReaderBC.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICE_FILE_READER_BC_H_
#define _XN_DEVICE_FILE_READER_BC_H_
diff --git a/Source/XnDeviceFile/XnDeviceFileWriter.cpp b/Source/XnDeviceFile/XnDeviceFileWriter.cpp
index d1ae22a..76e2a85 100644
--- a/Source/XnDeviceFile/XnDeviceFileWriter.cpp
+++ b/Source/XnDeviceFile/XnDeviceFileWriter.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -88,7 +82,7 @@ XnStatus XnDeviceFileWriter::DestroyStream(const XnChar* StreamName)
nRetVal = FindStream(StreamName, &pStream);
XN_IS_STATUS_OK(nRetVal);
- XnUInt32 nCurPos;
+ XnUInt64 nCurPos;
nRetVal = GetIOStream()->Tell(&nCurPos);
XN_IS_STATUS_OK(nRetVal);
@@ -201,8 +195,6 @@ XnStatus XnDeviceFileWriter::StartTimer()
XnStatus XnDeviceFileWriter::CreateStreamModule(const XnChar* StreamType, const XnChar* StreamName, XnDeviceModuleHolder** ppStreamHolder)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnFileWriterStream* pStream;
XN_VALIDATE_NEW(pStream, XnFileWriterStream, StreamType, StreamName, GetDataPacker());
@@ -231,7 +223,7 @@ XnStatus XnDeviceFileWriter::CreateIOStreamImpl(const XnChar* strConnectionStrin
XN_VALIDATE_NEW_AND_INIT(pStream, XnIOFileStream, strConnectionString, XN_OS_FILE_WRITE | XN_OS_FILE_TRUNCATE);
// write down the magic
- nRetVal = pStream->WriteData((const XnUChar*)XN_DEVICE_FILE_MAGIC_V4, strlen(XN_DEVICE_FILE_MAGIC_V4));
+ nRetVal = pStream->WriteData((const XnUChar*)XN_DEVICE_FILE_MAGIC_V4, (XnUInt32)strlen(XN_DEVICE_FILE_MAGIC_V4));
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(pStream);
diff --git a/Source/XnDeviceFile/XnDeviceFileWriter.h b/Source/XnDeviceFile/XnDeviceFileWriter.h
index ff8acda..3ba79dc 100644
--- a/Source/XnDeviceFile/XnDeviceFileWriter.h
+++ b/Source/XnDeviceFile/XnDeviceFileWriter.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICE_FILE_WRITER_H_
#define _XN_DEVICE_FILE_WRITER_H_
diff --git a/Source/XnDeviceFile/XnExportedFileDevice.cpp b/Source/XnDeviceFile/XnExportedFileDevice.cpp
index b03d4f5..2ecf9e6 100644
--- a/Source/XnDeviceFile/XnExportedFileDevice.cpp
+++ b/Source/XnDeviceFile/XnExportedFileDevice.cpp
@@ -1,35 +1,29 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnExportedFileDevice.h"
-#include
+#include
#include "XnDeviceFileReader.h"
#include "XnFileDevice.h"
#include
@@ -43,10 +37,10 @@ void XnExportedFileDevice::FillCommonDescriptionFields(XnProductionNodeDescripti
strcpy(pDescription->strName, XN_DEVICE_NAME);
strcpy(pDescription->strVendor, XN_VENDOR_PRIMESENSE);
- pDescription->Version.nMajor = XN_MAJOR_VERSION;
- pDescription->Version.nMinor = XN_MINOR_VERSION;
- pDescription->Version.nMaintenance = XN_MAINTENANCE_VERSION;
- pDescription->Version.nBuild = XN_BUILD_VERSION;
+ pDescription->Version.nMajor = XN_PS_MAJOR_VERSION;
+ pDescription->Version.nMinor = XN_PS_MINOR_VERSION;
+ pDescription->Version.nMaintenance = XN_PS_MAINTENANCE_VERSION;
+ pDescription->Version.nBuild = XN_PS_BUILD_VERSION;
}
void XnExportedFileDevice::GetDescription(XnProductionNodeDescription* pDescription)
@@ -55,7 +49,7 @@ void XnExportedFileDevice::GetDescription(XnProductionNodeDescription* pDescript
pDescription->Type = XN_NODE_TYPE_PLAYER;
}
-XnStatus XnExportedFileDevice::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
+XnStatus XnExportedFileDevice::EnumerateProductionTrees(xn::Context& /*context*/, xn::NodeInfoList& TreesList, xn::EnumerationErrors* /*pErrors*/)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -67,7 +61,7 @@ XnStatus XnExportedFileDevice::EnumerateProductionTrees(xn::Context& context, xn
return (XN_STATUS_OK);
}
-XnStatus XnExportedFileDevice::Create(xn::Context& context, const XnChar* strInstanceName, const XnChar* strCreationInfo, xn::NodeInfoList* pNeededTrees, const XnChar* strConfigurationDir, xn::ModuleProductionNode** ppInstance)
+XnStatus XnExportedFileDevice::Create(xn::Context& context, const XnChar* strInstanceName, const XnChar* /*strCreationInfo*/, xn::NodeInfoList* /*pNeededTrees*/, const XnChar* /*strConfigurationDir*/, xn::ModuleProductionNode** ppInstance)
{
XnStatus nRetVal = XN_STATUS_OK;
diff --git a/Source/XnDeviceFile/XnExportedFileDevice.h b/Source/XnDeviceFile/XnExportedFileDevice.h
index 23d116d..aac3963 100644
--- a/Source/XnDeviceFile/XnExportedFileDevice.h
+++ b/Source/XnDeviceFile/XnExportedFileDevice.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_EXPORTED_SENSOR_DEVICE_H__
#define __XN_EXPORTED_SENSOR_DEVICE_H__
diff --git a/Source/XnDeviceFile/XnFileDevice.cpp b/Source/XnDeviceFile/XnFileDevice.cpp
index 6f9e15a..4957e79 100644
--- a/Source/XnDeviceFile/XnFileDevice.cpp
+++ b/Source/XnDeviceFile/XnFileDevice.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -69,7 +63,9 @@ XnFileDevice::XnFileDevice(xn::Context& context, const XnChar* strInstanceName)
m_nCurrTimestamp(0),
m_pBCData(NULL),
m_bRepeat(TRUE),
- m_bEOF(FALSE)
+ m_bEOF(FALSE),
+ m_strName(strInstanceName),
+ m_hSelf(NULL)
{
xnOSMemSet(&m_ShiftToDepth, 0, sizeof(m_ShiftToDepth));
}
@@ -95,6 +91,12 @@ void XnFileDevice::Free()
{
XnNodeInfo& nodeInfo = it.Value();
XN_DELETE(nodeInfo.pXnCodec);
+ if (nodeInfo.codec.IsValid())
+ {
+ xnRemoveNeededNode(GetSelfNodeHandle(), nodeInfo.codec);
+ nodeInfo.codec.Release();
+ }
+
}
m_nodeInfoMap.Clear();
@@ -241,6 +243,7 @@ XnStatus XnFileDevice::SetInputStream(void *pStreamCookie, XnPlayerInputStreamIn
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(m_pInputStream);
+ m_pInputStream = NULL;
return (nRetVal);
}
@@ -331,7 +334,7 @@ XnStatus XnFileDevice::SeekTo(XnUInt64 nMinTimestamp, const XnChar* strNodeName,
XnPackedDataType nType = (XnPackedDataType)-1;
XnLastStreamDataHash StreamsHash;
- while (TRUE)
+ for (;;)
{
XnUInt32 nPositionBefore;
nRetVal = m_pInputStream->Tell(&nPositionBefore);
@@ -439,8 +442,6 @@ XnStatus XnFileDevice::SeekTo(XnUInt64 nMinTimestamp, const XnChar* strNodeName,
XnStatus XnFileDevice::SeekToTimeStamp(XnInt64 nTimeOffset, XnPlayerSeekOrigin origin)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnUInt64 nTimestamp = 0;
if (origin == XN_PLAYER_SEEK_CUR)
{
@@ -511,8 +512,6 @@ XnStatus XnFileDevice::SeekToFrame(const XnChar* strNodeName, XnInt32 nFrameOffs
XnStatus XnFileDevice::TellTimestamp(XnUInt64& nTimestamp)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
nTimestamp = m_nCurrTimestamp;
return (XN_STATUS_OK);
@@ -687,7 +686,7 @@ XnStatus XnFileDevice::HandleNewStream(const XnChar *strType, const XnChar *strN
}
// find compression type
- XnActualIntProperty* pComp;
+ XnActualIntProperty* pComp = NULL;
nRetVal = pInitialValues->Get(XN_STREAM_PROPERTY_COMPRESSION, (XnProperty*&)pComp);
XN_IS_STATUS_OK(nRetVal);
@@ -804,7 +803,11 @@ XnStatus XnFileDevice::CreateCodec(xn::ProductionNode& node)
{
// release old codec
XN_DELETE(pNodeInfo->pXnCodec);
- pNodeInfo->codec.Unref();
+ if (pNodeInfo->codec.IsValid())
+ {
+ xnRemoveNeededNode(GetSelfNodeHandle(), pNodeInfo->codec);
+ pNodeInfo->codec.Release();
+ }
// special case: IR recorded with JPEG. This mode is no longer allowed by OpenNI (JPEG
// can now only be used for image). We'll have to handle it ourselves.
@@ -824,6 +827,11 @@ XnStatus XnFileDevice::CreateCodec(xn::ProductionNode& node)
nRetVal = m_context.CreateCodec(codecID, node, pNodeInfo->codec);
XN_IS_STATUS_OK(nRetVal);
+ // we need to make the codec a needed node, so that if xnForceShutdown() is called, we will be
+ // destroyed *before* it does (as we hold a reference to it).
+ nRetVal = xnAddNeededNode(GetSelfNodeHandle(), pNodeInfo->codec);
+ XN_IS_STATUS_OK(nRetVal);
+
XN_VALIDATE_NEW(pNodeInfo->pXnCodec, XnNiCodec, pNodeInfo->codec);
}
}
@@ -880,7 +888,7 @@ XnStatus XnFileDevice::HandleStreamRemoved(const XnChar* strName)
XnPackedDataType nType = XN_PACKED_STREAM_REMOVED;
XnUInt32 nPositionBefore;
- while (TRUE)
+ for (;;)
{
nRetVal = m_pInputStream->Tell(&nPositionBefore);
XN_IS_STATUS_OK(nRetVal);
@@ -980,15 +988,15 @@ XnStatus XnFileDevice::HandleIntProperty(const XnChar *strModule, const XnChar *
if (strcmp(strName, XN_STREAM_PROPERTY_X_RES) == 0)
{
- mode.nXRes = nValue;
+ mode.nXRes = (XnUInt32)nValue;
}
else if (strcmp(strName, XN_STREAM_PROPERTY_Y_RES) == 0)
{
- mode.nYRes = nValue;
+ mode.nYRes = (XnUInt32)nValue;
}
else if (strcmp(strName, XN_STREAM_PROPERTY_FPS) == 0)
{
- mode.nFPS = nValue;
+ mode.nFPS = (XnUInt32)nValue;
}
// change supported modes to this one
@@ -1047,11 +1055,11 @@ XnStatus XnFileDevice::HandleIntProperty(const XnChar *strModule, const XnChar *
if (strcmp(strName, XN_STREAM_PROPERTY_SAMPLE_RATE) == 0)
{
- mode.nSampleRate = nValue;
+ mode.nSampleRate = (XnUInt32)nValue;
}
else if (strcmp(strName, XN_STREAM_PROPERTY_NUMBER_OF_CHANNELS) == 0)
{
- mode.nChannels = nValue;
+ mode.nChannels = (XnUInt8)nValue;
}
// change supported modes to this one
@@ -1284,10 +1292,10 @@ void TransformRGB24ToGrayscale16(XnUInt8* pBuffer, XnUInt32* pnBufferSize)
pOutput++;
}
- *pnBufferSize = (XnUInt8*)pOutput - pBuffer;
+ *pnBufferSize = (XnUInt32)((XnUInt8*)pOutput - pBuffer);
}
-XnStatus XnFileDevice::HandleStreamData(XnStreamData* pDataProps, XnCompressionFormats nCompression, XnUInt32 nCompressedSize)
+XnStatus XnFileDevice::HandleStreamData(XnStreamData* pDataProps, XnCompressionFormats /*nCompression*/, XnUInt32 /*nCompressedSize*/)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -1490,40 +1498,40 @@ XnStatus XnFileDevice::UpdateS2DTables(const xn::DepthGenerator& depth)
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, nTemp);
XN_IS_STATUS_OK(nRetVal);
- config.nZeroPlaneDistance = nTemp;
+ config.nZeroPlaneDistance = (XnDepthPixel)nTemp;
nRetVal = depth.GetRealProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, dTemp);
XN_IS_STATUS_OK(nRetVal);
- config.fZeroPlanePixelSize = dTemp;
+ config.fZeroPlanePixelSize = (XnFloat)dTemp;
nRetVal = depth.GetRealProperty(XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE, dTemp);
XN_IS_STATUS_OK(nRetVal);
- config.fEmitterDCmosDistance = dTemp;
+ config.fEmitterDCmosDistance = (XnFloat)dTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_MAX_SHIFT, nTemp);
XN_IS_STATUS_OK(nRetVal);
- config.nDeviceMaxShiftValue = nTemp;
+ config.nDeviceMaxShiftValue = (XnUInt32)nTemp;
config.nDeviceMaxDepthValue = depth.GetDeviceMaxDepth();
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_CONST_SHIFT, nTemp);
XN_IS_STATUS_OK(nRetVal);
- config.nConstShift = nTemp;
+ config.nConstShift = (XnUInt32)nTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_PIXEL_SIZE_FACTOR, nTemp);
XN_IS_STATUS_OK(nRetVal);
- config.nPixelSizeFactor = nTemp;
+ config.nPixelSizeFactor = (XnUInt32)nTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_PARAM_COEFF, nTemp);
XN_IS_STATUS_OK(nRetVal);
- config.nParamCoeff = nTemp;
+ config.nParamCoeff = (XnUInt32)nTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_SHIFT_SCALE, nTemp);
XN_IS_STATUS_OK(nRetVal);
- config.nShiftScale = nTemp;
+ config.nShiftScale = (XnUInt32)nTemp;
config.nDepthMinCutOff = 0;
- config.nDepthMaxCutOff = config.nDeviceMaxDepthValue;
+ config.nDepthMaxCutOff = (XnDepthPixel)config.nDeviceMaxDepthValue;
if (!m_ShiftToDepth.bIsInitialized)
{
@@ -1572,3 +1580,18 @@ XnStatus XnFileDevice::UpdateRWData(const xn::DepthGenerator& depth)
return (XN_STATUS_OK);
}
+
+XnNodeHandle XnFileDevice::GetSelfNodeHandle()
+{
+ if (m_hSelf == NULL)
+ {
+ xn::Player player;
+ XnStatus nRetVal = m_context.GetProductionNodeByName(m_strName, player);
+ XN_ASSERT(nRetVal == XN_STATUS_OK);
+
+ // keep only the handle (we don't want to keep a reference to ourself. This will prevent destruction)
+ m_hSelf = player;
+ }
+
+ return m_hSelf;
+}
\ No newline at end of file
diff --git a/Source/XnDeviceFile/XnFileDevice.h b/Source/XnDeviceFile/XnFileDevice.h
index c32a213..55af718 100644
--- a/Source/XnDeviceFile/XnFileDevice.h
+++ b/Source/XnDeviceFile/XnFileDevice.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_DEVICE_H__
#define __XN_SENSOR_DEVICE_H__
@@ -53,7 +47,7 @@ class XnFileDevice : virtual public xn::ModulePlayer
XnStatus Init();
- virtual XnBool IsCapabilitySupported(const XnChar* strCapabilityName) { return FALSE; }
+ virtual XnBool IsCapabilitySupported(const XnChar* /*strCapabilityName*/) { return FALSE; }
virtual const XnChar* GetSupportedFormat() { return "XNS"; }
virtual XnStatus SetInputStream(void *pStreamCookie, XnPlayerInputStreamInterface *pStream);
@@ -100,6 +94,7 @@ class XnFileDevice : virtual public xn::ModulePlayer
XnStatus UpdateRWData(const xn::DepthGenerator& depth);
XnStatus CreateCodec(xn::ProductionNode& node);
XnStatus CheckIRCompatibility(xn::ProductionNode& node);
+ XnNodeHandle GetSelfNodeHandle();
// Some BC functions
XnStatus BCSeek(XnUInt64 nTimestamp);
@@ -150,6 +145,8 @@ class XnFileDevice : virtual public xn::ModulePlayer
XnShiftToDepthTables m_ShiftToDepth;
XnFileBCData* m_pBCData;
+ const XnChar* m_strName;
+ XnNodeHandle m_hSelf;
};
#endif // __XN_SENSOR_DEVICE_H__
\ No newline at end of file
diff --git a/Source/XnDeviceFile/XnFileDeviceBC.cpp b/Source/XnDeviceFile/XnFileDeviceBC.cpp
index 2795a63..2b41d29 100644
--- a/Source/XnDeviceFile/XnFileDeviceBC.cpp
+++ b/Source/XnDeviceFile/XnFileDeviceBC.cpp
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#include "XnFileDevice.h"
#include "XnDeviceFileReaderBC.h"
#include
@@ -61,8 +57,6 @@ XnStatus XnFileDevice::BCInit()
XnStatus XnFileDevice::BCCalculatePackedBufferSize()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnStreamPropertiesV3* pStreamProperties = &m_pBCData->StreamProperties;
XnPackedStreamProperties* pPackedStreamProperties = &m_pBCData->PackedStreamProperties;
@@ -186,8 +180,6 @@ XnStatus XnFileDevice::BCCalculatePackedBufferSize()
nBufferSize += sizeof(XnPackedStreamFrameHeaderV3);
return nBufferSize;
-
- return (XN_STATUS_OK);
}
XnStatus XnFileDevice::BCReadInitialState(XnPropertySet* pSet)
@@ -199,6 +191,7 @@ XnStatus XnFileDevice::BCReadInitialState(XnPropertySet* pSet)
m_pBCData->nFramePos = 1;
+ xnOSFreeAligned(m_pBCData->pPackedStreamBuffer);
m_pBCData->pPackedStreamBuffer = NULL;
m_pBCData->nPackedStreamBufferSize = 0;
@@ -308,7 +301,7 @@ XnStatus XnFileDevice::BCReadInitialState(XnPropertySet* pSet)
XnUInt32 nBufferSize = BCCalculatePackedBufferSize();
if (nBufferSize != m_pBCData->nPackedStreamBufferSize)
{
- xnOSFree(m_pBCData->pPackedStreamBuffer);
+ xnOSFreeAligned(m_pBCData->pPackedStreamBuffer);
XN_VALIDATE_ALIGNED_CALLOC(m_pBCData->pPackedStreamBuffer, XnUChar, nBufferSize, XN_DEFAULT_MEM_ALIGN);
m_pBCData->nPackedStreamBufferSize = nBufferSize;
}
@@ -320,7 +313,7 @@ XnStatus XnFileDevice::BCReadInitialState(XnPropertySet* pSet)
return (XN_STATUS_OK);
}
-XnStatus XnFileDevice::BCSeek(XnUInt64 nTimestamp)
+XnStatus XnFileDevice::BCSeek(XnUInt64 /*nTimestamp*/)
{
return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED);
}
@@ -368,12 +361,6 @@ XnStatus XnFileDevice::BCSeekFrame(XnUInt32 nFrameID)
nRetVal = m_pInputStream->Seek(nOffset);
XN_IS_STATUS_OK(nRetVal);
- // If the wanted position was the first frame, we're already there
- if (m_pBCData->nFramePos == 1)
- {
- return (XN_STATUS_OK);
- }
-
// Keep reading frames until we reach the wanted frame
XnUInt32 nCurrFilePos = 1;
while (nCurrFilePos < m_pBCData->nFramePos)
@@ -458,10 +445,6 @@ XnStatus XnFileDevice::BCReadFrame(XnBool* pbWrapOccured)
// Local function variables
XnStatus nRetVal = XN_STATUS_OK;
XnDeviceFileFrameHeaderV3 FileFrameHeader;
- XnUInt64 nCurrTime = 0;
- XnUInt64 nDiffTime = 0;
- XnUInt64 nFramesDiffTime = 0;
- XnUInt32 nSleepTime = 0;
*pbWrapOccured = FALSE;
diff --git a/Source/XnDeviceFile/XnFileOpenNiteImpl.cpp b/Source/XnDeviceFile/XnFileOpenNiteImpl.cpp
index a8d1ec6..ff0476f 100644
--- a/Source/XnDeviceFile/XnFileOpenNiteImpl.cpp
+++ b/Source/XnDeviceFile/XnFileOpenNiteImpl.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceFile/XnFileWriterStream.cpp b/Source/XnDeviceFile/XnFileWriterStream.cpp
index b0686a4..e96c11d 100644
--- a/Source/XnDeviceFile/XnFileWriterStream.cpp
+++ b/Source/XnDeviceFile/XnFileWriterStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceFile/XnFileWriterStream.h b/Source/XnDeviceFile/XnFileWriterStream.h
index e03a9d3..40ef2e2 100644
--- a/Source/XnDeviceFile/XnFileWriterStream.h
+++ b/Source/XnDeviceFile/XnFileWriterStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_FILE_STREAM_WRITER_H__
#define __XN_FILE_STREAM_WRITER_H__
@@ -45,7 +40,7 @@ class XnFileWriterStream : public XnStreamWriterStream
inline XnUInt64 GetNumberOfFrames() const { return m_NumberOfFrames.GetValue(); }
- XnUInt32 m_nNumFramesPos;
+ XnUInt64 m_nNumFramesPos;
protected:
XnStatus WriteImpl(XnStreamData* pStreamData);
diff --git a/Source/XnDeviceFile/XnNiInputStream.h b/Source/XnDeviceFile/XnNiInputStream.h
index 7ac77dc..4da35c7 100644
--- a/Source/XnDeviceFile/XnNiInputStream.h
+++ b/Source/XnDeviceFile/XnNiInputStream.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_XN_INPUT_STREAM_H__
#define __XN_XN_INPUT_STREAM_H__
@@ -56,7 +50,7 @@ class XnInputStream : public XnIOStream
m_pStreamInterface->Close(m_pCookie);
return (XN_STATUS_OK);
}
- XnStatus WriteData(const XnUChar* pData, XnUInt32 nDataSize)
+ XnStatus WriteData(const XnUChar* /*pData*/, XnUInt32 /*nDataSize*/)
{
return XN_STATUS_NOT_IMPLEMENTED;
}
diff --git a/Source/XnDeviceSensorV2/Bayer.cpp b/Source/XnDeviceSensorV2/Bayer.cpp
index 7c00cbe..b961ed6 100644
--- a/Source/XnDeviceSensorV2/Bayer.cpp
+++ b/Source/XnDeviceSensorV2/Bayer.cpp
@@ -1,129 +1,1229 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+/****************************************************************************
+ * Edited 12.04.2011 by Raphael Dumusc *
+ * Incorporated ROS code for improved Bayer Pattern to RGB conversion. *
+ ***************************************************************************/
+ /*
+ The ROS bayer pattern to RGB conversion
+ Modified to be used in Avin's mod of the Primesense driver.
+ Original code available here:
+ http://www.ros.org/doc/api/openni_camera/html/openni__image__bayer__grbg_8cpp_source.html
+*/
+/*
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2011 2011 Willow Garage, Inc.
+ * Suat Gedikli
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
-
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
#include "Bayer.h"
-#include
+#include
+#include
-//---------------------------------------------------------------------------
-// Global Variables
-//---------------------------------------------------------------------------
-XnUInt8 Gamma[256] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+#define AVG(a,b) (((int)(a) + (int)(b)) >> 1)
+#define AVG3(a,b,c) (((int)(a) + (int)(b) + (int)(c)) / 3)
+#define AVG4(a,b,c,d) (((int)(a) + (int)(b) + (int)(c) + (int)(d)) >> 2)
+#define WAVG4(a,b,c,d,x,y) ( ( ((int)(a) + (int)(b)) * (int)(x) + ((int)(c) + (int)(d)) * (int)(y) ) / ( 2 * ((int)(x) + (int(y))) ) )
+using namespace std;
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-void BayerUpdateGamma(float fGammaCorr)
+typedef enum
{
- for(XnUInt32 iG = 0; iG < 256;++iG)
- Gamma[iG] = XnUInt32(255*pow(XnDouble(iG)/255.0,(XnDouble)fGammaCorr) + 0.5);
-}
+ Bilinear = 0,
+ EdgeAware,
+ EdgeAwareWeighted
+} DebayeringMethod;
-static inline void WriteRGB(XnUInt8 *pBuffer, XnUInt8 nRed, XnUInt8 nGreen, XnUInt8 nBlue)
+void BayerUpdateGamma(float fGammaCorr)
{
- pBuffer[BAYER_RED] = Gamma[nRed];
- pBuffer[BAYER_GREEN] = Gamma[nGreen];
- pBuffer[BAYER_BLUE] = Gamma[nBlue];
}
-void Bayer2RGB888(const XnUInt8* pBayerImage, XnUInt8* pRGBImage, XnUInt32 nXRes, XnUInt32 nYRes, XnUInt32 nDownSampleStep, XnUInt32 nBadPixels)
+void fillRGB(unsigned width, unsigned height, const XnUInt8* bayer_pixel, unsigned char* rgb_buffer, DebayeringMethod debayering_method, XnUInt32 nDownSampleStep)
{
- XnUInt8 nRed;
- XnUInt8 nGreen;
- XnUInt8 nBlue;
- const XnUInt8* pBayer;
- XnUInt8* pRGB;
-
- //if (nBadPixels > 1)
- //{
- //nBadPixels = 1;
- //}
-
- XnInt32 BAYER_LINE_LENGTH = nXRes;
- XnInt32 BAYER_LINE_LENGTH2 = BAYER_LINE_LENGTH*2;
- XnInt32 BAYER_RGB_LINE_LENGTH = nXRes*BAYER_BPP;
- XnInt32 BAYER_RGB_LINE_LENGTH2 = BAYER_RGB_LINE_LENGTH*2;
-
- const XnUInt8* pCurrBayer;
- XnUInt8* pCurrRGB;
- XnUInt32 nColCount;
- XnUInt32 nTotalColsCount = (nXRes-2) / 2;
- XnUInt32 nTotalRowsCount = (nYRes-4) / 2;
-
- pBayer = pBayerImage + BAYER_LINE_LENGTH - nBadPixels;
- pRGB = pRGBImage + BAYER_RGB_LINE_LENGTH;
-
- do {
- pCurrBayer = pBayer+ 1;
- pCurrRGB = pRGB + BAYER_BPP;
-
- nColCount = nTotalColsCount;
-
- do {
+
+ unsigned rgb_line_step = width * 3;
+
+ // padding skip for destination image
+ unsigned rgb_line_skip = rgb_line_step - width * 3;
+
+ if (nDownSampleStep == 1)
+ {
+ //register const XnUInt8 *bayer_pixel = image_md_->Data ();
+ register unsigned yIdx, xIdx;
+
+ int bayer_line_step = width;
+ int bayer_line_step2 = width << 1;
+
+ if (debayering_method == Bilinear)
+ {
+ // first two pixel values for first two lines
+ // Bayer 0 1 2
+ // 0 G r g
+ // line_step b g b
+ // line_step2 g r g
+
+ rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[rgb_line_step + 2] = rgb_buffer[2] = bayer_pixel[bayer_line_step]; // blue;
+
+ // Bayer 0 1 2
+ // 0 g R g
+ // line_step b g b
+ // line_step2 g r g
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // 0 g r g
+ // line_step B g b
+ // line_step2 g r g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[bayer_line_step2]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // pixel (1, 1) 0 1 2
+ // 0 g r g
+ // line_step b G b
+ // line_step2 g r g
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = AVG( bayer_pixel[line_step] , bayer_pixel[line_step+2] );
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // rest of the first two lines
+
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // 0 r G r g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = bayer_pixel[bayer_line_step + 1];
+
+ // Bayer -1 0 1 2
+ // 0 r g R g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // 0 r g r g
+ // line_step g B g b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1 2
+ // 0 r g r g
+ // line_step g b G b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = AVG( bayer_pixel[line_step] , bayer_pixel[line_step+2] );
+ }
+
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // 0 r G r
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = rgb_buffer[5] = rgb_buffer[2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // 0 r g R
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[5] = bayer_pixel[line_step];
+
+ // BGBG line
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g B g
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g b G
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+
+ bayer_pixel += bayer_line_step + 2;
+ rgb_buffer += rgb_line_step + 6 + rgb_line_skip;
+
+ // main processing
+
+ for (yIdx = 2; yIdx < height - 2; yIdx += 2)
+ {
+ // first two pixel values
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 G r g
+ // line_step b g b
+ // line_step2 g r g
+
+ rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]); // blue;
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g R g
+ // line_step b g b
+ // line_step2 g r g
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // 0 g r g
+ // line_step B g b
+ // line_step2 g r g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[bayer_line_step2]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // pixel (1, 1) 0 1 2
+ // 0 g r g
+ // line_step b G b
+ // line_step2 g r g
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // continue with rest of the line
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r G r g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g R g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step], bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g B g b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g b G b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+ }
+
+ // last two pixels of the line
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // 0 r G r
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = rgb_buffer[5] = rgb_buffer[2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // 0 r g R
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[5] = bayer_pixel[line_step];
+
+ // BGBG line
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g B g
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g b G
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+
+ bayer_pixel += bayer_line_step + 2;
+ rgb_buffer += rgb_line_step + 6 + rgb_line_skip;
+ }
+
+ //last two lines
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 G r g
+ // line_step b g b
+
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[rgb_line_step + 2] = rgb_buffer[2] = bayer_pixel[bayer_line_step]; // blue;
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g R g
+ // line_step b g b
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g r g
+ // line_step B g b
+ //rgb_pixel[rgb_line_step ] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 1] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g r g
+ // line_step b G b
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // rest of the last two lines
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r G r g
+ // line_step g b g b
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g R g
+ // line_step g b g b
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[-bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g B g b
+ rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[-1], bayer_pixel[1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g b G b
+ //rgb_pixel[rgb_line_step + 3] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+ }
+
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r G r
+ // line_step g b g
+ rgb_buffer[rgb_line_step ] = rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[5] = rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g R
+ // line_step g b g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[-bayer_line_step + 1]);
+ //rgb_pixel[5] = AVG( bayer_pixel[line_step], bayer_pixel[-line_step] );
+
+ // BGBG line
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g r
+ // line_step g B g
+ //rgb_pixel[rgb_line_step ] = AVG2( bayer_pixel[-1], bayer_pixel[1] );
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g r
+ // line_step g b G
+ //rgb_pixel[rgb_line_step + 3] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+ }
+ else if (debayering_method == EdgeAware)
+ {
+ int dh, dv;
+
+ // first two pixel values for first two lines
+ // Bayer 0 1 2
+ // 0 G r g
+ // line_step b g b
+ // line_step2 g r g
+
+ rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[rgb_line_step + 2] = rgb_buffer[2] = bayer_pixel[bayer_line_step]; // blue;
+
+ // Bayer 0 1 2
+ // 0 g R g
+ // line_step b g b
+ // line_step2 g r g
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // 0 g r g
+ // line_step B g b
+ // line_step2 g r g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[bayer_line_step2]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // pixel (1, 1) 0 1 2
+ // 0 g r g
+ // line_step b G b
+ // line_step2 g r g
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = AVG( bayer_pixel[line_step] , bayer_pixel[line_step+2] );
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // rest of the first two lines
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // 0 r G r g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = bayer_pixel[bayer_line_step + 1];
+
+ // Bayer -1 0 1 2
+ // 0 r g R g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // 0 r g r g
+ // line_step g B g b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1 2
+ // 0 r g r g
+ // line_step g b G b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = AVG( bayer_pixel[line_step] , bayer_pixel[line_step+2] );
+ }
+
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // 0 r G r
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = rgb_buffer[5] = rgb_buffer[2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // 0 r g R
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[5] = bayer_pixel[line_step];
+
+ // BGBG line
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g B g
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g b G
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+
+ bayer_pixel += bayer_line_step + 2;
+ rgb_buffer += rgb_line_step + 6 + rgb_line_skip;
+ // main processing
+ for (yIdx = 2; yIdx < height - 2; yIdx += 2)
+ {
+ // first two pixel values
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 G r g
+ // line_step b g b
+ // line_step2 g r g
+
+ rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]); // blue;
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g R g
+ // line_step b g b
+ // line_step2 g r g
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // 0 g r g
+ // line_step B g b
+ // line_step2 g r g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[bayer_line_step2]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // pixel (1, 1) 0 1 2
+ // 0 g r g
+ // line_step b G b
+ // line_step2 g r g
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // continue with rest of the line
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r G r g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g R g
+ // line_step g b g b
+ // line_step2 r g r g
+
+ dh = abs (bayer_pixel[0] - bayer_pixel[2]);
+ dv = abs (bayer_pixel[-bayer_line_step + 1] - bayer_pixel[bayer_line_step + 1]);
+
+ if (dh > dv)
+ rgb_buffer[4] = AVG (bayer_pixel[-bayer_line_step + 1], bayer_pixel[bayer_line_step + 1]);
+ else if (dv > dh)
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[2]);
+ else
+ rgb_buffer[4] = AVG4 (bayer_pixel[-bayer_line_step + 1], bayer_pixel[bayer_line_step + 1], bayer_pixel[0], bayer_pixel[2]);
+
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[5] = AVG4 (bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step], bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g B g b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ dv = abs (bayer_pixel[0] - bayer_pixel[bayer_line_step2]);
+ dh = abs (bayer_pixel[bayer_line_step - 1] - bayer_pixel[bayer_line_step + 1]);
+
+ if (dv > dh)
+ rgb_buffer[rgb_line_step + 1] = AVG (bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ else if (dh > dv)
+ rgb_buffer[rgb_line_step + 1] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step2]);
+ else
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g b G b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+ }
+
+ // last two pixels of the line
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // 0 r G r
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = rgb_buffer[5] = rgb_buffer[2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // 0 r g R
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[5] = bayer_pixel[line_step];
+
+ // BGBG line
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g B g
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g b G
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+
+ bayer_pixel += bayer_line_step + 2;
+ rgb_buffer += rgb_line_step + 6 + rgb_line_skip;
+ }
+
+ //last two lines
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 G r g
+ // line_step b g b
+
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[rgb_line_step + 2] = rgb_buffer[2] = bayer_pixel[bayer_line_step]; // blue;
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g R g
+ // line_step b g b
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g r g
+ // line_step B g b
+ //rgb_pixel[rgb_line_step ] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 1] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g r g
+ // line_step b G b
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // rest of the last two lines
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r G r g
+ // line_step g b g b
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g R g
+ // line_step g b g b
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[-bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g B g b
+ rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[-1], bayer_pixel[1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g b G b
+ //rgb_pixel[rgb_line_step + 3] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+ }
+
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r G r
+ // line_step g b g
+ rgb_buffer[rgb_line_step ] = rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[5] = rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g R
+ // line_step g b g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[-bayer_line_step + 1]);
+ //rgb_pixel[5] = AVG( bayer_pixel[line_step], bayer_pixel[-line_step] );
+
+ // BGBG line
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g r
+ // line_step g B g
+ //rgb_pixel[rgb_line_step ] = AVG2( bayer_pixel[-1], bayer_pixel[1] );
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g r
+ // line_step g b G
+ //rgb_pixel[rgb_line_step + 3] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+ }
+ else if (debayering_method == EdgeAwareWeighted)
+ {
+ int dh, dv;
+
+ // first two pixel values for first two lines
+ // Bayer 0 1 2
+ // 0 G r g
+ // line_step b g b
+ // line_step2 g r g
+
+ rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[rgb_line_step + 2] = rgb_buffer[2] = bayer_pixel[bayer_line_step]; // blue;
+
+ // Bayer 0 1 2
+ // 0 g R g
+ // line_step b g b
+ // line_step2 g r g
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // 0 g r g
+ // line_step B g b
+ // line_step2 g r g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[bayer_line_step2]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // pixel (1, 1) 0 1 2
+ // 0 g r g
+ // line_step b G b
+ // line_step2 g r g
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = AVG( bayer_pixel[line_step] , bayer_pixel[line_step+2] );
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // rest of the first two lines
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // 0 r G r g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = bayer_pixel[bayer_line_step + 1];
+
+ // Bayer -1 0 1 2
+ // 0 r g R g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // 0 r g r g
+ // line_step g B g b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1 2
+ // 0 r g r g
+ // line_step g b G b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = AVG( bayer_pixel[line_step] , bayer_pixel[line_step+2] );
+ }
+
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // 0 r G r
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = rgb_buffer[5] = rgb_buffer[2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // 0 r g R
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[5] = bayer_pixel[line_step];
+
+ // BGBG line
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g B g
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g b G
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+
+ bayer_pixel += bayer_line_step + 2;
+ rgb_buffer += rgb_line_step + 6 + rgb_line_skip;
+ // main processing
+ for (yIdx = 2; yIdx < height - 2; yIdx += 2)
+ {
+ // first two pixel values
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 G r g
+ // line_step b g b
+ // line_step2 g r g
+
+ rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]); // blue;
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g R g
+ // line_step b g b
+ // line_step2 g r g
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // 0 g r g
+ // line_step B g b
+ // line_step2 g r g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[bayer_line_step2]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // pixel (1, 1) 0 1 2
+ // 0 g r g
+ // line_step b G b
+ // line_step2 g r g
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // continue with rest of the line
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r G r g
+ // line_step g b g b
+ // line_step2 r g r g
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g R g
+ // line_step g b g b
+ // line_step2 r g r g
+
+ dh = abs (bayer_pixel[0] - bayer_pixel[2]);
+ dv = abs (bayer_pixel[-bayer_line_step + 1] - bayer_pixel[bayer_line_step + 1]);
+
+ if (dv == 0 && dh == 0)
+ rgb_buffer[4] = AVG4 (bayer_pixel[1 - bayer_line_step], bayer_pixel[1 + bayer_line_step], bayer_pixel[0], bayer_pixel[2]);
+ else
+ rgb_buffer[4] = WAVG4 (bayer_pixel[1 - bayer_line_step], bayer_pixel[1 + bayer_line_step], bayer_pixel[0], bayer_pixel[2], dh, dv);
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[5] = AVG4 (bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step], bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g B g b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ dv = abs (bayer_pixel[0] - bayer_pixel[bayer_line_step2]);
+ dh = abs (bayer_pixel[bayer_line_step - 1] - bayer_pixel[bayer_line_step + 1]);
+
+ if (dv == 0 && dh == 0)
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ else
+ rgb_buffer[rgb_line_step + 1] = WAVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1], dh, dv);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g b G b
+ // line_step2 r g r g
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+ }
+
+ // last two pixels of the line
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // 0 r G r
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = rgb_buffer[5] = rgb_buffer[2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // 0 r g R
+ // line_step g b g
+ // line_step2 r g r
+ rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[5] = bayer_pixel[line_step];
+
+ // BGBG line
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g B g
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step ] = AVG4 (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1], bayer_pixel[-1], bayer_pixel[bayer_line_step2 - 1]);
+ rgb_buffer[rgb_line_step + 1] = AVG4 (bayer_pixel[0], bayer_pixel[bayer_line_step2], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ //rgb_pixel[rgb_line_step + 2] = bayer_pixel[line_step];
+
+ // Bayer -1 0 1
+ // 0 r g r
+ // line_step g b G
+ // line_step2 r g r
+ rgb_buffer[rgb_line_step + 3] = AVG (bayer_pixel[1], bayer_pixel[bayer_line_step2 + 1]);
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+
+ bayer_pixel += bayer_line_step + 2;
+ rgb_buffer += rgb_line_step + 6 + rgb_line_skip;
+ }
+
+ //last two lines
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 G r g
+ // line_step b g b
+
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[rgb_line_step ] = rgb_buffer[3] = rgb_buffer[0] = bayer_pixel[1]; // red pixel
+ rgb_buffer[1] = bayer_pixel[0]; // green pixel
+ rgb_buffer[rgb_line_step + 2] = rgb_buffer[2] = bayer_pixel[bayer_line_step]; // blue;
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g R g
+ // line_step b g b
+ //rgb_pixel[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[2 - bayer_line_step]);
+
+ // BGBG line
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g r g
+ // line_step B g b
+ //rgb_pixel[rgb_line_step ] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 1] = AVG (bayer_pixel[0], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer 0 1 2
+ // -1 b g b
+ // 0 g r g
+ // line_step b G b
+ //rgb_pixel[rgb_line_step + 3] = AVG( bayer_pixel[1] , bayer_pixel[line_step2+1] );
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+
+ rgb_buffer += 6;
+ bayer_pixel += 2;
+ // rest of the last two lines
+ for (xIdx = 2; xIdx < width - 2; xIdx += 2, rgb_buffer += 6, bayer_pixel += 2)
+ {
+ // GRGR line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r G r g
+ // line_step g b g b
+ rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g R g
+ // line_step g b g b
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG4 (bayer_pixel[0], bayer_pixel[2], bayer_pixel[bayer_line_step + 1], bayer_pixel[1 - bayer_line_step]);
+ rgb_buffer[5] = AVG4 (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2], bayer_pixel[-bayer_line_step], bayer_pixel[-bayer_line_step + 2]);
+
+ // BGBG line
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g B g b
+ rgb_buffer[rgb_line_step ] = AVG (bayer_pixel[-1], bayer_pixel[1]);
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+
+ // Bayer -1 0 1 2
+ // -1 g b g b
+ // 0 r g r g
+ // line_step g b G b
+ //rgb_pixel[rgb_line_step + 3] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ rgb_buffer[rgb_line_step + 5] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[bayer_line_step + 2]);
+ }
+
+ // last two pixel values for first two lines
+ // GRGR line
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r G r
+ // line_step g b g
+ rgb_buffer[rgb_line_step ] = rgb_buffer[0] = AVG (bayer_pixel[1], bayer_pixel[-1]);
+ rgb_buffer[1] = bayer_pixel[0];
+ rgb_buffer[5] = rgb_buffer[2] = AVG (bayer_pixel[bayer_line_step], bayer_pixel[-bayer_line_step]);
+
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g R
+ // line_step g b g
+ rgb_buffer[rgb_line_step + 3] = rgb_buffer[3] = bayer_pixel[1];
+ rgb_buffer[4] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step + 1], bayer_pixel[-bayer_line_step + 1]);
+ //rgb_pixel[5] = AVG( bayer_pixel[line_step], bayer_pixel[-line_step] );
+
+ // BGBG line
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g r
+ // line_step g B g
+ //rgb_pixel[rgb_line_step ] = AVG2( bayer_pixel[-1], bayer_pixel[1] );
+ rgb_buffer[rgb_line_step + 1] = AVG3 (bayer_pixel[0], bayer_pixel[bayer_line_step - 1], bayer_pixel[bayer_line_step + 1]);
+ rgb_buffer[rgb_line_step + 5] = rgb_buffer[rgb_line_step + 2] = bayer_pixel[bayer_line_step];
+
+ // Bayer -1 0 1
+ // -1 g b g
+ // 0 r g r
+ // line_step g b G
+ //rgb_pixel[rgb_line_step + 3] = bayer_pixel[1];
+ rgb_buffer[rgb_line_step + 4] = bayer_pixel[bayer_line_step + 1];
+ //rgb_pixel[rgb_line_step + 5] = bayer_pixel[line_step];
+ }
+ //else
+ // THROW_OPENNI_EXCEPTION ("Unknwon debayering method: %d", (int)debayering_method);
+ }
+ //Warning: Downsampling mod is untested
+ else if (nDownSampleStep > 1)
+ {
+ // get each or each 2nd pixel group to find rgb values!
+ register unsigned bayerXStep = nDownSampleStep;
+ register unsigned bayerYSkip = (nDownSampleStep - 1) * width;
+
+ // Downsampling and debayering at once
+ register const XnUInt8* bayer_buffer = bayer_pixel;
+
+ for (register unsigned yIdx = 0; yIdx < height; ++yIdx, bayer_buffer += bayerYSkip, rgb_buffer += rgb_line_skip) // skip a line
+ {
+ for (register unsigned xIdx = 0; xIdx < width; ++xIdx, rgb_buffer += 3, bayer_buffer += bayerXStep)
+ {
+ rgb_buffer[ 2 ] = bayer_buffer[ width ];
+ rgb_buffer[ 1 ] = AVG (bayer_buffer[0], bayer_buffer[ width + 1]);
+ rgb_buffer[ 0 ] = bayer_buffer[ 1 ];
+ }
+ }
+ }
+}
- nRed = ((XnUInt32)pCurrBayer[-BAYER_LINE_LENGTH]+pCurrBayer[BAYER_LINE_LENGTH]) / 2;
- nBlue = ((XnUInt32)pCurrBayer[-1]+pCurrBayer[1]) / 2;
- WriteRGB(pCurrRGB+0, nRed, pCurrBayer[0], nBlue);
- nRed = ((XnUInt32)pCurrBayer[-BAYER_LINE_LENGTH+2]+pCurrBayer[BAYER_LINE_LENGTH+2]) / 2;
- nGreen = ((XnUInt32)pCurrBayer[0]+pCurrBayer[2]) / 2;
- WriteRGB(pCurrRGB+BAYER_BPP, nRed, nGreen, pCurrBayer[1]);
- nGreen = ((XnUInt32)pCurrBayer[BAYER_LINE_LENGTH-1]+pCurrBayer[BAYER_LINE_LENGTH+1]) / 2;
- nBlue = ((XnUInt32)pCurrBayer[BAYER_LINE_LENGTH2-1]+pCurrBayer[BAYER_LINE_LENGTH2+1]) / 2;
- WriteRGB(pCurrRGB+BAYER_RGB_LINE_LENGTH, pCurrBayer[BAYER_LINE_LENGTH], nGreen, nBlue);
+void Bayer2RGB888(const XnUInt8* pBayerImage, XnUInt8* pRGBImage, XnUInt32 nXRes, XnUInt32 nYRes, XnUInt32 nDownSampleStep, XnUInt32 nBadPixels)
+{
+ fillRGB(nXRes, nYRes, pBayerImage, pRGBImage, DebayeringMethod(1), nDownSampleStep); // DebayeringMethod(0) == bilinear, (1) == edge aware, (2) == edge aware weighted
+}
- nRed = ((XnUInt32)pCurrBayer[BAYER_LINE_LENGTH]+pCurrBayer[BAYER_LINE_LENGTH+2]) / 2;
- nBlue = ((XnUInt32)pCurrBayer[1]+pCurrBayer[BAYER_LINE_LENGTH2+1]) / 2;
- WriteRGB(pCurrRGB+BAYER_RGB_LINE_LENGTH+BAYER_BPP, nRed, pCurrBayer[BAYER_LINE_LENGTH+1], nBlue);
- pCurrBayer += 2;
- pCurrRGB += 2*BAYER_BPP;
- } while (--nColCount);
- pBayer += BAYER_LINE_LENGTH2;
- pRGB += BAYER_RGB_LINE_LENGTH2;
- } while (--nTotalRowsCount);
-}
diff --git a/Source/XnDeviceSensorV2/Bayer.h b/Source/XnDeviceSensorV2/Bayer.h
index 15c3925..7b866ad 100644
--- a/Source/XnDeviceSensorV2/Bayer.h
+++ b/Source/XnDeviceSensorV2/Bayer.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_BAYER_H_
#define _XN_BAYER_H_
diff --git a/Source/XnDeviceSensorV2/IXnSensorStream.h b/Source/XnDeviceSensorV2/IXnSensorStream.h
index c4fde67..aaf28b6 100644
--- a/Source/XnDeviceSensorV2/IXnSensorStream.h
+++ b/Source/XnDeviceSensorV2/IXnSensorStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __I_XN_SENSOR_STREAM_H__
#define __I_XN_SENSOR_STREAM_H__
diff --git a/Source/XnDeviceSensorV2/Registration.cpp b/Source/XnDeviceSensorV2/Registration.cpp
index 3a033a2..006fc57 100644
--- a/Source/XnDeviceSensorV2/Registration.cpp
+++ b/Source/XnDeviceSensorV2/Registration.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -61,8 +55,8 @@ inline XnDouble XnXRegistrationFunction1000(XnRegistrationInformation1000& regIn
regInfo1000.FuncX.dD,
regInfo1000.FuncX.dE,
regInfo1000.FuncX.dF,
- nX - nXRes/2,
- nY - nYRes/2);
+ (XnUInt16)(nX - nXRes/2),
+ (XnUInt16)(nY - nYRes/2));
}
inline XnDouble XnYRegistrationFunction1000(XnRegistrationInformation1000& regInfo1000, XnUInt16 nX, XnUInt16 nY, XnUInt32 nXRes, XnUInt32 nYRes)
@@ -74,8 +68,8 @@ inline XnDouble XnYRegistrationFunction1000(XnRegistrationInformation1000& regIn
regInfo1000.FuncY.dD,
regInfo1000.FuncY.dE,
regInfo1000.FuncY.dF,
- nX - nXRes/2,
- nY - nYRes/2);
+ (XnUInt16)(nX - nXRes/2),
+ (XnUInt16)(nY - nYRes/2));
}
XnStatus XnRegistration::BuildRegTable1000()
@@ -84,7 +78,7 @@ XnStatus XnRegistration::BuildRegTable1000()
// take needed parameters to perform registration
XnRegistrationInformation1000 regInfo1000;
- nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION, ®Info1000, sizeof(regInfo1000), m_pDepthStream->GetResolution(), m_pDepthStream->GetFPS());
+ nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION, ®Info1000, sizeof(regInfo1000), m_pDepthStream->GetResolution(), (XnUInt16)m_pDepthStream->GetFPS());
XN_IS_STATUS_OK(nRetVal);
XnUInt16* pRegTable = m_pRegistrationTable;
@@ -93,8 +87,8 @@ XnStatus XnRegistration::BuildRegTable1000()
XnDouble dNewX = 0,
dNewY = 0;
- XnUInt64 nDepthXRes = m_pDepthStream->GetXRes();
- XnUInt64 nDepthYRes = m_pDepthStream->GetYRes();
+ XnUInt32 nDepthXRes = m_pDepthStream->GetXRes();
+ XnUInt32 nDepthYRes = m_pDepthStream->GetYRes();
const XnUInt16 nIllegalValue = XnUInt16(nDepthXRes*4);
@@ -235,7 +229,6 @@ void CreateDXDYTables (XnDouble* RegXTable, XnDouble* RegYTable,
#define XN_SENSOR_WIN_OFFET_Y 1
#define RGB_REG_X_VAL_SCALE 16
#define S2D_PEL_CONST 10
-#define XN_SENSOR_DEPTH_RGB_CMOS_DISTANCE 2.4
#define S2D_CONST_OFFSET 0.375
void BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDepthStream* m_pStream)
@@ -253,10 +246,14 @@ void BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDepthStream* m_pStre
XnUInt64 nPlaneDsr;
XnDouble dPlaneDsr;
m_pStream->GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &nPlaneDsr);
- dPlaneDsr = nPlaneDsr;
+ dPlaneDsr = (XnDouble)nPlaneDsr;
+
+ // --avin mod-- (seems like a ps bug)
+ XnDouble dDCRCDist;
+ m_pStream->GetProperty(XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE, &dDCRCDist);
XnDouble dPelSize = 1.0 / (dPlanePixelSize * nXScale * S2D_PEL_CONST);
- XnDouble dPelDCC = XN_SENSOR_DEPTH_RGB_CMOS_DISTANCE * dPelSize * S2D_PEL_CONST;
+ XnDouble dPelDCC = dDCRCDist * dPelSize * S2D_PEL_CONST;
XnDouble dPelDSR = dPlaneDsr * dPelSize * S2D_PEL_CONST;
memset(pRGBRegDepthToShiftTable, XN_DEVICE_SENSOR_NO_DEPTH_VALUE, nMaxDepth * sizeof(XnInt16));
@@ -264,7 +261,7 @@ void BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDepthStream* m_pStre
for (nIndex = 0; nIndex < nMaxDepth; nIndex++)
{
dDepth = nIndex * dPelSize;
- pRGBRegDepthToShiftTable[nIndex] = ((dPelDCC * (dDepth - dPelDSR) / dDepth) + (S2D_CONST_OFFSET)) * RGB_REG_X_VAL_SCALE;
+ pRGBRegDepthToShiftTable[nIndex] = (XnInt16)(((dPelDCC * (dDepth - dPelDSR) / dDepth) + (S2D_CONST_OFFSET)) * RGB_REG_X_VAL_SCALE);
}
}
@@ -274,11 +271,11 @@ XnStatus XnRegistration::BuildRegTable1080()
// take needed parameters to perform registration
XnRegistrationInformation1080 RegData;
- nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION, &RegData, sizeof(RegData), m_pDepthStream->GetResolution(), m_pDepthStream->GetFPS());
+ nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION, &RegData, sizeof(RegData), m_pDepthStream->GetResolution(), (XnUInt16)m_pDepthStream->GetFPS());
XN_IS_STATUS_OK(nRetVal);
xnOSMemSet(&m_padInfo, 0, sizeof(m_padInfo));
- nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_PADDING, &m_padInfo, sizeof(m_padInfo), m_pDepthStream->GetResolution(), m_pDepthStream->GetFPS());
+ nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_PADDING, &m_padInfo, sizeof(m_padInfo), m_pDepthStream->GetResolution(), (XnUInt16)m_pDepthStream->GetFPS());
XN_IS_STATUS_OK(nRetVal);
XN_VALIDATE_ALIGNED_CALLOC(m_pDepthToShiftTable, XnUInt16, m_pDepthStream->GetXRes()*m_pDepthStream->GetYRes(), XN_DEFAULT_MEM_ALIGN);
@@ -289,10 +286,8 @@ XnStatus XnRegistration::BuildRegTable1080()
XnDouble* RegXTable = XN_NEW_ARR(XnDouble, RGB_REG_X_RES*RGB_REG_Y_RES);
XnDouble* RegYTable = XN_NEW_ARR(XnDouble, RGB_REG_X_RES*RGB_REG_Y_RES);
- XnInt16* pRGBRegDepthToShiftTable = (XnInt16*)m_pDepthToShiftTable;
XnUInt16 nDepthXRes = XN_DEPTH_XRES;
XnUInt16 nDepthYRes = XN_DEPTH_YRES;
- XnUInt32 nXScale = XN_CMOS_VGAOUTPUT_XRES / XN_DEPTH_XRES;
XnDouble* pRegXTable = (XnDouble*)RegXTable;
XnDouble* pRegYTable = (XnDouble*)RegYTable;
XnInt16* pRegTable = (XnInt16*)m_pRegistrationTable;
@@ -347,14 +342,14 @@ XnStatus XnRegistration::BuildRegTable1080()
nNewX = ((nDepthXRes*4) * RGB_REG_X_VAL_SCALE); // set illegal value on purpose
}
- if (nNewY > nDepthYRes)
+ if (nNewY > nDepthYRes-2)
{
nNewY = nDepthYRes;
goto FinishLoop;
}
- *pRegTable = nNewX;
- *(pRegTable+1) = nNewY;
+ *pRegTable = (XnInt16)nNewX;
+ *(pRegTable+1) = (XnInt16)nNewY;
pRegXTable++;
pRegYTable++;
@@ -371,8 +366,6 @@ XnStatus XnRegistration::BuildRegTable1080()
XnStatus XnRegistration::BuildRegTable()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
m_b1000 = (m_pDevicePrivateData->ChipInfo.nChipVer == XN_SENSOR_CHIP_VER_PS1000);
if (m_b1000)
{
@@ -382,8 +375,6 @@ XnStatus XnRegistration::BuildRegTable()
{
return BuildRegTable1080();
}
-
- return (XN_STATUS_OK);
}
XnStatus XnRegistration::Init(XnDevicePrivateData* pDevicePrivateData, XnSensorDepthStream* pDepthStream, XnUInt16* pDepthToShiftTable)
@@ -480,29 +471,17 @@ void XnRegistration::Apply1000(XnDepthPixel* pInput, XnDepthPixel* pOutput)
nNewX = (XnInt32)(XnDouble(*pRegTable)/XN_REG_X_SCALE + XnInt32(pDepth2ShiftTable[nValue]/XN_REG_PARAB_COEFF - nConstShift) * dShiftFactor);
nNewY = *(pRegTable+1);
- if ( nNewX < nDepthXRes && nNewY < nDepthYRes )
+ if ((XnUInt32)nNewX-1 < (XnUInt32)nDepthXRes-1)
{
nArrPos = nNewY * nDepthXRes + nNewX;
nOutValue = pOutput[nArrPos];
if (nOutValue == 0 || nOutValue > nValue)
{
- if ( nNewX > 0 && nNewY > 0 )
- {
- pOutput[nArrPos-nDepthXRes] = nValue;
- pOutput[nArrPos-nDepthXRes-1] = nValue;
- pOutput[nArrPos-1] = nValue;
- }
- else if( nNewY > 0 )
- {
- pOutput[nArrPos-nDepthXRes] = nValue;
- }
- else if( nNewX > 0 )
- {
- pOutput[nArrPos-1] = nValue;
- }
-
pOutput[nArrPos] = nValue;
+ pOutput[nArrPos-1] = nValue;
+ pOutput[nArrPos-nDepthXRes] = nValue;
+ pOutput[nArrPos-nDepthXRes-1] = nValue;
}
}
}
@@ -527,15 +506,13 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
memset(pOutput, XN_DEVICE_SENSOR_NO_DEPTH_VALUE, nDepthXRes*nDepthYRes*sizeof(XnDepthPixel));
// entire map should be shifted by X lines
- XnUInt32 nConstOffset = nDepthYRes*m_padInfo.nStartLines;
-
- XnDepthPixel* pInputEnd = pInput + nDepthYRes*nDepthXRes;
+ XnUInt32 nConstOffset = nDepthXRes*m_padInfo.nStartLines;
XnBool bMirror = m_pDepthStream->IsMirrored();
for (XnUInt32 y = 0; y < nDepthYRes; ++y)
{
- pRegTable = (XnInt16*)&m_pRegistrationTable[ bMirror ? (y+1) * nDepthXRes * 2 - 2 : y * nDepthXRes * 2 ];
+ pRegTable = (XnInt16*)&m_pRegistrationTable[ bMirror ? (y+1) * nDepthXRes * 2 : y * nDepthXRes * 2 ];
for (XnUInt32 x = 0; x < nDepthXRes; ++x)
{
nValue = *pInput;
@@ -545,9 +522,9 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
nNewX = (XnUInt32)(*pRegTable + pRGBRegDepthToShiftTable[nValue]) / RGB_REG_X_VAL_SCALE;
nNewY = *(pRegTable+1);
- if (nNewX < nDepthXRes && nNewY < nDepthYRes )
+ if (nNewX < nDepthXRes)
{
- nArrPos = bMirror ? (nNewY+1)*nDepthXRes - nNewX - 2 : (nNewY*nDepthXRes) + nNewX;
+ nArrPos = bMirror ? (nNewY+1)*nDepthXRes - nNewX : (nNewY*nDepthXRes) + nNewX;
nArrPos -= nConstOffset;
nOutValue = pOutput[nArrPos];
@@ -568,7 +545,7 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
{
pOutput[nArrPos-1] = nValue;
}
-
+
pOutput[nArrPos] = nValue;
}
}
diff --git a/Source/XnDeviceSensorV2/Registration.h b/Source/XnDeviceSensorV2/Registration.h
index 8ed1a3e..3a2f189 100644
--- a/Source/XnDeviceSensorV2/Registration.h
+++ b/Source/XnDeviceSensorV2/Registration.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_REGISTRATION_H_
#define _XN_REGISTRATION_H_
diff --git a/Source/XnDeviceSensorV2/Uncomp.cpp b/Source/XnDeviceSensorV2/Uncomp.cpp
index 9b6edc4..bdcc2c0 100644
--- a/Source/XnDeviceSensorV2/Uncomp.cpp
+++ b/Source/XnDeviceSensorV2/Uncomp.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -92,7 +86,7 @@ XnStatus XnStreamUncompressYUVImagePS(const XnUInt8* pInput, const XnUInt32 nInp
{
// take high_element only
// diffs are between -6 and 6 (0x0 to 0xc)
- nLastFullValue[nChannel] += (cInput >> 4) - 6;
+ nLastFullValue[nChannel] += XnInt8((cInput >> 4) - 6);
}
else if (cInput < 0xe0) // 0xd is dummy
{
@@ -108,7 +102,7 @@ XnStatus XnStreamUncompressYUVImagePS(const XnUInt8* pInput, const XnUInt32 nInp
break;
nTempValue += (*pInput >> 4);
- nLastFullValue[nChannel] = nTempValue;
+ nLastFullValue[nChannel] = (XnUInt8)nTempValue;
}
}
else
@@ -121,7 +115,7 @@ XnStatus XnStreamUncompressYUVImagePS(const XnUInt8* pInput, const XnUInt32 nInp
if (cInput < 0xd) // 0x0 to 0xc are diffs
{
// diffs are between -6 and 6 (0x0 to 0xc)
- nLastFullValue[nChannel] += cInput - 6;
+ nLastFullValue[nChannel] += (XnInt8)(cInput - 6);
}
else if (cInput < 0xe) // 0xd is dummy
{
@@ -173,13 +167,13 @@ XnStatus XnStreamUncompressYUVImagePS(const XnUInt8* pInput, const XnUInt32 nInp
if (bLastPart == TRUE)
{
- *pnOutputSize = (pOutput - pOrigOutput) * sizeof(XnUInt8);
- *pnActualRead += (pInput - pInputOrig) * sizeof(XnUInt8);
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput) * sizeof(XnUInt8);
+ *pnActualRead += (XnUInt32)(pInput - pInputOrig) * sizeof(XnUInt8);
}
else if ((pOutputLastPossibleStop != pOrigOutput) && (pInputLastPossibleStop != pInputOrig))
{
- *pnOutputSize = (pOutputLastPossibleStop - pOrigOutput) * sizeof(XnUInt8);
- *pnActualRead += (pInputLastPossibleStop - pInputOrig) * sizeof(XnUInt8);
+ *pnOutputSize = (XnUInt32)(pOutputLastPossibleStop - pOrigOutput) * sizeof(XnUInt8);
+ *pnActualRead += (XnUInt32)(pInputLastPossibleStop - pInputOrig) * sizeof(XnUInt8);
}
// All is good...
@@ -229,7 +223,7 @@ XnStatus XnStreamUncompressImageNew(const XnUInt8* pInput, const XnUInt32 nInput
{
// take high_element only
// diffs are between -6 and 6 (0x0 to 0xc)
- nLastFullValue[nChannel] += (cInput >> 4) - 6;
+ nLastFullValue[nChannel] += (XnInt8)((cInput >> 4) - 6);
}
else if (cInput < 0xe0) // 0xd is dummy
{
@@ -245,7 +239,7 @@ XnStatus XnStreamUncompressImageNew(const XnUInt8* pInput, const XnUInt32 nInput
break;
nTempValue += (*pInput >> 4);
- nLastFullValue[nChannel] = nTempValue;
+ nLastFullValue[nChannel] = (XnUInt8)nTempValue;
}
}
else
@@ -258,7 +252,7 @@ XnStatus XnStreamUncompressImageNew(const XnUInt8* pInput, const XnUInt32 nInput
if (cInput < 0xd) // 0x0 to 0xc are diffs
{
// diffs are between -6 and 6 (0x0 to 0xc)
- nLastFullValue[nChannel] += cInput - 6;
+ nLastFullValue[nChannel] += (XnInt8)(cInput - 6);
}
else if (cInput < 0xe) // 0xd is dummy
{
@@ -306,13 +300,13 @@ XnStatus XnStreamUncompressImageNew(const XnUInt8* pInput, const XnUInt32 nInput
if (bLastPart == TRUE)
{
- *pnOutputSize = (pOutput - pOrigOutput) * sizeof(XnUInt8);
- *pnActualRead += (pInput - pInputOrig) * sizeof(XnUInt8);
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput) * sizeof(XnUInt8);
+ *pnActualRead += (XnUInt32)(pInput - pInputOrig) * sizeof(XnUInt8);
}
else if ((pOutputLastPossibleStop != pOrigOutput) && (pInputLastPossibleStop != pInputOrig))
{
- *pnOutputSize = (pOutputLastPossibleStop - pOrigOutput) * sizeof(XnUInt8);
- *pnActualRead += (pInputLastPossibleStop - pInputOrig) * sizeof(XnUInt8);
+ *pnOutputSize = (XnUInt32)(pOutputLastPossibleStop - pOrigOutput) * sizeof(XnUInt8);
+ *pnActualRead += (XnUInt32)(pInputLastPossibleStop - pInputOrig) * sizeof(XnUInt8);
}
// All is good...
diff --git a/Source/XnDeviceSensorV2/Uncomp.h b/Source/XnDeviceSensorV2/Uncomp.h
index a34af76..3712f38 100644
--- a/Source/XnDeviceSensorV2/Uncomp.h
+++ b/Source/XnDeviceSensorV2/Uncomp.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_UNCOMP_H_
#define _XN_UNCOMP_H_
diff --git a/Source/XnDeviceSensorV2/XnAudioProcessor.cpp b/Source/XnDeviceSensorV2/XnAudioProcessor.cpp
index f768383..c720b25 100644
--- a/Source/XnDeviceSensorV2/XnAudioProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnAudioProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -38,14 +32,14 @@ XnAudioProcessor::XnAudioProcessor(XnSensorAudioStream* pStream, XnSensorStreamH
XnWholePacketProcessor(pHelper->GetPrivateData(), pStream->GetType(), nInputPacketSize),
m_pStream(pStream),
m_pHelper(pHelper),
- m_AudioInDump(XN_DUMP_CLOSED)
+ m_AudioInDump(NULL)
{
- xnDumpInit(&m_AudioInDump, XN_DUMP_AUDIO_IN, NULL, "AudioIn.pcm");
+ m_AudioInDump = xnDumpFileOpen(XN_DUMP_AUDIO_IN, "AudioIn.pcm");
}
XnAudioProcessor::~XnAudioProcessor()
{
- xnDumpClose(&m_AudioInDump);
+ xnDumpFileClose(m_AudioInDump);
GetStream()->NumberOfChannelsProperty().OnChangeEvent().Unregister(m_hNumChannelsCallback);
}
@@ -66,8 +60,6 @@ XnStatus XnAudioProcessor::Init()
void XnAudioProcessor::ProcessWholePacket(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData)
{
- XnInt32 nAvailableBytes = 0;
-
xnOSEnterCriticalSection(&m_pDevicePrivateData->hAudioBufferCriticalSection);
// take write packet
@@ -102,7 +94,7 @@ void XnAudioProcessor::ProcessWholePacket(const XnSensorProtocolResponseHeader*
XnUInt64 nSysTime;
xnOSGetTimeStamp(&nSysTime);
- xnDumpWriteString(m_pDevicePrivateData->BandwidthDump, "%llu,%s,%d,%d\n",
+ xnDumpFileWriteString(m_pDevicePrivateData->BandwidthDump, "%llu,%s,%d,%d\n",
nSysTime, "Audio", -1, m_nBytesReceived);
m_nBytesReceived = 0;
@@ -119,7 +111,7 @@ void XnAudioProcessor::ProcessWholePacket(const XnSensorProtocolResponseHeader*
xnOSLeaveCriticalSection(&m_pDevicePrivateData->hAudioBufferCriticalSection);
- xnDumpWriteBuffer(m_AudioInDump, pData, pHeader->nBufSize);
+ xnDumpFileWriteBuffer(m_AudioInDump, pData, pHeader->nBufSize);
if (m_pDevicePrivateData->pAudioCallback != NULL)
{
@@ -132,7 +124,7 @@ void XnAudioProcessor::CalcDeleteChannel()
m_bDeleteChannel = (m_pHelper->GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2 && GetStream()->GetNumberOfChannels() == 1);
}
-XnStatus XnAudioProcessor::DeleteChannelChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XnAudioProcessor::DeleteChannelChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnAudioProcessor* pThis = (XnAudioProcessor*)pCookie;
pThis->CalcDeleteChannel();
diff --git a/Source/XnDeviceSensorV2/XnAudioProcessor.h b/Source/XnDeviceSensorV2/XnAudioProcessor.h
index 4395240..5384fe2 100644
--- a/Source/XnDeviceSensorV2/XnAudioProcessor.h
+++ b/Source/XnDeviceSensorV2/XnAudioProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_AUDIO_PROCESSOR_H__
#define __XN_AUDIO_PROCESSOR_H__
@@ -64,7 +59,7 @@ class XnAudioProcessor : public XnWholePacketProcessor
static XnStatus XN_CALLBACK_TYPE DeleteChannelChangedCallback(const XnProperty* pSender, void* pCookie);
/** Used to dump Audio In data. */
- XnDump m_AudioInDump;
+ XnDumpFile* m_AudioInDump;
XnBool m_bDeleteChannel;
XnSensorAudioStream* m_pStream;
XnSensorStreamHelper* m_pHelper;
diff --git a/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp b/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp
index 20a5d15..9e78426 100644
--- a/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -109,7 +103,7 @@ void XnBayerImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolRespon
XnUInt32 nActualRead = 0;
XnBool bLastPart = pHeader->nType == XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END && (nDataOffset + nDataSize) == pHeader->nBufSize;
XnStatus nRetVal = XnStreamUncompressImageNew(pBuf, nBufSize, pWriteBuffer->GetUnsafeWritePointer(),
- &nWrittenOutput, GetActualXRes(), &nActualRead, bLastPart);
+ &nWrittenOutput, (XnUInt16)GetActualXRes(), &nActualRead, bLastPart);
if (nRetVal != XN_STATUS_OK)
{
diff --git a/Source/XnDeviceSensorV2/XnBayerImageProcessor.h b/Source/XnDeviceSensorV2/XnBayerImageProcessor.h
index a779587..0eb5cd7 100644
--- a/Source/XnDeviceSensorV2/XnBayerImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnBayerImageProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_BAYER_IMAGE_PROCESSOR_H__
#define __XN_BAYER_IMAGE_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnCmosInfo.cpp b/Source/XnDeviceSensorV2/XnCmosInfo.cpp
index 6e5b243..0eebe3c 100644
--- a/Source/XnDeviceSensorV2/XnCmosInfo.cpp
+++ b/Source/XnDeviceSensorV2/XnCmosInfo.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -36,7 +30,9 @@
XnCmosInfo::XnCmosInfo(XnSensorFirmware* pFirmware, XnDevicePrivateData* pDevicePrivateData) :
m_pFirmware(pFirmware),
m_pDevicePrivateData(pDevicePrivateData)
-{}
+{
+ xnOSMemSet(m_pCurrCmosBlankingInfo, 0, sizeof(m_pCurrCmosBlankingInfo));
+}
XnCmosInfo::~XnCmosInfo()
{
@@ -69,7 +65,7 @@ XnStatus XnCmosInfo::SetCmosConfig(XnCMOSType nCmos, XnResolutions nResolution,
data.nRes = nResolution;
data.nFPS = nFPS;
- nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_BLANKING, &data.BlankingInfo, sizeof(XnCmosBlankingInformation), nResolution, nFPS);
+ nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_BLANKING, &data.BlankingInfo, sizeof(XnCmosBlankingInformation), nResolution, (XnUInt16)nFPS);
XN_IS_STATUS_OK(nRetVal);
// add to list
diff --git a/Source/XnDeviceSensorV2/XnCmosInfo.h b/Source/XnDeviceSensorV2/XnCmosInfo.h
index 588c3e4..9d4051b 100644
--- a/Source/XnDeviceSensorV2/XnCmosInfo.h
+++ b/Source/XnDeviceSensorV2/XnCmosInfo.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_CMOS_INFO_H__
#define __XN_CMOS_INFO_H__
diff --git a/Source/XnDeviceSensorV2/XnDataProcessor.cpp b/Source/XnDeviceSensorV2/XnDataProcessor.cpp
index 49fd1a0..c29c373 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnDataProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -64,18 +58,18 @@ void XnDataProcessor::ProcessData(const XnSensorProtocolResponseHeader* pHeader,
if (nDataOffset == 0)
{
// make sure no packet was lost
- if (pHeader->nReserve != m_nLastPacketID+1 && pHeader->nReserve != 0)
+ if (pHeader->nPacketID != m_nLastPacketID+1 && pHeader->nPacketID != 0)
{
- xnLogWarning(XN_MASK_SENSOR_PROTOCOL, "%s: Expected %x, got %x", m_csName, m_nLastPacketID+1, pHeader->nReserve);
+ xnLogWarning(XN_MASK_SENSOR_PROTOCOL, "%s: Expected %x, got %x", m_csName, m_nLastPacketID+1, pHeader->nPacketID);
OnPacketLost();
}
- m_nLastPacketID = pHeader->nReserve;
+ m_nLastPacketID = pHeader->nPacketID;
// log packet arrival
XnUInt64 nNow;
xnOSGetHighResTimeStamp(&nNow);
- xnDumpWriteString(m_pDevicePrivateData->MiniPacketsDump, "%llu,0x%hx,0x%hx,0x%hx,%u\n", nNow, pHeader->nType, pHeader->nReserve, pHeader->nBufSize, pHeader->nTimeStamp);
+ xnDumpFileWriteString(m_pDevicePrivateData->MiniPacketsDump, "%llu,0x%hx,0x%hx,0x%hx,%u\n", nNow, pHeader->nType, pHeader->nPacketID, pHeader->nBufSize, pHeader->nTimeStamp);
}
ProcessPacketChunk(pHeader, pData, nDataOffset, nDataSize);
@@ -94,7 +88,8 @@ XnUInt64 XnDataProcessor::GetTimeStamp(XnUInt32 nDeviceTimeStamp)
XnUInt64 nNow;
xnOSGetHighResTimeStamp(&nNow);
- XnChar csDumpComment[200] = "";
+ const XnUInt32 nDumpCommentMaxLength = 200;
+ XnChar csDumpComment[nDumpCommentMaxLength] = "";
XnBool bCheckSanity = TRUE;
@@ -113,20 +108,51 @@ XnUInt64 XnDataProcessor::GetTimeStamp(XnUInt32 nDeviceTimeStamp)
if (m_TimeStampData.bFirst)
{
- // check how much OS time passed since global reference was taken
+ /*
+ This is a bit tricky, as we need to synchronize the first timestamp of different streams.
+ We somehow need to translate 32-bit tick counts to 64-bit timestamps. The device timestamps
+ wrap-around every ~71.5 seconds (for PS1080 @ 60 MHz).
+ Lets assume the first packet of the first stream got timestamp X. Now we get the first packet of another
+ stream with a timestamp Y.
+ We need to figure out what is the relation between X and Y.
+ We do that by analyzing the following scenarios:
+ 1. Y is after X, in the same period (no wraparound yet).
+ 2. Y is after X, in a different period (one or more wraparounds occurred).
+ 3. Y is before X, in the same period (might happen due to race condition).
+ 4. Y is before X, in a different period (this can happen if X is really small, and Y is almost at wraparound).
+
+ The following code tried to handle all those cases. It uses an OS timer to try and figure out how
+ many wraparounds occurred.
+ */
+
+ // estimate the number of wraparound that occurred using OS time
XnUInt64 nOSTime = nNow - m_pDevicePrivateData->nGlobalReferenceOSTime;
- // check how many full wrap-arounds occurred (according to OS time)
- XnFloat fWrapAroundInMicroseconds = nWrapPoint / (XnDouble)m_pDevicePrivateData->fDeviceFrequency;
- XnUInt32 nWraps = nOSTime / fWrapAroundInMicroseconds; // floor
+ // calculate wraparound length
+ XnDouble fWrapAroundInMicroseconds = nWrapPoint / (XnDouble)m_pDevicePrivateData->fDeviceFrequency;
+
+ // perform a rough estimation
+ XnInt32 nWraps = (XnInt32)(nOSTime / fWrapAroundInMicroseconds);
+
+ // now fix the estimation by clipping TS to the correct wraparounds
+ XnInt64 nEstimatedTicks =
+ nWraps * nWrapPoint + // wraps time
+ nDeviceTimeStamp - m_pDevicePrivateData->nGlobalReferenceTS;
+
+ XnInt64 nEstimatedTime = (XnInt64)(nEstimatedTicks / (XnDouble)m_pDevicePrivateData->fDeviceFrequency);
+
+ if (nEstimatedTime < nOSTime - 0.5 * fWrapAroundInMicroseconds)
+ nWraps++;
+ else if (nEstimatedTime > nOSTime + 0.5 * fWrapAroundInMicroseconds)
+ nWraps--;
- // now check, if current timestamp is less than global, then we have one more wrap-around
- // (make sure it's significant - we allow up to 10 ms before - otherwise it could just be a
- // matter of race-condition)
- if (m_pDevicePrivateData->nGlobalReferenceTS > nDeviceTimeStamp &&
- nOSTime > XN_SENSOR_TIMESTAMP_SANITY_DIFF*1000)
+ // handle the two special cases - 3 & 4 in which we get a timestamp which is
+ // *before* global TS (meaning before time 0)
+ if (nWraps < 0 || // case 4
+ (nWraps == 0 && nDeviceTimeStamp < m_pDevicePrivateData->nGlobalReferenceTS)) // case 3
{
- ++nWraps;
+ nDeviceTimeStamp = m_pDevicePrivateData->nGlobalReferenceTS;
+ nWraps = 0;
}
m_TimeStampData.nReferenceTS = m_pDevicePrivateData->nGlobalReferenceTS;
@@ -168,14 +194,14 @@ XnUInt64 XnDataProcessor::GetTimeStamp(XnUInt32 nDeviceTimeStamp)
if (bCheckSanity && (nResultTimeMilliSeconds > (m_TimeStampData.nLastResultTime + XN_SENSOR_TIMESTAMP_SANITY_DIFF*1000)))
{
bIsSane = FALSE;
- sprintf(csDumpComment, "%s,Didn't pass sanity. Will try to re-sync.", csDumpComment);
+ xnOSStrAppend(csDumpComment, ",Didn't pass sanity. Will try to re-sync.", nDumpCommentMaxLength);
}
// calc result
XnUInt64 nResult = (m_pDevicePrivateData->pSensor->IsHighResTimestamps() ? (XnUInt64)dResultTimeMicroSeconds : nResultTimeMilliSeconds);
// dump it
- xnDumpWriteString(m_pDevicePrivateData->TimestampsDump, "%llu,%s,%u,%llu,%s\n", nNow, m_TimeStampData.csStreamName, nDeviceTimeStamp, nResult, csDumpComment);
+ xnDumpFileWriteString(m_pDevicePrivateData->TimestampsDump, "%llu,%s,%u,%llu,%s\n", nNow, m_TimeStampData.csStreamName, nDeviceTimeStamp, nResult, csDumpComment);
if (bIsSane)
{
diff --git a/Source/XnDeviceSensorV2/XnDataProcessor.h b/Source/XnDeviceSensorV2/XnDataProcessor.h
index c738042..9185a7b 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessor.h
+++ b/Source/XnDeviceSensorV2/XnDataProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DATA_PROCESSOR_H__
#define __XN_DATA_PROCESSOR_H__
@@ -81,7 +76,7 @@ class XnDataProcessor
*
* @param nDeviceTimeStamp [in] The device TS to translate.
*/
- XnUInt64 GetTimeStamp(XnUInt32 nDeviceTimeStamp);
+ virtual XnUInt64 GetTimeStamp(XnUInt32 nDeviceTimeStamp);
//---------------------------------------------------------------------------
// Class Members
@@ -91,6 +86,7 @@ class XnDataProcessor
/* The number of bytes received so far (since last time this member was reset). */
XnUInt32 m_nBytesReceived;
/* Stores last packet ID */
+ // --avin mod--
XnUInt8 m_nLastPacketID;
/* The name of the stream. */
const XnChar* m_csName;
diff --git a/Source/XnDeviceSensorV2/XnDataProcessorHolder.cpp b/Source/XnDeviceSensorV2/XnDataProcessorHolder.cpp
index 2da1dc6..433200f 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessorHolder.cpp
+++ b/Source/XnDeviceSensorV2/XnDataProcessorHolder.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnDataProcessorHolder.h b/Source/XnDeviceSensorV2/XnDataProcessorHolder.h
index fa7a03a..09804a9 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessorHolder.h
+++ b/Source/XnDeviceSensorV2/XnDataProcessorHolder.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_PROCESSOR_HOLDER_H__
#define __XN_STREAM_PROCESSOR_HOLDER_H__
diff --git a/Source/XnDeviceSensorV2/XnDepthProcessor.cpp b/Source/XnDeviceSensorV2/XnDepthProcessor.cpp
index 5b15c37..336a501 100644
--- a/Source/XnDeviceSensorV2/XnDepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnDepthProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -73,7 +67,7 @@ XnStatus XnDepthProcessor::Init()
XN_VALIDATE_ALLOC_PTR(m_pShiftToDepthTable);
for (XnUInt32 i = 0; i < XN_DEVICE_SENSOR_MAX_SHIFT_VALUE; ++i)
{
- m_pShiftToDepthTable[i] = i;
+ m_pShiftToDepthTable[i] = (XnDepthPixel)i;
}
m_bShiftToDepthAllocated = TRUE;
}
@@ -166,8 +160,6 @@ void XnDepthProcessor::OnFrameReady(XnUInt32 nFrameID, XnUInt64 nFrameTS)
void XnDepthProcessor::WriteShifts(XnUInt16* pShifts, XnUInt32 nCount)
{
- XnBuffer* pWriteBuffer = GetWriteBuffer();
-
XnUInt32 nOutputSize = nCount * sizeof(XnDepthPixel);
// make sure we have enough room
diff --git a/Source/XnDeviceSensorV2/XnDepthProcessor.h b/Source/XnDeviceSensorV2/XnDepthProcessor.h
index 09ccd6b..3c081c5 100644
--- a/Source/XnDeviceSensorV2/XnDepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnDepthProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEPTH_PROCESSOR_H__
#define __XN_DEPTH_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensor.cpp b/Source/XnDeviceSensorV2/XnDeviceSensor.cpp
index 2f1fe5d..95db25e 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensor.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensor.h b/Source/XnDeviceSensorV2/XnDeviceSensor.h
index 9c3a17d..30da04e 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensor.h
+++ b/Source/XnDeviceSensorV2/XnDeviceSensor.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICESENSOR_H_
#define _XN_DEVICESENSOR_H_
@@ -54,8 +48,9 @@
//---------------------------------------------------------------------------
#define XN_DEVICE_MAJORVERSION 1
#define XN_DEVICE_MINORVERSION 0
-#define XN_DEVICE_NAME "SensorV2"
-#define XN_DEVICE_DESCRIPTION "Xiron I/O Prime Sensor v2/v3/v4 Device"
+// --avin mod--
+#define XN_DEVICE_NAME "SensorKinect"
+#define XN_DEVICE_DESCRIPTION "Xiron I/O Kinect Device"
#define XN_DEVICE_SENSOR_THREAD_KILL_TIMEOUT 5000
@@ -249,6 +244,12 @@ typedef struct XnCmosBlankingInformation
XnCmosBlankingCoefficients Coefficients[2];
} XnCmosBlankingInformation;
+typedef struct XnDeviceInformation
+{
+ XnChar strDeviceName[128];
+ XnChar strVendorData[128];
+} XnDeviceInformation;
+
typedef XnStatus (XN_CALLBACK_TYPE* NewAudioDataCallback)(void* pCookie);
struct XnSpecificUsbDevice; // Forward Declaration
@@ -317,11 +318,11 @@ typedef struct XnDevicePrivateData
XnUInt16 nFrameSync;
/** Used to dump timestamps data. */
- XnDump TimestampsDump;
+ XnDumpFile* TimestampsDump;
/** Used to dump bandwidth data. */
- XnDump BandwidthDump;
+ XnDumpFile* BandwidthDump;
/** Used to dump MiniPackets data. */
- XnDump MiniPacketsDump;
+ XnDumpFile* MiniPacketsDump;
XnBool bDepthMirror;
XnBool bImageMirror;
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp b/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
index 7dc79a4..53a07e8 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
@@ -1,53 +1,37 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnDeviceSensorIO.h"
#include "XnDeviceSensor.h"
+#include
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
-#define XN_SENSOR_VENDOR_ID 0x1D27
-#define XN_SENSOR_VENDOR_ID_KINECT 0x045E
-#define XN_SENSOR_2_0_PRODUCT_ID 0x0200
-#define XN_SENSOR_5_0_PRODUCT_ID 0x0500
-#define XN_SENSOR_6_0_PRODUCT_ID 0x0600
-#define XN_SENSOR_KINECT_PRODUCT_ID 0x02AE
-
-#if XN_PLATFORM == XN_PLATFORM_WIN32
- #include
- DEFINE_GUID(GUID_CLASS_PSDRV_USB, 0xc3b5f022, 0x5a42, 0x1980, 0x19, 0x09, 0xea, 0x72, 0x09, 0x56, 0x01, 0xb1);
- #define USB_DEVICE_EXTRA_PARAM (void*)&GUID_CLASS_PSDRV_USB
-#else
- #define USB_DEVICE_EXTRA_PARAM NULL
-#endif
+// --avin mod--
+#define XN_SENSOR_VENDOR_ID_KINECT 0x045E
+#define XN_SENSOR_PRODUCT_ID_KINECT 0x02AE
//---------------------------------------------------------------------------
// Enums
@@ -61,10 +45,10 @@ typedef enum
//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
-
XnSensorIO::XnSensorIO(XN_SENSOR_HANDLE* pSensorHandle) :
m_pSensorHandle(pSensorHandle),
- m_bMiscSupported(FALSE)
+ m_bMiscSupported(FALSE),
+ m_bIsLowBandwidth(FALSE)
{
}
@@ -84,33 +68,23 @@ XnStatus XnSensorIO::OpenDevice(const XnChar* strPath)
xnLogVerbose(XN_MASK_DEVICE_IO, "Connecting to USB device...");
- if (strstr(strPath, "\\\\?\\usb") == NULL)
+ if (strPath == NULL || strcmp(strPath, "*:0") == 0)
{
- strPath = NULL;
- }
+ // support old style API
+ XnConnectionString aConnections[1];
+ XnUInt32 nCount = 1;
+ nRetVal = EnumerateSensors(aConnections, &nCount);
+ if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_OUTPUT_BUFFER_OVERFLOW)
+ {
+ return nRetVal;
+ }
- // try to open a 6.0 device
- xnLogVerbose(XN_MASK_DEVICE_IO, "Trying to open a 6.0 sensor...");
- nRetVal = xnUSBOpenDevice(XN_SENSOR_VENDOR_ID, XN_SENSOR_6_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, (void*)strPath, &m_pSensorHandle->USBDevice);
- if (nRetVal == XN_STATUS_USB_DEVICE_NOT_FOUND)
- {
- // if not found, see if we have a 5.0 device
- xnLogVerbose(XN_MASK_DEVICE_IO, "Can't find 6.0. Trying to open a 5.0 sensor...");
- nRetVal = xnUSBOpenDevice(XN_SENSOR_VENDOR_ID, XN_SENSOR_5_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, (void*)strPath, &m_pSensorHandle->USBDevice);
+ strPath = aConnections[0];
}
- if (nRetVal == XN_STATUS_USB_DEVICE_NOT_FOUND)
- {
- // if not found, see if we have a 2.0 - 4.0 devices
- xnLogVerbose(XN_MASK_DEVICE_IO, "Can't find 5.0. Trying to open an older sensor...");
- nRetVal = xnUSBOpenDevice(XN_SENSOR_VENDOR_ID, XN_SENSOR_2_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, (void*)strPath, &m_pSensorHandle->USBDevice);
- }
- if (nRetVal == XN_STATUS_USB_DEVICE_NOT_FOUND)
- {
- // if not found, try the kinect
- xnLogVerbose(XN_MASK_DEVICE_IO, "Can't find 2.0 - 4.0. Trying to open a kinect sensor...");
- nRetVal = xnUSBOpenDevice(XN_SENSOR_VENDOR_ID_KINECT, XN_SENSOR_KINECT_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, (void*)strPath, &m_pSensorHandle->USBDevice);
- }
+ // try to open the device
+ xnLogVerbose(XN_MASK_DEVICE_IO, "Trying to open sensor '%s'...", strPath);
+ nRetVal = xnUSBOpenDeviceByPath(strPath, &m_pSensorHandle->USBDevice);
XN_IS_STATUS_OK(nRetVal);
nRetVal = xnUSBGetDeviceSpeed(m_pSensorHandle->USBDevice, &DevSpeed);
@@ -140,34 +114,43 @@ XnStatus XnSensorIO::OpenDevice(const XnChar* strPath)
m_pSensorHandle->ControlConnection.bIsBulk = TRUE;
}
- xnLogInfo(XN_MASK_DEVICE_IO, "Connected to USB device");
+ nRetVal = IsSensorLowBandwidth(strPath, &m_bIsLowBandwidth);
+ XN_IS_STATUS_OK(nRetVal);
+
+ xnLogInfo(XN_MASK_DEVICE_IO, "Connected to USB device%s", m_bIsLowBandwidth ? " (LowBand)" : "");
+
+ strcpy(m_strDeviceName, strPath);
return XN_STATUS_OK;
}
-XnStatus XnSensorIO::OpenDataEndPoints(XnSensorUsbInterface nInterface)
+XnStatus XnSensorIO::OpenDataEndPoints(XnSensorUsbInterface nInterface, const XnFirmwareInfo& fwInfo)
{
XnStatus nRetVal = XN_STATUS_OK;
// try to set requested interface
if (nInterface != XN_SENSOR_USB_INTERFACE_DEFAULT)
{
- XnFWUsbInterface nFWInterface;
+ XnUInt8 nAlternativeInterface = 0;
+
switch (nInterface)
{
case XN_SENSOR_USB_INTERFACE_ISO_ENDPOINTS:
- nFWInterface = XN_FW_USB_INTERFACE_ISO;
+ nAlternativeInterface = fwInfo.nISOAlternativeInterface;
break;
case XN_SENSOR_USB_INTERFACE_BULK_ENDPOINTS:
- nFWInterface = XN_FW_USB_INTERFACE_BULK;
+ nAlternativeInterface = fwInfo.nBulkAlternativeInterface;
break;
default:
+ XN_ASSERT(FALSE);
XN_LOG_WARNING_RETURN(XN_STATUS_USB_INTERFACE_NOT_SUPPORTED, XN_MASK_DEVICE_IO, "Unknown interface type: %d", nInterface);
}
-
- xnLogVerbose(XN_MASK_DEVICE_IO, "Setting USB interface to %d...", nFWInterface);
- nRetVal = xnUSBSetInterface(m_pSensorHandle->USBDevice, 0, nFWInterface);
+// --avin mod--
+/*
+ xnLogVerbose(XN_MASK_DEVICE_IO, "Setting USB alternative interface to %d...", nAlternativeInterface);
+ nRetVal = xnUSBSetInterface(m_pSensorHandle->USBDevice, 0, nAlternativeInterface);
XN_IS_STATUS_OK(nRetVal);
+*/
}
xnLogVerbose(XN_MASK_DEVICE_IO, "Opening endpoints...");
@@ -374,48 +357,102 @@ XnStatus XnSensorIO::CloseDevice()
return (XN_STATUS_OK);
}
-XnStatus XnSensorIO::GetNumOfSensors(XnUInt32* pnNumSensors)
+XnStatus Enumerate(XnUInt16 nProduct, XnStringsHash& devicesSet)
{
XnStatus nRetVal = XN_STATUS_OK;
- XnBool bIsPresent = FALSE;
-
- *pnNumSensors = 0;
-
- nRetVal = xnUSBInit();
- if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_USB_ALREADY_INIT)
- return nRetVal;
+
+ const XnUSBConnectionString* astrDevicePaths;
+ XnUInt32 nCount;
- // search for a v6.0 device
- nRetVal = xnUSBIsDevicePresent(XN_SENSOR_VENDOR_ID, XN_SENSOR_6_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, &bIsPresent);
+ // --avin mod--
+ nRetVal = xnUSBEnumerateDevices(XN_SENSOR_VENDOR_ID_KINECT, nProduct, &astrDevicePaths, &nCount);
XN_IS_STATUS_OK(nRetVal);
- if (!bIsPresent)
+ for (XnUInt32 i = 0; i < nCount; ++i)
{
- // search for a v5.0 device
- nRetVal = xnUSBIsDevicePresent(XN_SENSOR_VENDOR_ID, XN_SENSOR_5_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, &bIsPresent);
+ nRetVal = devicesSet.Set(astrDevicePaths[i], NULL);
XN_IS_STATUS_OK(nRetVal);
}
- if (!bIsPresent)
+ xnUSBFreeDevicesList(astrDevicePaths);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorIO::EnumerateSensors(XnConnectionString* aConnectionStrings, XnUInt32* pnCount)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = xnUSBInit();
+ if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_USB_ALREADY_INIT)
+ return nRetVal;
+
+// Temporary patch: "Cache" the devices since running USB enum on the MacOSX platform takes several seconds due to problems in libusb!
+#if (XN_PLATFORM == XN_PLATFORM_MACOSX)
+ static XnStringsHash devicesSet;
+
+ if (devicesSet.Size() == 0)
{
- // try searching for an older device
- nRetVal = xnUSBIsDevicePresent(XN_SENSOR_VENDOR_ID, XN_SENSOR_2_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, &bIsPresent);
+ // --avin mod--
+ // search for a kinect device
+ nRetVal = Enumerate(XN_SENSOR_PRODUCT_ID_KINECT, devicesSet);
XN_IS_STATUS_OK(nRetVal);
}
+#else
+ XnStringsHash devicesSet;
+
+ // --avin mod--
+ // search for a kinect device
+ nRetVal = Enumerate(XN_SENSOR_PRODUCT_ID_KINECT, devicesSet);
+ XN_IS_STATUS_OK(nRetVal);
+#endif
- if (!bIsPresent)
+ // now copy back
+ XnUInt32 nCount = 0;
+ for (XnStringsHash::ConstIterator it = devicesSet.begin(); it != devicesSet.end(); ++it, ++nCount)
{
- // try searching for a kinect
- nRetVal = xnUSBIsDevicePresent(XN_SENSOR_VENDOR_ID_KINECT, XN_SENSOR_KINECT_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, &bIsPresent);
- XN_IS_STATUS_OK(nRetVal);
- }
+ if (nCount < *pnCount)
+ {
+ strcpy(aConnectionStrings[nCount], it.Key());
+ }
+ }
- if (bIsPresent == TRUE)
+ if (nCount > *pnCount)
{
- *pnNumSensors = 1;
+ *pnCount = nCount;
+ return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
}
// All is good...
+ *pnCount = nCount;
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorIO::IsSensorLowBandwidth(const XnConnectionString connectionString, XnBool* pbIsLowBandwidth)
+{
+ XnConnectionString cpMatchString;
+
+ *pbIsLowBandwidth = FALSE;
+
+#if (XN_PLATFORM == XN_PLATFORM_WIN32)
+ // WAVI Detection:
+ // Normal USB string: \\?\usb#vid_1d27&pid_0600#6&XXXXXXXX&0&2
+ // WAVI USB String: \\?\usb#vid_1d27&pid_0600#1&1d270600&2&3
+ // ^^^^^^^^ - VID/PID is always repeated here with the WAVI.
+ // Regular USB devices will have the port/hub chain instead.
+ if ((xnOSStrCaseCmp(connectionString, "\\\\?\\usb#vid_") >= 0) && (xnOSStrLen(connectionString) > 25))
+ {
+ strncpy(&cpMatchString[0], &connectionString[12], 4); //VID
+ strncpy(&cpMatchString[4], &connectionString[21], 4); //PID
+ cpMatchString[8] = 0;
+
+ if (strstr ((char*)connectionString,cpMatchString) != 0)
+ {
+ *pbIsLowBandwidth = TRUE;
+ }
+ }
+#endif
+
return (XN_STATUS_OK);
}
@@ -425,12 +462,13 @@ XnStatus XnSensorIO::SetCallback(XnUSBEventCallbackFunctionPtr pCallbackPtr, voi
XnStatus nRetVal = XN_STATUS_OK;
// try to register callback to a 5.0 device
- nRetVal = xnUSBSetCallbackHandler(XN_SENSOR_VENDOR_ID, XN_SENSOR_5_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, pCallbackPtr, pCallbackData);
- if (nRetVal == XN_STATUS_USB_DEVICE_NOT_FOUND)
- {
- // if not found, see if we have a 2.0 - 4.0 devices
- nRetVal = xnUSBSetCallbackHandler(XN_SENSOR_VENDOR_ID, XN_SENSOR_2_0_PRODUCT_ID, USB_DEVICE_EXTRA_PARAM, pCallbackPtr, pCallbackData);
- }
+// --avin mod--
+// nRetVal = xnUSBSetCallbackHandler(XN_SENSOR_VENDOR_ID, XN_SENSOR_5_0_PRODUCT_ID, NULL, pCallbackPtr, pCallbackData);
return nRetVal;
}
+
+const XnChar* XnSensorIO::GetDevicePath()
+{
+ return m_strDeviceName;
+}
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorIO.h b/Source/XnDeviceSensorV2/XnDeviceSensorIO.h
index 4b43c3e..a329975 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorIO.h
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorIO.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_DEVICE_SENSOR_I_O_H__
#define __XN_DEVICE_SENSOR_I_O_H__
@@ -34,6 +28,8 @@
#include
#include
#include
+#include
+#include "XnFirmwareInfo.h"
//---------------------------------------------------------------------------
// Structures & Enums
@@ -67,7 +63,6 @@ typedef struct XN_SENSOR_HANDLE
XnUsbConnection DepthConnection;
XnUsbConnection ImageConnection;
XnUsbConnection MiscConnection;
-// XnSensorRes SensorRes;
XnUInt8 nBoardVer;
} XN_SENSOR_HANDLE;
@@ -80,24 +75,30 @@ class XnSensorIO
XnSensorIO(XN_SENSOR_HANDLE* pSensorHandle);
~XnSensorIO();
+ static XnStatus EnumerateSensors(XnConnectionString* aConnectionStrings, XnUInt32* pnCount);
+ static XnStatus IsSensorLowBandwidth(const XnConnectionString connectionString, XnBool* pbIsLowband);
+
XnStatus OpenDevice(const XnChar* strPath);
- XnStatus OpenDataEndPoints(XnSensorUsbInterface nInterface);
+ XnStatus OpenDataEndPoints(XnSensorUsbInterface nInterface, const XnFirmwareInfo& fwInfo);
XnSensorUsbInterface GetCurrentInterface() { return m_interface; }
XnStatus CloseDevice();
- static XnStatus GetNumOfSensors(XnUInt32* pnNumSensors);
-
inline XnBool IsMiscEndpointSupported() const { return m_bMiscSupported; }
+ inline XnBool IsLowBandwidth() const { return m_bIsLowBandwidth; }
XnStatus SetCallback(XnUSBEventCallbackFunctionPtr pCallbackPtr, void* pCallbackData);
+ const XnChar* GetDevicePath();
+
private:
XN_SENSOR_HANDLE* m_pSensorHandle;
XnBool m_bMiscSupported;
XnSensorUsbInterface m_interface;
+ XnChar m_strDeviceName[XN_DEVICE_MAX_STRING_LENGTH];
+ XnBool m_bIsLowBandwidth;
};
#endif //__XN_DEVICE_SENSOR_I_O_H__
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp b/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
index b82f633..1b22fce 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -37,7 +31,7 @@
#include
#include "XnSensor.h"
-#define XN_HOST_PROTOCOL_MUTEX_NAME "HostProtocolMutex"
+#define XN_HOST_PROTOCOL_MUTEX_NAME_PREFIX "HostProtocolMutex"
//---------------------------------------------------------------------------
// Code
@@ -49,8 +43,18 @@ XnStatus XnDeviceSensorInit(XnDevicePrivateData* pDevicePrivateData)
nRetVal = XnDeviceSensorAllocateBuffers(pDevicePrivateData);
XN_IS_STATUS_OK(nRetVal);
- nRetVal = xnOSCreateNamedMutex(&pDevicePrivateData->hExecuteMutex, XN_HOST_PROTOCOL_MUTEX_NAME);
+#if XN_PLATFORM == XN_PLATFORM_ANDROID_ARM
+ nRetVal = xnOSCreateMutex(&pDevicePrivateData->hExecuteMutex);
+ XN_IS_STATUS_OK(nRetVal);
+#else
+ XnChar strMutexName[XN_FILE_MAX_PATH];
+ XnUInt32 nCharsWritten = 0;
+ nRetVal = xnOSStrFormat(strMutexName, XN_FILE_MAX_PATH, &nCharsWritten, "%s%s", XN_HOST_PROTOCOL_MUTEX_NAME_PREFIX, pDevicePrivateData->pSensor->GetUSBPath());
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = xnOSCreateNamedMutex(&pDevicePrivateData->hExecuteMutex, strMutexName);
XN_IS_STATUS_OK(nRetVal);
+#endif
nRetVal = XnDeviceSensorConfigureVersion(pDevicePrivateData);
XN_IS_STATUS_OK(nRetVal);
@@ -65,8 +69,6 @@ XnStatus XnDeviceSensorInit(XnDevicePrivateData* pDevicePrivateData)
XnStatus XnDeviceSensorOpenInputThreads(XnDevicePrivateData* pDevicePrivateData, XnBool bOpen1, XnBool bOpen2, XnBool bOpen3)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (bOpen2)
{
// Depth
@@ -77,11 +79,22 @@ XnStatus XnDeviceSensorOpenInputThreads(XnDevicePrivateData* pDevicePrivateData,
if (pDevicePrivateData->pSpecificDepthUsb->pUsbConnection->bIsISO == TRUE)
{
- pDevicePrivateData->pSpecificDepthUsb->nChunkReadBytes = XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_ISO * pDevicePrivateData->SensorHandle.DepthConnection.nMaxPacketSize;
+ if (pDevicePrivateData->pSensor->IsLowBandwidth())
+ {
+ pDevicePrivateData->pSpecificDepthUsb->nChunkReadBytes = XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO * pDevicePrivateData->SensorHandle.DepthConnection.nMaxPacketSize;
+ }
+ else
+ {
+ pDevicePrivateData->pSpecificDepthUsb->nChunkReadBytes = XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_ISO * pDevicePrivateData->SensorHandle.DepthConnection.nMaxPacketSize;
+ }
+
+ pDevicePrivateData->pSpecificDepthUsb->nTimeout = XN_SENSOR_READ_THREAD_TIMEOUT_ISO;
}
else
{
pDevicePrivateData->pSpecificDepthUsb->nChunkReadBytes = XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_BULK * pDevicePrivateData->SensorHandle.DepthConnection.nMaxPacketSize;
+
+ pDevicePrivateData->pSpecificDepthUsb->nTimeout = XN_SENSOR_READ_THREAD_TIMEOUT_BULK;
}
pDevicePrivateData->pSpecificDepthUsb->nIgnoreBytes = (pDevicePrivateData->FWInfo.nFWVer >= XN_SENSOR_FW_VER_5_0) ? 0 : pDevicePrivateData->pSpecificDepthUsb->nChunkReadBytes;
@@ -97,11 +110,22 @@ XnStatus XnDeviceSensorOpenInputThreads(XnDevicePrivateData* pDevicePrivateData,
if (pDevicePrivateData->pSpecificImageUsb->pUsbConnection->bIsISO == TRUE)
{
- pDevicePrivateData->pSpecificImageUsb->nChunkReadBytes = XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO * pDevicePrivateData->SensorHandle.ImageConnection.nMaxPacketSize;
+ if (pDevicePrivateData->pSensor->IsLowBandwidth())
+ {
+ pDevicePrivateData->pSpecificImageUsb->nChunkReadBytes = XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO * pDevicePrivateData->SensorHandle.ImageConnection.nMaxPacketSize;
+ }
+ else
+ {
+ pDevicePrivateData->pSpecificImageUsb->nChunkReadBytes = XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO * pDevicePrivateData->SensorHandle.ImageConnection.nMaxPacketSize;
+ }
+
+ pDevicePrivateData->pSpecificImageUsb->nTimeout = XN_SENSOR_READ_THREAD_TIMEOUT_ISO;
}
else
{
pDevicePrivateData->pSpecificImageUsb->nChunkReadBytes = XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_BULK * pDevicePrivateData->SensorHandle.ImageConnection.nMaxPacketSize;
+
+ pDevicePrivateData->pSpecificImageUsb->nTimeout = XN_SENSOR_READ_THREAD_TIMEOUT_BULK;
}
pDevicePrivateData->pSpecificImageUsb->nIgnoreBytes = (pDevicePrivateData->FWInfo.nFWVer >= XN_SENSOR_FW_VER_5_0) ? 0 : pDevicePrivateData->pSpecificImageUsb->nChunkReadBytes;
@@ -117,11 +141,22 @@ XnStatus XnDeviceSensorOpenInputThreads(XnDevicePrivateData* pDevicePrivateData,
if (pDevicePrivateData->pSpecificMiscUsb->pUsbConnection->bIsISO == TRUE)
{
- pDevicePrivateData->pSpecificMiscUsb->nChunkReadBytes = XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_ISO * pDevicePrivateData->SensorHandle.MiscConnection.nMaxPacketSize;
+ if (pDevicePrivateData->pSensor->IsLowBandwidth())
+ {
+ pDevicePrivateData->pSpecificMiscUsb->nChunkReadBytes = XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO * pDevicePrivateData->SensorHandle.MiscConnection.nMaxPacketSize;
+ }
+ else
+ {
+ pDevicePrivateData->pSpecificMiscUsb->nChunkReadBytes = XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_ISO * pDevicePrivateData->SensorHandle.MiscConnection.nMaxPacketSize;
+ }
+
+ pDevicePrivateData->pSpecificMiscUsb->nTimeout = XN_SENSOR_READ_THREAD_TIMEOUT_ISO;
}
else
{
pDevicePrivateData->pSpecificMiscUsb->nChunkReadBytes = XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_BULK * pDevicePrivateData->SensorHandle.MiscConnection.nMaxPacketSize;
+
+ pDevicePrivateData->pSpecificMiscUsb->nTimeout = XN_SENSOR_READ_THREAD_TIMEOUT_BULK;
}
pDevicePrivateData->pSpecificMiscUsb->nIgnoreBytes = (pDevicePrivateData->FWInfo.nFWVer >= XN_SENSOR_FW_VER_5_0) ? 0 : pDevicePrivateData->pSpecificMiscUsb->nChunkReadBytes;
@@ -209,7 +244,6 @@ XnStatus XnDeviceSensorFreeBuffers(XnDevicePrivateData* pDevicePrivateData)
XnStatus XnDeviceSensorConfigureVersion(XnDevicePrivateData* pDevicePrivateData)
{
- XnVersions Versions;
XnStatus nRetVal = XN_STATUS_OK;
nRetVal = XnHostProtocolGetVersion(pDevicePrivateData, pDevicePrivateData->Version);
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorInit.h b/Source/XnDeviceSensorV2/XnDeviceSensorInit.h
index 6894130..3de4773 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorInit.h
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorInit.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICESENSORINIT_H_
#define _XN_DEVICESENSORINIT_H_
@@ -39,17 +33,20 @@
//---------------------------------------------------------------------------
#if XN_PLATFORM == XN_PLATFORM_WIN32
- #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO 8*10
- #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_BULK 120
- #define XN_SENSOR_USB_IMAGE_BUFFERS 8
-
- #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_ISO 8*10
- #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_BULK 120
- #define XN_SENSOR_USB_DEPTH_BUFFERS 8
-
- #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_ISO 104
- #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_BULK 20
- #define XN_SENSOR_USB_MISC_BUFFERS 8
+ #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO 8*10
+ #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_BULK 120
+ #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 8*5
+ #define XN_SENSOR_USB_IMAGE_BUFFERS 8
+
+ #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_ISO 8*10
+ #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_BULK 120
+ #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 8*5
+ #define XN_SENSOR_USB_DEPTH_BUFFERS 8
+
+ #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_ISO 104
+ #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_BULK 20
+ #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 52
+ #define XN_SENSOR_USB_MISC_BUFFERS 8
#elif XN_PLATFORM == XN_PLATFORM_PS3
#define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_ISO 0x1E000
#define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_BULK 0x4000
@@ -60,21 +57,25 @@
#define XN_SENSOR_USB_MISC_BUFFER_SIZE 0x1000
#define XN_SENSOR_USB_MISC_BUFFERS 1
-#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
- #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO 32
- #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_BULK 40
- #define XN_SENSOR_USB_IMAGE_BUFFERS 16
-
- #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_ISO 32
- #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_BULK 40
- #define XN_SENSOR_USB_DEPTH_BUFFERS 16
-
- #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_ISO 104
- #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_BULK 20
- #define XN_SENSOR_USB_MISC_BUFFERS 5
+#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_MACOSX || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM)
+ #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_ISO 32
+ #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_BULK 40
+ #define XN_SENSOR_USB_IMAGE_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 16
+ #define XN_SENSOR_USB_IMAGE_BUFFERS 16
+
+ #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_ISO 32
+ #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_BULK 40
+ #define XN_SENSOR_USB_DEPTH_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 16
+ #define XN_SENSOR_USB_DEPTH_BUFFERS 16
+
+ #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_ISO 104
+ #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_BULK 20
+ #define XN_SENSOR_USB_MISC_BUFFER_SIZE_MULTIPLIER_LOWBAND_ISO 52
+ #define XN_SENSOR_USB_MISC_BUFFERS 5
#endif
-#define XN_SENSOR_READ_THREAD_TIMEOUT 100
+#define XN_SENSOR_READ_THREAD_TIMEOUT_ISO 100
+#define XN_SENSOR_READ_THREAD_TIMEOUT_BULK 1000
//---------------------------------------------------------------------------
// Functions Declaration
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp b/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp
index 1b45e62..6fae06e 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -43,21 +37,6 @@ FILE* g_fUSBDump;
//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
-XnStatus XnDeviceSensorProtocolGetSensorInfo(XnDevicePrivateData* pDevicePrivateData, XnChar* csSensorID)
-{
- // Local function variables
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnFixedParams FixedParams;
- nRetVal = XnHostProtocolGetFixedParams(pDevicePrivateData, FixedParams);
- XN_IS_STATUS_OK(nRetVal);
-
- sprintf(csSensorID, "%x", FixedParams.nSerialNumber);
-
- // All is good...
- return (XN_STATUS_OK);
-}
-
XnBool XN_CALLBACK_TYPE XnDeviceSensorProtocolUsbEpCb(XnUChar* pBuffer, XnUInt32 nBufferSize, void* pCallbackData)
{
XN_PROFILING_START_MT_SECTION("XnDeviceSensorProtocolUsbEpCb");
@@ -160,7 +139,7 @@ XnBool XN_CALLBACK_TYPE XnDeviceSensorProtocolUsbEpCb(XnUChar* pBuffer, XnUInt32
// we have entire header. Fix it
pCurrState->CurrHeader.nBufSize = XN_PREPARE_VAR16_IN_BUFFER(pCurrState->CurrHeader.nBufSize);
pCurrState->CurrHeader.nMagic = XN_PREPARE_VAR16_IN_BUFFER(pCurrState->CurrHeader.nMagic);
- pCurrState->CurrHeader.nReserve = XN_PREPARE_VAR16_IN_BUFFER(pCurrState->CurrHeader.nReserve);
+ pCurrState->CurrHeader.nPacketID = XN_PREPARE_VAR16_IN_BUFFER(pCurrState->CurrHeader.nPacketID);
pCurrState->CurrHeader.nTimeStamp = XN_PREPARE_VAR32_IN_BUFFER(pCurrState->CurrHeader.nTimeStamp);
pCurrState->CurrHeader.nType = XN_PREPARE_VAR16_IN_BUFFER(pCurrState->CurrHeader.nType);
pCurrState->CurrHeader.nBufSize = xnOSEndianSwapUINT16(pCurrState->CurrHeader.nBufSize);
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.h b/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.h
index f35bf8c..aca49b8 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.h
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_DEVICESENSORPROTOCOL_H_
#define _XN_DEVICESENSORPROTOCOL_H_
@@ -88,7 +82,8 @@ typedef struct XnSensorProtocolResponseHeader
{
XnUInt16 nMagic;
XnUInt16 nType;
- XnUInt8 nReserve;
+ // --avin mod--
+ XnUInt8 nPacketID;
XnUInt8 nUnknown;
XnUInt16 nBufSize;
XnUInt32 nTimeStamp;
@@ -119,14 +114,13 @@ typedef struct XnSpecificUsbDevice
XnUInt32 nIgnoreBytes;
XnUInt32 nChunkReadBytes;
XnSpecificUsbDeviceState CurrState;
+ XnUInt32 nTimeout;
} XnSpecificUsbDevice;
//---------------------------------------------------------------------------
// Functions Declaration
//---------------------------------------------------------------------------
-XnStatus XnDeviceSensorProtocolGetSensorInfo(XnDevicePrivateData* pDevicePrivateData, XnChar* csSensorID);
-
XnBool XN_CALLBACK_TYPE XnDeviceSensorProtocolUsbEpCb(XnUChar* pBuffer, XnUInt32 nBufferSize, void* pCallbackData);
XnStatus XnCalculateExpectedImageSize(XnDevicePrivateData* pDevicePrivateData, XnUInt32* pnExpectedSize);
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp b/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
index bc627b9..3b68036 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
+++ b/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -35,6 +29,17 @@
#include
#include "XnSensorServer.h"
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+// On weak platforms (like Arm), the default is not to use multi-process.
+#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM)
+ #define XN_SENSOR_DEFAULT_MULTI_PROCESS (FALSE)
+#else
+ #define XN_SENSOR_DEFAULT_MULTI_PROCESS (TRUE)
+#endif
+
+
//---------------------------------------------------------------------------
// XnExportedSensorDevice class
//---------------------------------------------------------------------------
@@ -58,7 +63,7 @@ void XnExportedSensorDevice::GetDescription(XnProductionNodeDescription* pDescri
pDescription->Type = XN_NODE_TYPE_DEVICE;
}
-XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
+XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* /*pErrors*/)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -87,23 +92,30 @@ XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context,
XnProductionNodeDescription Description;
GetDescription(&Description);
- // each connection string is a sensor. return it
for (XnUInt32 i = 0; i < nCount; ++i)
{
- nRetVal = TreesList.Add(Description, pConnStrings[i], NULL);
- if (nRetVal != XN_STATUS_OK)
+ // Each connection string is a sensor. Return it if it wasn't created already.
+ if (FindCreatedDevice(context.GetUnderlyingObject(), pConnStrings[i]) == m_createdDevices.end())
{
- xnOSFree(pConnStrings);
- return (nRetVal);
+ nRetVal = TreesList.Add(Description, pConnStrings[i], NULL);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnOSFree(pConnStrings);
+ return (nRetVal);
+ }
}
}
xnOSFree(pConnStrings);
-
return (XN_STATUS_OK);
}
-XnStatus XnExportedSensorDevice::Create(xn::Context& context, const XnChar* strInstanceName, const XnChar* strCreationInfo, xn::NodeInfoList* pNeededTrees, const XnChar* strConfigurationDir, xn::ModuleProductionNode** ppInstance)
+XnStatus XnExportedSensorDevice::Create(xn::Context& context,
+ const XnChar* strInstanceName,
+ const XnChar* strCreationInfo,
+ xn::NodeInfoList* /*pNeededTrees*/,
+ const XnChar* strConfigurationDir,
+ xn::ModuleProductionNode** ppInstance)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -111,12 +123,17 @@ XnStatus XnExportedSensorDevice::Create(xn::Context& context, const XnChar* strI
nRetVal = XnSensor::ResolveGlobalConfigFileName(strGlobalConfigFile, XN_FILE_MAX_PATH, strConfigurationDir);
XN_IS_STATUS_OK(nRetVal);
- XnBool bEnableMultiProcess = TRUE;
+ // multi-process is not supported on Mac
+#if (XN_PLATFORM == XN_PLATFORM_MACOSX)
+ XnBool bEnableMultiProcess = FALSE;
+#else
+ XnBool bEnableMultiProcess = XN_SENSOR_DEFAULT_MULTI_PROCESS;
XnUInt32 nValue;
- if (XN_STATUS_OK == xnOSReadIntFromINI(strGlobalConfigFile, XN_CONFIG_FILE_SERVER_SECTION, XN_MODULE_PROPERTY_ENABLE_MULTI_PROCESS, &nValue))
+ if (XN_STATUS_OK == xnOSReadIntFromINI(strGlobalConfigFile, XN_SENSOR_SERVER_CONFIG_FILE_SECTION, XN_MODULE_PROPERTY_ENABLE_MULTI_PROCESS, &nValue))
{
bEnableMultiProcess = (nValue == TRUE);
}
+#endif
XnDeviceBase* pSensor = NULL;
@@ -170,6 +187,13 @@ XnStatus XnExportedSensorDevice::Create(xn::Context& context, const XnChar* strI
return (nRetVal);
}
+ nRetVal = m_createdDevices.AddLast(DeviceKey(context.GetUnderlyingObject(), strCreationInfo));
+ if (nRetVal != XN_STATUS_OK)
+ {
+ XN_DELETE(pSensor);
+ return (nRetVal);
+ }
+
*ppInstance = pDevice;
return (XN_STATUS_OK);
@@ -177,9 +201,52 @@ XnStatus XnExportedSensorDevice::Create(xn::Context& context, const XnChar* strI
void XnExportedSensorDevice::Destroy(xn::ModuleProductionNode* pInstance)
{
+ XnStatus nRetVal = XN_STATUS_OK;
XnSensorDevice* pDevice = dynamic_cast(pInstance);
+ XnChar strConnStr[XN_MAX_CREATION_INFO_LENGTH];
+ nRetVal = pDevice->GetStringProperty(XN_MODULE_PROPERTY_USB_PATH, strConnStr, sizeof(strConnStr));
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_DEVICE_SENSOR, "Couldn't get usb path property ?! :(");
+ XN_ASSERT(FALSE);
+ }
+ XnContext* pContext = pDevice->GetContext().GetUnderlyingObject();
+ CreatedDevices::Iterator it = FindCreatedDevice(pContext, strConnStr);
+ if (it == m_createdDevices.end())
+ {
+ xnLogWarning(XN_MASK_DEVICE_SENSOR, "Couldn't find device in created devices ?! :(");
+ XN_ASSERT(FALSE);
+ }
+ else
+ {
+ m_createdDevices.Remove(it);
+ }
+
XnDeviceBase* pSensor = pDevice->GetSensor();
pSensor->Destroy();
XN_DELETE(pSensor);
XN_DELETE(pDevice);
+
}
+
+XnExportedSensorDevice::DeviceKey::DeviceKey(XnContext* pContext, const XnChar* strConnStr)
+{
+ m_pContext = pContext;
+ xnOSStrCopy(m_strConnStr, strConnStr, sizeof(m_strConnStr));
+}
+
+XnExportedSensorDevice::CreatedDevices::Iterator XnExportedSensorDevice::FindCreatedDevice(XnContext* pContext,
+ const XnChar* strConnStr)
+{
+ CreatedDevices::Iterator it = m_createdDevices.begin();
+ for (; it != m_createdDevices.end(); it++)
+ {
+ if ((it->m_pContext == pContext) &&
+ (xnOSStrCmp(it->m_strConnStr, strConnStr) == 0))
+ {
+ break;
+ }
+ }
+
+ return it;
+}
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorDevice.h b/Source/XnDeviceSensorV2/XnExportedSensorDevice.h
index 7bd9d81..96a8d46 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorDevice.h
+++ b/Source/XnDeviceSensorV2/XnExportedSensorDevice.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_EXPORTED_SENSOR_DEVICE_H__
#define __XN_EXPORTED_SENSOR_DEVICE_H__
@@ -46,6 +40,20 @@ class XnExportedSensorDevice : public xn::ModuleExportedProductionNode
XnStatus EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors);
XnStatus Create(xn::Context& context, const XnChar* strInstanceName, const XnChar* strCreationInfo, xn::NodeInfoList* pNeededTrees, const XnChar* strConfigurationDir, xn::ModuleProductionNode** ppInstance);
void Destroy(xn::ModuleProductionNode* pInstance);
+
+private:
+ struct DeviceKey
+ {
+ DeviceKey(XnContext* pContext, const XnChar* strConnStr);
+ XnContext* m_pContext;
+ XnChar m_strConnStr[XN_MAX_CREATION_INFO_LENGTH];
+ };
+
+
+ XN_DECLARE_LIST(DeviceKey, CreatedDevices);
+ CreatedDevices m_createdDevices;
+
+ CreatedDevices::Iterator FindCreatedDevice(XnContext* pContext, const XnChar* strConnStr);
};
#endif // __XN_EXPORTED_SENSOR_DEVICE_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp b/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp
index 2f4f8e0..8224788 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -37,8 +31,9 @@
//---------------------------------------------------------------------------
// XnExportedSensorGenerator class
//---------------------------------------------------------------------------
-XnExportedSensorGenerator::XnExportedSensorGenerator(XnProductionNodeType Type, const XnChar* strStreamType) :
-m_Type(Type)
+XnExportedSensorGenerator::XnExportedSensorGenerator(XnProductionNodeType Type, const XnChar* strStreamType, XnBool isAvailbaleInLowBand /* = TRUE */) :
+ m_Type(Type),
+ m_bIsAvailableInLowBand(isAvailbaleInLowBand)
{
strcpy(m_strStreamType, strStreamType);
}
@@ -56,16 +51,52 @@ XnStatus XnExportedSensorGenerator::EnumerateProductionTrees(xn::Context& contex
XnProductionNodeDescription Description;
GetDescription(&Description);
+ // perform a query to be sure the device we'll find is the same one exported from this DLL.
xn::Query query;
query.SetVendor(XN_VENDOR_PRIMESENSE);
-
- nRetVal = context.AutoEnumerateOverSingleInput(TreesList, Description, NULL, XN_NODE_TYPE_DEVICE, pErrors, &query);
+ query.SetName(XN_DEVICE_NAME);
+ query.SetMinVersion(Description.Version);
+ query.SetMaxVersion(Description.Version);
+
+ // check which devices are currently connected
+ xn::NodeInfoList devices;
+ nRetVal = context.EnumerateProductionTrees(XN_NODE_TYPE_DEVICE, &query, devices, pErrors);
+ if (nRetVal == XN_STATUS_NO_NODE_PRESENT)
+ {
+ // the error was already added to the EnumerationErrors object
+ return XN_STATUS_OK;
+ }
XN_IS_STATUS_OK(nRetVal);
+
+ // now check each one, to find out if it supports our generator
+ for (xn::NodeInfoList::Iterator it = devices.Begin(); it != devices.End(); ++it)
+ {
+ xn::NodeInfo deviceInfo = *it;
+
+ XnBool bIsGeneratorSupported = TRUE;
+ nRetVal = IsSupportedForDevice(context, deviceInfo, &bIsGeneratorSupported);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (bIsGeneratorSupported)
+ {
+ xn::NodeInfoList neededNodes;
+ nRetVal = neededNodes.AddNode(deviceInfo);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = TreesList.Add(Description, NULL, &neededNodes);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ }
+
+ if (TreesList.IsEmpty())
+ {
+ return XN_STATUS_NO_NODE_PRESENT;
+ }
return (XN_STATUS_OK);
}
-XnStatus XnExportedSensorGenerator::Create(xn::Context& context, const XnChar* strInstanceName, const XnChar* strCreationInfo, xn::NodeInfoList* pNeededTrees, const XnChar* strConfigurationDir, xn::ModuleProductionNode** ppInstance)
+XnStatus XnExportedSensorGenerator::Create(xn::Context& context, const XnChar* strInstanceName, const XnChar* /*strCreationInfo*/, xn::NodeInfoList* pNeededTrees, const XnChar* /*strConfigurationDir*/, xn::ModuleProductionNode** ppInstance)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -123,3 +154,55 @@ void XnExportedSensorGenerator::Destroy(xn::ModuleProductionNode* pInstance)
XN_DELETE(pGenerator);
}
+XnStatus XnExportedSensorGenerator::IsSupportedForDevice(xn::Context& context, xn::NodeInfo& sensorInfo, XnBool* pbSupported)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ *pbSupported = FALSE;
+
+ // first of all, make sure there isn't already a generator of that type from this device (not supported)
+ // Do this by searching in OpenNI
+ xn::Device sensor;
+ nRetVal = sensorInfo.GetInstance(sensor);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (sensor.IsValid())
+ {
+ xn::NodeInfoList existingGenerators;
+ nRetVal = context.EnumerateExistingNodes(existingGenerators, m_Type);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // now leave only the ones needing our device
+ xn::Query query;
+ nRetVal = query.AddNeededNode(sensorInfo.GetInstanceName());
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = existingGenerators.FilterList(context, query);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // if there's anything left, then this device already has that generator
+ if (!existingGenerators.IsEmpty())
+ {
+ *pbSupported = FALSE;
+ return XN_STATUS_OK;
+ }
+ }
+
+ // now, check if this is a low-bandwidth device
+ if (!m_bIsAvailableInLowBand)
+ {
+ XnBool bIsLowBand;
+ nRetVal = XnSensorIO::IsSensorLowBandwidth(sensorInfo.GetCreationInfo(), &bIsLowBand);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (bIsLowBand)
+ {
+ *pbSupported = FALSE;
+ return XN_STATUS_OK;
+ }
+ }
+
+ *pbSupported = TRUE;
+
+ return (XN_STATUS_OK);
+}
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorGenerator.h b/Source/XnDeviceSensorV2/XnExportedSensorGenerator.h
index db271c1..6197a64 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorGenerator.h
+++ b/Source/XnDeviceSensorV2/XnExportedSensorGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_EXPORTED_SENSOR_GENERATOR_H__
#define __XN_EXPORTED_SENSOR_GENERATOR_H__
@@ -41,7 +35,7 @@
class XnExportedSensorGenerator : public xn::ModuleExportedProductionNode
{
public:
- XnExportedSensorGenerator(XnProductionNodeType Type, const XnChar* strStreamType);
+ XnExportedSensorGenerator(XnProductionNodeType Type, const XnChar* strStreamType, XnBool isAvailbaleInLowBand = TRUE);
void GetDescription(XnProductionNodeDescription* pDescription);
XnStatus EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors);
@@ -49,11 +43,13 @@ class XnExportedSensorGenerator : public xn::ModuleExportedProductionNode
void Destroy(xn::ModuleProductionNode* pInstance);
protected:
+ virtual XnStatus IsSupportedForDevice(xn::Context& context, xn::NodeInfo& sensorInfo, XnBool* pbSupported);
virtual XnSensorGenerator* CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName) = 0;
private:
XnProductionNodeType m_Type;
XnChar m_strStreamType[XN_DEVICE_MAX_STRING_LENGTH];
+ XnBool m_bIsAvailableInLowBand;
};
#endif // __XN_EXPORTED_SENSOR_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnFirmwareCommands.cpp b/Source/XnDeviceSensorV2/XnFirmwareCommands.cpp
index a46ac34..0c453d0 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareCommands.cpp
+++ b/Source/XnDeviceSensorV2/XnFirmwareCommands.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -51,5 +45,5 @@ XnStatus XnFirmwareCommands::SetFirmwareParam(XnUInt16 nParam, XnUInt16 nValue)
XnStatus XnFirmwareCommands::SetMultipleFirmwareParams(XnInnerParamData* aParams, XnUInt32 nCount)
{
- return XnHostProtocolSetMultipleParams(m_pDevicePrivateData, nCount, aParams);
+ return XnHostProtocolSetMultipleParams(m_pDevicePrivateData, (XnUInt16)nCount, aParams);
}
diff --git a/Source/XnDeviceSensorV2/XnFirmwareCommands.h b/Source/XnDeviceSensorV2/XnFirmwareCommands.h
index d85b5c0..bd4ffd0 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareCommands.h
+++ b/Source/XnDeviceSensorV2/XnFirmwareCommands.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_FIRMWARE_COMMANDS_H__
#define __XN_FIRMWARE_COMMANDS_H__
diff --git a/Source/XnDeviceSensorV2/XnFirmwareInfo.cpp b/Source/XnDeviceSensorV2/XnFirmwareInfo.cpp
index 3cb366e..b4a4293 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareInfo.cpp
+++ b/Source/XnDeviceSensorV2/XnFirmwareInfo.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnFirmwareInfo.h b/Source/XnDeviceSensorV2/XnFirmwareInfo.h
index 9177cac..a56483c 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareInfo.h
+++ b/Source/XnDeviceSensorV2/XnFirmwareInfo.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_FIRMWARE_INFO_H__
#define __XN_FIRMWARE_INFO_H__
@@ -59,6 +54,9 @@ class XnFirmwareInfo
XnUInt16 nOpcodeReset;
XnUInt16 nOpcodeSetCmosBlanking;
XnUInt16 nOpcodeGetCmosBlanking;
+ XnUInt16 nOpcodeGetCmosPresets;
+ XnUInt16 nOpcodeGetSerialNumber;
+ XnUInt16 nOpcodeGetFastConvergenceTEC;
XnBool bMirrorSupported;
@@ -71,6 +69,9 @@ class XnFirmwareInfo
XnUInt16 nUSBDelaySetParamStream0Mode;
XnUInt16 nUSBDelaySetParamStream1Mode;
XnUInt16 nUSBDelaySetParamStream2Mode;
+
+ XnUInt8 nISOAlternativeInterface;
+ XnUInt8 nBulkAlternativeInterface;
};
#endif //__XN_FIRMWARE_INFO_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp b/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
index 7d8f2d0..97e468c 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
+++ b/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -117,7 +111,8 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Cannot set depth stream to resolution %d when IR is set to resolution %d!", nRes, pIRStreamData->nRes);
}
- // Avin: Removed to enable 1280x1024 IR
+ // --avin mod--
+ // Removed to enable 1280x1024 IR
/*
// check FPS
if (pIRStreamData->nFPS != nFPS)
@@ -153,7 +148,8 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
}
// check FPS
- // Avin: Removed to enable 1280x1024 IR
+ // --avin mod--
+ // Removed to enable 1280x1024 IR
/*
if (pDepthStreamData->nFPS != nFPS)
diff --git a/Source/XnDeviceSensorV2/XnFirmwareStreams.h b/Source/XnDeviceSensorV2/XnFirmwareStreams.h
index be747c8..49b2e58 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareStreams.h
+++ b/Source/XnDeviceSensorV2/XnFirmwareStreams.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_FIRMWARE_STREAMS_H__
#define __XN_FIRMWARE_STREAMS_H__
diff --git a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp
index cad4799..79d8178 100644
--- a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -39,14 +33,16 @@ XnFrameStreamProcessor::XnFrameStreamProcessor(XnFrameStream* pStream, XnSensorS
m_nTypeSOF(nTypeSOF),
m_nTypeEOF(nTypeEOF),
m_pTripleBuffer(pStream->GetTripleBuffer()),
- m_InDump(XN_DUMP_CLOSED),
- m_InternalDump(XN_DUMP_CLOSED),
- m_bFrameCorrupted(FALSE)
+ m_InDump(NULL),
+ m_InternalDump(NULL),
+ m_bFrameCorrupted(FALSE),
+ m_bAllowDoubleSOF(FALSE),
+ m_nLastSOFPacketID(0)
{
sprintf(m_csInDumpMask, "%sIn", pStream->GetType());
sprintf(m_csInternalDumpMask, "Internal%s", pStream->GetType());
- xnDumpInit(&m_InDump, m_csInDumpMask, NULL, "%s_0.raw", m_csInDumpMask);
- xnDumpInit(&m_InternalDump, m_csInternalDumpMask, NULL, "%s_0.raw", m_csInternalDumpMask);
+ m_InDump = xnDumpFileOpen(m_csInDumpMask, "%s_0.raw", m_csInDumpMask);
+ m_InternalDump = xnDumpFileOpen(m_csInternalDumpMask, "%s_0.raw", m_csInternalDumpMask);
}
XnFrameStreamProcessor::~XnFrameStreamProcessor()
@@ -55,17 +51,21 @@ XnFrameStreamProcessor::~XnFrameStreamProcessor()
void XnFrameStreamProcessor::ProcessPacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
{
- XN_PROFILING_START_SECTION("XnFrameStreamProcessor::ProcessPacketChunk")
+ XN_PROFILING_START_SECTION("XnFrameStreamProcessor::ProcessPacketChunk");
// if first data from SOF packet
if (pHeader->nType == m_nTypeSOF && nDataOffset == 0)
{
- OnStartOfFrame(pHeader);
+ if (!m_bAllowDoubleSOF || pHeader->nPacketID != (m_nLastSOFPacketID + 1))
+ {
+ m_nLastSOFPacketID = pHeader->nPacketID;
+ OnStartOfFrame(pHeader);
+ }
}
if (!m_bFrameCorrupted)
{
- xnDumpWriteBuffer(m_InDump, pData, nDataSize);
+ xnDumpFileWriteBuffer(m_InDump, pData, nDataSize);
ProcessFramePacketChunk(pHeader, pData, nDataOffset, nDataSize);
}
@@ -83,7 +83,7 @@ void XnFrameStreamProcessor::OnPacketLost()
FrameIsCorrupted();
}
-void XnFrameStreamProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader)
+void XnFrameStreamProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader* /*pHeader*/)
{
m_bFrameCorrupted = FALSE;
m_pTripleBuffer->GetWriteBuffer()->Reset();
@@ -93,9 +93,9 @@ void XnFrameStreamProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader*
{
// write dump
XnBuffer* pCurWriteBuffer = m_pTripleBuffer->GetWriteBuffer();
- xnDumpWriteBuffer(m_InternalDump, pCurWriteBuffer->GetData(), pCurWriteBuffer->GetSize());
- xnDumpClose(&m_InternalDump);
- xnDumpClose(&m_InDump);
+ xnDumpFileWriteBuffer(m_InternalDump, pCurWriteBuffer->GetData(), pCurWriteBuffer->GetSize());
+ xnDumpFileClose(m_InternalDump);
+ xnDumpFileClose(m_InDump);
if (!m_bFrameCorrupted)
{
@@ -116,12 +116,12 @@ void XnFrameStreamProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader*
// log bandwidth
XnUInt64 nSysTime;
xnOSGetTimeStamp(&nSysTime);
- xnDumpWriteString(m_pDevicePrivateData->BandwidthDump, "%llu,%s,%d,%d\n",
+ xnDumpFileWriteString(m_pDevicePrivateData->BandwidthDump, "%llu,%s,%d,%d\n",
nSysTime, m_csName, GetCurrentFrameID(), m_nBytesReceived);
// re-init dumps
- xnDumpInit(&m_InDump, m_csInDumpMask, NULL, "%s_%d.raw", m_csInDumpMask, GetCurrentFrameID());
- xnDumpInit(&m_InternalDump, m_csInternalDumpMask, NULL, "%s_%d.raw", m_csInternalDumpMask, GetCurrentFrameID());
+ m_InDump = xnDumpFileOpen(m_csInDumpMask, "%s_%d.raw", m_csInDumpMask, GetCurrentFrameID());
+ m_InternalDump = xnDumpFileOpen(m_csInternalDumpMask, "%s_%d.raw", m_csInternalDumpMask, GetCurrentFrameID());
m_nBytesReceived = 0;
}
diff --git a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h
index 459ae88..c917e5a 100644
--- a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h
+++ b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_FRAME_STREAM_PROCESSOR_H__
#define __XN_FRAME_STREAM_PROCESSOR_H__
@@ -99,7 +94,7 @@ class XnFrameStreamProcessor : public XnStreamProcessor
* @param nFrameID [in] ID of this frame.
* @param nFrameTS [in] Timestamp of this frame.
*/
- virtual void OnFrameReady(XnUInt32 nFrameID, XnUInt64 nFrameTS) {}
+ virtual void OnFrameReady(XnUInt32 /*nFrameID*/, XnUInt64 /*nFrameTS*/) {}
//---------------------------------------------------------------------------
// Utility Functions
@@ -158,6 +153,8 @@ class XnFrameStreamProcessor : public XnStreamProcessor
*/
void FrameIsCorrupted();
+ void SetAllowDoubleSOFPackets(XnBool bAllow) { m_bAllowDoubleSOF = bAllow; }
+
private:
//---------------------------------------------------------------------------
// Class Members
@@ -171,9 +168,11 @@ class XnFrameStreamProcessor : public XnStreamProcessor
XnChar m_csInDumpMask[100];
XnChar m_csInternalDumpMask[100];
- XnDump m_InDump;
- XnDump m_InternalDump;
+ XnDumpFile* m_InDump;
+ XnDumpFile* m_InternalDump;
XnBool m_bFrameCorrupted;
+ XnBool m_bAllowDoubleSOF;
+ XnUInt16 m_nLastSOFPacketID;
};
#endif //__XN_FRAME_STREAM_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnHostProtocol.cpp b/Source/XnDeviceSensorV2/XnHostProtocol.cpp
index 6c4079b..c080369 100644
--- a/Source/XnDeviceSensorV2/XnHostProtocol.cpp
+++ b/Source/XnDeviceSensorV2/XnHostProtocol.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#include "XnDeviceSensorProtocol.h"
#include "XnHostProtocol.h"
#include
@@ -57,6 +51,38 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
switch (nFWVer)
{
+ case XN_SENSOR_FW_VER_5_6:
+ nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_5);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // audio is no longer supported - switched to UAC
+ pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
+
+ pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+ break;
+
+ case XN_SENSOR_FW_VER_5_5:
+ nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_4);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // only difference is the interfaces order
+ pDevicePrivateData->FWInfo.nBulkAlternativeInterface = 0;
+ pDevicePrivateData->FWInfo.nISOAlternativeInterface = 1;
+
+ pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+ break;
+
+ case XN_SENSOR_FW_VER_5_4:
+ nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_3);
+ XN_IS_STATUS_OK(nRetVal);
+
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_GET_CMOS_PRESETS;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_GET_SERIAL_NUMBER;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC= OPCODE_GET_FAST_CONVERGENCE_TEC;
+
+ pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+ break;
+
case XN_SENSOR_FW_VER_5_3:
nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_2);
XN_IS_STATUS_OK(nRetVal);
@@ -100,6 +126,12 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_SET_CMOS_BLANKING;
pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
+
+ pDevicePrivateData->FWInfo.nISOAlternativeInterface = 0;
+ pDevicePrivateData->FWInfo.nBulkAlternativeInterface = 1;
break;
@@ -124,6 +156,9 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
break;
case XN_SENSOR_FW_VER_3_0:
@@ -146,6 +181,9 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
break;
case XN_SENSOR_FW_VER_1_2:
@@ -168,6 +206,9 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
break;
case XN_SENSOR_FW_VER_1_1:
@@ -190,6 +231,9 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
break;
case XN_SENSOR_FW_VER_0_17:
@@ -212,6 +256,9 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_V017_RESET;
pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+ pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
break;
default:
@@ -223,7 +270,7 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnF
return (XN_STATUS_OK);
}
-XnStatus XnHostProtocolInitHeader(XnDevicePrivateData* pDevicePrivateData, void* pBuffer, void* pDataBuf, XnUInt32 nSize, XnUInt16 nOpcode)
+XnStatus XnHostProtocolInitHeader(XnDevicePrivateData* pDevicePrivateData, void* pBuffer, XnUInt32 nSize, XnUInt16 nOpcode)
{
static XnUInt16 nId = 0;
@@ -249,9 +296,9 @@ XnStatus XnHostProtocolInitHeader(XnDevicePrivateData* pDevicePrivateData, void*
}
XnStatus XnHostProtocolUSBSend(XnDevicePrivateData* pDevicePrivateData,
- XnUChar* pBuffer, XnUInt16 nSize, XnUInt32& nRead, XnUInt32 nTimeOut, XnBool bForceBulk)
+ XnUChar* pBuffer, XnUInt16 nSize, XnUInt32 nTimeOut, XnBool bForceBulk)
{
- XnStatus nRetVal;
+ XnStatus nRetVal = XN_STATUS_OK;
XnUsbControlConnection* pCtrlConnection = &pDevicePrivateData->SensorHandle.ControlConnection;
@@ -286,7 +333,7 @@ XnStatus XnHostProtocolUSBReceive(XnDevicePrivateData* pDevicePrivateData,
xnOSGetHighResTimeStamp(&nMaxTime);
nMaxTime += (nTimeOut * 1000);
- while (TRUE)
+ for (;;)
{
xnOSGetHighResTimeStamp(&nCurrTime);
if (nCurrTime > nMaxTime)
@@ -509,14 +556,14 @@ XnStatus XnHostProtocolGetRequestID(XnDevicePrivateData* pDevicePrivateData, XnU
return XN_STATUS_OK;
}
-XnStatus XnHostProtocolReceiveReply(XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt16 nBufferSize, XnUInt32 nTimeOut, XnUInt16 nOpcode, XnUInt16 nRequestId, XnUInt32* pnReadBytes, XnUInt16* pnDataSize, XnUChar** ppRelevantBuffer, XnBool bForceBulk, XnUInt32 nRecvTimeout, XnUInt32 nFailTimeout)
+XnStatus XnHostProtocolReceiveReply(XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nTimeOut, XnUInt16 nOpcode, XnUInt16 nRequestId, XnUInt32* pnReadBytes, XnUInt16* pnDataSize, XnUChar** ppRelevantBuffer, XnBool bForceBulk, XnUInt32 nRecvTimeout, XnUInt32 nFailTimeout)
{
XnStatus rc = XN_STATUS_OK;
XnUInt64 nStartWaitingTime;
xnOSGetTimeStamp(&nStartWaitingTime);
- while (TRUE) // loop until timeout expires
+ for (;;) // loop until timeout expires
{
do // loop until right reply ID is received
{
@@ -602,7 +649,7 @@ XnStatus XnHostProtocolExecute(XnDevicePrivateData* pDevicePrivateData,
xnOSSleep(pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend);
// Send request
- rc = XnHostProtocolUSBSend(pDevicePrivateData, request, nSize, nRead, nTimeOut, bForceBulk);
+ rc = XnHostProtocolUSBSend(pDevicePrivateData, request, nSize, nTimeOut, bForceBulk);
if (rc != XN_STATUS_OK)
{
xnOSUnLockMutex(pDevicePrivateData->hExecuteMutex);
@@ -613,7 +660,7 @@ XnStatus XnHostProtocolExecute(XnDevicePrivateData* pDevicePrivateData,
xnOSSleep(pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend);
// receive reply
- rc = XnHostProtocolReceiveReply(pDevicePrivateData, pBuffer, nSize, nTimeOut, nOpcode, nRequestId, &nRead, &nDataSize, ppRelevantBuffer, bForceBulk, nRecvTimeout, nFailTimeout);
+ rc = XnHostProtocolReceiveReply(pDevicePrivateData, pBuffer, nTimeOut, nOpcode, nRequestId, &nRead, &nDataSize, ppRelevantBuffer, bForceBulk, nRecvTimeout, nFailTimeout);
if (rc == XN_STATUS_DEVICE_PROTOCOL_NOT_READY || rc == XN_STATUS_OK)
{
@@ -665,24 +712,40 @@ XnStatus XnHostProtocolExecute(XnDevicePrivateData* pDevicePrivateData,
}
+XnInt32 compareVersion(const XnVersions& version, XnInt32 nMajor, XnInt32 nMinor, XnInt32 nBuild)
+{
+ XnInt32 nResult = version.nMajor - nMajor;
+
+ if (nResult == 0)
+ {
+ nResult = version.nMinor - nMinor;
+ }
+
+ if (nResult == 0)
+ {
+ nResult = version.nBuild - nBuild;
+ }
+
+ return nResult;
+}
+
XnStatus XnHostProtocolGetVersion(XnDevicePrivateData* pDevicePrivateData, XnVersions& Version)
{
XnUChar buffer[MAX_PACKET_SIZE] = {0};
- XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
XnUInt16 nDataSize;
XnVersions *pVersion = NULL;
xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Getting hardware versions...");
XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_1);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, 0, pDevicePrivateData->FWInfo.nOpcodeGetVersion);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetVersion);
XnStatus rc = XnHostProtocolExecute(pDevicePrivateData,
buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetVersion,
(XnUChar**)(&pVersion), nDataSize);
if (rc != XN_STATUS_OK)
{
XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_1_1);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, 0, pDevicePrivateData->FWInfo.nOpcodeGetVersion);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetVersion);
rc = XnHostProtocolExecute(pDevicePrivateData,
buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetVersion,
(XnUChar**)(&pVersion), nDataSize);
@@ -704,11 +767,17 @@ XnStatus XnHostProtocolGetVersion(XnDevicePrivateData* pDevicePrivateData, XnVer
*((XnUInt16*)&Version) = xnOSEndianSwapUINT16(*((XnUInt16*)pVersion));
- if (Version.nMajor > 5 || (Version.nMajor == 5 && Version.nMinor > 3))
+ if (compareVersion(Version, 5, 6, 0) > 0)
{
- xnLogWarning(XN_MASK_SENSOR_PROTOCOL, "Sensor version %d.%d is newer than latest known. Trying to use 5.3 protocol...", Version.nMajor, Version.nMinor);
- XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_3);
+ xnLogWarning(XN_MASK_SENSOR_PROTOCOL, "Sensor version %d.%d is newer than latest known. Trying to use 5.6 protocol...", Version.nMajor, Version.nMinor);
+ XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_6);
}
+ else if (Version.nMajor == 5 && Version.nMinor == 6)
+ XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_6);
+ else if (Version.nMajor == 5 && Version.nMinor == 5)
+ XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_5);
+ else if (Version.nMajor == 5 && Version.nMinor == 4)
+ XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_4);
else if (Version.nMajor == 5 && Version.nMinor == 3)
XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_3);
else if (Version.nMajor == 5 && Version.nMinor == 2)
@@ -791,10 +860,11 @@ XnStatus XnHostProtocolGetVersion(XnDevicePrivateData* pDevicePrivateData, XnVer
{
XnChar cpBuffer[XN_MAX_OS_NAME_LENGTH];
sprintf(cpBuffer, "%x", Version.nBuild);
- Version.nBuild = atoi(cpBuffer);
+ Version.nBuild = (XnUInt16)atoi(cpBuffer);
}
- if ((Version.nMajor >= 5) && (Version.nMinor >= 3) && (Version.nBuild >= 16))
+ if (!pDevicePrivateData->pSensor->IsLowBandwidth() &&
+ compareVersion(Version, 5, 3, 16) >= 0)
{
pDevicePrivateData->FWInfo.nUSBDelayReceive = 1;
pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 0;
@@ -816,7 +886,7 @@ XnStatus XnHostProtocolGetVersion(XnDevicePrivateData* pDevicePrivateData, XnVer
pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 300;
pDevicePrivateData->FWInfo.nUSBDelaySetParamStream2Mode = 1;
- if ((Version.nMajor == 5) && (Version.nMinor == 3) && (Version.nBuild == 15))
+ if (compareVersion(Version, 5, 3, 15) == 0)
{
pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 300;
}
@@ -830,11 +900,10 @@ XnStatus XnHostProtocolGetVersion(XnDevicePrivateData* pDevicePrivateData, XnVer
XnStatus XnHostProtocolKeepAlive(XnDevicePrivateData* pDevicePrivateData)
{
XnUChar buffer[MAX_PACKET_SIZE] = {0};
- XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Requesting KeepAlive...");
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, 0, pDevicePrivateData->FWInfo.nOpcodeKeepAlive);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeKeepAlive);
XnUInt16 nDataSize;
@@ -860,7 +929,7 @@ XnStatus XnHostProtocolGetParam(XnDevicePrivateData* pDevicePrivateData, XnUInt1
*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER(nParam);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeGetParam);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeGetParam);
XnUInt16 nDataSize;
XnUInt16* pValue = NULL;
@@ -890,7 +959,7 @@ XnStatus XnHostProtocolSetParam(XnDevicePrivateData* pDevicePrivateData, XnUInt1
*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER(nParam);
*(((XnUInt16*)pDataBuf)+1) = XN_PREPARE_VAR16_IN_BUFFER(nValue);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnUInt16)*2, pDevicePrivateData->FWInfo.nOpcodeSetParam);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16)*2, pDevicePrivateData->FWInfo.nOpcodeSetParam);
XnUInt16 nDataSize;
@@ -975,7 +1044,7 @@ XnStatus XnHostProtocolGetFixedParams(XnDevicePrivateData* pDevicePrivateData, X
while (nDataRead < nFixedParamSize)
{
*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER(XnUInt16(nDataRead/sizeof(XnUInt32)));
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeGetFixedParams);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeGetFixedParams);
XnUInt16 nDataSize;
@@ -998,7 +1067,7 @@ XnStatus XnHostProtocolGetFixedParams(XnDevicePrivateData* pDevicePrivateData, X
xnOSMemCopy(pData + nDataRead, pRelevantBuffer, nReadNow);
- nDataRead += nReadNow;
+ nDataRead += (XnUInt16)nReadNow;
}
for (XnUInt32 i = 0; i < nFixedParamSize/sizeof(XnUInt32); i ++)
@@ -1030,9 +1099,8 @@ XnStatus XnHostProtocolGetFixedParams(XnDevicePrivateData* pDevicePrivateData, X
XnStatus XnHostProtocolGetMode(XnDevicePrivateData* pDevicePrivateData, XnUInt16& nMode)
{
XnUChar buffer[MAX_PACKET_SIZE] = {0};
- XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, 0, pDevicePrivateData->FWInfo.nOpcodeGetMode);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetMode);
XnUInt16 nDataSize;
XnUInt16* pMode = NULL;
@@ -1062,7 +1130,7 @@ XnStatus XnHostProtocolReset(XnDevicePrivateData* pDevicePrivateData, XnUInt16 n
*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER(nResetType);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeReset);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeReset);
XnUInt16 nDataSize;
@@ -1121,11 +1189,11 @@ XnStatus XnHostProtocolSetMode(XnDevicePrivateData* pDevicePrivateData, XnUInt16
xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Setting mode to %d...", nMode);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeSetMode);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeSetMode);
XnUInt16 nDataSize;
- XnStatus rc = XnHostProtocolExecute(pDevicePrivateData,
+ XnHostProtocolExecute(pDevicePrivateData,
buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeSetMode,
NULL, nDataSize);
@@ -1174,9 +1242,9 @@ XnStatus XnHostProtocolAlgorithmParams(XnDevicePrivateData* pDevicePrivateData,
if (pDevicePrivateData->FWInfo.nFWVer >= XN_SENSOR_FW_VER_5_1)
{
XnAlgorithmParamRequest* pRequest = (XnAlgorithmParamRequest*)pDataBuf;
- pRequest->nParamID = XN_PREPARE_VAR16_IN_BUFFER(eAlgorithmType);
+ pRequest->nParamID = XN_PREPARE_VAR16_IN_BUFFER((XnUInt16)eAlgorithmType);
pRequest->nFormat = 0;
- pRequest->nResolution = XN_PREPARE_VAR16_IN_BUFFER(nResolution);
+ pRequest->nResolution = XN_PREPARE_VAR16_IN_BUFFER((XnUInt16)nResolution);
pRequest->nFPS = XN_PREPARE_VAR16_IN_BUFFER(nFPS);
pRequest->nOffset = XN_PREPARE_VAR16_IN_BUFFER(nDataRead / sizeof(XnUInt16));
nRequestSize = sizeof(XnAlgorithmParamRequest);
@@ -1184,15 +1252,15 @@ XnStatus XnHostProtocolAlgorithmParams(XnDevicePrivateData* pDevicePrivateData,
else
{
XnAlgorithmParamRequestV4* pRequest = (XnAlgorithmParamRequestV4*)pDataBuf;
- pRequest->nParamID = eAlgorithmType;
+ pRequest->nParamID = (XnUInt8)eAlgorithmType;
pRequest->nFormat = 0;
- pRequest->nResolution = nResolution;
+ pRequest->nResolution = (XnUInt8)nResolution;
pRequest->nFPS = 0;
pRequest->nOffset = XN_PREPARE_VAR16_IN_BUFFER(nDataRead / sizeof(XnUInt16));
nRequestSize = sizeof(XnAlgorithmParamRequestV4);
}
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, nRequestSize, pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, nRequestSize, pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams);
XnUInt16 nDataSize;
rc = XnHostProtocolExecute(pDevicePrivateData,
@@ -1203,7 +1271,7 @@ XnStatus XnHostProtocolAlgorithmParams(XnDevicePrivateData* pDevicePrivateData,
if (rc != XN_STATUS_OK)
return rc;
- XnUInt32 nReadNow = nDataSize*sizeof(XnUInt16);
+ XnUInt16 nReadNow = (XnUInt16)(nDataSize*sizeof(XnUInt16));
if (nReadNow == 0)
{
break;
@@ -1260,7 +1328,7 @@ XnStatus XnHostProtocolSetAudioSampleRate(XnDevicePrivateData* pDevicePrivateDat
return XN_STATUS_DEVICE_UNSUPPORTED_MODE;
}
- return XnHostProtocolSetParam(pDevicePrivateData, PARAM_AUDIO_SAMPLE_RATE, nSample);
+ return XnHostProtocolSetParam(pDevicePrivateData, PARAM_AUDIO_SAMPLE_RATE, (XnUInt16)nSample);
}
XnStatus XnHostProtocolGetAudioSampleRate(XnDevicePrivateData* pDevicePrivateData, XnSampleRate* pSampleRate)
@@ -1320,7 +1388,7 @@ XnStatus XnHostProtocolSetMultipleParams(XnDevicePrivateData* pDevicePrivateData
*pCurData++ = XN_PREPARE_VAR16_IN_BUFFER(anParams[nIndex].nValue);
}
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnUInt16)*nNumOfParams*2, pDevicePrivateData->FWInfo.nOpcodeSetParam);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16)*nNumOfParams*2, pDevicePrivateData->FWInfo.nOpcodeSetParam);
XnUInt16 nDataSize;
@@ -1369,7 +1437,7 @@ XnStatus XnHostProtocolSetIRCropping(XnDevicePrivateData* pDevicePrivateData, Xn
}
// commit
- rc = XnHostProtocolSetParam(pDevicePrivateData, PARAM_IR_CROP_ENABLE, pCropping->bEnabled);
+ rc = XnHostProtocolSetParam(pDevicePrivateData, PARAM_IR_CROP_ENABLE, (XnUInt16)pCropping->bEnabled);
return rc;
}
@@ -1461,7 +1529,7 @@ XnStatus XnHostProtocolSetCmosBlanking(XnDevicePrivateData* pDevicePrivateData,
{
XnVSyncRequest* pRequest = (XnVSyncRequest*)pDataBuf;
pRequest->nUnits = XN_PREPARE_VAR16_IN_BUFFER(nUnits);
- pRequest->nCmosID = XN_PREPARE_VAR16_IN_BUFFER(nCMOSID);
+ pRequest->nCmosID = XN_PREPARE_VAR16_IN_BUFFER((XnUInt16)nCMOSID);
pRequest->nNumberOfFrames = XN_PREPARE_VAR16_IN_BUFFER(nNumberOfFrames);
nRequestSize = sizeof(XnVSyncRequest);
}
@@ -1472,11 +1540,11 @@ XnStatus XnHostProtocolSetCmosBlanking(XnDevicePrivateData* pDevicePrivateData,
xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Chaning CMOS %d Blanking to %hd (NumberOfFrames=%hu)...", nCMOSID, nUnits, nNumberOfFrames);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, nRequestSize, pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, nRequestSize, pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking);
XnUInt16 nDataSize;
XnStatus rc = XnHostProtocolExecute(pDevicePrivateData,
- buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize + nRequestSize, pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking,
+ buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize + (XnUInt16)nRequestSize, pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking,
NULL, nDataSize);
if (rc != XN_STATUS_OK)
@@ -1507,11 +1575,11 @@ XnStatus XnHostProtocolGetCmosBlanking(XnDevicePrivateData* pDevicePrivateData,
XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
XnGetCmosBlankingRequest* pRequest = (XnGetCmosBlankingRequest*)pDataBuf;
- pRequest->nCmosID = nCMOSID;
+ pRequest->nCmosID = (XnUInt16)nCMOSID;
xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Getting Cmos %d VBlanking...", nCMOSID);
- XnHostProtocolInitHeader(pDevicePrivateData, buffer, pDataBuf, sizeof(XnGetCmosBlankingRequest), pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking);
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnGetCmosBlankingRequest), pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking);
XnGetCmosBlankingReply* pReply;
XnUInt16 nDataSize;
@@ -1526,7 +1594,75 @@ XnStatus XnHostProtocolGetCmosBlanking(XnDevicePrivateData* pDevicePrivateData,
xnLogInfo(XN_MASK_SENSOR_PROTOCOL, "Cmos %d VBlanking: %u", nCMOSID, pReply->nUnits);
- *pnLines = pReply->nUnits;
+ *pnLines = (XnUInt16)pReply->nUnits;
return (XN_STATUS_OK);
}
+
+XnStatus XnHostProtocolGetCmosPresets(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOSID, XnCmosPreset* aPresets, XnUInt32& nCount)
+{
+ XnUChar buffer[MAX_PACKET_SIZE] = {0};
+ XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
+
+ xnLogInfo(XN_MASK_SENSOR_PROTOCOL, "Reading CMOS %d supported presets...", nCMOSID);
+
+ *(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER((XnUInt16)nCMOSID);
+
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets);
+
+ XnUInt16 nDataSize;
+ XnCmosPreset* pValue = NULL;
+
+ XnStatus rc = XnHostProtocolExecute(pDevicePrivateData,
+ buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+sizeof(XnUInt16), pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets,
+ (XnUChar**)(&pValue), nDataSize);
+ if (rc != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_PROTOCOL, "Failed getting CMOS %d presets: %s", nCMOSID, xnGetStatusString(rc));
+ return rc;
+ }
+
+ XnUInt32 nReturnedCount = nDataSize * 2 / sizeof(XnCmosPreset);
+ if (nReturnedCount > nCount)
+ {
+ return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
+ }
+
+ nCount = nReturnedCount;
+
+ for (XnUInt32 i = 0; i < nCount; ++i)
+ {
+ aPresets[i].nFormat = XN_PREPARE_VAR16_IN_BUFFER(pValue[i].nFormat);
+ aPresets[i].nResolution = XN_PREPARE_VAR16_IN_BUFFER(pValue[i].nResolution);
+ aPresets[i].nFPS = XN_PREPARE_VAR16_IN_BUFFER(pValue[i].nFPS);
+ }
+
+ return XN_STATUS_OK;
+}
+
+XnStatus XnHostProtocolGetSerialNumber (XnDevicePrivateData* pDevicePrivateData, XnChar* cpSerialNumber)
+{
+ XnUChar buffer[MAX_PACKET_SIZE] = {0};
+
+ xnLogInfo(XN_MASK_SENSOR_PROTOCOL, "Reading sensor serial number...");
+
+ XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber);
+
+ XnUInt16 nDataSize;
+ XnUChar *serialNumberBuffer = NULL;
+
+ XnStatus rc = XnHostProtocolExecute(pDevicePrivateData,
+ buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber,
+ (XnUChar**)(&serialNumberBuffer), nDataSize);
+ if (rc != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_PROTOCOL, "Failed getting the sensor serial number: %s", xnGetStatusString(rc));
+ return rc;
+ }
+
+ serialNumberBuffer[nDataSize*2]=0;
+
+ strcpy(cpSerialNumber, (XnChar*)serialNumberBuffer);
+
+ return XN_STATUS_OK;
+}
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnHostProtocol.h b/Source/XnDeviceSensorV2/XnHostProtocol.h
index fcc67fd..2deabe2 100644
--- a/Source/XnDeviceSensorV2/XnHostProtocol.h
+++ b/Source/XnDeviceSensorV2/XnHostProtocol.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef HOST_PROTOCOL_H
#define HOST_PROTOCOL_H
@@ -57,6 +51,9 @@ enum EPsProtocolOpCodes
OPCODE_ALGORITM_PARAMS = 22,
OPCODE_SET_CMOS_BLANKING = 34,
OPCODE_GET_CMOS_BLANKING = 35,
+ OPCODE_GET_CMOS_PRESETS = 36,
+ OPCODE_GET_SERIAL_NUMBER = 37,
+ OPCODE_GET_FAST_CONVERGENCE_TEC = 38,
};
enum EPsProtocolOpCodes_V400
@@ -111,9 +108,11 @@ enum EPsProtocolOpCodes_V017
typedef enum
{
XN_HOST_PROTOCOL_ALGORITHM_DEPTH_INFO = 0x00,
+ // --avin mod--
XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION = 0x40,
XN_HOST_PROTOCOL_ALGORITHM_PADDING = 0x41,
XN_HOST_PROTOCOL_ALGORITHM_BLANKING = 0x06,
+ XN_HOST_PROTOCOL_ALGORITHM_DEVICE_INFO = 0x07,
XN_HOST_PROTOCOL_ALGORITHM_FREQUENCY = 0x80
} XnHostProtocolAlgorithmType;
@@ -218,5 +217,9 @@ XnStatus XnHostProtocolGetDepthAGCBin(XnDevicePrivateData* pDevicePrivateData, X
XnStatus XnHostProtocolSetCmosBlanking (XnDevicePrivateData* pDevicePrivateData, XnUInt16 nLines, XnCMOSType nCMOSID, XnUInt16 nNumberOfFrames);
XnStatus XnHostProtocolGetCmosBlanking (XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOSID, XnUInt16* pnLines);
+XnStatus XnHostProtocolGetCmosPresets (XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOSID, XnCmosPreset* aPresets, XnUInt32& nCount);
+
+XnStatus XnHostProtocolGetSerialNumber (XnDevicePrivateData* pDevicePrivateData, XnChar* cpSerialNumber);
+
#endif
diff --git a/Source/XnDeviceSensorV2/XnIRProcessor.cpp b/Source/XnDeviceSensorV2/XnIRProcessor.cpp
index 6170b9a..b7428d4 100644
--- a/Source/XnDeviceSensorV2/XnIRProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnIRProcessor.cpp
@@ -1,35 +1,30 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnIRProcessor.h"
#include
+#include "XnSensor.h"
//---------------------------------------------------------------------------
// Defines
@@ -45,7 +40,8 @@
//---------------------------------------------------------------------------
XnIRProcessor::XnIRProcessor(XnSensorIRStream* pStream, XnSensorStreamHelper* pHelper) :
- XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END)
+ XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END),
+ m_nRefTimestamp(0)
{
}
@@ -134,12 +130,12 @@ XnStatus XnIRProcessor::Unpack10to16(const XnUInt8* pcInput, const XnUInt32 nInp
pcInput++;
}
- *pnActualRead = pcInput - pOrigInput;
+ *pnActualRead = (XnUInt32)(pcInput - pOrigInput);
*pnOutputSize = nNeededOutput;
return XN_STATUS_OK;
}
-void XnIRProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
+void XnIRProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
XN_PROFILING_START_SECTION("XnIRProcessor::ProcessFramePacketChunk")
@@ -202,7 +198,7 @@ void IRto888(XnUInt16* pInput, XnUInt32 nInputSize, XnUInt8* pOutput, XnUInt32*
while (pInput != pInputEnd && pOutput < pOutputEnd)
{
- *pOutput = (*pInput)>>2;
+ *pOutput = (XnUInt8)((*pInput)>>2);
*(pOutput+1) = *pOutput;
*(pOutput+2) = *pOutput;
@@ -210,7 +206,7 @@ void IRto888(XnUInt16* pInput, XnUInt32 nInputSize, XnUInt8* pOutput, XnUInt32*
pInput++;
}
- *pnOutputSize = pOutput - pOutputOrig;
+ *pnOutputSize = (XnUInt32)(pOutput - pOutputOrig);
}
XnUInt32 XnIRProcessor::CalculateExpectedSize()
@@ -271,3 +267,30 @@ void XnIRProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
XN_PROFILING_END_SECTION
}
+
+XnUInt64 XnIRProcessor::GetTimeStamp(XnUInt32 nDeviceTimeStamp)
+{
+ XnUInt64 nNow;
+ xnOSGetHighResTimeStamp(&nNow);
+
+ // There's a firmware bug, causing IR timestamps not to advance if depth stream is off.
+ // If so, we need to create our own timestamps.
+ if (m_pDevicePrivateData->pSensor->GetFirmware()->GetParams()->m_Stream1Mode.GetValue() != XN_VIDEO_STREAM_DEPTH)
+ {
+ if (m_nRefTimestamp == 0)
+ {
+ m_nRefTimestamp = nNow;
+ }
+
+ return nNow - m_nRefTimestamp;
+ }
+ else
+ {
+ XnUInt64 nResult = XnFrameStreamProcessor::GetTimeStamp(nDeviceTimeStamp);
+
+ // keep it as ref so that if depth is turned off, we'll continue from there
+ m_nRefTimestamp = nNow - nResult;
+
+ return nResult;
+ }
+}
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnIRProcessor.h b/Source/XnDeviceSensorV2/XnIRProcessor.h
index 3df8f59..ffa9465 100644
--- a/Source/XnDeviceSensorV2/XnIRProcessor.h
+++ b/Source/XnDeviceSensorV2/XnIRProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IR_PROCESSOR_H__
#define __XN_IR_PROCESSOR_H__
@@ -51,6 +46,7 @@ class XnIRProcessor : public XnFrameStreamProcessor
//---------------------------------------------------------------------------
virtual void ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
virtual void OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader);
+ virtual XnUInt64 GetTimeStamp(XnUInt32 nDeviceTimeStamp);
//---------------------------------------------------------------------------
// Internal Functions
@@ -70,6 +66,7 @@ class XnIRProcessor : public XnFrameStreamProcessor
/* A buffer to store bytes till we have enough to unpack. */
XnBuffer m_ContinuousBuffer;
XnBuffer m_UnpackedBuffer;
+ XnUInt64 m_nRefTimestamp; // needed for firmware bug workaround
};
#endif //__XN_IR_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnImageProcessor.cpp b/Source/XnDeviceSensorV2/XnImageProcessor.cpp
index 536fe0f..fa65b07 100644
--- a/Source/XnDeviceSensorV2/XnImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnImageProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -36,8 +30,9 @@
// Code
//---------------------------------------------------------------------------
-XnImageProcessor::XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
- XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END)
+XnImageProcessor::XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnBool bCompressedOutput /* = FALSE */) :
+ XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END),
+ m_bCompressedOutput(bCompressedOutput)
{
}
@@ -95,11 +90,15 @@ XnUInt32 XnImageProcessor::CalculateExpectedSize()
void XnImageProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
{
- XnUInt32 nExpectedSize = CalculateExpectedSize();
- if (GetWriteBuffer()->GetSize() != nExpectedSize)
+ if (!m_bCompressedOutput)
{
- xnLogWarning(XN_MASK_SENSOR_READ, "Read: Image buffer is corrupt. Size is %u (!= %u)", GetWriteBuffer()->GetSize(), nExpectedSize);
- FrameIsCorrupted();
+ // make sure data size is right
+ XnUInt32 nExpectedSize = CalculateExpectedSize();
+ if (GetWriteBuffer()->GetSize() != nExpectedSize)
+ {
+ xnLogWarning(XN_MASK_SENSOR_READ, "Read: Image buffer is corrupt. Size is %u (!= %u)", GetWriteBuffer()->GetSize(), nExpectedSize);
+ FrameIsCorrupted();
+ }
}
// call base
@@ -127,7 +126,7 @@ void XnImageProcessor::CalcActualRes()
}
}
-XnStatus XnImageProcessor::ActualResChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XnImageProcessor::ActualResChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnImageProcessor* pThis = (XnImageProcessor*)pCookie;
pThis->CalcActualRes();
diff --git a/Source/XnDeviceSensorV2/XnImageProcessor.h b/Source/XnDeviceSensorV2/XnImageProcessor.h
index 7d6c32e..f1a4583 100644
--- a/Source/XnDeviceSensorV2/XnImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnImageProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_IMAGE_PROCESSOR_H__
#define __XN_IMAGE_PROCESSOR_H__
@@ -39,7 +34,7 @@
class XnImageProcessor : public XnFrameStreamProcessor
{
public:
- XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
+ XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnBool bCompressedOutput = FALSE);
virtual ~XnImageProcessor();
XnStatus Init();
@@ -75,6 +70,8 @@ class XnImageProcessor : public XnFrameStreamProcessor
XnCallbackHandle m_hXCropCallback;
XnCallbackHandle m_hYCropCallback;
XnCallbackHandle m_hCropEnabledCallback;
+
+ XnBool m_bCompressedOutput;
};
#endif //__XN_IMAGE_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp b/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp
index 3d9b91b..11db885 100644
--- a/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -36,79 +30,28 @@
//---------------------------------------------------------------------------
XnJpegImageProcessor::XnJpegImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
- XnImageProcessor(pStream, pHelper)
+ XnImageProcessor(pStream, pHelper, TRUE)
{
+ SetAllowDoubleSOFPackets(TRUE);
}
XnJpegImageProcessor::~XnJpegImageProcessor()
{
- XnStreamFreeUncompressImageJ(&m_JPEGContext);
-}
-
-XnStatus XnJpegImageProcessor::Init()
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- nRetVal = XnImageProcessor::Init();
- XN_IS_STATUS_OK(nRetVal);
-
- XN_VALIDATE_BUFFER_ALLOCATE(m_RawData, GetExpectedOutputSize());
-
- nRetVal = XnStreamInitUncompressImageJ(&m_JPEGContext);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-void XnJpegImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
-{
- XN_PROFILING_START_SECTION("XnJpegImageProcessor::ProcessFramePacketChunk")
-
- // append to raw buffer
- if (m_RawData.GetFreeSpaceInBuffer() < nDataSize)
- {
- xnLogWarning(XN_MASK_SENSOR_PROTOCOL_IMAGE, "Bad overflow image! %d", m_RawData.GetSize());
- FrameIsCorrupted();
- m_RawData.Reset();
- }
- else
- {
- m_RawData.UnsafeWrite(pData, nDataSize);
- }
-
- XN_PROFILING_END_SECTION
-}
-
-void XnJpegImageProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader)
-{
- XnImageProcessor::OnStartOfFrame(pHeader);
- m_RawData.Reset();
}
-void XnJpegImageProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
+void XnJpegImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
- XN_PROFILING_START_SECTION("XnJpegImageProcessor::OnEndOfFrame")
+ XN_PROFILING_START_SECTION("XnJpegImageProcessor::ProcessFramePacketChunk");
+ // when image is uncompressed, we can just copy it directly to write buffer
XnBuffer* pWriteBuffer = GetWriteBuffer();
- XnUInt32 nOutputSize = pWriteBuffer->GetMaxSize();
- XnStatus nRetVal = XnStreamUncompressImageJ(&m_JPEGContext, m_RawData.GetData(), m_RawData.GetSize(), pWriteBuffer->GetUnsafeWritePointer(), &nOutputSize);
- if (nRetVal != XN_STATUS_OK)
+ // make sure we have enough room
+ if (CheckWriteBufferForOverflow(nDataSize))
{
- xnLogWarning(XN_MASK_SENSOR_PROTOCOL_IMAGE, "Failed to uncompress JPEG for frame %d: %s (%d)\n", GetCurrentFrameID(), xnGetStatusString(nRetVal), pWriteBuffer->GetSize());
- FrameIsCorrupted();
-
- XnDump badImageDump = XN_DUMP_CLOSED;
- xnDumpInit(&badImageDump, XN_DUMP_BAD_IMAGE, NULL, "BadImage_%d.jpeg", GetCurrentFrameID());
- xnDumpWriteBuffer(badImageDump, m_RawData.GetData(), m_RawData.GetSize());
- xnDumpClose(&badImageDump);
+ pWriteBuffer->UnsafeWrite(pData, nDataSize);
}
- pWriteBuffer->UnsafeUpdateSize(nOutputSize);
-
- m_RawData.Reset();
- XnImageProcessor::OnEndOfFrame(pHeader);
-
- XN_PROFILING_END_SECTION
+ XN_PROFILING_END_SECTION;
}
diff --git a/Source/XnDeviceSensorV2/XnJpegImageProcessor.h b/Source/XnDeviceSensorV2/XnJpegImageProcessor.h
index b01356c..e61ab2f 100644
--- a/Source/XnDeviceSensorV2/XnJpegImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnJpegImageProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_JPEG_IMAGE_PROCESSOR_H__
#define __XN_JPEG_IMAGE_PROCESSOR_H__
@@ -43,22 +38,8 @@ class XnJpegImageProcessor : public XnImageProcessor
XnJpegImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
~XnJpegImageProcessor();
- XnStatus Init();
-
- //---------------------------------------------------------------------------
- // Overridden Functions
- //---------------------------------------------------------------------------
protected:
virtual void ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
- virtual void OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader);
- virtual void OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader);
-
- //---------------------------------------------------------------------------
- // Class Members
- //---------------------------------------------------------------------------
-private:
- XnBuffer m_RawData;
- XnStreamUncompJPEGContext m_JPEGContext;
};
-#endif
+#endif // __XN_JPEG_IMAGE_PROCESSOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp
new file mode 100644
index 0000000..8095b5f
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnJpegToRGBImageProcessor.h"
+#include
+
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+
+XnJpegToRGBImageProcessor::XnJpegToRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+ XnImageProcessor(pStream, pHelper)
+{
+ SetAllowDoubleSOFPackets(TRUE);
+}
+
+XnJpegToRGBImageProcessor::~XnJpegToRGBImageProcessor()
+{
+ XnStreamFreeUncompressImageJ(&m_JPEGContext);
+}
+
+XnStatus XnJpegToRGBImageProcessor::Init()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = XnImageProcessor::Init();
+ XN_IS_STATUS_OK(nRetVal);
+
+ XN_VALIDATE_BUFFER_ALLOCATE(m_RawData, GetExpectedOutputSize());
+
+ nRetVal = XnStreamInitUncompressImageJ(&m_JPEGContext);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+void XnJpegToRGBImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
+{
+ XN_PROFILING_START_SECTION("XnJpegToRGBImageProcessor::ProcessFramePacketChunk")
+
+ // append to raw buffer
+ if (m_RawData.GetFreeSpaceInBuffer() < nDataSize)
+ {
+ xnLogWarning(XN_MASK_SENSOR_PROTOCOL_IMAGE, "Bad overflow image! %d", m_RawData.GetSize());
+ FrameIsCorrupted();
+ m_RawData.Reset();
+ }
+ else
+ {
+ m_RawData.UnsafeWrite(pData, nDataSize);
+ }
+
+ XN_PROFILING_END_SECTION
+}
+
+void XnJpegToRGBImageProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader)
+{
+ XnImageProcessor::OnStartOfFrame(pHeader);
+ m_RawData.Reset();
+}
+
+void XnJpegToRGBImageProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
+{
+ XN_PROFILING_START_SECTION("XnJpegToRGBImageProcessor::OnEndOfFrame")
+
+// xnOSSaveFile("c:\\temp\\fromSensor.jpeg", m_RawData.GetData(), m_RawData.GetSize());
+
+ XnBuffer* pWriteBuffer = GetWriteBuffer();
+
+ XnUInt32 nOutputSize = pWriteBuffer->GetMaxSize();
+ XnStatus nRetVal = XnStreamUncompressImageJ(&m_JPEGContext, m_RawData.GetData(), m_RawData.GetSize(), pWriteBuffer->GetUnsafeWritePointer(), &nOutputSize);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_PROTOCOL_IMAGE, "Failed to uncompress JPEG for frame %d: %s (%d)\n", GetCurrentFrameID(), xnGetStatusString(nRetVal), pWriteBuffer->GetSize());
+ FrameIsCorrupted();
+
+ XnDumpFile* badImageDump = xnDumpFileOpen(XN_DUMP_BAD_IMAGE, "BadImage_%d.jpeg", GetCurrentFrameID());
+ xnDumpFileWriteBuffer(badImageDump, m_RawData.GetData(), m_RawData.GetSize());
+ xnDumpFileClose(badImageDump);
+ }
+
+ pWriteBuffer->UnsafeUpdateSize(nOutputSize);
+
+ m_RawData.Reset();
+ XnImageProcessor::OnEndOfFrame(pHeader);
+
+ XN_PROFILING_END_SECTION
+}
+
diff --git a/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h
new file mode 100644
index 0000000..7cbcea6
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+#ifndef __XN_JPEG_TO_RGB_IMAGE_PROCESSOR_H__
+#define __XN_JPEG_TO_RGB_IMAGE_PROCESSOR_H__
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnImageProcessor.h"
+#include
+
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+
+class XnJpegToRGBImageProcessor : public XnImageProcessor
+{
+public:
+ XnJpegToRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
+ ~XnJpegToRGBImageProcessor();
+
+ XnStatus Init();
+
+ //---------------------------------------------------------------------------
+ // Overridden Functions
+ //---------------------------------------------------------------------------
+protected:
+ virtual void ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
+ virtual void OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader);
+ virtual void OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader);
+
+ //---------------------------------------------------------------------------
+ // Class Members
+ //---------------------------------------------------------------------------
+private:
+ XnBuffer m_RawData;
+ XnStreamUncompJPEGContext m_JPEGContext;
+};
+
+#endif //__XN_JPEG_TO_RGB_IMAGE_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp
index 44e9f9b..00eb9c4 100644
--- a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp
+++ b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -86,7 +80,7 @@ void XnMultiPropChangedHandler::Unregister()
}
}
-void XnMultiPropChangedHandler::PropertyChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie)
+void XnMultiPropChangedHandler::PropertyChangedCallback(XnDeviceHandle /*pDeviceHandle*/, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie)
{
XnMultiPropChangedHandler* pThis = (XnMultiPropChangedHandler*)pCookie;
pThis->OnModulePropertyChanged(ModuleName, PropertyName);
@@ -101,7 +95,7 @@ XnMultiPropStateChangedHandler::XnMultiPropStateChangedHandler(XnSensorProductio
m_pCookie(pCookie)
{}
-void XnMultiPropStateChangedHandler::OnModulePropertyChanged(const XnChar* strModule, const XnChar* strProperty)
+void XnMultiPropStateChangedHandler::OnModulePropertyChanged(const XnChar* /*strModule*/, const XnChar* /*strProperty*/)
{
m_pHandler(m_pCookie);
}
diff --git a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h
index 2ce68b5..dfadfe0 100644
--- a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h
+++ b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_MULTI_PROP_CHANGED_HANDLER_H__
#define __XN_MULTI_PROP_CHANGED_HANDLER_H__
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp
index 1ed1ad0..d0a98c5 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -106,7 +100,7 @@ XnPSCompressedDepthProcessor::~XnPSCompressedDepthProcessor()
/** Gets a pointer to n elements before current input */
#define GET_PREV_INPUT(n) __pCurrInput - n/2;
-#define GET_INPUT_READ_BYTES __pCurrInput - __pInputOrig;
+#define GET_INPUT_READ_BYTES (__pCurrInput - __pInputOrig);
XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput, const XnUInt32 nInputSize,
XnUInt16* pOutput, XnUInt32* pnOutputSize,
@@ -129,7 +123,7 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
XnUInt32 nLargeValue;
XnBool bCanStop;
- while (TRUE)
+ for (;;)
{
bCanStop = CAN_INPUT_STOP_HERE;
GET_NEXT_INPUT(nInput);
@@ -167,7 +161,7 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
nLargeValue |= nInput;
// diff values are from -64 to 63 (0x00 to 0x7f)
- nLastValue += nLargeValue - 64;
+ nLastValue += ((XnInt16)nLargeValue - 64);
}
else // Full value (15-bit)
{
@@ -188,7 +182,7 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
nLargeValue |= nInput << 4;
GET_NEXT_INPUT(nInput);
- nLastValue = (nLargeValue | nInput);
+ nLastValue = (XnUInt16)(nLargeValue | nInput);
}
XN_DEPTH_OUTPUT(pOutput, pOutputEnd, nLastValue);
@@ -196,20 +190,20 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
break;
default: // all rest (smaller than 0xd) are diffs
// diff values are from -6 to 6 (0x0 to 0xc)
- nLastValue += nInput - 6;
+ nLastValue += ((XnInt16)nInput - 6);
XN_DEPTH_OUTPUT(pOutput, pOutputEnd, nLastValue);
}
}
if (bLastPart == TRUE)
{
- *pnOutputSize = (pOutput - pOutputOrig) * sizeof(XnUInt16);
- *pnActualRead = GET_INPUT_READ_BYTES;
+ *pnOutputSize = (XnUInt32)(pOutput - pOutputOrig) * sizeof(XnUInt16);
+ *pnActualRead = (XnUInt32)GET_INPUT_READ_BYTES;
}
else
{
- *pnOutputSize = (pOutputLastPossibleStop - pOutputOrig) * sizeof(XnUInt16);
- *pnActualRead = (pInputLastPossibleStop - pInputOrig) * sizeof(XnUInt8);
+ *pnOutputSize = (XnUInt32)(pOutputLastPossibleStop - pOutputOrig) * sizeof(XnUInt16);
+ *pnActualRead = (XnUInt32)(pInputLastPossibleStop - pInputOrig) * sizeof(XnUInt8);
}
// All is good...
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h
index b1e162a..0af4742 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PS_COMPRESSED_DEPTH_PROCESSOR_H__
#define __XN_PS_COMPRESSED_DEPTH_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp
index 912c615..26a3d60 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -110,7 +104,7 @@ void XnPSCompressedImageProcessor::ProcessFramePacketChunk(const XnSensorProtoco
XnUInt32 nActualRead = 0;
XnBool bLastPart = pHeader->nType == XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END && (nDataOffset + nDataSize) == pHeader->nBufSize;
XnStatus nRetVal = XnStreamUncompressYUVImagePS(pBuf, nBufSize, pWriteBuffer->GetUnsafeWritePointer(),
- &nWrittenOutput, GetActualXRes()*2, &nActualRead, bLastPart);
+ &nWrittenOutput, (XnUInt16)(GetActualXRes()*2), &nActualRead, bLastPart);
if (nRetVal != XN_STATUS_OK)
{
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h
index 7eb9293..1a5702e 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PS_COMPRESSED_IMAGE_PROCESSOR_H__
#define __XN_PS_COMPRESSED_IMAGE_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp
index 3f2f419..7e5cd4f 100644
--- a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -121,20 +115,18 @@ XnStatus XnPacked11DepthProcessor::Unpack11to16(const XnUInt8* pcInput, const Xn
pnOutput += 8;
}
- *pnActualRead = pcInput - pOrigInput;
+ *pnActualRead = (XnUInt32)(pcInput - pOrigInput);
pWriteBuffer->UnsafeUpdateSize(nNeededOutput);
return XN_STATUS_OK;
}
-void XnPacked11DepthProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
+void XnPacked11DepthProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
XN_PROFILING_START_SECTION("XnPacked11DepthProcessor::ProcessFramePacketChunk")
XnStatus nRetVal = XN_STATUS_OK;
- XnBuffer* pWriteBuffer = GetWriteBuffer();
-
// check if we have data from previous packet
if (m_ContinuousBuffer.GetSize() != 0)
{
@@ -148,7 +140,6 @@ void XnPacked11DepthProcessor::ProcessFramePacketChunk(const XnSensorProtocolRes
{
// process it
XnUInt32 nActualRead = 0;
- XnUInt32 nOutputSize = pWriteBuffer->GetFreeSpaceInBuffer();
Unpack11to16(m_ContinuousBuffer.GetData(), XN_INPUT_ELEMENT_SIZE, &nActualRead);
m_ContinuousBuffer.Reset();
}
diff --git a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h
index e7c634c..5e9f14f 100644
--- a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_PACKED_11_DEPTH_PROCESSOR_H__
#define __XN_PACKED_11_DEPTH_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnParams.h b/Source/XnDeviceSensorV2/XnParams.h
index 3352f38..6a2b4fe 100644
--- a/Source/XnDeviceSensorV2/XnParams.h
+++ b/Source/XnDeviceSensorV2/XnParams.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef XN_PARAMS_H
#define XN_PARAMS_H
@@ -106,7 +100,13 @@ typedef enum
PARAM_IMAGE_MIRROR = 71,
PARAM_IR_MIRROR = 72,
-
+ PARAM_IMAGE_SHARPNESS = 76,
+ PARAM_IMAGE_AUTO_WHITE_BALANCE_MODE = 77,
+ PARAM_IMAGE_COLOR_TEMPERATURE = 78,
+ PARAM_IMAGE_BACK_LIGHT_COMPENSATION = 79,
+ PARAM_IMAGE_AUTO_EXPOSURE_MODE = 80,
+ PARAM_IMAGE_EXPOSURE_BAR = 81,
+ PARAM_IMAGE_LOW_LIGHT_COMPENSATION_MODE = 82,
} EConfig_Params;
typedef enum XnExecuter
diff --git a/Source/XnDeviceSensorV2/XnSensor.cpp b/Source/XnDeviceSensorV2/XnSensor.cpp
index cdc4541..842f142 100644
--- a/Source/XnDeviceSensorV2/XnSensor.cpp
+++ b/Source/XnDeviceSensorV2/XnSensor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -45,7 +39,16 @@
#define XN_SENSOR_MAX_STREAM_COUNT 5
#define XN_SENSOR_FRAME_SYNC_MAX_DIFF 3
#define XN_SENSOR_DEFAULT_CLOSE_STREAMS_ON_SHUTDOWN TRUE
-#define XN_GLOBAL_CONFIG_FILE_NAME "GlobalDefaults.ini"
+#define XN_SENSOR_DEFAULT_ENABLE_MULTI_USERS FALSE
+// --avin mod--
+#define XN_GLOBAL_CONFIG_FILE_NAME "GlobalDefaultsKinect.ini"
+
+// on weak platforms (Arm), we prefer to use BULK
+#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_ANDROID_ARM)
+ #define XN_SENSOR_DEFAULT_USB_INTERFACE XN_SENSOR_USB_INTERFACE_BULK_ENDPOINTS
+#else
+ #define XN_SENSOR_DEFAULT_USB_INTERFACE XN_SENSOR_USB_INTERFACE_ISO_ENDPOINTS
+#endif
//---------------------------------------------------------------------------
// Types
@@ -64,7 +67,7 @@ XnSensor::XnSensor() :
XnDeviceBase(XN_DEVICE_NAME, TRUE),
m_ErrorState(XN_MODULE_PROPERTY_ERROR_STATE, XN_STATUS_OK),
m_ResetSensorOnStartup(XN_MODULE_PROPERTY_RESET_SENSOR_ON_STARTUP, TRUE),
- m_Interface(XN_MODULE_PROPERTY_USB_INTERFACE, XN_SENSOR_USB_INTERFACE_DEFAULT),
+ m_Interface(XN_MODULE_PROPERTY_USB_INTERFACE, XN_SENSOR_DEFAULT_USB_INTERFACE),
m_NumberOfBuffers(XN_MODULE_PROPERTY_NUMBER_OF_BUFFERS, 6),
m_ReadFromEP1(XN_MODULE_PROPERTY_READ_ENDPOINT_1, TRUE),
m_ReadFromEP2(XN_MODULE_PROPERTY_READ_ENDPOINT_2, TRUE),
@@ -80,15 +83,19 @@ XnSensor::XnSensor() :
m_FixedParam(XN_MODULE_PROPERTY_FIXED_PARAMS, NULL),
m_CloseStreamsOnShutdown(XN_MODULE_PROPERTY_CLOSE_STREAMS_ON_SHUTDOWN, XN_SENSOR_DEFAULT_CLOSE_STREAMS_ON_SHUTDOWN),
m_ID(XN_MODULE_PROPERTY_ID),
- m_pThis(this),
- m_InstancePointer(XN_SENSOR_PROPERTY_INSTANCE_POINTER, &m_pThis, sizeof(m_pThis), NULL),
+ m_InstancePointer(XN_SENSOR_PROPERTY_INSTANCE_POINTER),
+ m_USBPath(XN_MODULE_PROPERTY_USB_PATH),
+ m_DeviceName(XN_MODULE_PROPERTY_PHYSICAL_DEVICE_NAME),
+ m_VendorSpecificData(XN_MODULE_PROPERTY_VENDOR_SPECIFIC_DATA),
+ m_AllowOtherUsers(XN_MODULE_PROPERTY_ENABLE_MULTI_USERS, XN_SENSOR_DEFAULT_ENABLE_MULTI_USERS),
+ m_AudioSupported(XN_MODULE_PROPERTY_AUDIO_SUPPORTED),
m_Firmware(&m_DevicePrivateData),
m_FixedParams(&m_Firmware, &m_DevicePrivateData),
m_SensorIO(&m_DevicePrivateData.SensorHandle),
m_FPS(),
m_CmosInfo(&m_Firmware, &m_DevicePrivateData),
m_Objects(&m_Firmware, &m_DevicePrivateData, &m_FixedParams, &m_FPS, &m_CmosInfo),
- m_FrameSyncDump(XN_DUMP_CLOSED),
+ m_FrameSyncDump(NULL),
m_bInitialized(FALSE)
{
// reset all data
@@ -97,6 +104,7 @@ XnSensor::XnSensor() :
m_ResetSensorOnStartup.UpdateSetCallbackToDefault();
m_Interface.UpdateSetCallback(SetInterfaceCallback, this);
+ m_AllowOtherUsers.UpdateSetCallback(SetAllowOtherUsersCallback, this);
m_NumberOfBuffers.UpdateSetCallback(SetNumberOfBuffersCallback, this);
m_ReadFromEP1.UpdateSetCallback(SetReadEndpoint1Callback, this);
m_ReadFromEP2.UpdateSetCallback(SetReadEndpoint2Callback, this);
@@ -114,6 +122,8 @@ XnSensor::XnSensor() :
m_FirmwareMode.UpdateGetCallback(GetFirmwareModeCallback, this);
m_FixedParam.UpdateGetCallback(GetFixedParamsCallback, this);
m_CloseStreamsOnShutdown.UpdateSetCallbackToDefault();
+ m_AudioSupported.UpdateGetCallback(GetAudioSupportedCallback, this);
+ m_InstancePointer.UpdateGetCallback(GetInstanceCallback, this);
}
@@ -138,36 +148,11 @@ XnStatus XnSensor::GetDefinition(XnDeviceDefinition* pDeviceDefinition)
XnStatus XnSensor::Enumerate(XnConnectionString* aConnectionStrings, XnUInt32* pnCount)
{
XnStatus nRetVal = XN_STATUS_OK;
- XnUInt32 nNumSensors = 0;
- XnUInt32 nSensorIndex = 0;
- XnChar cpBoardID[16];
- XnDevicePrivateData DevicePrivateData;
- XnVersions Versions;
- XnChar* pCurrConnectionString;
-
XN_VALIDATE_INPUT_PTR(pnCount);
- xnOSMemSet(&DevicePrivateData, 0, sizeof(DevicePrivateData));
-
- nRetVal = XnSensorIO::GetNumOfSensors(&nNumSensors);
+ nRetVal = XnSensorIO::EnumerateSensors(aConnectionStrings, pnCount);
XN_IS_STATUS_OK(nRetVal);
- XnUInt32 nArraySize = *pnCount;
-
- *pnCount = nNumSensors;
- if (nArraySize < nNumSensors)
- {
- return (XN_STATUS_OUTPUT_BUFFER_OVERFLOW);
- }
-
- // for now, the driver only supports telling if we have a sensor or not (and not how many),
- // so result is always 0 or 1.
- if (nNumSensors != 0)
- {
- XN_ASSERT(nNumSensors == 1);
- strcpy(aConnectionStrings[0], "*:0");
- }
-
return (XN_STATUS_OK);
}
@@ -190,7 +175,8 @@ XnStatus XnSensor::InitImpl(const XnDeviceConfig *pDeviceConfig)
XN_IS_STATUS_OK(nRetVal);
// other stuff
- xnDumpInit(&m_FrameSyncDump, XN_DUMP_FRAME_SYNC, "HostTime(us),DepthNewData,DepthTimestamp(ms),ImageNewData,ImageTimestamp(ms),Diff(ms),Action\n", "FrameSync.csv");
+ m_FrameSyncDump = xnDumpFileOpen(XN_DUMP_FRAME_SYNC, "FrameSync.csv");
+ xnDumpFileWriteString(m_FrameSyncDump, "HostTime(us),DepthNewData,DepthTimestamp(ms),ImageNewData,ImageTimestamp(ms),Diff(ms),Action\n");
nRetVal = XnDeviceBase::InitImpl(pDeviceConfig);
XN_IS_STATUS_OK(nRetVal);
@@ -243,6 +229,9 @@ XnStatus XnSensor::InitSensor(const XnDeviceConfig* pDeviceConfig)
nRetVal = m_SensorIO.OpenDevice(pDeviceConfig->cpConnectionString);
XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_USBPath.UnsafeUpdateValue(m_SensorIO.GetDevicePath());
+ XN_IS_STATUS_OK(nRetVal);
+
// initialize
nRetVal = XnDeviceSensorInit(pDevicePrivateData);
XN_IS_STATUS_OK(nRetVal);
@@ -258,6 +247,25 @@ XnStatus XnSensor::InitSensor(const XnDeviceConfig* pDeviceConfig)
nRetVal = m_FixedParams.Init();
XN_IS_STATUS_OK(nRetVal);
+ XnDeviceInformation deviceInfo;
+ strcpy(deviceInfo.strDeviceName, "PrimeSense Sensor");
+ strcpy(deviceInfo.strVendorData, "");
+
+ // try to take device information (only supported from 5.3.25)
+ if (pDevicePrivateData->Version.nMajor > 5 ||
+ (pDevicePrivateData->Version.nMajor == 5 && pDevicePrivateData->Version.nMinor > 3) ||
+ (pDevicePrivateData->Version.nMajor == 5 && pDevicePrivateData->Version.nMinor == 3 && pDevicePrivateData->Version.nBuild >= 25))
+ {
+ nRetVal = XnHostProtocolAlgorithmParams(pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_DEVICE_INFO,
+ &deviceInfo, sizeof(deviceInfo), (XnResolutions)0, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ nRetVal = m_DeviceName.UnsafeUpdateValue(deviceInfo.strDeviceName);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_VendorSpecificData.UnsafeUpdateValue(deviceInfo.strVendorData);
+ XN_IS_STATUS_OK(nRetVal);
+
// update serial number
nRetVal = m_ID.UnsafeUpdateValue(m_FixedParams.GetSensorSerial());
XN_IS_STATUS_OK(nRetVal);
@@ -311,13 +319,19 @@ XnStatus XnSensor::Destroy()
pDevicePrivateData->hExecuteMutex = NULL;
}
+ // Register USB event callback
+#if WIN32
+ nRetVal = m_SensorIO.SetCallback(NULL, this);
+ XN_IS_STATUS_OK(nRetVal);
+#endif
+
XnDeviceBase::Destroy();
// close dumps
- xnDumpClose(&pDevicePrivateData->TimestampsDump);
- xnDumpClose(&pDevicePrivateData->BandwidthDump);
- xnDumpClose(&pDevicePrivateData->MiniPacketsDump);
- xnDumpClose(&m_FrameSyncDump);
+ xnDumpFileClose(pDevicePrivateData->TimestampsDump);
+ xnDumpFileClose(pDevicePrivateData->BandwidthDump);
+ xnDumpFileClose(pDevicePrivateData->MiniPacketsDump);
+ xnDumpFileClose(m_FrameSyncDump);
m_Firmware.Free();
@@ -340,6 +354,7 @@ XnStatus XnSensor::CreateDeviceModule(XnDeviceModuleHolder** ppModuleHolder)
&m_ReadFromEP2, &m_ReadFromEP3, &m_ReadData, &m_NumberOfBuffers, &m_FirmwareParam,
&m_CmosBlankingUnits, &m_CmosBlankingTime, &m_Reset, &m_FirmwareMode, &m_Version,
&m_FixedParam, &m_FrameSync, &m_CloseStreamsOnShutdown, &m_InstancePointer, &m_ID,
+ &m_USBPath, &m_DeviceName, &m_VendorSpecificData, &m_AllowOtherUsers, &m_AudioSupported,
};
nRetVal = pModule->AddProperties(pProps, sizeof(pProps)/sizeof(XnProperty*));
@@ -392,28 +407,33 @@ XnStatus XnSensor::CreateStreamModule(const XnChar* StreamType, const XnChar* St
if (strcmp(StreamType, XN_STREAM_TYPE_DEPTH) == 0)
{
XnSensorDepthStream* pDepthStream;
- XN_VALIDATE_NEW(pDepthStream, XnSensorDepthStream, StreamName, &m_Objects, m_NumberOfBuffers.GetValue());
+ XN_VALIDATE_NEW(pDepthStream, XnSensorDepthStream, GetUSBPath(), StreamName, &m_Objects, (XnUInt32)m_NumberOfBuffers.GetValue(), AreOtherUsersAllowed());
pStream = pDepthStream;
pHelper = pDepthStream->GetHelper();
}
else if (strcmp(StreamType, XN_STREAM_TYPE_IMAGE) == 0)
{
XnSensorImageStream* pImageStream;
- XN_VALIDATE_NEW(pImageStream, XnSensorImageStream, StreamName, &m_Objects, m_NumberOfBuffers.GetValue());
+ XN_VALIDATE_NEW(pImageStream, XnSensorImageStream, GetUSBPath(), StreamName, &m_Objects, (XnUInt32)m_NumberOfBuffers.GetValue(), AreOtherUsersAllowed());
pStream = pImageStream;
pHelper = pImageStream->GetHelper();
}
else if (strcmp(StreamType, XN_STREAM_TYPE_IR) == 0)
{
XnSensorIRStream* pIRStream;
- XN_VALIDATE_NEW(pIRStream, XnSensorIRStream, StreamName, &m_Objects, m_NumberOfBuffers.GetValue());
+ XN_VALIDATE_NEW(pIRStream, XnSensorIRStream, GetUSBPath(), StreamName, &m_Objects, (XnUInt32)m_NumberOfBuffers.GetValue(), AreOtherUsersAllowed());
pStream = pIRStream;
pHelper = pIRStream->GetHelper();
}
else if (strcmp(StreamType, XN_STREAM_TYPE_AUDIO) == 0)
{
+ if (!m_Firmware.GetInfo()->bAudioSupported)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_UNSUPPORTED_STREAM, XN_MASK_DEVICE_SENSOR, "Audio is not supported by this FW!");
+ }
+
XnSensorAudioStream* pAudioStream;
- XN_VALIDATE_NEW(pAudioStream, XnSensorAudioStream, StreamName, &m_Objects);
+ XN_VALIDATE_NEW(pAudioStream, XnSensorAudioStream, GetUSBPath(), StreamName, &m_Objects, AreOtherUsersAllowed());
pStream = pAudioStream;
pHelper = pAudioStream->GetHelper();
}
@@ -567,7 +587,7 @@ XnBool XnSensor::HasSynchedFrameArrived(const XnChar* strDepthStream, const XnCh
{
XnUInt64 nNow;
xnOSGetHighResTimeStamp(&nNow);
- xnDumpWriteString(m_FrameSyncDump, "%llu,%u,%llu,%u,%llu,%s\n",
+ xnDumpFileWriteString(m_FrameSyncDump, "%llu,%u,%llu,%u,%llu,%s\n",
nNow,
pDepth->IsNewDataAvailable(),
pDepth->GetLastTimestamp(),
@@ -663,22 +683,22 @@ XnStatus XnSensor::Read(XnStreamDataSet* pStreamOutputSet)
return (XN_STATUS_OK);
}
-XnStatus XnSensor::WriteStream(const XnStreamData* pStreamOutput)
+XnStatus XnSensor::WriteStream(XnStreamData* /*pStreamOutput*/)
{
return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED);
}
-XnStatus XnSensor::Write(const XnStreamDataSet* pStreamOutputSet)
+XnStatus XnSensor::Write(XnStreamDataSet* /*pStreamOutputSet*/)
{
return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED);
}
-XnStatus XnSensor::Seek(XnUInt64 nTimestamp)
+XnStatus XnSensor::Seek(XnUInt64 /*nTimestamp*/)
{
return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED);
}
-XnStatus XnSensor::SeekFrame(XnUInt32 nFrameID)
+XnStatus XnSensor::SeekFrame(XnUInt32 /*nFrameID*/)
{
return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED);
}
@@ -739,7 +759,10 @@ XnStatus XnSensor::InitReading()
XnStatus nRetVal = XN_STATUS_OK;
// open data endpoints
- nRetVal = m_SensorIO.OpenDataEndPoints((XnSensorUsbInterface)m_Interface.GetValue());
+ nRetVal = m_SensorIO.OpenDataEndPoints((XnSensorUsbInterface)m_Interface.GetValue(), *m_Firmware.GetInfo());
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_Interface.UnsafeUpdateValue(m_SensorIO.GetCurrentInterface());
XN_IS_STATUS_OK(nRetVal);
// take frequency information
@@ -752,12 +775,12 @@ XnStatus XnSensor::InitReading()
m_DevicePrivateData.fDeviceFrequency = XN_PREPARE_VAR_FLOAT_IN_BUFFER(FrequencyInformation.fDeviceFrequency);
// Init Dumps
- m_DevicePrivateData.BandwidthDump = XN_DUMP_CLOSED;
- xnDumpInit(&m_DevicePrivateData.BandwidthDump, XN_DUMP_BANDWIDTH, "Timestamp,Frame Type,Frame ID,Size\n", "Bandwidth.csv");
- m_DevicePrivateData.TimestampsDump = XN_DUMP_CLOSED;
- xnDumpInit(&m_DevicePrivateData.TimestampsDump, XN_DUMP_TIMESTAMPS, "Host Time (us),Stream,Device TS,Time (ms),Comments\n", "Timestamps.csv");
- m_DevicePrivateData.MiniPacketsDump = XN_DUMP_CLOSED;
- xnDumpInit(&m_DevicePrivateData.MiniPacketsDump, XN_DUMP_MINI_PACKETS, "HostTS,Type,ID,Size,Timestamp\n", "MiniPackets.csv");
+ m_DevicePrivateData.BandwidthDump = xnDumpFileOpen(XN_DUMP_BANDWIDTH, "Bandwidth.csv");
+ xnDumpFileWriteString(m_DevicePrivateData.BandwidthDump, "Timestamp,Frame Type,Frame ID,Size\n");
+ m_DevicePrivateData.TimestampsDump = xnDumpFileOpen(XN_DUMP_TIMESTAMPS, "Timestamps.csv");
+ xnDumpFileWriteString(m_DevicePrivateData.TimestampsDump, "Host Time (us),Stream,Device TS,Time (ms),Comments\n");
+ m_DevicePrivateData.MiniPacketsDump = xnDumpFileOpen(XN_DUMP_MINI_PACKETS, "MiniPackets.csv");
+ xnDumpFileWriteString(m_DevicePrivateData.MiniPacketsDump, "HostTS,Type,ID,Size,Timestamp\n");
m_DevicePrivateData.nGlobalReferenceTS = 0;
nRetVal = xnOSCreateCriticalSection(&m_DevicePrivateData.hEndPointsCS);
@@ -776,32 +799,8 @@ XnStatus XnSensor::InitReading()
}
-XnStatus XnSensor::ParseConnectionString(const XnChar* csConnectionString, XnChar* csSensorID, XnUInt32* pnBoardID)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
-/* const XnChar* cpSepPos = strstr(csConnectionString, XN_DEVICE_SENSOR_BOARDID_SEP);
- if (cpSepPos == NULL)
- {
- return (XN_STATUS_IO_INVALID_CONNECTION_STRING);
- }
-
- XnUInt32 nSepPos = cpSepPos - csConnectionString;
-
- xnOSMemSet(csSensorID, 0, XN_SENSOR_PROTOCOL_SENSOR_ID_LENGTH);
-
- nRetVal = xnOSStrNCopy(csSensorID, csConnectionString, nSepPos, XN_SENSOR_PROTOCOL_SENSOR_ID_LENGTH);
- XN_IS_STATUS_OK(nRetVal);
-
- *pnBoardID = atoi(cpSepPos + 1);
-*/
- return (XN_STATUS_OK);
-}
-
XnStatus XnSensor::ValidateSensorID(XnChar* csSensorID)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (strcmp(csSensorID, XN_DEVICE_SENSOR_DEFAULT_ID) != 0)
{
if (strcmp(csSensorID, GetFixedParams()->GetSensorSerial()) != 0)
@@ -998,6 +997,23 @@ XnStatus XnSensor::SetInterface(XnSensorUsbInterface nInterface)
return (XN_STATUS_OK);
}
+XnStatus XnSensor::SetAllowOtherUsers(XnBool bAllowOtherUsers)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // we only allow changing this *before* creating any streams
+ if (m_ReadData.GetValue() == TRUE &&
+ m_AllowOtherUsers.GetValue() != bAllowOtherUsers)
+ {
+ return (XN_STATUS_DEVICE_PROPERTY_READ_ONLY);
+ }
+
+ nRetVal = m_AllowOtherUsers.UnsafeUpdateValue(bAllowOtherUsers);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
XnStatus XnSensor::SetNumberOfBuffers(XnUInt32 nCount)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -1165,7 +1181,7 @@ XnStatus XnSensor::Reset(XnParamResetType nType)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = XnHostProtocolReset(&m_DevicePrivateData, nType);
+ nRetVal = XnHostProtocolReset(&m_DevicePrivateData, (XnUInt16)nType);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -1195,7 +1211,7 @@ XnStatus XnSensor::SetFirmwareMode(XnParamCurrentMode nMode)
return XN_STATUS_DEVICE_UNSUPPORTED_MODE;
}
- nRetVal = XnHostProtocolSetMode(&m_DevicePrivateData, nActualValue);
+ nRetVal = XnHostProtocolSetMode(&m_DevicePrivateData, (XnUInt16)nActualValue);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -1222,97 +1238,103 @@ XnStatus XnSensor::OnFrameSyncPropertyChanged()
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetInterfaceCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetInterfaceCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->XnSensor::SetInterface((XnSensorUsbInterface)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetNumberOfBuffersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetAllowOtherUsersCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
+{
+ XnSensor* pThis = (XnSensor*)pCookie;
+ return pThis->XnSensor::SetAllowOtherUsers(nValue == 1);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensor::SetNumberOfBuffersCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->SetNumberOfBuffers((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint1Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint1Callback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->XnSensor::SetReadEndpoint1((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint2Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint2Callback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->XnSensor::SetReadEndpoint2((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint3Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint3Callback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->XnSensor::SetReadEndpoint3((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetReadDataCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetReadDataCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->XnSensor::SetReadData((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetFirmwareParamCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetFirmwareParamCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnInnerParamData);
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->SetFirmwareParam((const XnInnerParamData*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetCmosBlankingUnitsCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetCmosBlankingUnitsCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnCmosBlankingUnits);
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->SetCmosBlankingUnits((const XnCmosBlankingUnits*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetCmosBlankingTimeCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetCmosBlankingTimeCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnCmosBlankingTime);
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->SetCmosBlankingTime((const XnCmosBlankingTime*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::ResetCallback(XnIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::ResetCallback(XnIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->Reset((XnParamResetType)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::SetFirmwareModeCallback(XnIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetFirmwareModeCallback(XnIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->SetFirmwareMode((XnParamCurrentMode)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::GetFirmwareParamCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::GetFirmwareParamCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnInnerParamData);
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->GetFirmwareParam((XnInnerParamData*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::GetCmosBlankingUnitsCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::GetCmosBlankingUnitsCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnCmosBlankingUnits);
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->GetCmosBlankingUnits((XnCmosBlankingUnits*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::GetCmosBlankingTimeCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::GetCmosBlankingTimeCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnCmosBlankingTime);
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->GetCmosBlankingTime((XnCmosBlankingTime*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensor::GetFirmwareModeCallback(const XnIntProperty* pSender, XnUInt64* pnValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::GetFirmwareModeCallback(const XnIntProperty* /*pSender*/, XnUInt64* pnValue, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
XnParamCurrentMode nMode;
@@ -1323,13 +1345,20 @@ XnStatus XN_CALLBACK_TYPE XnSensor::GetFirmwareModeCallback(const XnIntProperty*
return XN_STATUS_OK;
}
-XnStatus XN_CALLBACK_TYPE XnSensor::FrameSyncPropertyChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::GetAudioSupportedCallback(const XnIntProperty* /*pSender*/, XnUInt64* pnValue, void* pCookie)
+{
+ XnSensor* pThis = (XnSensor*)pCookie;
+ *pnValue = pThis->m_Firmware.GetInfo()->bAudioSupported;
+ return XN_STATUS_OK;
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensor::FrameSyncPropertyChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnSensor* pThis = (XnSensor*)pCookie;
return pThis->OnFrameSyncPropertyChanged();
}
-XnStatus XN_CALLBACK_TYPE XnSensor::GetFixedParamsCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::GetFixedParamsCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnDynamicSizeBuffer);
XnSensor* pThis = (XnSensor*)pCookie;
@@ -1337,7 +1366,7 @@ XnStatus XN_CALLBACK_TYPE XnSensor::GetFixedParamsCallback(const XnGeneralProper
return pThis->GetFixedParams(pBuffer);
}
-XnBool XN_CALLBACK_TYPE XnSensor::USBEventCallback(XnUSBEventType USBEventType, XnChar* cpDevPath, void* pCallbackData)
+XnBool XN_CALLBACK_TYPE XnSensor::USBEventCallback(XnUSBEventType USBEventType, XnChar* /*cpDevPath*/, void* pCallbackData)
{
XnSensor* pXnSensor = (XnSensor*)pCallbackData;
if (USBEventType == XN_USB_EVENT_DEVICE_DISCONNECT)
@@ -1353,3 +1382,15 @@ XnBool XN_CALLBACK_TYPE XnSensor::USBEventCallback(XnUSBEventType USBEventType,
return TRUE;
}
+
+XnStatus XN_CALLBACK_TYPE XnSensor::GetInstanceCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
+{
+ if (gbValue.nDataSize != sizeof(void*))
+ {
+ return XN_STATUS_DEVICE_PROPERTY_SIZE_DONT_MATCH;
+ }
+
+ *(void**)gbValue.pData = pCookie;
+ return XN_STATUS_OK;
+}
+
diff --git a/Source/XnDeviceSensorV2/XnSensor.h b/Source/XnDeviceSensorV2/XnSensor.h
index 5465f71..efcb633 100644
--- a/Source/XnDeviceSensorV2/XnSensor.h
+++ b/Source/XnDeviceSensorV2/XnSensor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_H__
#define __XN_SENSOR_H__
@@ -52,7 +47,7 @@
//---------------------------------------------------------------------------
class XnSensor : public XnDeviceBase
{
- friend class XnSensorServer;
+ friend class XnServerSensorInvoker;
public:
XnSensor();
@@ -66,8 +61,8 @@ class XnSensor : public XnDeviceBase
virtual XnStatus OpenAllStreams();
virtual XnStatus ReadStream(XnStreamData* pStreamOutput);
virtual XnStatus Read(XnStreamDataSet* pStreamOutputSet);
- virtual XnStatus WriteStream(const XnStreamData* pStreamOutput);
- virtual XnStatus Write(const XnStreamDataSet* pStreamOutputSet);
+ virtual XnStatus WriteStream(XnStreamData* pStreamOutput);
+ virtual XnStatus Write(XnStreamDataSet* pStreamOutputSet);
virtual XnStatus Seek(XnUInt64 nTimestamp);
virtual XnStatus SeekFrame(XnUInt32 nFrameID);
virtual XnStatus LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar* csSectionName);
@@ -85,6 +80,7 @@ class XnSensor : public XnDeviceBase
XnStatus ConfigPropertyFromFile(XnIntProperty* pProperty, const XnChar* csINIFilePath, const XnChar* csSectionName);
inline XnBool IsMiscSupported() const { return m_SensorIO.IsMiscEndpointSupported(); }
+ inline XnBool IsLowBandwidth() const { return m_SensorIO.IsLowBandwidth(); }
XnStatus GetSharedBufferPool(const XnChar* strStream, XnSharedMemoryBufferPool** ppBufferPool);
@@ -95,6 +91,9 @@ class XnSensor : public XnDeviceBase
XnStatus SetGlobalConfigFile(const XnChar* strConfigFile);
XnStatus ConfigureModuleFromGlobalFile(const XnChar* strModule, const XnChar* strSection = NULL);
+ const XnChar* GetUSBPath() { return m_USBPath.GetValue(); }
+ XnBool AreOtherUsersAllowed() { return (m_AllowOtherUsers.GetValue() == TRUE); }
+
protected:
virtual XnStatus CreateStreamImpl(const XnChar* strType, const XnChar* strName, const XnActualPropertiesHash* pInitialSet);
@@ -107,7 +106,6 @@ class XnSensor : public XnDeviceBase
private:
XnStatus InitSensor(const XnDeviceConfig* pDeviceConfig);
- XnStatus ParseConnectionString(const XnChar* csConnectionString, XnChar* csSensorID, XnUInt32* pnBoardID);
XnStatus ValidateSensorID(XnChar* csSensorID);
XnStatus ReadFromStreamImpl(XnDeviceStream* pStream, XnStreamData* pStreamOutput);
XnStatus SetMirrorForModule(XnDeviceModule* pModule, XnUInt64 nValue);
@@ -117,6 +115,8 @@ class XnSensor : public XnDeviceBase
XnBool HasSynchedFrameArrived(const XnChar* strDepthStream, const XnChar* strImageStream);
XnStatus OnFrameSyncPropertyChanged();
+ static XnStatus XN_CALLBACK_TYPE GetInstanceCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
+
//---------------------------------------------------------------------------
// Getters
@@ -133,6 +133,7 @@ class XnSensor : public XnDeviceBase
// Setters
//---------------------------------------------------------------------------
XnStatus SetInterface(XnSensorUsbInterface nInterface);
+ XnStatus SetAllowOtherUsers(XnBool bAllowOtherUsers);
XnStatus SetNumberOfBuffers(XnUInt32 nCount);
XnStatus SetReadEndpoint1(XnBool bRead);
XnStatus SetReadEndpoint2(XnBool bRead);
@@ -148,6 +149,7 @@ class XnSensor : public XnDeviceBase
// Callbacks
//---------------------------------------------------------------------------
static XnStatus XN_CALLBACK_TYPE SetInterfaceCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetAllowOtherUsersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetNumberOfBuffersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetReadEndpoint1Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetReadEndpoint2Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
@@ -166,6 +168,7 @@ class XnSensor : public XnDeviceBase
static XnStatus XN_CALLBACK_TYPE GetCmosBlankingUnitsCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE GetCmosBlankingTimeCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE GetFirmwareModeCallback(const XnIntProperty* pSender, XnUInt64* pnValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE GetAudioSupportedCallback(const XnIntProperty* pSender, XnUInt64* pnValue, void* pCookie);
//---------------------------------------------------------------------------
@@ -189,9 +192,13 @@ class XnSensor : public XnDeviceBase
XnVersions m_VersionData;
XnActualGeneralProperty m_Version;
XnGeneralProperty m_FixedParam;
- XnSensor* m_pThis;
- XnActualGeneralProperty m_InstancePointer;
+ XnGeneralProperty m_InstancePointer;
XnActualStringProperty m_ID;
+ XnActualStringProperty m_USBPath;
+ XnActualStringProperty m_DeviceName;
+ XnActualStringProperty m_VendorSpecificData;
+ XnActualIntProperty m_AllowOtherUsers;
+ XnIntProperty m_AudioSupported;
XnSensorFirmware m_Firmware;
XnDevicePrivateData m_DevicePrivateData;
@@ -203,7 +210,7 @@ class XnSensor : public XnDeviceBase
XnSensorObjects m_Objects;
- XnDump m_FrameSyncDump;
+ XnDumpFile* m_FrameSyncDump;
XnBool m_bInitialized;
XnIntPropertySynchronizer m_PropSynchronizer;
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp
index 7828258..f7a4670 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -87,7 +81,7 @@ XnStatus XnSensorAudioGenerator::Init()
XnBool XnSensorAudioGenerator::IsCapabilitySupported(const XnChar* strCapabilityName)
{
- return FALSE;
+ return XnSensorGenerator::IsCapabilitySupported(strCapabilityName);
}
XnUChar* XnSensorAudioGenerator::GetAudioBuffer()
@@ -102,8 +96,6 @@ XnUInt32 XnSensorAudioGenerator::GetSupportedWaveOutputModesCount()
XnStatus XnSensorAudioGenerator::GetSupportedWaveOutputModes(XnWaveOutputMode aSupportedModes[], XnUInt32& nCount)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(aSupportedModes);
if (nCount < m_SupportedModes.Size())
@@ -182,9 +174,50 @@ void XnSensorAudioGenerator::FilterProperties(XnActualPropertiesHash* pHash)
// XnExportedSensorAudioGenerator class
//---------------------------------------------------------------------------
XnExportedSensorAudioGenerator::XnExportedSensorAudioGenerator() :
- XnExportedSensorGenerator(XN_NODE_TYPE_AUDIO, XN_STREAM_TYPE_AUDIO)
+ XnExportedSensorGenerator(XN_NODE_TYPE_AUDIO, XN_STREAM_TYPE_AUDIO, FALSE)
{}
+XnStatus XnExportedSensorAudioGenerator::IsSupportedForDevice(xn::Context& context, xn::NodeInfo& sensorInfo, XnBool* pbSupported)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = XnExportedSensorGenerator::IsSupportedForDevice(context, sensorInfo, pbSupported);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (*pbSupported == FALSE)
+ {
+ return XN_STATUS_OK;
+ }
+
+ xn::Device sensor;
+ nRetVal = sensorInfo.GetInstance(sensor);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnBool bShouldBeCreated = (!sensor.IsValid());
+
+ if (bShouldBeCreated)
+ {
+ nRetVal = context.CreateProductionTree(sensorInfo, sensor);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ // check if firmware supports audio
+ XnUInt64 nAudioSupported = FALSE;
+ nRetVal = sensor.GetIntProperty(XN_MODULE_PROPERTY_AUDIO_SUPPORTED, nAudioSupported);
+ XN_IS_STATUS_OK(nRetVal);
+ if (nAudioSupported != TRUE)
+ {
+ *pbSupported = FALSE;
+ }
+
+ if (bShouldBeCreated)
+ {
+ sensor.Release();
+ }
+
+ return (XN_STATUS_OK);
+}
+
XnSensorGenerator* XnExportedSensorAudioGenerator::CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName)
{
return XN_NEW(XnSensorAudioGenerator, context, sensor, pSensor, strStreamName);
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h
index 682c2c3..06dc935 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_AUDIO_GENERATOR_H__
#define __XN_SENSOR_AUDIO_GENERATOR_H__
@@ -38,6 +32,10 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorAudioGenerator :
public XnSensorGenerator,
virtual public xn::ModuleAudioGenerator
@@ -49,6 +47,7 @@ class XnSensorAudioGenerator :
XnBool IsCapabilitySupported(const XnChar* strCapabilityName);
+ const void* GetData() { return XnSensorGenerator::GetData(); }
XnUChar* GetAudioBuffer();
XnUInt32 GetSupportedWaveOutputModesCount();
XnStatus GetSupportedWaveOutputModes(XnWaveOutputMode aSupportedModes[], XnUInt32& nCount);
@@ -70,7 +69,12 @@ class XnExportedSensorAudioGenerator : public XnExportedSensorGenerator
{
public:
XnExportedSensorAudioGenerator();
+
+protected:
+ virtual XnStatus IsSupportedForDevice(xn::Context& context, xn::NodeInfo& sensorInfo, XnBool* pbSupported);
virtual XnSensorGenerator* CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_AUDIO_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp b/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp
index 23173f7..983325c 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -34,27 +28,30 @@
#include "XnAudioProcessor.h"
#include
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
#define XN_AUDIO_MAX_SAMPLE_RATE 48000
#define XN_AUDIO_MAX_NUMBER_OF_CHANNELS 2
-#define XN_AUDIO_STREAM_DEFAULT_VOLUME 12
-#define XN_AUDIO_STREAM_DEFAULT_SAMPLE_RATE 48000
-#define XN_AUDIO_STREAM_DEFAULT_NUMBER_OF_CHANNELS 2
-#define XN_AUDIO_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_PCM
-#define XN_AUDIO_STREAM_DEFAULT_CHUNK_SIZE 2120
-
#define XN_SENSOR_PROTOCOL_AUDIO_PACKET_SIZE_BULK 424
#define XN_SENSOR_PROTOCOL_AUDIO_PACKET_SIZE_ISO 180
-XnSensorAudioStream::XnSensorAudioStream(const XnChar* StreamName, XnSensorObjects* pObjects) :
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+XnSensorAudioStream::XnSensorAudioStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnBool bAllowOtherUsers) :
XnAudioStream(StreamName, XN_AUDIO_MAX_NUMBER_OF_CHANNELS),
+ m_strDeviceName(strDeviceName),
m_Helper(pObjects),
+ m_bAllowOtherUsers(bAllowOtherUsers),
m_LeftChannelVolume(XN_STREAM_PROPERTY_LEFT_CHANNEL_VOLUME, XN_AUDIO_STREAM_DEFAULT_VOLUME),
m_RightChannelVolume(XN_STREAM_PROPERTY_RIGHT_CHANNEL_VOLUME, XN_AUDIO_STREAM_DEFAULT_VOLUME),
m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME),
m_ActualRead(XN_STREAM_PROPERTY_ACTUAL_READ_DATA, FALSE),
m_hSharedMemory(NULL),
- m_pSharedHeader(NULL)
+ m_pSharedHeader(NULL),
+ m_nFrameID(0)
{
m_LeftChannelVolume.UpdateSetCallback(SetLeftChannelVolumeCallback, this);
m_RightChannelVolume.UpdateSetCallback(SetRightChannelVolumeCallback, this);
@@ -115,10 +112,14 @@ XnStatus XnSensorAudioStream::MapPropertiesToFirmware()
{
XnStatus nRetVal = XN_STATUS_OK;
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(SampleRateProperty(), GetFirmwareParams()->m_AudioSampleRate, FALSE, ConvertSampleRateToFirmwareRate));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(NumberOfChannelsProperty(), GetFirmwareParams()->m_AudioStereo, FALSE, ConvertNumberOfChannelsToStereo));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_LeftChannelVolume, GetFirmwareParams()->m_AudioLeftChannelGain, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_RightChannelVolume, GetFirmwareParams()->m_AudioRightChannelGain, TRUE));
+ nRetVal = m_Helper.MapFirmwareProperty(SampleRateProperty(), GetFirmwareParams()->m_AudioSampleRate, FALSE, ConvertSampleRateToFirmwareRate);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(NumberOfChannelsProperty(), GetFirmwareParams()->m_AudioStereo, FALSE, ConvertNumberOfChannelsToStereo);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_LeftChannelVolume, GetFirmwareParams()->m_AudioLeftChannelGain, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_RightChannelVolume, GetFirmwareParams()->m_AudioRightChannelGain, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
return (XN_STATUS_OK);
}
@@ -132,10 +133,14 @@ XnStatus XnSensorAudioStream::ConfigureStreamImpl()
nRetVal = SetActualRead(TRUE);
XN_IS_STATUS_OK(nRetVal);
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(SampleRateProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(NumberOfChannelsProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_LeftChannelVolume));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_RightChannelVolume));
+ nRetVal = m_Helper.ConfigureFirmware(SampleRateProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(NumberOfChannelsProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_LeftChannelVolume);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_RightChannelVolume);
+ XN_IS_STATUS_OK(nRetVal);;
return (XN_STATUS_OK);
}
@@ -149,7 +154,8 @@ XnStatus XnSensorAudioStream::SetActualRead(XnBool bRead)
if (bRead)
{
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Creating USB audio read thread...");
- nRetVal = xnUSBInitReadThread(GetHelper()->GetPrivateData()->pSpecificMiscUsb->pUsbConnection->UsbEp, GetHelper()->GetPrivateData()->pSpecificMiscUsb->nChunkReadBytes, XN_SENSOR_USB_MISC_BUFFERS, XN_SENSOR_READ_THREAD_TIMEOUT, XnDeviceSensorProtocolUsbEpCb, GetHelper()->GetPrivateData()->pSpecificMiscUsb);
+ XnSpecificUsbDevice* pUSB = GetHelper()->GetPrivateData()->pSpecificMiscUsb;
+ nRetVal = xnUSBInitReadThread(pUSB->pUsbConnection->UsbEp, pUSB->nChunkReadBytes, XN_SENSOR_USB_MISC_BUFFERS, pUSB->nTimeout, XnDeviceSensorProtocolUsbEpCb, pUSB);
XN_IS_STATUS_OK(nRetVal);
}
else
@@ -196,8 +202,6 @@ XnStatus XnSensorAudioStream::CloseStreamImpl()
XnStatus XnSensorAudioStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnDataProcessor* pAudioProcessor;
XN_VALIDATE_NEW_AND_INIT(pAudioProcessor, XnAudioProcessor, this, &m_Helper, m_nOrigAudioPacketSize);
@@ -228,7 +232,7 @@ XnStatus XnSensorAudioStream::SetSampleRate(XnSampleRate nSampleRate)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.BeforeSettingFirmwareParam(SampleRateProperty(), nSampleRate);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(SampleRateProperty(), (XnUInt16)nSampleRate);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnAudioStream::SetSampleRate(nSampleRate);
@@ -244,7 +248,7 @@ XnStatus XnSensorAudioStream::SetNumberOfChannels(XnUInt32 nNumberOfChannels)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.BeforeSettingFirmwareParam(NumberOfChannelsProperty(), nNumberOfChannels);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(NumberOfChannelsProperty(), (XnUInt16)nNumberOfChannels);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnAudioStream::SetNumberOfChannels(nNumberOfChannels);
@@ -261,8 +265,6 @@ XnStatus XnSensorAudioStream::SetNumberOfChannels(XnUInt32 nNumberOfChannels)
XnStatus XnSensorAudioStream::NewData()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnDevicePrivateData* pDevicePrivateData = m_Helper.GetPrivateData();
// check how many buffers we have
@@ -283,8 +285,6 @@ XnStatus XnSensorAudioStream::NewData()
XnStatus XnSensorAudioStream::ReadImpl(XnStreamData *pStreamOutput)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnDevicePrivateData* pDevicePrivateData = m_Helper.GetPrivateData();
pStreamOutput->nDataSize = 0;
@@ -326,6 +326,9 @@ XnStatus XnSensorAudioStream::ReadImpl(XnStreamData *pStreamOutput)
}
xnOSLeaveCriticalSection(&pDevicePrivateData->hAudioBufferCriticalSection);
+
+ ++m_nFrameID;
+ pStreamOutput->nFrameID = m_nFrameID;
return (XN_STATUS_OK);
}
@@ -422,7 +425,7 @@ XnStatus XnSensorAudioStream::SetLeftChannelVolume(XnUInt32 nVolume)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_LeftChannelVolume, nVolume);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_LeftChannelVolume, (XnUInt16)nVolume);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -432,7 +435,7 @@ XnStatus XnSensorAudioStream::SetRightChannelVolume(XnUInt32 nVolume)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_RightChannelVolume, nVolume);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_RightChannelVolume, (XnUInt16)nVolume);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -467,7 +470,7 @@ XnStatus XnSensorAudioStream::ReallocBuffer()
XN_PROCESS_ID procID;
xnOSGetCurrentProcessID(&procID);
XnChar strSharedName[XN_DEVICE_MAX_STRING_LENGTH];
- sprintf(strSharedName, "%u_%s", procID, GetName());
+ sprintf(strSharedName, "%u_%s_%s", (XnUInt32)procID, m_strDeviceName, GetName());
nRetVal = m_SharedBufferName.UnsafeUpdateValue(strSharedName);
XN_IS_STATUS_OK(nRetVal);
@@ -475,7 +478,7 @@ XnStatus XnSensorAudioStream::ReallocBuffer()
nRetVal = RequiredSizeProperty().UnsafeUpdateValue(nMaxBufferSize);
XN_IS_STATUS_OK(nRetVal);
- nRetVal = xnOSCreateSharedMemory(strSharedName, nSharedBufferSize, XN_OS_FILE_READ | XN_OS_FILE_WRITE, &m_hSharedMemory);
+ nRetVal = xnOSCreateSharedMemoryEx(strSharedName, nSharedBufferSize, XN_OS_FILE_READ | XN_OS_FILE_WRITE, m_bAllowOtherUsers, &m_hSharedMemory);
XN_IS_STATUS_OK(nRetVal);
XnUChar* pAddress;
@@ -488,7 +491,7 @@ XnStatus XnSensorAudioStream::ReallocBuffer()
pDevicePrivateData->nAudioBufferSize = nMaxBufferSize;
m_pSharedHeader->nTimestampsListOffset = sizeof(XnAudioSharedBuffer);
- m_pSharedHeader->nBufferOffset = pDevicePrivateData->pAudioBuffer - pAddress;
+ m_pSharedHeader->nBufferOffset = (XnUInt32)(pDevicePrivateData->pAudioBuffer - pAddress);
}
// calculate current packet size
@@ -512,19 +515,19 @@ XnStatus XnSensorAudioStream::ReallocBuffer()
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnSensorAudioStream::SetLeftChannelVolumeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorAudioStream::SetLeftChannelVolumeCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorAudioStream* pThis = (XnSensorAudioStream*)pCookie;
return pThis->SetLeftChannelVolume((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorAudioStream::SetRightChannelVolumeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorAudioStream::SetRightChannelVolumeCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorAudioStream* pThis = (XnSensorAudioStream*)pCookie;
return pThis->SetRightChannelVolume((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorAudioStream::SetActualReadCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorAudioStream::SetActualReadCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorAudioStream* pThis = (XnSensorAudioStream*)pCookie;
return pThis->SetActualRead(nValue == TRUE);
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioStream.h b/Source/XnDeviceSensorV2/XnSensorAudioStream.h
index 0b4e1de..38def0d 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorAudioStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_AUDIO_STREAM_H__
#define __XN_SENSOR_AUDIO_STREAM_H__
@@ -34,13 +29,22 @@
#include "XnSensorStreamHelper.h"
#include "XnSharedMemoryBufferPool.h"
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+#define XN_AUDIO_STREAM_DEFAULT_VOLUME 12
+#define XN_AUDIO_STREAM_DEFAULT_SAMPLE_RATE 48000
+#define XN_AUDIO_STREAM_DEFAULT_NUMBER_OF_CHANNELS 2
+#define XN_AUDIO_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_PCM
+#define XN_AUDIO_STREAM_DEFAULT_CHUNK_SIZE 2120
+
//---------------------------------------------------------------------------
// XnSensorAudioStream class
//---------------------------------------------------------------------------
class XnSensorAudioStream : public XnAudioStream, public IXnSensorStream
{
public:
- XnSensorAudioStream(const XnChar* StreamName, XnSensorObjects* pObjects);
+ XnSensorAudioStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnBool bAllowOtherUsers);
~XnSensorAudioStream() { Free(); }
//---------------------------------------------------------------------------
@@ -67,9 +71,9 @@ class XnSensorAudioStream : public XnAudioStream, public IXnSensorStream
void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = XN_RESOLUTION_CUSTOM; *pnFPS = 0; }
XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return NULL; }
- XnStatus WriteImpl(XnStreamData* pStreamData) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+ XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
XnStatus ReadImpl(XnStreamData* pStreamOutput);
- XnStatus Mirror(XnStreamData* pStreamOutput) const { return XN_STATUS_OK; }
+ XnStatus Mirror(XnStreamData* /*pStreamOutput*/) const { return XN_STATUS_OK; }
//---------------------------------------------------------------------------
// Setters
@@ -102,6 +106,8 @@ class XnSensorAudioStream : public XnAudioStream, public IXnSensorStream
//---------------------------------------------------------------------------
XnSensorStreamHelper m_Helper;
+ const XnChar* m_strDeviceName;
+ XnBool m_bAllowOtherUsers;
XnActualStringProperty m_SharedBufferName;
XnActualIntProperty m_LeftChannelVolume;
XnActualIntProperty m_RightChannelVolume;
@@ -112,6 +118,7 @@ class XnSensorAudioStream : public XnAudioStream, public IXnSensorStream
XN_SHARED_MEMORY_HANDLE m_hSharedMemory;
XnAudioSharedBuffer* m_pSharedHeader;
+ XnUInt32 m_nFrameID;
};
#endif //__XN_SENSOR_AUDIO_STREAM_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorClient.cpp b/Source/XnDeviceSensorV2/XnSensorClient.cpp
index 8bb6320..7907999 100644
--- a/Source/XnDeviceSensorV2/XnSensorClient.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorClient.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -49,13 +43,6 @@
//---------------------------------------------------------------------------
// XnSensorClient class
//---------------------------------------------------------------------------
-XnChar XnSensorClient::ms_strDir[XN_FILE_MAX_PATH];
-
-XnStatus XnSensorClient::TakeServerLocation()
-{
- return xnOSGetCurrentDir(ms_strDir, XN_FILE_MAX_PATH);
-}
-
XnSensorClient::XnSensorClient() :
XnStreamReaderDevice(XN_DEVICE_NAME, XN_SENSOR_SERVER_MAX_MESSAGE_SIZE),
m_hSocket(NULL),
@@ -64,12 +51,13 @@ XnSensorClient::XnSensorClient() :
m_pOutgoingPacker(NULL),
m_bShouldRun(TRUE),
m_bConnected(TRUE),
- m_pThis(this),
- m_InstancePointer(XN_SENSOR_PROPERTY_INSTANCE_POINTER, &m_pThis, sizeof(m_pThis), NULL),
+ m_InstancePointer(XN_SENSOR_PROPERTY_INSTANCE_POINTER),
m_ErrorState(XN_MODULE_PROPERTY_ERROR_STATE, XN_STATUS_OK),
- m_hLock(NULL)
+ m_hLock(NULL),
+ m_bAllowServerFromOtherUser(FALSE)
{
strcpy(m_strConfigDir, ".");
+ m_InstancePointer.UpdateGetCallback(GetInstanceCallback, this);
}
XnSensorClient::~XnSensorClient()
@@ -79,6 +67,7 @@ XnSensorClient::~XnSensorClient()
void XnSensorClient::SetConfigDir(const XnChar* strConfigDir)
{
strcpy(m_strConfigDir, strConfigDir);
+ XnSensor::ResolveGlobalConfigFileName(m_strConfigFile, sizeof(m_strConfigFile), strConfigDir);
}
XnStatus XnSensorClient::GetDefinition(XnDeviceDefinition* pDeviceDefinition)
@@ -98,8 +87,6 @@ XnStatus XnSensorClient::Init(const XnDeviceConfig* pDeviceConfig)
nRetVal = XnStreamReaderDevice::Init(pDeviceConfig);
XN_IS_STATUS_OK(nRetVal);
- m_pThis = this;
-
return (XN_STATUS_OK);
}
@@ -109,10 +96,16 @@ XnStatus XnSensorClient::InitImpl(const XnDeviceConfig* pDeviceConfig)
XN_MUTEX_HANDLE hServerRunningMutex = NULL;
XnOSEvent serverRunningEvent;
- nRetVal = serverRunningEvent.Open(XN_SENSOR_SERVER_RUNNING_EVENT_NAME);
+ XnUInt32 nValue;
+ if (XN_STATUS_OK == xnOSReadIntFromINI(m_strConfigFile, XN_SENSOR_SERVER_CONFIG_FILE_SECTION, XN_MODULE_PROPERTY_ENABLE_MULTI_USERS, &nValue))
+ {
+ m_bAllowServerFromOtherUser = (nValue == TRUE);
+ }
+
+ nRetVal = serverRunningEvent.Open(XN_SENSOR_SERVER_RUNNING_EVENT_NAME, m_bAllowServerFromOtherUser);
if (nRetVal != XN_STATUS_OK)
{
- nRetVal = serverRunningEvent.Create(XN_SENSOR_SERVER_RUNNING_EVENT_NAME, TRUE);
+ nRetVal = serverRunningEvent.Create(XN_SENSOR_SERVER_RUNNING_EVENT_NAME, TRUE, m_bAllowServerFromOtherUser);
if (nRetVal != XN_STATUS_OK)
{
xnLogError(XN_MASK_SENSOR_CLIENT, "Failed to create server running event: %s", xnGetStatusString(nRetVal));
@@ -120,7 +113,7 @@ XnStatus XnSensorClient::InitImpl(const XnDeviceConfig* pDeviceConfig)
}
}
- nRetVal = xnOSCreateNamedMutex(&hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_NAME);
+ nRetVal = xnOSCreateNamedMutexEx(&hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_NAME, m_bAllowServerFromOtherUser);
XN_IS_STATUS_OK(nRetVal);
nRetVal = xnOSLockMutex(hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_TIMEOUT);
@@ -739,7 +732,7 @@ XnStatus XnSensorClient::CreateIOStreamImpl(const XnChar *strConnectionString, X
}
// send server a request to open the sensor
- nRetVal = m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_OPEN_SENSOR, strConnectionString, strlen(strConnectionString) + 1);
+ nRetVal = m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_OPEN_SENSOR, strConnectionString, (XnUInt32)strlen(strConnectionString) + 1);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(pNetworkStream);
@@ -785,8 +778,6 @@ XnStatus XnSensorClient::CreateDeviceModule(XnDeviceModuleHolder** ppModuleHolde
XnStatus XnSensorClient::CreateStreamModule(const XnChar* StreamType, const XnChar* StreamName, XnDeviceModuleHolder** ppStreamHolder)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnSensorClientStream* pStream;
if (strcmp(StreamType, XN_STREAM_TYPE_AUDIO) == 0)
{
@@ -856,30 +847,52 @@ XN_THREAD_PROC XnSensorClient::ListenThread(XN_THREAD_PARAM pThreadParam)
XN_THREAD_PROC_RETURN(nRetVal);
}
+#if (XN_PLATFORM == XN_PLATFORM_WIN32)
+static XnStatus GetModuleDir(XnChar* strBuffer)
+{
+ // get current module handle
+ HMODULE hModule;
+ BOOL bRes = GetModuleHandleEx(
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | // get by address
+ GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, // don't increase refcount (so we don't need to release the handle)
+ (LPCSTR)GetModuleDir, // give any address inside this DLL
+ &hModule);
+
+ if (bRes == 0)
+ {
+ return XN_STATUS_ERROR;
+ }
+
+ XnChar strModuleFileName[XN_FILE_MAX_PATH];
+ bRes = GetModuleFileName(hModule, strModuleFileName, XN_FILE_MAX_PATH);
+ if (bRes == 0)
+ {
+ return XN_STATUS_ERROR;
+ }
+
+ return xnOSGetDirName(strModuleFileName, strBuffer, XN_FILE_MAX_PATH);
+}
+#endif
+
XnStatus XnSensorClient::StartServerProcess()
{
XnStatus nRetVal = XN_STATUS_OK;
- const XnChar* strServerDir;
+ XnChar strServerDir[XN_FILE_MAX_PATH];
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
- strServerDir = ms_strDir;
-#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
- strServerDir = "/usr/bin";
+ nRetVal = GetModuleDir(strServerDir);
+#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_MACOSX)
+ sprintf(strServerDir, "/usr/bin");
#endif
- // we'll start it in it's directory
- XnChar strCurrDir[XN_FILE_MAX_PATH];
- nRetVal = xnOSGetCurrentDir(strCurrDir, XN_FILE_MAX_PATH);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = xnOSSetCurrentDir(strServerDir);
- XN_IS_STATUS_OK(nRetVal);
-
XnChar strProcessName[XN_FILE_MAX_PATH];
sprintf(strProcessName, "%s%sXnSensorServer", strServerDir, XN_FILE_DIR_SEP);
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
+ #ifdef _M_X64
+ XN_VALIDATE_STR_APPEND(strProcessName, "64", XN_FILE_MAX_PATH, nRetVal);
+ #endif
XN_VALIDATE_STR_APPEND(strProcessName, ".exe", XN_FILE_MAX_PATH, nRetVal);
#endif
@@ -887,13 +900,19 @@ XnStatus XnSensorClient::StartServerProcess()
XN_PROCESS_ID procID;
nRetVal = xnOSCreateProcess(strProcessName, 1, strArguments, &procID);
-
- // in any case, return to working dir
- xnOSSetCurrentDir(strCurrDir);
-
- // now check for errors
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
+XnStatus XN_CALLBACK_TYPE XnSensorClient::GetInstanceCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
+{
+ if (gbValue.nDataSize != sizeof(void*))
+ {
+ return XN_STATUS_DEVICE_PROPERTY_SIZE_DONT_MATCH;
+ }
+
+ *(void**)gbValue.pData = pCookie;
+ return XN_STATUS_OK;
+}
+
diff --git a/Source/XnDeviceSensorV2/XnSensorClient.h b/Source/XnDeviceSensorV2/XnSensorClient.h
index 09b1fb6..161d346 100644
--- a/Source/XnDeviceSensorV2/XnSensorClient.h
+++ b/Source/XnDeviceSensorV2/XnSensorClient.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_CLIENT_H__
#define __XN_SENSOR_CLIENT_H__
@@ -64,8 +59,7 @@ class XnSensorClient : public XnStreamReaderDevice
XnStatus Read(XnStreamDataSet* pStreamOutputSet);
void SetConfigDir(const XnChar* strConfigDir);
-
- static XnStatus TakeServerLocation();
+ XnBool IsServerFromOtherUserAllowed() { return m_bAllowServerFromOtherUser; }
protected:
XnStatus SendBye();
@@ -92,6 +86,7 @@ class XnSensorClient : public XnStreamReaderDevice
XnStatus StartServerProcess();
static XN_THREAD_PROC ListenThread(XN_THREAD_PARAM pThreadParam);
+ static XnStatus XN_CALLBACK_TYPE GetInstanceCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
XN_SOCKET_HANDLE m_hSocket;
XN_EVENT_HANDLE m_hReplyEvent;
@@ -101,14 +96,13 @@ class XnSensorClient : public XnStreamReaderDevice
XnSensorClientServerReply m_LastReply;
XnBool m_bConnected;
- XnSensorClient* m_pThis;
- XnActualGeneralProperty m_InstancePointer;
+ XnGeneralProperty m_InstancePointer;
XnActualIntProperty m_ErrorState;
XN_CRITICAL_SECTION_HANDLE m_hLock;
XnChar m_strConfigDir[XN_FILE_MAX_PATH];
-
- static XnChar ms_strDir[];
+ XnChar m_strConfigFile[XN_FILE_MAX_PATH];
+ XnBool m_bAllowServerFromOtherUser;
};
#endif //__XN_SENSOR_CLIENT_H__
diff --git a/Source/XnDeviceSensorV2/XnSensorClientServer.h b/Source/XnDeviceSensorV2/XnSensorClientServer.h
index cfb06c6..ea3579b 100644
--- a/Source/XnDeviceSensorV2/XnSensorClientServer.h
+++ b/Source/XnDeviceSensorV2/XnSensorClientServer.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_CLIENT_SERVER_H__
#define __XN_SENSOR_CLIENT_SERVER_H__
@@ -45,6 +40,7 @@
#define XN_MASK_SENSOR_SERVER "SensorServer"
#define XN_SENSOR_SERVER_RUNNING_EVENT_NAME "XnSensorServerRunningEvent"
#define XN_SENSOR_SERVER_RUNNING_MUTEX_NAME "XnSensorServerRunningMutex"
+#define XN_SENSOR_SERVER_CONFIG_FILE_SECTION "Server"
//---------------------------------------------------------------------------
// Enums
diff --git a/Source/XnDeviceSensorV2/XnSensorClientStream.cpp b/Source/XnDeviceSensorV2/XnSensorClientStream.cpp
index c37bfe6..cdecb02 100644
--- a/Source/XnDeviceSensorV2/XnSensorClientStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorClientStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -62,7 +56,7 @@ XnStatus XnSensorClientStream::OpenSharedMemory()
nRetVal = GetProperty(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, strSharedMemoryName);
XN_IS_STATUS_OK(nRetVal);
- nRetVal = xnOSOpenSharedMemory(strSharedMemoryName, XN_OS_FILE_READ, &m_hSharedMemory);
+ nRetVal = xnOSOpenSharedMemoryEx(strSharedMemoryName, XN_OS_FILE_READ, m_pClient->IsServerFromOtherUserAllowed(), &m_hSharedMemory);
XN_IS_STATUS_OK(nRetVal);
nRetVal = xnOSSharedMemoryGetAddress(m_hSharedMemory, (void**)&m_pSharedMemory);
@@ -75,7 +69,7 @@ XnStatus XnSensorClientStream::Open()
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_pClient->m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_OPEN_STREAM, GetName(), strlen(GetName()) + 1);
+ nRetVal = m_pClient->m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_OPEN_STREAM, GetName(), (XnUInt32)strlen(GetName()) + 1);
XN_IS_STATUS_OK(nRetVal);
// wait for reply
@@ -93,7 +87,7 @@ XnStatus XnSensorClientStream::Close()
XnStatus nRetVal = XN_STATUS_OK;
// read data from server
- nRetVal = m_pClient->m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_CLOSE_STREAM, GetName(), strlen(GetName()) + 1);
+ nRetVal = m_pClient->m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_CLOSE_STREAM, GetName(), (XnUInt32)strlen(GetName()) + 1);
XN_IS_STATUS_OK(nRetVal);
// wait for reply
@@ -108,8 +102,6 @@ XnStatus XnSensorClientStream::Close()
XnStatus XnSensorClientStream::Free()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (m_hSharedMemory != NULL)
{
xnOSCloseSharedMemory(m_hSharedMemory);
@@ -137,7 +129,7 @@ XnStatus XnSensorClientFrameStream::ReadImpl(XnStreamData* pStreamOutput)
XnStatus nRetVal = XN_STATUS_OK;
// read data from server
- nRetVal = m_pClient->m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_READ_STREAM, pStreamOutput->StreamName, strlen(pStreamOutput->StreamName) + 1);
+ nRetVal = m_pClient->m_pOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_READ_STREAM, pStreamOutput->StreamName, (XnUInt32)strlen(pStreamOutput->StreamName) + 1);
XN_IS_STATUS_OK(nRetVal);
// wait for reply
@@ -180,12 +172,44 @@ XnSensorClientAudioStream::XnSensorClientAudioStream(XnSensorClient* pClient, co
XnSensorClientStream(pClient, strType, strName),
m_pHeader(NULL),
m_pBuffer(NULL),
- m_nLastReadIndex(0)
+ m_nLastReadIndex(0),
+ m_hLock(NULL),
+ m_nFrameID(0),
+ m_pTimestamps(NULL)
{}
XnSensorClientAudioStream::~XnSensorClientAudioStream()
{}
+XnStatus XnSensorClientAudioStream::Init()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = XnSensorClientStream::Init();
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = xnOSCreateCriticalSection(&m_hLock);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorClientAudioStream::Free()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ if (m_hLock != NULL)
+ {
+ xnOSCloseCriticalSection(&m_hLock);
+ m_hLock = NULL;
+ }
+
+ nRetVal = XnSensorClientStream::Free();
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
XnStatus XnSensorClientAudioStream::OpenSharedMemory()
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -200,17 +224,26 @@ XnStatus XnSensorClientAudioStream::OpenSharedMemory()
return (XN_STATUS_OK);
}
+void XnSensorClientAudioStream::NewDataAvailable(XnUInt64 /*nTimestamp*/, XnUInt32 /*nFrameID*/)
+{
+ // if a read is in progress, wait for it to complete
+ XnAutoCSLocker locker(m_hLock);
+
+ // check if we still have new data
+ if (m_pHeader->nWritePacketIndex != m_nLastReadIndex)
+ {
+ XnSensorClientStream::NewDataAvailable(m_pTimestamps[m_nLastReadIndex], 0);
+ }
+}
+
XnStatus XnSensorClientAudioStream::ReadImpl(XnStreamData* pStreamOutput)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
pStreamOutput->nDataSize = 0;
- // take last write index
- XnUInt32 nWriteIndex = m_pHeader->nWritePacketIndex;
+ // take last write index (note: this is taken from shared memory)
+ XnAutoCSLocker locker(m_hLock);
- // take timestamp
- pStreamOutput->nTimestamp = m_pTimestamps[m_nLastReadIndex];
+ XnUInt32 nWriteIndex = m_pHeader->nWritePacketIndex;
// check how many buffers we have
XnInt32 nAvailbalePackets = nWriteIndex - m_nLastReadIndex;
@@ -224,6 +257,9 @@ XnStatus XnSensorClientAudioStream::ReadImpl(XnStreamData* pStreamOutput)
nAvailbalePackets--;
}
+ // take timestamp
+ pStreamOutput->nTimestamp = m_pTimestamps[m_nLastReadIndex];
+
// now copy data from last read position to this one
XnUChar* pAudioBuf = (XnUChar*)pStreamOutput->pData;
@@ -240,5 +276,8 @@ XnStatus XnSensorClientAudioStream::ReadImpl(XnStreamData* pStreamOutput)
m_nLastReadIndex = (m_nLastReadIndex + 1) % m_pHeader->nPacketCount;
}
+ m_nFrameID++;
+ pStreamOutput->nFrameID = m_nFrameID;
+
return (XN_STATUS_OK);
}
diff --git a/Source/XnDeviceSensorV2/XnSensorClientStream.h b/Source/XnDeviceSensorV2/XnSensorClientStream.h
index 3e12afc..26cd2f6 100644
--- a/Source/XnDeviceSensorV2/XnSensorClientStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorClientStream.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_CLIENT_STREAM_H__
#define __XN_SENSOR_CLIENT_STREAM_H__
@@ -83,16 +77,23 @@ class XnSensorClientAudioStream : public XnSensorClientStream
XnSensorClientAudioStream(XnSensorClient* pClient, const XnChar* strType, const XnChar* strName);
~XnSensorClientAudioStream();
+ XnStatus Init();
+ XnStatus Free();
+
XnStatus OpenSharedMemory();
+ virtual void NewDataAvailable(XnUInt64 nTimestamp, XnUInt32 nFrameID);
+
protected:
XnStatus ReadImpl(XnStreamData* pStreamOutput);
private:
+ XnUInt32 m_nFrameID;
XnAudioSharedBuffer* m_pHeader;
XnUChar* m_pBuffer;
XnUInt32 m_nLastReadIndex;
XnUInt64* m_pTimestamps;
+ XN_CRITICAL_SECTION_HANDLE m_hLock;
};
#endif // __XN_SENSOR_CLIENT_STREAM_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp
index 6c742d8..eaff6f1 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -40,13 +34,14 @@
//---------------------------------------------------------------------------
XnSensorDepthGenerator::XnSensorDepthGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName) :
- XnSensorMapGenerator(context, sensor, pSensor, strStreamName)
+ XnSensorMapGenerator(context, sensor, pSensor, strStreamName),
+ m_hRWPropCallback(NULL)
{
}
XnSensorDepthGenerator::~XnSensorDepthGenerator()
{
- if (m_hRWPropCallback)
+ if (m_hRWPropCallback != NULL)
{
UnregisterFromProps(m_hRWPropCallback);
}
@@ -152,9 +147,9 @@ XnStatus XnSensorDepthGenerator::SetUserPosition(XnUInt32 nIndex, const XnBoundi
{
// set (we only support Z boxing for now)
XnDepthAGCBin bin;
- bin.nBin = nIndex;
- bin.nMin = Position.LeftBottomNear.Z;
- bin.nMax = Position.RightTopFar.Z;
+ bin.nBin = (XnUInt16)nIndex;
+ bin.nMin = (XnUInt16)Position.LeftBottomNear.Z;
+ bin.nMax = (XnUInt16)Position.RightTopFar.Z;
return m_pSensor->SetProperty(m_strModule, XN_STREAM_PROPERTY_AGC_BIN, XN_PACK_GENERAL_BUFFER(bin));
}
@@ -164,7 +159,7 @@ XnStatus XnSensorDepthGenerator::GetUserPosition(XnUInt32 nIndex, XnBoundingBox3
// get
XnDepthAGCBin bin;
- bin.nBin = nIndex;
+ bin.nBin = (XnUInt16)nIndex;
nRetVal = m_pSensor->GetProperty(m_strModule, XN_STREAM_PROPERTY_AGC_BIN, XN_PACK_GENERAL_BUFFER(bin));
XN_IS_STATUS_OK(nRetVal);
@@ -176,9 +171,9 @@ XnStatus XnSensorDepthGenerator::GetUserPosition(XnUInt32 nIndex, XnBoundingBox3
Position.LeftBottomNear.Z = bin.nMin;
Position.RightTopFar.Z = bin.nMax;
Position.LeftBottomNear.X = 0;
- Position.RightTopFar.X = MapOutputMode.nXRes - 1;
+ Position.RightTopFar.X = (XnFloat)(MapOutputMode.nXRes - 1);
Position.LeftBottomNear.Y = 0;
- Position.RightTopFar.Y = MapOutputMode.nYRes - 1;
+ Position.RightTopFar.Y = (XnFloat)(MapOutputMode.nYRes - 1);
return (XN_STATUS_OK);
}
@@ -295,8 +290,9 @@ XnStatus XnSensorDepthGenerator::FrameSyncWith(xn::ProductionNode& OtherNode)
}
}
-XnStatus XnSensorDepthGenerator::StopFrameSyncWith(xn::ProductionNode& OtherNode)
+XnStatus XnSensorDepthGenerator::StopFrameSyncWith(xn::ProductionNode& /*OtherNode*/)
{
+ // we assume the other node is the image one (this is the only one we started)
return m_pSensor->SetProperty(XN_MODULE_NAME_DEVICE, XN_MODULE_PROPERTY_FRAME_SYNC, (XnUInt64)FALSE);
}
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h
index 33b2ee7..2e7aaf0 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_DEPTH_GENERATOR_H__
#define __XN_SENSOR_DEPTH_GENERATOR_H__
@@ -37,6 +31,10 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorDepthGenerator :
public XnSensorMapGenerator,
virtual public xn::ModuleDepthGenerator,
@@ -52,6 +50,7 @@ class XnSensorDepthGenerator :
XnBool IsCapabilitySupported(const XnChar* strCapabilityName);
+ const void* GetData() { return XnSensorMapGenerator::GetData(); }
XnDepthPixel* GetDepthMap();
XnDepthPixel GetDeviceMaxDepth();
void GetFieldOfView(XnFieldOfView& FOV);
@@ -105,5 +104,6 @@ class XnExportedSensorDepthGenerator : public XnExportedSensorGenerator
virtual XnSensorGenerator* CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
};
+#pragma warning (pop)
#endif // __XN_SENSOR_DEPTH_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp b/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp
index 06d8827..cb1766d 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -38,23 +32,12 @@
#include
#include
#include
+#include "XnSensor.h"
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
-#define XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT XN_IO_DEPTH_FORMAT_COMPRESSED_PS
-#define XN_DEPTH_STREAM_DEFAULT_RESOLUTION XN_RESOLUTION_QVGA
-#define XN_DEPTH_STREAM_DEFAULT_FPS 30
-#define XN_DEPTH_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_DEPTH_VALUES
-#define XN_DEPTH_STREAM_DEFAULT_REGISTRATION FALSE
-#define XN_DEPTH_STREAM_DEFAULT_REGISTRATION_TYPE XN_PROCESSING_DONT_CARE
-#define XN_DEPTH_STREAM_DEFAULT_HOLE_FILLER TRUE
-#define XN_DEPTH_STREAM_DEFAULT_WHITE_BALANCE TRUE
-#define XN_DEPTH_STREAM_DEFAULT_GAIN_OLD 50
-#define XN_DEPTH_STREAM_DEFAULT_GMC_MODE TRUE
-
-
#define XN_SHIFTS_MAX_SHIFT 2047
#define XN_SHIFTS_PIXEL_SIZE_FACTOR 1
#define XN_SHIFTS_PARAM_COEFFICIENT 4
@@ -67,10 +50,10 @@
//---------------------------------------------------------------------------
// XnSensorDepthStream class
//---------------------------------------------------------------------------
-XnSensorDepthStream::XnSensorDepthStream(const XnChar* strName, XnSensorObjects* pObjects, XnUInt32 nBufferCount) :
+XnSensorDepthStream::XnSensorDepthStream(const XnChar* strDeviceName, const XnChar* strName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers) :
XnDepthStream(strName, FALSE, XN_DEVICE_SENSOR_MAX_DEPTH, XN_SHIFTS_MAX_SHIFT),
m_Helper(pObjects),
- m_BufferPool(nBufferCount, strName, XN_DEPTH_MAX_BUFFER_SIZE),
+ m_BufferPool(nBufferCount, strDeviceName, strName, XN_DEPTH_MAX_BUFFER_SIZE, bAllowOtherUsers),
m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, m_BufferPool.GetSharedMemoryName()),
m_InputFormat(XN_STREAM_PROPERTY_INPUT_FORMAT, XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT),
m_DepthRegistration(XN_STREAM_PROPERTY_REGISTRATION, XN_DEPTH_STREAM_DEFAULT_REGISTRATION),
@@ -117,8 +100,14 @@ XnStatus XnSensorDepthStream::Init()
XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_DepthRegistration, &m_HoleFilter,
&m_WhiteBalance, &m_Gain, &m_AGCBin, &m_SharedBufferName, &m_ActualRead, &m_GMCMode,
- &m_RegistrationType,
- );
+ &m_RegistrationType);
+
+
+ if (m_Helper.GetPrivateData()->pSensor->IsLowBandwidth())
+ {
+ nRetVal = m_InputFormat.UnsafeUpdateValue(XN_IO_DEPTH_FORMAT_COMPRESSED_PS);
+ XN_IS_STATUS_OK(nRetVal);
+ }
// set base properties default values
nRetVal = ResolutionProperty().UnsafeUpdateValue(XN_DEPTH_STREAM_DEFAULT_RESOLUTION);
@@ -153,19 +142,24 @@ XnStatus XnSensorDepthStream::Init()
nRetVal = EmitterDCmosDistanceProperty().UnsafeUpdateValue(m_Helper.GetFixedParams()->GetEmitterDCmosDistance());
XN_IS_STATUS_OK(nRetVal);
+ nRetVal = GetDCmosRCmosDistanceProperty().UnsafeUpdateValue(m_Helper.GetFixedParams()->GetDCmosRCmosDistance());
+ XN_IS_STATUS_OK(nRetVal);
+
// init helper
nRetVal = m_Helper.Init(this, this);
XN_IS_STATUS_OK(nRetVal);
if (m_Helper.GetFirmwareVersion() < XN_SENSOR_FW_VER_3_0)
{
- XN_IS_STATUS_OK(m_GMCMode.UnsafeUpdateValue(FALSE));
+ nRetVal = m_GMCMode.UnsafeUpdateValue(FALSE);
+ XN_IS_STATUS_OK(nRetVal);
}
if (m_Helper.GetFirmwareVersion() < XN_SENSOR_FW_VER_4_0)
{
- XN_IS_STATUS_OK(m_WhiteBalance.UnsafeUpdateValue(FALSE));
+ nRetVal = m_WhiteBalance.UnsafeUpdateValue(FALSE);
+ XN_IS_STATUS_OK(nRetVal);
}
// on old firmwares, the host decides on the default gain. On new firmwares, we read it from firmware
@@ -198,6 +192,37 @@ XnStatus XnSensorDepthStream::Init()
XN_IS_STATUS_OK(nRetVal);
+ // register supported modes
+ XnCmosPreset aSupportedModes[] =
+ {
+ { XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 30 },
+ { XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 60 },
+ { XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_VGA, 30 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 30 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 60 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_VGA, 30 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 30 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 60 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_VGA, 30 },
+ };
+ nRetVal = AddSupportedModes(aSupportedModes, sizeof(aSupportedModes)/sizeof(aSupportedModes[0]));
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+ {
+ XnCmosPreset aSupportedModes25[] =
+ {
+ { XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 25 },
+ { XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_VGA, 25 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 25 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_VGA, 25 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 25 },
+ { XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_VGA, 25 },
+ };
+ nRetVal = AddSupportedModes(aSupportedModes25, sizeof(aSupportedModes25)/sizeof(aSupportedModes25[0]));
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
return (XN_STATUS_OK);
}
@@ -224,20 +249,34 @@ XnStatus XnSensorDepthStream::MapPropertiesToFirmware()
{
XnStatus nRetVal = XN_STATUS_OK;
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_InputFormat, GetFirmwareParams()->m_DepthFormat, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(ResolutionProperty(), GetFirmwareParams()->m_DepthResolution, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(FPSProperty(), GetFirmwareParams()->m_DepthFPS, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_HoleFilter, GetFirmwareParams()->m_DepthHoleFilter, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_Gain, GetFirmwareParams()->m_DepthGain, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_WhiteBalance, GetFirmwareParams()->m_DepthWhiteBalance, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareMirror, GetFirmwareParams()->m_DepthMirror, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareRegistration, GetFirmwareParams()->m_RegistrationEnabled, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropSizeX, GetFirmwareParams()->m_DepthCropSizeX, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropSizeY, GetFirmwareParams()->m_DepthCropSizeY, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetX, GetFirmwareParams()->m_DepthCropOffsetX, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetY, GetFirmwareParams()->m_DepthCropOffsetY, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropEnabled, GetFirmwareParams()->m_DepthCropEnabled, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_GMCMode, GetFirmwareParams()->m_GMCMode, TRUE));
+ nRetVal = m_Helper.MapFirmwareProperty(m_InputFormat, GetFirmwareParams()->m_DepthFormat, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(ResolutionProperty(), GetFirmwareParams()->m_DepthResolution, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(FPSProperty(), GetFirmwareParams()->m_DepthFPS, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_HoleFilter, GetFirmwareParams()->m_DepthHoleFilter, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_Gain, GetFirmwareParams()->m_DepthGain, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_WhiteBalance, GetFirmwareParams()->m_DepthWhiteBalance, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareMirror, GetFirmwareParams()->m_DepthMirror, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareRegistration, GetFirmwareParams()->m_RegistrationEnabled, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropSizeX, GetFirmwareParams()->m_DepthCropSizeX, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropSizeY, GetFirmwareParams()->m_DepthCropSizeY, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetX, GetFirmwareParams()->m_DepthCropOffsetX, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetY, GetFirmwareParams()->m_DepthCropOffsetY, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropEnabled, GetFirmwareParams()->m_DepthCropEnabled, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_GMCMode, GetFirmwareParams()->m_GMCMode, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
return (XN_STATUS_OK);
}
@@ -251,11 +290,16 @@ XnStatus XnSensorDepthStream::ConfigureStreamImpl()
nRetVal = SetActualRead(TRUE);
XN_IS_STATUS_OK(nRetVal);
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_InputFormat));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(ResolutionProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(FPSProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_HoleFilter));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_Gain));
+ nRetVal = m_Helper.ConfigureFirmware(m_InputFormat);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(ResolutionProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(FPSProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_HoleFilter);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_Gain);
+ XN_IS_STATUS_OK(nRetVal);;
// we need to turn decimation on when resolution is QVGA, and FPS is different than 60
// NOTE: this is ugly as hell. This logic should be moved to firmware.
@@ -263,14 +307,19 @@ XnStatus XnSensorDepthStream::ConfigureStreamImpl()
nRetVal = GetFirmwareParams()->m_DepthDecimation.SetValue(bDecimation);
XN_IS_STATUS_OK(nRetVal);
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareRegistration));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareMirror));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_GMCMode));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_WhiteBalance));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareRegistration);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareMirror);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_GMCMode);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_WhiteBalance);
+ XN_IS_STATUS_OK(nRetVal);;
nRetVal = m_Helper.GetCmosInfo()->SetCmosConfig(XN_CMOS_TYPE_DEPTH, GetResolution(), GetFPS());
XN_IS_STATUS_OK(nRetVal);
+ // --avin mod--
//Turn off the IR projector anti-cover thingy. I find it annoying and It's off on the XBox360 so it must be safe :-)
//This is probably not the best way to do it, but adding it as a real param is too much work for me at the moment...
XnHostProtocolSetParam(GetHelper()->GetPrivateData(), 0x105, 0);
@@ -287,7 +336,8 @@ XnStatus XnSensorDepthStream::SetActualRead(XnBool bRead)
if (bRead)
{
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Creating USB depth read thread...");
- nRetVal = xnUSBInitReadThread(GetHelper()->GetPrivateData()->pSpecificDepthUsb->pUsbConnection->UsbEp, GetHelper()->GetPrivateData()->pSpecificDepthUsb->nChunkReadBytes, XN_SENSOR_USB_DEPTH_BUFFERS, XN_SENSOR_READ_THREAD_TIMEOUT, XnDeviceSensorProtocolUsbEpCb, GetHelper()->GetPrivateData()->pSpecificDepthUsb);
+ XnSpecificUsbDevice* pUSB = GetHelper()->GetPrivateData()->pSpecificDepthUsb;
+ nRetVal = xnUSBInitReadThread(pUSB->pUsbConnection->UsbEp, pUSB->nChunkReadBytes, XN_SENSOR_USB_DEPTH_BUFFERS, pUSB->nTimeout, XnDeviceSensorProtocolUsbEpCb, pUSB);
XN_IS_STATUS_OK(nRetVal);
}
else
@@ -313,12 +363,17 @@ XnStatus XnSensorDepthStream::OpenStreamImpl()
// Cropping
if (m_FirmwareCropEnabled.GetValue() == TRUE)
{
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropSizeX));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropSizeY));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropOffsetX));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropOffsetY));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropSizeX);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropSizeY);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropOffsetX);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropOffsetY);
+ XN_IS_STATUS_OK(nRetVal);;
}
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropEnabled));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropEnabled);
+ XN_IS_STATUS_OK(nRetVal);;
nRetVal = XnDepthStream::Open();
XN_IS_STATUS_OK(nRetVal);
@@ -376,7 +431,7 @@ XnStatus XnSensorDepthStream::SetMirror(XnBool bIsMirrored)
// set firmware mirror
XnBool bFirmwareMirror = (bIsMirrored == TRUE && m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_0);
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareMirror, bFirmwareMirror);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareMirror, (XnUInt16)bFirmwareMirror);
if (nRetVal != XN_STATUS_OK)
{
xnOSLeaveCriticalSection(GetLock());
@@ -395,7 +450,7 @@ XnStatus XnSensorDepthStream::SetFPS(XnUInt32 nFPS)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.BeforeSettingFirmwareParam(FPSProperty(), nFPS);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(FPSProperty(), (XnUInt16)nFPS);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnDepthStream::SetFPS(nFPS);
@@ -411,16 +466,7 @@ XnStatus XnSensorDepthStream::SetResolution(XnResolutions nResolution)
{
XnStatus nRetVal = XN_STATUS_OK;
- switch (nResolution)
- {
- case XN_RESOLUTION_QVGA:
- case XN_RESOLUTION_VGA:
- break;
- default:
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported depth resolution: %d", nResolution);
- }
-
- nRetVal = m_Helper.BeforeSettingFirmwareParam(ResolutionProperty(), nResolution);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(ResolutionProperty(), (XnUInt16)nResolution);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnDepthStream::SetResolution(nResolution);
@@ -451,7 +497,7 @@ XnStatus XnSensorDepthStream::SetInputFormat(XnIODepthFormats nInputFormat)
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unknown depth input format: %d", nInputFormat);
}
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_InputFormat, nInputFormat);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_InputFormat, (XnUInt16)nInputFormat);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -477,7 +523,7 @@ XnStatus XnSensorDepthStream::SetHoleFilter(XnBool bHoleFilter)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_HoleFilter, bHoleFilter);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_HoleFilter, (XnUInt16)bHoleFilter);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -487,7 +533,7 @@ XnStatus XnSensorDepthStream::SetWhiteBalance(XnBool bWhiteBalance)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_WhiteBalance, bWhiteBalance);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_WhiteBalance, (XnUInt16)bWhiteBalance);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -497,7 +543,7 @@ XnStatus XnSensorDepthStream::SetGain(XnUInt32 nGain)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_Gain, nGain);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_Gain, (XnUInt16)nGain);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -524,7 +570,7 @@ XnStatus XnSensorDepthStream::SetGMCMode(XnBool bGMCMode)
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_GMCMode, bGMCMode);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_GMCMode, (XnUInt16)bGMCMode);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -535,8 +581,10 @@ XnStatus XnSensorDepthStream::SetAGCBin(const XnDepthAGCBin* pBin)
{
XnStatus nRetVal = XN_STATUS_OK;
- XN_IS_STATUS_OK(ValidateDepthValue(pBin->nMin));
- XN_IS_STATUS_OK(ValidateDepthValue(pBin->nMax));
+ nRetVal = ValidateDepthValue(pBin->nMin);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = ValidateDepthValue(pBin->nMax);
+ XN_IS_STATUS_OK(nRetVal);
// translate to shifts
XnUInt16* pDepthToShift = GetDepthToShiftTable();
@@ -608,7 +656,9 @@ XnStatus XnSensorDepthStream::SetCropping(const XnCropping* pCropping)
}
if (nRetVal == XN_STATUS_OK)
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareCropEnabled, pCropping->bEnabled);
+ {
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareCropEnabled, (XnUInt16)pCropping->bEnabled);
+ }
if (nRetVal != XN_STATUS_OK)
{
@@ -714,8 +764,6 @@ XnStatus XnSensorDepthStream::Mirror(XnStreamData* pStreamOutput) const
XnStatus XnSensorDepthStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnStreamProcessor* pNew;
switch (m_InputFormat.GetValue())
@@ -784,7 +832,7 @@ XnStatus XnSensorDepthStream::DecideFirmwareRegistration(XnBool bRegistration, X
}
}
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareRegistration, bFirmwareRegistration);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareRegistration, (XnUInt16)bFirmwareRegistration);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -824,50 +872,50 @@ XnStatus XnSensorDepthStream::DecidePixelSizeFactor()
return (XN_STATUS_OK);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetInputFormatCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetInputFormatCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetInputFormat((XnIODepthFormats)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetRegistrationCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetRegistrationCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetRegistration((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetHoleFilterCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetHoleFilterCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetHoleFilter((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetWhiteBalanceCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetWhiteBalanceCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetWhiteBalance((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetGainCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetGainCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetGain((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetRegistrationTypeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetRegistrationTypeCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetRegistrationType((XnProcessingType)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetGMCModeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetGMCModeCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->SetGMCMode((XnBool)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetAGCBinCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetAGCBinCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
if (gbValue.nDataSize != sizeof(XnDepthAGCBin))
{
@@ -878,7 +926,7 @@ XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetAGCBinCallback(XnGeneralProper
return pStream->SetAGCBin((XnDepthAGCBin*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::GetAGCBinCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::GetAGCBinCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
{
if (gbValue.nDataSize != sizeof(XnDepthAGCBin))
{
@@ -889,19 +937,19 @@ XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::GetAGCBinCallback(const XnGeneral
return pStream->GetAGCBin((XnDepthAGCBin*)gbValue.pData);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetActualReadCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetActualReadCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorDepthStream* pThis = (XnSensorDepthStream*)pCookie;
return pThis->SetActualRead(nValue == TRUE);
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::DecideFirmwareRegistrationCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::DecideFirmwareRegistrationCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->DecideFirmwareRegistration((XnBool)pStream->m_DepthRegistration.GetValue(), (XnProcessingType)pStream->m_RegistrationType.GetValue(), pStream->GetResolution());
}
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::DecidePixelSizeFactorCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::DecidePixelSizeFactorCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
return pStream->DecidePixelSizeFactor();
@@ -917,25 +965,25 @@ XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::ReadAGCBinsFromFile(XnGeneralProp
XnUInt32 nValue;
XnDepthAGCBin bin;
- bin.nBin = nBin;
+ bin.nBin = (XnUInt16)nBin;
XnBool bHasMin = FALSE;
XnBool bHasMax = FALSE;
- sprintf(csKey, "AGCBin%dMinDepth", nBin);
+ sprintf(csKey, "AGCBin%uMinDepth", nBin);
nRetVal = xnOSReadIntFromINI(csINIFile, csSection, csKey, &nValue);
if (nRetVal == XN_STATUS_OK)
{
- bin.nMin = nValue;
+ bin.nMin = (XnUInt16)nValue;
bHasMin = TRUE;
}
- sprintf(csKey, "AGCBin%dMaxDepth", nBin);
+ sprintf(csKey, "AGCBin%uMaxDepth", nBin);
nRetVal = xnOSReadIntFromINI(csINIFile, csSection, csKey, &nValue);
if (nRetVal == XN_STATUS_OK)
{
- bin.nMax = nValue;
+ bin.nMax = (XnUInt16)nValue;
bHasMax = TRUE;
}
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthStream.h b/Source/XnDeviceSensorV2/XnSensorDepthStream.h
index 198e61b..cecc103 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorDepthStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_DEPTH_STREAM_H__
#define __XN_SENSOR_DEPTH_STREAM_H__
@@ -37,13 +32,30 @@
#include "XnSharedMemoryBufferPool.h"
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+#define XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT
+// --avin mod--
+#define XN_DEPTH_STREAM_DEFAULT_RESOLUTION XN_RESOLUTION_VGA
+#define XN_DEPTH_STREAM_DEFAULT_FPS 30
+#define XN_DEPTH_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_DEPTH_VALUES
+#define XN_DEPTH_STREAM_DEFAULT_REGISTRATION FALSE
+// --avin mod--
+#define XN_DEPTH_STREAM_DEFAULT_REGISTRATION_TYPE XN_PROCESSING_SOFTWARE
+#define XN_DEPTH_STREAM_DEFAULT_HOLE_FILLER TRUE
+#define XN_DEPTH_STREAM_DEFAULT_WHITE_BALANCE TRUE
+#define XN_DEPTH_STREAM_DEFAULT_GAIN_OLD 50
+#define XN_DEPTH_STREAM_DEFAULT_GMC_MODE TRUE
+
+
//---------------------------------------------------------------------------
// XnSensorDepthStream class
//---------------------------------------------------------------------------
class XnSensorDepthStream : public XnDepthStream, public IXnSensorStream
{
public:
- XnSensorDepthStream(const XnChar* strName, XnSensorObjects* pObjects, XnUInt32 nBufferCount);
+ XnSensorDepthStream(const XnChar* strDeviceName, const XnChar* strName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers);
~XnSensorDepthStream() { Free(); }
//---------------------------------------------------------------------------
@@ -75,7 +87,7 @@ class XnSensorDepthStream : public XnDepthStream, public IXnSensorStream
XnStatus CreateDataProcessor(XnDataProcessor** ppProcessor);
XnStatus MapPropertiesToFirmware();
void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = GetResolution(); *pnFPS = GetFPS(); }
- XnStatus WriteImpl(XnStreamData* pStreamData) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+ XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return &m_BufferPool; }
diff --git a/Source/XnDeviceSensorV2/XnSensorDevice.cpp b/Source/XnDeviceSensorV2/XnSensorDevice.cpp
index cce8aae..fcb301a 100644
--- a/Source/XnDeviceSensorV2/XnSensorDevice.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorDevice.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -44,7 +38,9 @@ XnSensorDevice::~XnSensorDevice()
XnBool XnSensorDevice::IsCapabilitySupported(const XnChar* strCapabilityName)
{
- return (strcmp(strCapabilityName, XN_CAPABILITY_ERROR_STATE) == 0 ||
+ return (
+ strcmp(strCapabilityName, XN_CAPABILITY_ERROR_STATE) == 0 ||
+ strcmp(strCapabilityName, XN_CAPABILITY_DEVICE_IDENTIFICATION) == 0 ||
XnSensorProductionNode::IsCapabilitySupported(strCapabilityName));
}
@@ -73,3 +69,18 @@ void XnSensorDevice::UnregisterFromErrorStateChange(XnCallbackHandle hCallback)
{
UnregisterFromProps(hCallback);
}
+
+XnStatus XnSensorDevice::GetDeviceName(XnChar* strBuffer, XnUInt32& nBufferSize)
+{
+ return GetStringProperty(XN_MODULE_PROPERTY_PHYSICAL_DEVICE_NAME, strBuffer, nBufferSize);
+}
+
+XnStatus XnSensorDevice::GetVendorSpecificData(XnChar* strBuffer, XnUInt32& nBufferSize)
+{
+ return GetStringProperty(XN_MODULE_PROPERTY_VENDOR_SPECIFIC_DATA, strBuffer, nBufferSize);
+}
+
+XnStatus XnSensorDevice::GetSerialNumber(XnChar* strBuffer, XnUInt32& nBufferSize)
+{
+ return GetStringProperty(XN_MODULE_PROPERTY_ID, strBuffer, nBufferSize);
+}
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorDevice.h b/Source/XnDeviceSensorV2/XnSensorDevice.h
index 5a8098e..b6579af 100644
--- a/Source/XnDeviceSensorV2/XnSensorDevice.h
+++ b/Source/XnDeviceSensorV2/XnSensorDevice.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_DEVICE_H__
#define __XN_SENSOR_DEVICE_H__
@@ -36,10 +30,15 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorDevice :
public XnSensorProductionNode,
virtual public xn::ModuleDevice,
- virtual public xn::ModuleErrorStateInterface
+ virtual public xn::ModuleErrorStateInterface,
+ virtual public xn::ModuleDeviceIdentificationInterface
{
public:
XnSensorDevice(xn::Context& context, XnDeviceBase* pSensor, const XnChar* strInstanceName);
@@ -51,6 +50,13 @@ class XnSensorDevice :
virtual XnStatus GetErrorState();
virtual XnStatus RegisterToErrorStateChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
virtual void UnregisterFromErrorStateChange(XnCallbackHandle hCallback);
+
+ virtual ModuleDeviceIdentificationInterface* GetIdentificationInterface() { return this; }
+ virtual XnStatus GetDeviceName(XnChar* strBuffer, XnUInt32& nBufferSize);
+ virtual XnStatus GetVendorSpecificData(XnChar* strBuffer, XnUInt32& nBufferSize);
+ virtual XnStatus GetSerialNumber(XnChar* strBuffer, XnUInt32& nBufferSize);
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_DEVICE_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorFPS.cpp b/Source/XnDeviceSensorV2/XnSensorFPS.cpp
index f6d8a05..83ef326 100644
--- a/Source/XnDeviceSensorV2/XnSensorFPS.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFPS.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -42,7 +36,7 @@
// Code
//---------------------------------------------------------------------------
XnSensorFPS::XnSensorFPS() :
- m_FramesDump(XN_DUMP_CLOSED)
+ m_FramesDump(NULL)
{
xnFPSInit(&m_InputDepth, XN_SENSOR_FPS_FRAME_COUNT);
xnFPSInit(&m_InputImage, XN_SENSOR_FPS_FRAME_COUNT);
@@ -50,7 +44,8 @@ XnSensorFPS::XnSensorFPS() :
xnFPSInit(&m_OutputDepth, XN_SENSOR_FPS_FRAME_COUNT);
xnFPSInit(&m_OutputImage, XN_SENSOR_FPS_FRAME_COUNT);
- xnDumpInit(&m_FramesDump, XN_MASK_SENSOR_FPS, "TS,Type,FrameID,FrameTS\n", "FramesTimes.csv");
+ m_FramesDump = xnDumpFileOpen(XN_MASK_SENSOR_FPS, "FramesTimes.csv");
+ xnDumpFileWriteString(m_FramesDump, "TS,Type,FrameID,FrameTS\n");
}
XnSensorFPS::~XnSensorFPS()
@@ -61,7 +56,7 @@ XnSensorFPS::~XnSensorFPS()
xnFPSFree(&m_OutputDepth);
xnFPSFree(&m_OutputImage);
- xnDumpClose(&m_FramesDump);
+ xnDumpFileClose(m_FramesDump);
}
void XnSensorFPS::Mark(XnFPSData* pFPS, const XnChar* csName, XnUInt32 nFrameID, XnUInt64 nTS)
@@ -74,7 +69,7 @@ void XnSensorFPS::Mark(XnFPSData* pFPS, const XnChar* csName, XnUInt32 nFrameID,
xnFPSMarkFrame(pFPS, nNow);
- xnDumpWriteString(m_FramesDump, "%llu,%s,%u,%llu\n", nNow, csName, nFrameID, nTS);
+ xnDumpFileWriteString(m_FramesDump, "%llu,%s,%u,%llu\n", nNow, csName, nFrameID, nTS);
// get current time in seconds
nNow /= 1000000;
diff --git a/Source/XnDeviceSensorV2/XnSensorFPS.h b/Source/XnDeviceSensorV2/XnSensorFPS.h
index 2ba26af..64abc7e 100644
--- a/Source/XnDeviceSensorV2/XnSensorFPS.h
+++ b/Source/XnDeviceSensorV2/XnSensorFPS.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_FPS_H__
#define __XN_SENSOR_FPS_H__
@@ -63,7 +58,7 @@ class XnSensorFPS
XnFPSData m_OutputImage;
XnUInt64 m_nLastPrint;
- XnDump m_FramesDump;
+ XnDumpFile* m_FramesDump;
};
#endif //__XN_SENSOR_FPS_H__
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmware.cpp b/Source/XnDeviceSensorV2/XnSensorFirmware.cpp
index 8df69f4..681fac7 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmware.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFirmware.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmware.h b/Source/XnDeviceSensorV2/XnSensorFirmware.h
index be41869..3ae7f9a 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmware.h
+++ b/Source/XnDeviceSensorV2/XnSensorFirmware.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_FIRMWARE_H__
#define __XN_SENSOR_FIRMWARE_H__
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
index 0617dce..3908e36 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -81,6 +75,14 @@ XnSensorFirmwareParams::XnSensorFirmwareParams(XnFirmwareInfo* pInfo, XnFirmware
m_IRMirror("IRMirror"),
m_ReferenceResolution("ReferenceResolution", 0, "Firmware"),
m_GMCMode("GMCMode"),
+ m_ImageSharpness("ImageSharpness"),
+ m_ImageAutoWhiteBalance("ImageAutoWhiteBalance"),
+ m_ImageColorTemperature("ImageColorTemperature"),
+ m_ImageBacklightCompensation("ImageBacklightCompensation"),
+ m_ImageAutoExposure("ImageAutoExposure"),
+ m_ImageExposureBar("ImageExposureBar"),
+ m_ImageLowLightCompensation("ImageLowLightCompensation"),
+ m_ImageGain("ImageGain"),
m_pInfo(pInfo),
m_pCommands(pCommands),
m_bInTransaction(FALSE)
@@ -96,51 +98,110 @@ XnStatus XnSensorFirmwareParams::Init()
{
XnStatus nRetVal = XN_STATUS_OK;
- /* Property Param MinVersion MaxVersion ValueIfNotSupported */
- /* ====================== ======================================= ==================== ==================== =================== */
- XN_IS_STATUS_OK(AddFirmwareParam( m_FrameSyncEnabled, PARAM_GENERAL_FRAME_SYNC));
- XN_IS_STATUS_OK(AddFirmwareParam( m_RegistrationEnabled, PARAM_GENERAL_REGISTRATION_ENABLE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_Stream0Mode, PARAM_GENERAL_STREAM0_MODE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_Stream1Mode, PARAM_GENERAL_STREAM1_MODE));
- XN_IS_STATUS_OK(AddFirmwareAudioParam(m_Stream2Mode, PARAM_GENERAL_STREAM2_MODE));
- XN_IS_STATUS_OK(AddFirmwareAudioParam(m_AudioStereo, PARAM_AUDIO_STEREO_MODE));
- XN_IS_STATUS_OK(AddFirmwareAudioParam(m_AudioSampleRate, PARAM_AUDIO_SAMPLE_RATE));
- XN_IS_STATUS_OK(AddFirmwareAudioParam(m_AudioLeftChannelGain, PARAM_AUDIO_LEFT_CHANNEL_VOLUME_LEVEL));
- XN_IS_STATUS_OK(AddFirmwareAudioParam(m_AudioRightChannelGain, PARAM_AUDIO_RIGHT_CHANNEL_VOLUME_LEVEL));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageFormat, PARAM_IMAGE_FORMAT));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageResolution, PARAM_IMAGE_RESOLUTION));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageFPS, PARAM_IMAGE_FPS));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageQuality, PARAM_IMAGE_QUALITY));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageFlickerDetection, PARAM_IMAGE_FLICKER_DETECTION));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageCropSizeX, PARAM_IMAGE_CROP_SIZE_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageCropSizeY, PARAM_IMAGE_CROP_SIZE_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageCropOffsetX, PARAM_IMAGE_CROP_OFFSET_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageCropOffsetY, PARAM_IMAGE_CROP_OFFSET_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageCropEnabled, PARAM_IMAGE_CROP_ENABLE, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthFormat, PARAM_DEPTH_FORMAT));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthResolution, PARAM_DEPTH_RESOLUTION));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthFPS, PARAM_DEPTH_FPS));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthGain, PARAM_DEPTH_AGC));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthHoleFilter, PARAM_DEPTH_HOLE_FILTER));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthMirror, PARAM_DEPTH_MIRROR, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthDecimation, PARAM_DEPTH_DECIMATION));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthCropSizeX, PARAM_DEPTH_CROP_SIZE_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthCropSizeY, PARAM_DEPTH_CROP_SIZE_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthCropOffsetX, PARAM_DEPTH_CROP_OFFSET_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthCropOffsetY, PARAM_DEPTH_CROP_OFFSET_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthCropEnabled, PARAM_DEPTH_CROP_ENABLE, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRFormat, PARAM_IR_FORMAT));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRResolution, PARAM_IR_RESOLUTION));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRFPS, PARAM_IR_FPS));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRCropSizeX, PARAM_IR_CROP_SIZE_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRCropSizeY, PARAM_IR_CROP_SIZE_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRCropOffsetX, PARAM_IR_CROP_OFFSET_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRCropOffsetY, PARAM_IR_CROP_OFFSET_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRCropEnabled, PARAM_IR_CROP_ENABLE, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_DepthWhiteBalance, PARAM_DEPTH_WHITE_BALANCE_ENABLE, XN_SENSOR_FW_VER_4_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_ImageMirror, PARAM_IMAGE_MIRROR, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_IRMirror, PARAM_IR_MIRROR, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
- XN_IS_STATUS_OK(AddFirmwareParam( m_GMCMode, PARAM_DEPTH_GMC_MODE, XN_SENSOR_FW_VER_3_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE));
+ /* Property Param MinVersion MaxVersion ValueIfNotSupported */
+ /* ====================== ======================================= ==================== ==================== =================== */
+ nRetVal = AddFirmwareParam( m_FrameSyncEnabled, PARAM_GENERAL_FRAME_SYNC);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_RegistrationEnabled, PARAM_GENERAL_REGISTRATION_ENABLE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_Stream0Mode, PARAM_GENERAL_STREAM0_MODE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_Stream1Mode, PARAM_GENERAL_STREAM1_MODE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareAudioParam(m_Stream2Mode, PARAM_GENERAL_STREAM2_MODE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareAudioParam(m_AudioStereo, PARAM_AUDIO_STEREO_MODE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareAudioParam(m_AudioSampleRate, PARAM_AUDIO_SAMPLE_RATE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareAudioParam(m_AudioLeftChannelGain, PARAM_AUDIO_LEFT_CHANNEL_VOLUME_LEVEL);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareAudioParam(m_AudioRightChannelGain, PARAM_AUDIO_RIGHT_CHANNEL_VOLUME_LEVEL);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageFormat, PARAM_IMAGE_FORMAT);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageResolution, PARAM_IMAGE_RESOLUTION);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageFPS, PARAM_IMAGE_FPS);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageQuality, PARAM_IMAGE_QUALITY);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageFlickerDetection, PARAM_IMAGE_FLICKER_DETECTION);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageCropSizeX, PARAM_IMAGE_CROP_SIZE_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageCropSizeY, PARAM_IMAGE_CROP_SIZE_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageCropOffsetX, PARAM_IMAGE_CROP_OFFSET_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageCropOffsetY, PARAM_IMAGE_CROP_OFFSET_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageCropEnabled, PARAM_IMAGE_CROP_ENABLE, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthFormat, PARAM_DEPTH_FORMAT);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthResolution, PARAM_DEPTH_RESOLUTION);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthFPS, PARAM_DEPTH_FPS);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthGain, PARAM_DEPTH_AGC);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthHoleFilter, PARAM_DEPTH_HOLE_FILTER);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthMirror, PARAM_DEPTH_MIRROR, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthDecimation, PARAM_DEPTH_DECIMATION);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthCropSizeX, PARAM_DEPTH_CROP_SIZE_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthCropSizeY, PARAM_DEPTH_CROP_SIZE_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthCropOffsetX, PARAM_DEPTH_CROP_OFFSET_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthCropOffsetY, PARAM_DEPTH_CROP_OFFSET_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthCropEnabled, PARAM_DEPTH_CROP_ENABLE, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRFormat, PARAM_IR_FORMAT);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRResolution, PARAM_IR_RESOLUTION);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRFPS, PARAM_IR_FPS);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRCropSizeX, PARAM_IR_CROP_SIZE_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRCropSizeY, PARAM_IR_CROP_SIZE_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRCropOffsetX, PARAM_IR_CROP_OFFSET_X, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRCropOffsetY, PARAM_IR_CROP_OFFSET_Y, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRCropEnabled, PARAM_IR_CROP_ENABLE, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_DepthWhiteBalance, PARAM_DEPTH_WHITE_BALANCE_ENABLE, XN_SENSOR_FW_VER_4_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageMirror, PARAM_IMAGE_MIRROR, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_IRMirror, PARAM_IR_MIRROR, XN_SENSOR_FW_VER_5_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_GMCMode, PARAM_DEPTH_GMC_MODE, XN_SENSOR_FW_VER_3_0, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageSharpness, PARAM_IMAGE_SHARPNESS, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, 50);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageAutoWhiteBalance, PARAM_IMAGE_AUTO_WHITE_BALANCE_MODE, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageColorTemperature, PARAM_IMAGE_COLOR_TEMPERATURE, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageBacklightCompensation,PARAM_IMAGE_BACK_LIGHT_COMPENSATION, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageAutoExposure, PARAM_IMAGE_AUTO_EXPOSURE_MODE, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageExposureBar, PARAM_IMAGE_EXPOSURE_BAR, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageLowLightCompensation,PARAM_IMAGE_LOW_LIGHT_COMPENSATION_MODE, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddFirmwareParam( m_ImageGain, PARAM_IMAGE_AGC, XN_SENSOR_FW_VER_5_4, XN_SENSOR_FW_VER_UNKNOWN, 0);
+ XN_IS_STATUS_OK(nRetVal);
// override some props
m_ImageResolution.UpdateSetCallback(SetImageResolutionCallback, this);
@@ -228,8 +289,6 @@ XnStatus XnSensorFirmwareParams::UpdateAllProperties()
XnStatus XnSensorFirmwareParams::StartTransaction()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (m_bInTransaction)
{
return XN_STATUS_ERROR;
@@ -359,8 +418,6 @@ XnStatus XnSensorFirmwareParams::CommitTransactionAsBatch()
XnStatus XnSensorFirmwareParams::RollbackTransaction()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
if (!m_bInTransaction)
{
return XN_STATUS_ERROR;
@@ -444,29 +501,33 @@ XnStatus XnSensorFirmwareParams::SetFirmwareAudioParam(XnActualIntProperty* pPro
XnStatus XnSensorFirmwareParams::SetImageResolution(XnUInt64 nValue)
{
XnStatus nRetVal = XN_STATUS_OK;
-
- switch (nValue)
+
+ if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_4)
{
- case XN_RESOLUTION_QVGA:
- case XN_RESOLUTION_VGA:
- break;
- case XN_RESOLUTION_SXGA:
- // Avin: Removed to enable 1280x1024 Image
- /*
- if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_3)
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
- }
- */
- break;
- case XN_RESOLUTION_UXGA:
- if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_1)
+ switch (nValue)
{
- XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
+ case XN_RESOLUTION_QVGA:
+ case XN_RESOLUTION_VGA:
+ break;
+ case XN_RESOLUTION_SXGA:
+ // --avin mod--
+ // Removed to enable 1280x1024 Image
+ /*
+ if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_3)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
+ }
+ */
+ break;
+ case XN_RESOLUTION_UXGA:
+ if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_1)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
+ }
+ break;
+ default:
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported image resolution: %d", nValue);
}
- break;
- default:
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported image resolution: %d", nValue);
}
nRetVal = SetFirmwareParam(&m_ImageResolution, nValue);
@@ -595,13 +656,13 @@ XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetFirmwareAudioParamCallback(
return pThis->SetFirmwareAudioParam(pSender, nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetImageResolutionCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetImageResolutionCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorFirmwareParams* pThis = (XnSensorFirmwareParams*)pCookie;
return pThis->SetImageResolution(nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetImageFormatCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetImageFormatCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorFirmwareParams* pThis = (XnSensorFirmwareParams*)pCookie;
return pThis->SetImageFormat(nValue);
@@ -613,7 +674,7 @@ XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetStreamModeCallback(XnActual
return pThis->SetStreamMode(pSender, nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::ReferenceResolutionPropertyValueChanged(const XnProperty* pSender, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::ReferenceResolutionPropertyValueChanged(const XnProperty* /*pSender*/, void* pCookie)
{
XnSensorFirmwareParams* pThis = (XnSensorFirmwareParams*)pCookie;
return pThis->RecalculateReferenceResolution();
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h
index 504003e..b3d58ca 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h
+++ b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_FIRMWARE_PARAMS_H__
#define __XN_SENSOR_FIRMWARE_PARAMS_H__
@@ -104,6 +99,14 @@ class XnSensorFirmwareParams
XnActualIntProperty m_ReferenceResolution;
XnActualIntProperty m_DepthWhiteBalance;
XnActualIntProperty m_GMCMode;
+ XnActualIntProperty m_ImageSharpness;
+ XnActualIntProperty m_ImageAutoWhiteBalance;
+ XnActualIntProperty m_ImageColorTemperature;
+ XnActualIntProperty m_ImageBacklightCompensation;
+ XnActualIntProperty m_ImageAutoExposure;
+ XnActualIntProperty m_ImageExposureBar;
+ XnActualIntProperty m_ImageLowLightCompensation;
+ XnActualIntProperty m_ImageGain;
private:
typedef struct XnFirmwareParam
diff --git a/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp b/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp
index e9c8229..d8e48de 100644
--- a/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -51,13 +45,28 @@ XnStatus XnSensorFixedParams::Init()
{
}
- xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Sensor serial number: %d", FixedParams.nSerialNumber);
+ if (m_pDevicePrivateData->FWInfo.nFWVer < XN_SENSOR_FW_VER_5_4)
+ {
+ sprintf(m_strSensorSerial, "%d", FixedParams.nSerialNumber);
+ }
+ else
+ {
+ nRetVal = XnHostProtocolGetSerialNumber(m_pDevicePrivateData, m_strSensorSerial);
+
+ if (nRetVal != XN_STATUS_OK)
+ {
+ return nRetVal;
+ }
+ }
+
+ xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Sensor serial number: %s", m_strSensorSerial);
// fill in properties
m_nZeroPlaneDistance = (XnDepthPixel)FixedParams.fReferenceDistance;
m_dZeroPlanePixelSize = FixedParams.fReferencePixelSize;
m_dEmitterDCmosDistance = FixedParams.fDCmosEmitterDistance;
- sprintf(m_strSensorSerial, "%x", FixedParams.nSerialNumber);
+ m_dDCmosRCmosDistance = FixedParams.fDCmosRCmosDistance;
+
return (XN_STATUS_OK);
diff --git a/Source/XnDeviceSensorV2/XnSensorFixedParams.h b/Source/XnDeviceSensorV2/XnSensorFixedParams.h
index 9075a39..faa4dad 100644
--- a/Source/XnDeviceSensorV2/XnSensorFixedParams.h
+++ b/Source/XnDeviceSensorV2/XnSensorFixedParams.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_FIXED_PARAMS_H__
#define __XN_SENSOR_FIXED_PARAMS_H__
@@ -46,6 +41,7 @@ class XnSensorFixedParams
inline XnDepthPixel GetZeroPlaneDistance() const { return m_nZeroPlaneDistance; }
inline XnDouble GetZeroPlanePixelSize() const { return m_dZeroPlanePixelSize; }
inline XnDouble GetEmitterDCmosDistance() const { return m_dEmitterDCmosDistance; }
+ inline XnDouble GetDCmosRCmosDistance() const { return m_dDCmosRCmosDistance; }
inline const XnChar* GetSensorSerial() const { return m_strSensorSerial; }
@@ -57,6 +53,7 @@ class XnSensorFixedParams
XnDepthPixel m_nZeroPlaneDistance;
XnDouble m_dZeroPlanePixelSize;
XnDouble m_dEmitterDCmosDistance;
+ XnDouble m_dDCmosRCmosDistance;
XnChar m_strSensorSerial[XN_DEVICE_MAX_STRING_LENGTH];
};
diff --git a/Source/XnDeviceSensorV2/XnSensorGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorGenerator.cpp
index 8fe2f6e..86e8f8f 100644
--- a/Source/XnDeviceSensorV2/XnSensorGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorGenerator.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -193,11 +187,16 @@ void XnSensorGenerator::FilterProperties(XnActualPropertiesHash* pHash)
pHash->Remove(XN_STREAM_PROPERTY_STATE);
}
-void XN_CALLBACK_TYPE XnSensorGenerator::OnDeviceNewStreamData(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie)
+void XN_CALLBACK_TYPE XnSensorGenerator::OnDeviceNewStreamData(XnDeviceHandle /*pDeviceHandle*/, const XnChar* StreamName, void* pCookie)
{
NewDataCallback *pNewDataCBParams = (NewDataCallback*)pCookie;
if (strcmp(pNewDataCBParams->m_pGenerator->m_strInstanceName, StreamName) == 0)
{
pNewDataCBParams->m_handler(pNewDataCBParams->m_pCookie);
}
-}
\ No newline at end of file
+}
+
+const void* XnSensorGenerator::GetData()
+{
+ return m_pStreamData->pData;
+}
diff --git a/Source/XnDeviceSensorV2/XnSensorGenerator.h b/Source/XnDeviceSensorV2/XnSensorGenerator.h
index 2b0dd90..97cbc5a 100644
--- a/Source/XnDeviceSensorV2/XnSensorGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_GENERATOR_H__
#define __XN_SENSOR_GENERATOR_H__
@@ -36,6 +30,10 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorGenerator :
public XnSensorProductionNode,
virtual public xn::ModuleGenerator,
@@ -58,6 +56,7 @@ class XnSensorGenerator :
void UnregisterFromNewDataAvailable(XnCallbackHandle hCallback);
XnBool IsNewDataAvailable(XnUInt64& pnTimestamp);
XnStatus UpdateData();
+ const void* GetData();
XnUInt32 GetDataSize();
XnUInt64 GetTimestamp();
XnUInt32 GetFrameID();
@@ -90,4 +89,6 @@ class XnSensorGenerator :
static void XN_CALLBACK_TYPE OnDeviceNewStreamData(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorIRGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorIRGenerator.cpp
index 0e6b093..8f45f58 100644
--- a/Source/XnDeviceSensorV2/XnSensorIRGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorIRGenerator.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -58,14 +52,6 @@ XnStatus XnSensorIRGenerator::Init()
nRetVal = RegisterToCroppingChange(OnResChangedCallback, this, m_hCroppingCallback);
XN_IS_STATUS_OK(nRetVal);
- // add SXGA 30
- XnMapOutputMode mode;
- mode.nXRes = XN_SXGA_X_RES;
- mode.nYRes = XN_SXGA_Y_RES;
- mode.nFPS = 30;
- nRetVal = m_SupportedModes.AddLast(mode);
- XN_IS_STATUS_OK(nRetVal);
-
OnResChanged();
return (XN_STATUS_OK);
@@ -116,7 +102,7 @@ void XN_CALLBACK_TYPE XnSensorIRGenerator::OnResChangedCallback(void* pCookie)
// XnExportedSensorIRGenerator class
//---------------------------------------------------------------------------
XnExportedSensorIRGenerator::XnExportedSensorIRGenerator() :
- XnExportedSensorGenerator(XN_NODE_TYPE_IR, XN_STREAM_TYPE_IR)
+ XnExportedSensorGenerator(XN_NODE_TYPE_IR, XN_STREAM_TYPE_IR, FALSE)
{}
XnSensorGenerator* XnExportedSensorIRGenerator::CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName)
diff --git a/Source/XnDeviceSensorV2/XnSensorIRGenerator.h b/Source/XnDeviceSensorV2/XnSensorIRGenerator.h
index b3510eb..da753a6 100644
--- a/Source/XnDeviceSensorV2/XnSensorIRGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorIRGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_IR_GENERATOR_H__
#define __XN_SENSOR_IR_GENERATOR_H__
@@ -37,6 +31,10 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorIRGenerator:
public XnSensorMapGenerator,
virtual public xn::ModuleIRGenerator
@@ -49,6 +47,7 @@ class XnSensorIRGenerator:
virtual XnBool IsCapabilitySupported(const XnChar* strCapabilityName);
virtual XnUInt32 GetDataSize();
+ const void* GetData() { return XnSensorMapGenerator::GetData(); }
virtual XnIRPixel* GetIRMap();
private:
@@ -68,4 +67,6 @@ class XnExportedSensorIRGenerator : public XnExportedSensorGenerator
virtual XnSensorGenerator* CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_IR_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorIRStream.cpp b/Source/XnDeviceSensorV2/XnSensorIRStream.cpp
index 30ad6ec..4dfcaa4 100644
--- a/Source/XnDeviceSensorV2/XnSensorIRStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorIRStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -37,20 +31,16 @@
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
-#define XN_IR_STREAM_DEFAULT_FPS 30
-#define XN_IR_STREAM_DEFAULT_RESOLUTION XN_RESOLUTION_QVGA
-#define XN_IR_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_RGB24
-#define XN_IR_STREAM_DEFAULT_MIRROR FALSE
-
#define XN_IR_MAX_BUFFER_SIZE (XN_SXGA_X_RES * XN_SXGA_Y_RES * sizeof(XnRGB24Pixel))
//---------------------------------------------------------------------------
// XnSensorIRStream class
//---------------------------------------------------------------------------
-XnSensorIRStream::XnSensorIRStream(const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount) :
+XnSensorIRStream::XnSensorIRStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers) :
XnIRStream(StreamName, FALSE),
m_Helper(pObjects),
- m_BufferPool(nBufferCount, StreamName, XN_IR_MAX_BUFFER_SIZE),
+ m_InputFormat(XN_STREAM_PROPERTY_INPUT_FORMAT, 0),
+ m_BufferPool(nBufferCount, strDeviceName, StreamName, XN_IR_MAX_BUFFER_SIZE, bAllowOtherUsers),
m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, m_BufferPool.GetSharedMemoryName()),
m_FirmwareCropSizeX("FirmwareCropSizeX", 0, StreamName),
m_FirmwareCropSizeY("FirmwareCropSizeY", 0, StreamName),
@@ -74,7 +64,7 @@ XnStatus XnSensorIRStream::Init()
XN_IS_STATUS_OK(nRetVal);
// add properties
- XN_VALIDATE_ADD_PROPERTIES(this, &m_SharedBufferName, &m_ActualRead);
+ XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_SharedBufferName, &m_ActualRead);
// set base properties default values
nRetVal = ResolutionProperty().UnsafeUpdateValue(XN_IR_STREAM_DEFAULT_RESOLUTION);
@@ -90,6 +80,40 @@ XnStatus XnSensorIRStream::Init()
nRetVal = m_Helper.Init(this, this);
XN_IS_STATUS_OK(nRetVal);
+ // register supported modes
+ XnCmosPreset aSupportedModes[] =
+ {
+ { 0, XN_RESOLUTION_QVGA, 30 },
+ { 0, XN_RESOLUTION_QVGA, 60 },
+ { 0, XN_RESOLUTION_VGA, 30 },
+ // --avin mod--
+ { 0, XN_RESOLUTION_SXGA, 15 },
+ };
+ nRetVal = AddSupportedModes(aSupportedModes, sizeof(aSupportedModes)/sizeof(aSupportedModes[0]));
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_1)
+ {
+ XnCmosPreset aSupportedModesSXGA[] =
+ {
+ // --avin mod--
+ { 0, XN_RESOLUTION_SXGA, 15 },
+ };
+ nRetVal = AddSupportedModes(aSupportedModesSXGA, sizeof(aSupportedModesSXGA)/sizeof(aSupportedModesSXGA[0]));
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+ {
+ XnCmosPreset aSupportedModes25[] =
+ {
+ { 0, XN_RESOLUTION_QVGA, 25 },
+ { 0, XN_RESOLUTION_VGA, 25 },
+ };
+ nRetVal = AddSupportedModes(aSupportedModes25, sizeof(aSupportedModes25)/sizeof(aSupportedModes25[0]));
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
// data processor
nRetVal = m_Helper.RegisterDataProcessorProperty(ResolutionProperty());
XN_IS_STATUS_OK(nRetVal);
@@ -113,13 +137,20 @@ XnStatus XnSensorIRStream::MapPropertiesToFirmware()
{
XnStatus nRetVal = XN_STATUS_OK;
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(ResolutionProperty(), GetFirmwareParams()->m_IRResolution, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(FPSProperty(), GetFirmwareParams()->m_IRFPS, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropSizeX, GetFirmwareParams()->m_IRCropSizeX, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropSizeY, GetFirmwareParams()->m_IRCropSizeY, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetX, GetFirmwareParams()->m_IRCropOffsetX, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetY, GetFirmwareParams()->m_IRCropOffsetY, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropEnabled, GetFirmwareParams()->m_IRCropEnabled, TRUE));
+ nRetVal = m_Helper.MapFirmwareProperty(ResolutionProperty(), GetFirmwareParams()->m_IRResolution, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(FPSProperty(), GetFirmwareParams()->m_IRFPS, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropSizeX, GetFirmwareParams()->m_IRCropSizeX, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropSizeY, GetFirmwareParams()->m_IRCropSizeY, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetX, GetFirmwareParams()->m_IRCropOffsetX, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetY, GetFirmwareParams()->m_IRCropOffsetY, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropEnabled, GetFirmwareParams()->m_IRCropEnabled, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
return (XN_STATUS_OK);
}
@@ -133,8 +164,10 @@ XnStatus XnSensorIRStream::ConfigureStreamImpl()
nRetVal = SetActualRead(TRUE);
XN_IS_STATUS_OK(nRetVal);
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(ResolutionProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(FPSProperty()));
+ nRetVal = m_Helper.ConfigureFirmware(ResolutionProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(FPSProperty());
+ XN_IS_STATUS_OK(nRetVal);;
// IR mirror is always off in firmware
nRetVal = GetFirmwareParams()->m_IRMirror.SetValue(FALSE);
@@ -159,7 +192,8 @@ XnStatus XnSensorIRStream::SetActualRead(XnBool bRead)
if (bRead)
{
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Creating USB IR read thread...");
- nRetVal = xnUSBInitReadThread(GetHelper()->GetPrivateData()->pSpecificImageUsb->pUsbConnection->UsbEp, GetHelper()->GetPrivateData()->pSpecificImageUsb->nChunkReadBytes, XN_SENSOR_USB_IMAGE_BUFFERS, XN_SENSOR_READ_THREAD_TIMEOUT, XnDeviceSensorProtocolUsbEpCb, GetHelper()->GetPrivateData()->pSpecificImageUsb);
+ XnSpecificUsbDevice* pUSB = GetHelper()->GetPrivateData()->pSpecificImageUsb;
+ nRetVal = xnUSBInitReadThread(pUSB->pUsbConnection->UsbEp, pUSB->nChunkReadBytes, XN_SENSOR_USB_DEPTH_BUFFERS, pUSB->nTimeout, XnDeviceSensorProtocolUsbEpCb, pUSB);
XN_IS_STATUS_OK(nRetVal);
}
else
@@ -185,12 +219,17 @@ XnStatus XnSensorIRStream::OpenStreamImpl()
// Cropping
if (m_FirmwareCropEnabled.GetValue() == TRUE)
{
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropSizeX));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropSizeY));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropOffsetX));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropOffsetY));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropSizeX);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropSizeY);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropOffsetX);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropOffsetY);
+ XN_IS_STATUS_OK(nRetVal);;
}
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropEnabled));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropEnabled);
+ XN_IS_STATUS_OK(nRetVal);;
nRetVal = XnIRStream::Open();
@@ -245,7 +284,7 @@ XnStatus XnSensorIRStream::SetFPS(XnUInt32 nFPS)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.BeforeSettingFirmwareParam(FPSProperty(), nFPS);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(FPSProperty(), (XnUInt16)nFPS);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnIRStream::SetFPS(nFPS);
@@ -261,22 +300,7 @@ XnStatus XnSensorIRStream::SetResolution(XnResolutions nResolution)
{
XnStatus nRetVal = XN_STATUS_OK;
- switch (nResolution)
- {
- case XN_RESOLUTION_QVGA:
- case XN_RESOLUTION_VGA:
- break;
- case XN_RESOLUTION_SXGA:
- if (m_Helper.GetFirmwareVersion() < XN_SENSOR_FW_VER_5_1)
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "IR resolution is not supported by this firmware!");
- }
- break;
- default:
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported IR resolution: %d", nResolution);
- }
-
- nRetVal = m_Helper.BeforeSettingFirmwareParam(ResolutionProperty(), nResolution);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(ResolutionProperty(), (XnUInt16)nResolution);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnIRStream::SetResolution(nResolution);
@@ -311,7 +335,7 @@ XnStatus XnSensorIRStream::SetCropping(const XnCropping* pCropping)
XnUInt16 nXOffset = pCropping->nXOffset;
if (IsMirrored())
{
- nXOffset = GetXRes() - pCropping->nXOffset - pCropping->nXSize;
+ nXOffset = (XnUInt16)(GetXRes() - pCropping->nXOffset - pCropping->nXSize);
}
if (pCropping->bEnabled)
@@ -329,7 +353,9 @@ XnStatus XnSensorIRStream::SetCropping(const XnCropping* pCropping)
}
if (nRetVal == XN_STATUS_OK)
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareCropEnabled, pCropping->bEnabled);
+ {
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareCropEnabled, (XnUInt16)pCropping->bEnabled);
+ }
if (nRetVal != XN_STATUS_OK)
{
@@ -422,8 +448,6 @@ XnStatus XnSensorIRStream::CropImpl(XnStreamData* pStreamOutput, const XnCroppin
XnStatus XnSensorIRStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnDataProcessor* pNew;
XN_VALIDATE_NEW_AND_INIT(pNew, XnIRProcessor, this, &m_Helper);
@@ -447,13 +471,13 @@ XnStatus XnSensorIRStream::OnIsMirroredChanged()
return (XN_STATUS_OK);
}
-XnStatus XnSensorIRStream::IsMirroredChangedCallback(const XnProperty* pSender, void* pCookie)
+XnStatus XnSensorIRStream::IsMirroredChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
{
XnSensorIRStream* pThis = (XnSensorIRStream*)pCookie;
return pThis->OnIsMirroredChanged();
}
-XnStatus XN_CALLBACK_TYPE XnSensorIRStream::SetActualReadCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorIRStream::SetActualReadCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorIRStream* pThis = (XnSensorIRStream*)pCookie;
return pThis->SetActualRead(nValue == TRUE);
diff --git a/Source/XnDeviceSensorV2/XnSensorIRStream.h b/Source/XnDeviceSensorV2/XnSensorIRStream.h
index 68ab322..f7ad01f 100644
--- a/Source/XnDeviceSensorV2/XnSensorIRStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorIRStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_IR_STREAM_H__
#define __XN_SENSOR_IR_STREAM_H__
@@ -34,13 +29,21 @@
#include "XnSensorStreamHelper.h"
#include "XnSharedMemoryBufferPool.h"
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+#define XN_IR_STREAM_DEFAULT_FPS 30
+#define XN_IR_STREAM_DEFAULT_RESOLUTION XN_RESOLUTION_QVGA
+#define XN_IR_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_RGB24
+#define XN_IR_STREAM_DEFAULT_MIRROR FALSE
+
//---------------------------------------------------------------------------
// XnSensorIRStream class
//---------------------------------------------------------------------------
class XnSensorIRStream : public XnIRStream, public IXnSensorStream
{
public:
- XnSensorIRStream(const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount);
+ XnSensorIRStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers);
~XnSensorIRStream() { Free(); }
//---------------------------------------------------------------------------
@@ -71,7 +74,7 @@ class XnSensorIRStream : public XnIRStream, public IXnSensorStream
XnStatus CreateDataProcessor(XnDataProcessor** ppProcessor);
XnStatus MapPropertiesToFirmware();
void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = GetResolution(); *pnFPS = GetFPS(); }
- XnStatus WriteImpl(XnStreamData* pStreamData) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+ XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return &m_BufferPool; }
//---------------------------------------------------------------------------
@@ -90,6 +93,8 @@ class XnSensorIRStream : public XnIRStream, public IXnSensorStream
static XnStatus XN_CALLBACK_TYPE IsMirroredChangedCallback(const XnProperty* pSender, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetActualReadCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ XnActualIntProperty m_InputFormat;
+
XnSensorStreamHelper m_Helper;
XnSharedMemoryBufferPool m_BufferPool;
diff --git a/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp
index 1516020..b961e91 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp
@@ -1,35 +1,39 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnSensorImageGenerator.h"
#include
+#include "XnSensorImageStream.h"
+
+//---------------------------------------------------------------------------
+// Static Data
+//---------------------------------------------------------------------------
+static const XnUInt32 INVALID_INPUT_FORMAT = 9999;
+static XnUInt32 g_anAllowedRGBFormats[] = { XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_IO_IMAGE_FORMAT_YUV422, XN_IO_IMAGE_FORMAT_BAYER, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER };
+static XnUInt32 g_anAllowedYUVFormats[] = { XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_IO_IMAGE_FORMAT_YUV422 };
+static XnUInt32 g_anAllowedJPEGFormats[] = { XN_IO_IMAGE_FORMAT_JPEG };
+static XnUInt32 g_anAllowedGray8Formats[] = { XN_IO_IMAGE_FORMAT_UNCOMPRESSED_GRAY8, XN_IO_IMAGE_FORMAT_BAYER, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER };
//---------------------------------------------------------------------------
// XnSensorImageGenerator class
@@ -38,43 +42,12 @@ XnSensorImageGenerator::XnSensorImageGenerator(xn::Context& context, xn::Device&
XnSensorMapGenerator(context, sensor, pSensor, strStreamName)
{}
-XnStatus XnSensorImageGenerator::Init()
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- nRetVal = XnSensorMapGenerator::Init();
- XN_IS_STATUS_OK(nRetVal);
-
- // add supported modes unique for image
- XnMapOutputMode mode;
-
- switch (m_Version.FWVer)
- {
- case XN_SENSOR_FW_VER_5_1:
- case XN_SENSOR_FW_VER_5_2:
- // UXGA 30
- mode.nXRes = XN_UXGA_X_RES;
- mode.nYRes = XN_UXGA_Y_RES;
- mode.nFPS = 30;
- nRetVal = m_SupportedModes.AddLast(mode);
- XN_IS_STATUS_OK(nRetVal);
- break;
- case XN_SENSOR_FW_VER_5_3:
- // SXGA 30
- mode.nXRes = XN_SXGA_X_RES;
- mode.nYRes = XN_SXGA_Y_RES;
- mode.nFPS = 30;
- nRetVal = m_SupportedModes.AddLast(mode);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
-
- return (XN_STATUS_OK);
-}
-
XnBool XnSensorImageGenerator::IsCapabilitySupported(const XnChar* strCapabilityName)
{
- return XnSensorMapGenerator::IsCapabilitySupported(strCapabilityName);
+ return
+ (GetGeneralIntInterface(strCapabilityName) != NULL ||
+ strcmp(strCapabilityName, XN_CAPABILITY_ANTI_FLICKER) == 0 ||
+ XnSensorMapGenerator::IsCapabilitySupported(strCapabilityName));
}
XnUInt8* XnSensorImageGenerator::GetImageMap()
@@ -84,15 +57,75 @@ XnUInt8* XnSensorImageGenerator::GetImageMap()
XnBool XnSensorImageGenerator::IsPixelFormatSupported(XnPixelFormat Format)
{
- switch (Format)
+ for (XnUInt32 i = 0; i < m_nSupportedModesCount; ++i)
{
- case XN_PIXEL_FORMAT_RGB24:
- case XN_PIXEL_FORMAT_YUV422:
- case XN_PIXEL_FORMAT_GRAYSCALE_8_BIT:
- return TRUE;
- default:
- return FALSE;
+ switch (Format)
+ {
+ case XN_PIXEL_FORMAT_RGB24:
+ case XN_PIXEL_FORMAT_YUV422:
+ if (m_aSupportedModes[i].nInputFormat == XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422 ||
+ m_aSupportedModes[i].nInputFormat == XN_IO_IMAGE_FORMAT_YUV422)
+ {
+ return TRUE;
+ }
+ break;
+ case XN_PIXEL_FORMAT_GRAYSCALE_8_BIT:
+ if (m_aSupportedModes[i].nInputFormat == XN_IO_IMAGE_FORMAT_BAYER ||
+ m_aSupportedModes[i].nInputFormat == XN_IO_IMAGE_FORMAT_UNCOMPRESSED_GRAY8)
+ {
+ return TRUE;
+ }
+ break;
+ case XN_PIXEL_FORMAT_MJPEG:
+ if (m_aSupportedModes[i].nInputFormat == XN_IO_IMAGE_FORMAT_JPEG)
+ {
+ return TRUE;
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ }
+
+ // not found
+ return FALSE;
+}
+
+XnUInt32 XnSensorImageGenerator::FindSupportedInputFormat(XnUInt32* anAllowedInputFormats, XnUInt32 nAllowedInputFormats)
+{
+ // first check if current one is allowed
+ XnUInt64 nCurrentInputFormat;
+ GetIntProperty(XN_STREAM_PROPERTY_INPUT_FORMAT, nCurrentInputFormat);
+
+ for (XnUInt32 i = 0; i < nAllowedInputFormats; ++i)
+ {
+ if (anAllowedInputFormats[i] == nCurrentInputFormat)
+ {
+ return (XnUInt32)nCurrentInputFormat;
+ }
+ }
+
+ // current one is not allowed. find a matching mode and take its input format
+ XnMapOutputMode outputMode;
+ GetMapOutputMode(outputMode);
+
+ // the order in the allowed input formats is the preferred one
+ for (XnUInt32 iInput = 0; iInput < nAllowedInputFormats; ++iInput)
+ {
+ // see if such a mode exists
+ for (XnUInt32 iMode = 0; iMode < m_nSupportedModesCount; ++iMode)
+ {
+ if (m_aSupportedModes[iMode].nInputFormat == anAllowedInputFormats[iInput] &&
+ m_aSupportedModes[iMode].OutputMode.nXRes == outputMode.nXRes &&
+ m_aSupportedModes[iMode].OutputMode.nYRes == outputMode.nYRes &&
+ m_aSupportedModes[iMode].OutputMode.nFPS == outputMode.nFPS)
+ {
+ return anAllowedInputFormats[iInput];
+ }
+ }
}
+
+ return INVALID_INPUT_FORMAT;
}
XnStatus XnSensorImageGenerator::SetPixelFormat(XnPixelFormat Format)
@@ -102,24 +135,50 @@ XnStatus XnSensorImageGenerator::SetPixelFormat(XnPixelFormat Format)
return (XN_STATUS_OK);
}
+ XN_PROPERTY_SET_CREATE_ON_STACK(props);
+ XnStatus nRetVal = XnPropertySetAddModule(&props, m_strModule);
+ XN_IS_STATUS_OK(nRetVal);
+
XnOutputFormats OutputFormat;
+ XnUInt32* anAllowedInputFormats = NULL;
+ XnUInt32 nAllowedInputFormats = 0;
switch (Format)
{
case XN_PIXEL_FORMAT_RGB24:
OutputFormat = XN_OUTPUT_FORMAT_RGB24;
+ anAllowedInputFormats = g_anAllowedRGBFormats;
+ nAllowedInputFormats = sizeof(g_anAllowedRGBFormats)/sizeof(XnUInt32);
break;
case XN_PIXEL_FORMAT_YUV422:
OutputFormat = XN_OUTPUT_FORMAT_YUV422;
+ anAllowedInputFormats = g_anAllowedYUVFormats;
+ nAllowedInputFormats = sizeof(g_anAllowedYUVFormats)/sizeof(XnUInt32);
break;
case XN_PIXEL_FORMAT_GRAYSCALE_8_BIT:
OutputFormat = XN_OUTPUT_FORMAT_GRAYSCALE8;
+ anAllowedInputFormats = g_anAllowedGray8Formats;
+ nAllowedInputFormats = sizeof(g_anAllowedGray8Formats)/sizeof(XnUInt32);
+ break;
+ case XN_PIXEL_FORMAT_MJPEG:
+ OutputFormat = XN_OUTPUT_FORMAT_JPEG;
+ anAllowedInputFormats = g_anAllowedJPEGFormats;
+ nAllowedInputFormats = sizeof(g_anAllowedJPEGFormats)/sizeof(XnUInt32);
break;
default:
return XN_STATUS_INVALID_OPERATION;
}
- return m_pSensor->SetProperty(m_strModule, XN_STREAM_PROPERTY_OUTPUT_FORMAT, (XnUInt64)OutputFormat);
+ XnUInt32 nInputFormat = FindSupportedInputFormat(anAllowedInputFormats, nAllowedInputFormats);
+ if (nInputFormat == INVALID_INPUT_FORMAT)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Cannot set pixel format to %s - no matching input format.", xnPixelFormatToString(Format));
+ }
+
+ XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_INPUT_FORMAT, (XnUInt64)nInputFormat);
+ XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_OUTPUT_FORMAT, (XnUInt64)OutputFormat);
+
+ return m_pSensor->BatchConfig(&props);
}
XnPixelFormat XnSensorImageGenerator::GetPixelFormat()
@@ -135,6 +194,8 @@ XnPixelFormat XnSensorImageGenerator::GetPixelFormat()
return XN_PIXEL_FORMAT_YUV422;
case XN_OUTPUT_FORMAT_GRAYSCALE8:
return XN_PIXEL_FORMAT_GRAYSCALE_8_BIT;
+ case XN_OUTPUT_FORMAT_JPEG:
+ return XN_PIXEL_FORMAT_MJPEG;
default:
xnLogError(XN_MASK_DEVICE_SENSOR, "Unknown output format: %d", nValue);
return (XnPixelFormat)-1;
@@ -163,13 +224,250 @@ void XnSensorImageGenerator::FilterProperties(XnActualPropertiesHash* pHash)
pHash->Remove(XN_STREAM_PROPERTY_OUTPUT_FORMAT);
}
+xn::ModuleGeneralIntInterface* XnSensorImageGenerator::GetGeneralIntInterface( const XnChar* strCap )
+{
+ if (m_Version.FWVer < XN_SENSOR_FW_VER_5_4)
+ {
+ return NULL;
+ }
+
+ if (strcmp(strCap, XN_CAPABILITY_BRIGHTNESS) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_CONTRAST) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_SATURATION) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_SHARPNESS) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_COLOR_TEMPERATURE) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_BACKLIGHT_COMPENSATION) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_GAIN) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_ZOOM) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_EXPOSURE) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_PAN) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_TILT) == 0 ||
+ strcmp(strCap, XN_CAPABILITY_LOW_LIGHT_COMPENSATION) == 0)
+ {
+ return this;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+XnStatus XnSensorImageGenerator::GetRange( const XnChar* strCap, XnInt32& nMin, XnInt32& nMax, XnInt32& nStep, XnInt32& nDefault, XnBool& bIsAutoSupported )
+{
+ if (strcmp(strCap, XN_CAPABILITY_BRIGHTNESS) == 0)
+ {
+ nMin = 0;
+ nMax = 255;
+ nStep = 1;
+ nDefault = 128;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_CONTRAST) == 0)
+ {
+ nMin = 0;
+ nMax = 255;
+ nStep = 1;
+ nDefault = 32;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_SATURATION) == 0)
+ {
+ nMin = 0;
+ nMax = 255;
+ nStep = 1;
+ nDefault = 128;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_SHARPNESS) == 0)
+ {
+ nMin = 0;
+ nMax = 255;
+ nStep = 1;
+ nDefault = 32;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_COLOR_TEMPERATURE) == 0)
+ {
+ nMin = 0;
+ nMax = 10000;
+ nStep = 1;
+ nDefault = 5000;
+ bIsAutoSupported = TRUE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_BACKLIGHT_COMPENSATION) == 0)
+ {
+ nMin = 0;
+ nMax = 3;
+ nStep = 1;
+ nDefault = 1;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_GAIN) == 0)
+ {
+ nMin = 0;
+ nMax = 255;
+ nStep = 1;
+ nDefault = 128;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_ZOOM) == 0)
+ {
+ nMin = 100;
+ nMax = 200;
+ nStep = 10;
+ nDefault = 100;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_EXPOSURE) == 0)
+ {
+ nMin = 5;
+ nMax = 2000;
+ nStep = 1;
+ nDefault = 100;
+ bIsAutoSupported = TRUE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_PAN) == 0)
+ {
+ nMin = -180;
+ nMax = 180;
+ nStep = 1;
+ nDefault = 0;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_TILT) == 0)
+ {
+ nMin = -180;
+ nMax = 180;
+ nStep = 1;
+ nDefault = 0;
+ bIsAutoSupported = FALSE;
+ }
+ else if (strcmp(strCap, XN_CAPABILITY_LOW_LIGHT_COMPENSATION) == 0)
+ {
+ nMin = 0;
+ nMax = 1;
+ nStep = 1;
+ nDefault = 1;
+ bIsAutoSupported = FALSE;
+ }
+ else
+ {
+ return XN_STATUS_NO_SUCH_PROPERTY;
+ }
+
+ return XN_STATUS_OK;
+}
+
+XnStatus XnSensorImageGenerator::Get( const XnChar* strCap, XnInt32& nValue )
+{
+ XnUInt64 nValue64;
+ XnStatus nRetVal = GetIntProperty(strCap, nValue64);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nValue = (XnInt32)nValue64;
+
+ return XN_STATUS_OK;
+}
+
+XnInt32 XnSensorImageGenerator::Set( const XnChar* strCap, XnInt32 nValue )
+{
+ return SetIntProperty(strCap, nValue);
+}
+
+XnStatus XnSensorImageGenerator::RegisterToValueChange( const XnChar* strCap, XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback )
+{
+ const XnChar* strProps[] =
+ {
+ strCap,
+ NULL
+ };
+
+ return RegisterToProps(handler, pCookie, hCallback, strProps);
+}
+
+void XnSensorImageGenerator::UnregisterFromValueChange( const XnChar* /*strCap*/, XnCallbackHandle hCallback )
+{
+ UnregisterFromProps(hCallback);
+}
+
+XnPowerLineFrequency XnSensorImageGenerator::GetPowerLineFrequency()
+{
+ XnUInt64 nFlicker;
+ GetIntProperty(XN_STREAM_PROPERTY_FLICKER, nFlicker);
+ return (XnPowerLineFrequency)nFlicker;
+}
+
+XnStatus XnSensorImageGenerator::SetPowerLineFrequency( XnPowerLineFrequency nFrequency )
+{
+ return SetIntProperty(XN_STREAM_PROPERTY_FLICKER, nFrequency);
+}
+
+XnStatus XnSensorImageGenerator::RegisterToPowerLineFrequencyChange( XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback )
+{
+ const XnChar* strProps[] =
+ {
+ XN_STREAM_PROPERTY_FLICKER,
+ NULL
+ };
+
+ return RegisterToProps(handler, pCookie, hCallback, strProps);
+}
+
+void XnSensorImageGenerator::UnregisterFromPowerLineFrequencyChange( XnCallbackHandle hCallback )
+{
+ return UnregisterFromProps(hCallback);
+}
+
//---------------------------------------------------------------------------
// XnExportedSensorImageGenerator class
//---------------------------------------------------------------------------
XnExportedSensorImageGenerator::XnExportedSensorImageGenerator() :
- XnExportedSensorGenerator(XN_NODE_TYPE_IMAGE, XN_STREAM_TYPE_IMAGE)
+ XnExportedSensorGenerator(XN_NODE_TYPE_IMAGE, XN_STREAM_TYPE_IMAGE, FALSE)
{}
+XnStatus XnExportedSensorImageGenerator::IsSupportedForDevice(xn::Context& context, xn::NodeInfo& sensorInfo, XnBool* pbSupported)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = XnExportedSensorGenerator::IsSupportedForDevice(context, sensorInfo, pbSupported);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (*pbSupported == FALSE)
+ {
+ return XN_STATUS_OK;
+ }
+
+ xn::Device sensor;
+ nRetVal = sensorInfo.GetInstance(sensor);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnBool bShouldBeCreated = (!sensor.IsValid());
+
+ if (bShouldBeCreated)
+ {
+ nRetVal = context.CreateProductionTree(sensorInfo, sensor);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ // This is an ugly patch to find out if this sensor has an image CMOS. It will be fixed
+ // in future firmwares so we can just ask.
+ XnCmosBlankingUnits units;
+ units.nCmosID = XN_CMOS_TYPE_IMAGE;
+ nRetVal = sensor.GetGeneralProperty(XN_MODULE_PROPERTY_CMOS_BLANKING_UNITS, sizeof(units), &units);
+ if (nRetVal != XN_STATUS_OK || units.nUnits == 0)
+ {
+ // Failed. this means no image CMOS
+ *pbSupported = FALSE;
+ }
+
+ if (bShouldBeCreated)
+ {
+ sensor.Release();
+ }
+
+ return (XN_STATUS_OK);
+}
+
XnSensorGenerator* XnExportedSensorImageGenerator::CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName)
{
return XN_NEW(XnSensorImageGenerator, context, sensor, pSensor, strStreamName);
diff --git a/Source/XnDeviceSensorV2/XnSensorImageGenerator.h b/Source/XnDeviceSensorV2/XnSensorImageGenerator.h
index 82983cd..15fdb35 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorImageGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_IMAGE_GENERATOR_H__
#define __XN_SENSOR_IMAGE_GENERATOR_H__
@@ -37,17 +31,22 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorImageGenerator:
public XnSensorMapGenerator,
- virtual public xn::ModuleImageGenerator
+ virtual public xn::ModuleImageGenerator,
+ virtual public xn::ModuleGeneralIntInterface,
+ virtual public xn::ModuleAntiFlickerInterface
{
public:
XnSensorImageGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
- XnStatus Init();
-
XnBool IsCapabilitySupported(const XnChar* strCapabilityName);
+ const void* GetData() { return XnSensorMapGenerator::GetData(); }
XnUInt8* GetImageMap();
XnBool IsPixelFormatSupported(XnPixelFormat Format);
XnStatus SetPixelFormat(XnPixelFormat Format);
@@ -55,15 +54,36 @@ class XnSensorImageGenerator:
XnStatus RegisterToPixelFormatChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
void UnregisterFromPixelFormatChange(XnCallbackHandle hCallback);
+ virtual xn::ModuleGeneralIntInterface* GetGeneralIntInterface(const XnChar* strCap);
+ virtual XnStatus GetRange(const XnChar* strCap, XnInt32& nMin, XnInt32& nMax, XnInt32& nStep, XnInt32& nDefault, XnBool& bIsAutoSupported);
+ virtual XnStatus Get(const XnChar* strCap, XnInt32& nValue);
+ virtual XnInt32 Set(const XnChar* strCap, XnInt32 nValue);
+ virtual XnStatus RegisterToValueChange(const XnChar* strCap, XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
+ virtual void UnregisterFromValueChange(const XnChar* strCap, XnCallbackHandle hCallback);
+
+ virtual xn::ModuleAntiFlickerInterface* GetAntiFlickerInterface() { return this; }
+ virtual XnPowerLineFrequency GetPowerLineFrequency();
+ virtual XnStatus SetPowerLineFrequency( XnPowerLineFrequency nFrequency );
+ virtual XnStatus RegisterToPowerLineFrequencyChange( XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback );
+ virtual void UnregisterFromPowerLineFrequencyChange( XnCallbackHandle hCallback );
+
protected:
virtual void FilterProperties(XnActualPropertiesHash* pHash);
+
+private:
+ XnUInt32 FindSupportedInputFormat(XnUInt32* anAllowedInputFormats, XnUInt32 nAllowedInputFormats);
};
class XnExportedSensorImageGenerator : public XnExportedSensorGenerator
{
public:
XnExportedSensorImageGenerator();
+
+protected:
+ virtual XnStatus IsSupportedForDevice(xn::Context& context, xn::NodeInfo& sensorInfo, XnBool* pbSupported);
virtual XnSensorGenerator* CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_IMAGE_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorImageStream.cpp b/Source/XnDeviceSensorV2/XnSensorImageStream.cpp
index 7f39b8b..71bb36a 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorImageStream.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -35,44 +29,57 @@
#include "XnUncompressedBayerProcessor.h"
#include "XnPSCompressedImageProcessor.h"
#include "XnJpegImageProcessor.h"
+#include "XnJpegToRGBImageProcessor.h"
#include "XnUncompressedYUVImageProcessor.h"
#include "XnUncompressedYUVtoRGBImageProcessor.h"
#include "YUV.h"
#include "Bayer.h"
#include
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-#define XN_IMAGE_STREAM_DEFAULT_FPS 30
-#define XN_IMAGE_STREAM_DEFAULT_RESOLUTION XN_RESOLUTION_QVGA
-#define XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT XN_IO_IMAGE_FORMAT_YUV422
-#define XN_IMAGE_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_RGB24
-#define XN_IMAGE_STREAM_DEFAULT_FLICKER 0
-#define XN_IMAGE_STREAM_DEFAULT_QUALITY 10
-
//---------------------------------------------------------------------------
// XnSensorImageStream class
//---------------------------------------------------------------------------
-XnSensorImageStream::XnSensorImageStream(const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount) :
+XnSensorImageStream::XnSensorImageStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers) :
XnImageStream(StreamName, FALSE),
m_Helper(pObjects),
- m_BufferPool(nBufferCount, StreamName, GetMaxBufferSize(m_Helper.GetFirmwareVersion())),
+ m_BufferPool(nBufferCount, strDeviceName, StreamName, GetMaxBufferSize(m_Helper.GetFirmwareVersion()), bAllowOtherUsers),
m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, m_BufferPool.GetSharedMemoryName()),
m_InputFormat(XN_STREAM_PROPERTY_INPUT_FORMAT, XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT),
m_AntiFlicker(XN_STREAM_PROPERTY_FLICKER, XN_IMAGE_STREAM_DEFAULT_FLICKER),
m_ImageQuality(XN_STREAM_PROPERTY_QUALITY, XN_IMAGE_STREAM_DEFAULT_QUALITY),
+ m_Brightness(XN_STREAM_PROPERTY_BRIGHTNESS, XN_IMAGE_STREAM_DEFAULT_BRIGHTNESS),
+ m_Contrast(XN_STREAM_PROPERTY_CONTRAST, XN_IMAGE_STREAM_DEFAULT_CONTRAST),
+ m_Saturation(XN_STREAM_PROPERTY_SATURATION, XN_IMAGE_STREAM_DEFAULT_SATURATION),
+ m_Sharpness(XN_STREAM_PROPERTY_SHARPNESS, XN_IMAGE_STREAM_DEFAULT_SHARPNESS),
+ m_ColorTemperature(XN_STREAM_PROPERTY_COLOR_TEMPERATURE, XN_IMAGE_STREAM_DEFAULT_COLOR_TEMP),
+ m_BackLightCompensation(XN_STREAM_PROPERTY_BACKLIGHT_COMPENSATION, XN_IMAGE_STREAM_DEFAULT_BACKLIGHT_COMP),
+ m_Gain(XN_STREAM_PROPERTY_GAIN, XN_IMAGE_STREAM_DEFAULT_GAIN),
+ m_Zoom(XN_STREAM_PROPERTY_ZOOM, XN_IMAGE_STREAM_DEFAULT_ZOOM),
+ m_Exposure(XN_STREAM_PROPERTY_EXPOSURE, XN_IMAGE_STREAM_DEFAULT_EXPOSURE_BAR),
+ m_Pan(XN_STREAM_PROPERTY_PAN, XN_IMAGE_STREAM_DEFAULT_PAN),
+ m_Tilt(XN_STREAM_PROPERTY_TILT, XN_IMAGE_STREAM_DEFAULT_TILT),
+ m_LowLightCompensation(XN_STREAM_PROPERTY_LOW_LIGHT_COMPENSATION, XN_IMAGE_STREAM_DEFAULT_LOW_LIGHT_COMP),
m_FirmwareMirror("FirmwareMirror", FALSE, StreamName),
m_FirmwareCropSizeX("FirmwareCropSizeX", 0, StreamName),
m_FirmwareCropSizeY("FirmwareCropSizeY", 0, StreamName),
m_FirmwareCropOffsetX("FirmwareCropOffsetX", 0, StreamName),
m_FirmwareCropOffsetY("FirmwareCropOffsetY", 0, StreamName),
m_FirmwareCropEnabled("FirmwareCropEnabled", FALSE, StreamName),
+ m_FirmwareColorTemperature("FirmwareWhiteBalance", 0, StreamName),
+ m_FirmwareAutoWhiteBalance("FirmwareAutoWhiteBalance", 0, StreamName),
+ m_FirmwareExposure("FirmwareExposure", 0, StreamName),
+ m_FirmwareAutoExposure("FirmwareAutoExposure", FALSE, StreamName),
m_ActualRead(XN_STREAM_PROPERTY_ACTUAL_READ_DATA, FALSE)
{
m_ActualRead.UpdateSetCallback(SetActualReadCallback, this);
}
+static XnStatus AddSupportedMode(XnArray& modes, XnUInt16 nInputFormat, XnUInt16 nResolution, XnUInt16 nFPS)
+{
+ XnCmosPreset preset = { nInputFormat, nResolution, nFPS };
+ return modes.AddLast(preset);
+}
+
XnStatus XnSensorImageStream::Init()
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -87,9 +94,24 @@ XnStatus XnSensorImageStream::Init()
m_InputFormat.UpdateSetCallback(SetInputFormatCallback, this);
m_AntiFlicker.UpdateSetCallback(SetAntiFlickerCallback, this);
m_ImageQuality.UpdateSetCallback(SetImageQualityCallback, this);
+ m_Brightness.UpdateSetCallbackToDefault();
+ m_Contrast.UpdateSetCallbackToDefault();
+ m_Saturation.UpdateSetCallbackToDefault();
+ m_Zoom.UpdateSetCallbackToDefault();
+ m_Pan.UpdateSetCallbackToDefault();
+ m_Tilt.UpdateSetCallbackToDefault();
+ m_Sharpness.UpdateSetCallback(SetSharpnessCallback, this);
+ m_ColorTemperature.UpdateSetCallback(SetColorTemperatureCallback, this);
+ m_BackLightCompensation.UpdateSetCallback(SetBacklightCompensationCallback, this);
+ m_Gain.UpdateSetCallback(SetGainCallback, this);
+ m_Exposure.UpdateSetCallback(SetExposureCallback, this);
+ m_LowLightCompensation.UpdateSetCallback(SetLowLightCompensationCallback, this);
// add properties
XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_AntiFlicker, &m_ImageQuality,
+ &m_Brightness, &m_Contrast, &m_Saturation, &m_Sharpness,
+ &m_ColorTemperature, &m_BackLightCompensation, &m_Gain, &m_Zoom,
+ &m_Exposure, &m_Pan, &m_Tilt, &m_LowLightCompensation,
&m_SharedBufferName, &m_ActualRead);
// set base properties default values
@@ -116,6 +138,161 @@ XnStatus XnSensorImageStream::Init()
nRetVal = m_Helper.RegisterDataProcessorProperty(ResolutionProperty());
XN_IS_STATUS_OK(nRetVal);
+ // register supported modes
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_4)
+ {
+ // ask the firmware
+ const XnUInt32 nAllocSize = 100;
+ XnUInt32 nCount = nAllocSize;
+ XnCmosPreset aSupportedModes[nAllocSize];
+ nRetVal = XnHostProtocolGetCmosPresets(m_Helper.GetPrivateData(), XN_CMOS_TYPE_IMAGE, aSupportedModes, nCount);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (nCount == 0)
+ {
+ xnLogError(XN_MASK_DEVICE_SENSOR, "Device does not support any image mode!");
+ return XN_STATUS_DEVICE_UNSUPPORTED_PARAMETER;
+ }
+
+ // check if our current (default) configuration is valid
+ XnUInt16 nValidInputFormat = XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT;
+ XnBool bModeFound = FALSE;
+
+ for (XnUInt32 i = 0; i < nCount; ++i)
+ {
+ if (aSupportedModes[i].nResolution == XN_IMAGE_STREAM_DEFAULT_RESOLUTION &&
+ aSupportedModes[i].nFPS == XN_IMAGE_STREAM_DEFAULT_FPS)
+ {
+ // found
+ if (!bModeFound)
+ {
+ bModeFound = TRUE;
+ nValidInputFormat = aSupportedModes[i].nFormat;
+ }
+
+ if (aSupportedModes[i].nFormat == XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT)
+ {
+ nValidInputFormat = XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT;
+ break;
+ }
+ }
+ }
+
+ if (!bModeFound)
+ {
+ xnLogWarning(XN_MASK_DEVICE_SENSOR, "Default mode (res + FPS) is not supported by device. Changing defaults...");
+
+ nRetVal = ResolutionProperty().UnsafeUpdateValue(aSupportedModes[0].nResolution);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = FPSProperty().UnsafeUpdateValue(aSupportedModes[0].nFPS);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_InputFormat.UnsafeUpdateValue(aSupportedModes[0].nFormat);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ else
+ {
+ // just update input format
+ nRetVal = m_InputFormat.UnsafeUpdateValue(nValidInputFormat);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ nRetVal = AddSupportedModes(aSupportedModes, nCount);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ else
+ {
+ XnArray supportedModes(30);
+
+ // Uncompressed modes are only supported in ISO (not BULK)
+ XnBool bUncompressedAllowed = m_Helper.GetPrivateData()->pSpecificImageUsb->pUsbConnection->bIsISO;
+
+ // start with common modes supported by all
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 60);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_VGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // --avin mod--
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER, XN_RESOLUTION_SXGA, 15);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER, XN_RESOLUTION_QVGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER, XN_RESOLUTION_QVGA, 60);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER, XN_RESOLUTION_VGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+
+
+ // add uncompressed ones
+ if (bUncompressedAllowed)
+ {
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 60);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_VGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ // starting with FW 5.2, 25 FPS is also supported
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+ {
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 25);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_VGA, 25);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (bUncompressedAllowed)
+ {
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 25);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_VGA, 25);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ }
+
+ // high-res
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_3)
+ {
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_BAYER, XN_RESOLUTION_SXGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // starting with 5.3.28, YUV is also supported in high-res
+ if (m_Helper.GetPrivateData()->Version.nMajor > 5 ||
+ (m_Helper.GetPrivateData()->Version.nMajor == 5 && m_Helper.GetPrivateData()->Version.nMinor > 3) ||
+ (m_Helper.GetPrivateData()->Version.nMajor == 5 && m_Helper.GetPrivateData()->Version.nMinor == 3 && m_Helper.GetPrivateData()->Version.nBuild >= 28))
+ {
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_SXGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (bUncompressedAllowed)
+ {
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_SXGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ }
+ }
+ else if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+ {
+ // on 5.2, high-res was UXGA
+ nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_BAYER, XN_RESOLUTION_UXGA, 30);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ // Add all supported modes to the stream
+ nRetVal = AddSupportedModes(supportedModes.GetData(), supportedModes.GetSize());
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (!bUncompressedAllowed)
+ {
+ // update default input format
+ nRetVal = m_InputFormat.UnsafeUpdateValue(XN_IO_IMAGE_FORMAT_YUV422);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ }
+
return (XN_STATUS_OK);
}
@@ -144,17 +321,44 @@ XnStatus XnSensorImageStream::MapPropertiesToFirmware()
{
XnStatus nRetVal = XN_STATUS_OK;
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_InputFormat, GetFirmwareParams()->m_ImageFormat, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(ResolutionProperty(), GetFirmwareParams()->m_ImageResolution, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(FPSProperty(), GetFirmwareParams()->m_ImageFPS, FALSE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_AntiFlicker, GetFirmwareParams()->m_ImageFlickerDetection, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_ImageQuality, GetFirmwareParams()->m_ImageQuality, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareMirror, GetFirmwareParams()->m_ImageMirror, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropSizeX, GetFirmwareParams()->m_ImageCropSizeX, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropSizeY, GetFirmwareParams()->m_ImageCropSizeY, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetX, GetFirmwareParams()->m_ImageCropOffsetX, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetY, GetFirmwareParams()->m_ImageCropOffsetY, TRUE));
- XN_IS_STATUS_OK(m_Helper.MapFirmwareProperty(m_FirmwareCropEnabled, GetFirmwareParams()->m_ImageCropEnabled, TRUE));
+ nRetVal = m_Helper.MapFirmwareProperty(m_InputFormat, GetFirmwareParams()->m_ImageFormat, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(ResolutionProperty(), GetFirmwareParams()->m_ImageResolution, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(FPSProperty(), GetFirmwareParams()->m_ImageFPS, FALSE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_AntiFlicker, GetFirmwareParams()->m_ImageFlickerDetection, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_ImageQuality, GetFirmwareParams()->m_ImageQuality, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareMirror, GetFirmwareParams()->m_ImageMirror, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropSizeX, GetFirmwareParams()->m_ImageCropSizeX, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropSizeY, GetFirmwareParams()->m_ImageCropSizeY, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetX, GetFirmwareParams()->m_ImageCropOffsetX, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropOffsetY, GetFirmwareParams()->m_ImageCropOffsetY, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareCropEnabled, GetFirmwareParams()->m_ImageCropEnabled, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_Sharpness, GetFirmwareParams()->m_ImageSharpness, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareAutoWhiteBalance, GetFirmwareParams()->m_ImageAutoWhiteBalance, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareColorTemperature, GetFirmwareParams()->m_ImageColorTemperature, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_BackLightCompensation, GetFirmwareParams()->m_ImageBacklightCompensation, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_Gain, GetFirmwareParams()->m_ImageGain, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareExposure, GetFirmwareParams()->m_ImageExposureBar, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_FirmwareAutoExposure, GetFirmwareParams()->m_ImageAutoExposure, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.MapFirmwareProperty(m_LowLightCompensation, GetFirmwareParams()->m_ImageLowLightCompensation, TRUE);
+ XN_IS_STATUS_OK(nRetVal);;
return (XN_STATUS_OK);
}
@@ -167,35 +371,51 @@ XnStatus XnSensorImageStream::ValidateMode()
XnIOImageFormats nInputFormat = (XnIOImageFormats)m_InputFormat.GetValue();
XnOutputFormats nOutputFormat = GetOutputFormat();
XnResolutions nResolution = GetResolution();
+ XnUInt32 nFPS = GetFPS();
- // Avin: Removed to enable 1280x1024 Image
- // check resolution
- /*
- if ((nResolution == XN_RESOLUTION_UXGA || nResolution == XN_RESOLUTION_SXGA) && nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "UXGA resolution is only supported with BAYER input!");
- }
- */
-
- // check output format
- if (nOutputFormat == XN_OUTPUT_FORMAT_GRAYSCALE8 && nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Grayscale8 output requires BAYER input!");
- }
- else if (nOutputFormat == XN_OUTPUT_FORMAT_YUV422 && nInputFormat != XN_IO_IMAGE_FORMAT_YUV422 && nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422)
+ // check that input format matches output format
+ switch (nOutputFormat)
{
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "YUV output requires YUV input!");
+ case XN_OUTPUT_FORMAT_RGB24:
+ if (nInputFormat != XN_IO_IMAGE_FORMAT_YUV422 &&
+ nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422 &&
+ nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
+ {
+ // --avin mod--
+ //XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Input format %d cannot be converted to RGB24!", nInputFormat);
+ }
+ break;
+ case XN_OUTPUT_FORMAT_YUV422:
+ if (nInputFormat != XN_IO_IMAGE_FORMAT_YUV422 &&
+ nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Input format %d cannot be converted to YUV422!", nInputFormat);
+ }
+ break;
+ case XN_OUTPUT_FORMAT_JPEG:
+ if (nInputFormat != XN_IO_IMAGE_FORMAT_JPEG)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Input format %d cannot be converted to JPEG!", nInputFormat);
+ }
+ break;
+ case XN_OUTPUT_FORMAT_GRAYSCALE8:
+ if (nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_GRAY8 &&
+ nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER &&
+ nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Input format %d cannot be converted to Gray8!", nInputFormat);
+ }
+ break;
+ default:
+ // we shouldn't have reached here. Theres a check at SetOutputFormat.
+ XN_ASSERT(FALSE);
+ XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported image output format: %d!", nOutputFormat);
}
- // check input format
- if (nInputFormat == XN_IO_IMAGE_FORMAT_BAYER && nResolution != XN_RESOLUTION_UXGA && nResolution != XN_RESOLUTION_SXGA)
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "BAYER input requires SXGA/UXGA resolution!");
- }
- else if (nInputFormat == XN_IO_IMAGE_FORMAT_JPEG && nOutputFormat != XN_OUTPUT_FORMAT_RGB24)
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Jpeg input is only supported for RGB24 output!");
- }
+ // now check that mode exists
+ XnCmosPreset preset = { (XnUInt16)nInputFormat, (XnUInt16)nResolution, (XnUInt16)nFPS };
+ nRetVal = ValidateSupportedMode(preset);
+ XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
@@ -212,18 +432,24 @@ XnStatus XnSensorImageStream::ConfigureStreamImpl()
nRetVal = ValidateMode();
XN_IS_STATUS_OK(nRetVal);
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_InputFormat));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(ResolutionProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(FPSProperty()));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_AntiFlicker));
+ nRetVal = m_Helper.ConfigureFirmware(m_InputFormat);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(ResolutionProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(FPSProperty());
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_AntiFlicker);
+ XN_IS_STATUS_OK(nRetVal);;
// image quality is only relevant for JPEG
if (m_InputFormat.GetValue() == XN_IO_IMAGE_FORMAT_JPEG)
{
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_ImageQuality));
+ nRetVal = m_Helper.ConfigureFirmware(m_ImageQuality);
+ XN_IS_STATUS_OK(nRetVal);;
}
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareMirror));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareMirror);
+ XN_IS_STATUS_OK(nRetVal);;
if (GetResolution() != XN_RESOLUTION_UXGA && GetResolution() != XN_RESOLUTION_SXGA)
{
@@ -231,6 +457,26 @@ XnStatus XnSensorImageStream::ConfigureStreamImpl()
XN_IS_STATUS_OK(nRetVal);
}
+ if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_4)
+ {
+ nRetVal = m_Helper.ConfigureFirmware(m_Sharpness);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareColorTemperature);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareAutoWhiteBalance);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareExposure);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareAutoExposure);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_BackLightCompensation);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_Gain);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = m_Helper.ConfigureFirmware(m_LowLightCompensation);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
return (XN_STATUS_OK);
}
@@ -243,7 +489,8 @@ XnStatus XnSensorImageStream::SetActualRead(XnBool bRead)
if (bRead)
{
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Creating USB image read thread...");
- nRetVal = xnUSBInitReadThread(GetHelper()->GetPrivateData()->pSpecificImageUsb->pUsbConnection->UsbEp, GetHelper()->GetPrivateData()->pSpecificImageUsb->nChunkReadBytes, XN_SENSOR_USB_IMAGE_BUFFERS, XN_SENSOR_READ_THREAD_TIMEOUT, XnDeviceSensorProtocolUsbEpCb, GetHelper()->GetPrivateData()->pSpecificImageUsb);
+ XnSpecificUsbDevice* pUSB = GetHelper()->GetPrivateData()->pSpecificImageUsb;
+ nRetVal = xnUSBInitReadThread(pUSB->pUsbConnection->UsbEp, pUSB->nChunkReadBytes, XN_SENSOR_USB_IMAGE_BUFFERS, pUSB->nTimeout, XnDeviceSensorProtocolUsbEpCb, pUSB);
XN_IS_STATUS_OK(nRetVal);
}
else
@@ -269,12 +516,17 @@ XnStatus XnSensorImageStream::OpenStreamImpl()
// Cropping
if (m_FirmwareCropEnabled.GetValue() == TRUE)
{
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropSizeX));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropSizeY));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropOffsetX));
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropOffsetY));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropSizeX);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropSizeY);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropOffsetX);
+ XN_IS_STATUS_OK(nRetVal);;
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropOffsetY);
+ XN_IS_STATUS_OK(nRetVal);;
}
- XN_IS_STATUS_OK(m_Helper.ConfigureFirmware(m_FirmwareCropEnabled));
+ nRetVal = m_Helper.ConfigureFirmware(m_FirmwareCropEnabled);
+ XN_IS_STATUS_OK(nRetVal);;
nRetVal = XnImageStream::Open();
XN_IS_STATUS_OK(nRetVal);
@@ -307,6 +559,7 @@ XnStatus XnSensorImageStream::SetOutputFormat(XnOutputFormats nOutputFormat)
case XN_OUTPUT_FORMAT_GRAYSCALE8:
case XN_OUTPUT_FORMAT_YUV422:
case XN_OUTPUT_FORMAT_RGB24:
+ case XN_OUTPUT_FORMAT_JPEG:
break;
default:
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported image output format: %d", nOutputFormat);
@@ -333,7 +586,7 @@ XnStatus XnSensorImageStream::SetMirror(XnBool bIsMirrored)
xnOSEnterCriticalSection(GetLock());
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareMirror, bFirmwareMirror);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareMirror, (XnUInt16)bFirmwareMirror);
if (nRetVal != XN_STATUS_OK)
{
xnOSLeaveCriticalSection(GetLock());
@@ -352,7 +605,7 @@ XnStatus XnSensorImageStream::SetFPS(XnUInt32 nFPS)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.BeforeSettingFirmwareParam(FPSProperty(), nFPS);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(FPSProperty(), (XnUInt16)nFPS);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnImageStream::SetFPS(nFPS);
@@ -368,18 +621,7 @@ XnStatus XnSensorImageStream::SetResolution(XnResolutions nResolution)
{
XnStatus nRetVal = XN_STATUS_OK;
- switch (nResolution)
- {
- case XN_RESOLUTION_QVGA:
- case XN_RESOLUTION_VGA:
- case XN_RESOLUTION_SXGA:
- case XN_RESOLUTION_UXGA:
- break;
- default:
- XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unknown resolution: %u", nResolution);
- }
-
- nRetVal = m_Helper.BeforeSettingFirmwareParam(ResolutionProperty(), nResolution);
+ nRetVal = m_Helper.BeforeSettingFirmwareParam(ResolutionProperty(), (XnUInt16)nResolution);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnImageStream::SetResolution(nResolution);
@@ -408,7 +650,7 @@ XnStatus XnSensorImageStream::SetInputFormat(XnIOImageFormats nInputFormat)
XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unknown image input format: %d", nInputFormat);
}
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_InputFormat, nInputFormat);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_InputFormat, (XnUInt16)nInputFormat);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
@@ -418,16 +660,14 @@ XnStatus XnSensorImageStream::SetAntiFlicker(XnUInt32 nFrequency)
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_AntiFlicker, nFrequency);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_AntiFlicker, (XnUInt16)nFrequency);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
-XnStatus XnSensorImageStream::SetImageQuality(XnUInt32 nQuality)
+XnStatus XnSensorImageStream::SetImageQuality(XnUInt32 /*nQuality*/)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
// check relevance
if (m_InputFormat.GetValue() != XN_IO_IMAGE_FORMAT_JPEG)
{
@@ -470,7 +710,9 @@ XnStatus XnSensorImageStream::SetCropping(const XnCropping* pCropping)
}
if (nRetVal == XN_STATUS_OK)
- nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareCropEnabled, pCropping->bEnabled);
+ {
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareCropEnabled, (XnUInt16)pCropping->bEnabled);
+ }
if (nRetVal != XN_STATUS_OK)
{
@@ -504,15 +746,92 @@ XnStatus XnSensorImageStream::SetCropping(const XnCropping* pCropping)
return (XN_STATUS_OK);
}
-XnStatus XnSensorImageStream::PostProcessFrame(XnStreamData* pFrameData)
+XnStatus XnSensorImageStream::SetSharpness( XnInt32 nValue )
{
XnStatus nRetVal = XN_STATUS_OK;
- m_Helper.GetFPS()->MarkOutputImage(pFrameData->nFrameID, pFrameData->nTimestamp);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_Sharpness, (XnUInt16)nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorImageStream::SetColorTemperature( XnInt32 nValue )
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnBool bIsAuto = (nValue == XN_AUTO_CONTROL);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareAutoWhiteBalance, (XnUInt16)bIsAuto);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (!bIsAuto)
+ {
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareColorTemperature, (XnUInt16)nValue);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ nRetVal = m_ColorTemperature.UnsafeUpdateValue(nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorImageStream::SetBacklightCompensation( XnInt32 nValue )
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_BackLightCompensation, (XnUInt16)nValue);
+ XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
+XnStatus XnSensorImageStream::SetGain( XnInt32 nValue )
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_Gain, (XnUInt16)nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorImageStream::SetExposure( XnInt32 nValue )
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnBool bIsAuto = (nValue == XN_AUTO_CONTROL);
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareAutoExposure, (XnUInt16)bIsAuto);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (!bIsAuto)
+ {
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_FirmwareExposure, (XnUInt16)nValue);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ nRetVal = m_Exposure.UnsafeUpdateValue(nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorImageStream::SetLowLightCompensation( XnInt32 nValue )
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_Helper.SimpleSetFirmwareParam(m_LowLightCompensation, (XnUInt16)nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorImageStream::PostProcessFrame(XnStreamData* pFrameData)
+{
+ m_Helper.GetFPS()->MarkOutputImage(pFrameData->nFrameID, pFrameData->nTimestamp);
+ return (XN_STATUS_OK);
+}
+
XnStatus XnSensorImageStream::ReallocTripleFrameBuffer()
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -603,8 +922,6 @@ XnUInt32 XnSensorImageStream::CalculateExpectedSize()
XnStatus XnSensorImageStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XnStreamProcessor* pNew;
switch (m_InputFormat.GetValue())
@@ -616,7 +933,18 @@ XnStatus XnSensorImageStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
XN_VALIDATE_NEW_AND_INIT(pNew, XnPSCompressedImageProcessor, this, &m_Helper);
break;
case XN_IO_IMAGE_FORMAT_JPEG:
- XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegImageProcessor, this, &m_Helper);
+ if (GetOutputFormat() == XN_OUTPUT_FORMAT_JPEG)
+ {
+ XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegImageProcessor, this, &m_Helper);
+ }
+ else if (GetOutputFormat() == XN_OUTPUT_FORMAT_RGB24)
+ {
+ XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegToRGBImageProcessor, this, &m_Helper);
+ }
+ else
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "invalid output format %d!", GetOutputFormat());
+ }
break;
case XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422:
if (GetOutputFormat() == XN_OUTPUT_FORMAT_YUV422)
@@ -629,7 +957,7 @@ XnStatus XnSensorImageStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
}
else
{
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DEVICE_SENSOR, "invalid ouput format %d!", GetOutputFormat());
+ XN_LOG_WARNING_RETURN(XN_STATUS_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "invalid output format %d!", GetOutputFormat());
}
break;
case XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER:
@@ -644,27 +972,62 @@ XnStatus XnSensorImageStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
return XN_STATUS_OK;
}
-XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetInputFormatCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetInputFormatCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
return pThis->SetInputFormat((XnIOImageFormats)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetAntiFlickerCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetAntiFlickerCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
return pThis->SetAntiFlicker((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetImageQualityCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetImageQualityCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
return pThis->SetImageQuality((XnUInt32)nValue);
}
-XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetActualReadCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetActualReadCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
{
XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
return pThis->SetActualRead(nValue == TRUE);
}
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetSharpnessCallback( XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie )
+{
+ XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
+ return pThis->SetSharpness((XnInt32)nValue);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetColorTemperatureCallback( XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie )
+{
+ XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
+ return pThis->SetColorTemperature((XnInt32)nValue);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetBacklightCompensationCallback( XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie )
+{
+ XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
+ return pThis->SetBacklightCompensation((XnInt32)nValue);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetGainCallback( XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie )
+{
+ XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
+ return pThis->SetGain((XnInt32)nValue);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetLowLightCompensationCallback( XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie )
+{
+ XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
+ return pThis->SetLowLightCompensation((XnInt32)nValue);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensorImageStream::SetExposureCallback( XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie )
+{
+ XnSensorImageStream* pThis = (XnSensorImageStream*)pCookie;
+ return pThis->SetExposure((XnInt32)nValue);
+}
diff --git a/Source/XnDeviceSensorV2/XnSensorImageStream.h b/Source/XnDeviceSensorV2/XnSensorImageStream.h
index 526da72..f763e11 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorImageStream.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_IMAGE_STREAM_H__
#define __XN_SENSOR_IMAGE_STREAM_H__
@@ -34,13 +29,38 @@
#include "XnSensorStreamHelper.h"
#include "XnSharedMemoryBufferPool.h"
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+#define XN_IMAGE_STREAM_DEFAULT_FPS 30
+// --avin mod--
+#define XN_IMAGE_STREAM_DEFAULT_RESOLUTION XN_RESOLUTION_VGA
+#define XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER
+#define XN_IMAGE_STREAM_DEFAULT_OUTPUT_FORMAT XN_OUTPUT_FORMAT_RGB24
+#define XN_IMAGE_STREAM_DEFAULT_FLICKER 0
+#define XN_IMAGE_STREAM_DEFAULT_QUALITY 3
+#define XN_IMAGE_STREAM_DEFAULT_BRIGHTNESS 128
+#define XN_IMAGE_STREAM_DEFAULT_CONTRAST 32
+#define XN_IMAGE_STREAM_DEFAULT_SATURATION 128
+#define XN_IMAGE_STREAM_DEFAULT_SHARPNESS 32
+#define XN_IMAGE_STREAM_DEFAULT_AWB TRUE
+#define XN_IMAGE_STREAM_DEFAULT_COLOR_TEMP 5000
+#define XN_IMAGE_STREAM_DEFAULT_BACKLIGHT_COMP 1
+#define XN_IMAGE_STREAM_DEFAULT_GAIN 128
+#define XN_IMAGE_STREAM_DEFAULT_ZOOM 100
+#define XN_IMAGE_STREAM_DEFAULT_AUTO_EXPOSURE TRUE
+#define XN_IMAGE_STREAM_DEFAULT_EXPOSURE_BAR 100
+#define XN_IMAGE_STREAM_DEFAULT_PAN 0
+#define XN_IMAGE_STREAM_DEFAULT_TILT 0
+#define XN_IMAGE_STREAM_DEFAULT_LOW_LIGHT_COMP TRUE
+
//---------------------------------------------------------------------------
// XnSensorImageStream class
//---------------------------------------------------------------------------
class XnSensorImageStream : public XnImageStream, public IXnSensorStream
{
public:
- XnSensorImageStream(const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount);
+ XnSensorImageStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers);
~XnSensorImageStream() { Free(); }
//---------------------------------------------------------------------------
@@ -74,7 +94,7 @@ class XnSensorImageStream : public XnImageStream, public IXnSensorStream
XnStatus CreateDataProcessor(XnDataProcessor** ppProcessor);
XnStatus MapPropertiesToFirmware();
void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = GetResolution(); *pnFPS = GetFPS(); }
- XnStatus WriteImpl(XnStreamData* pStreamData) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+ XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return &m_BufferPool; }
//---------------------------------------------------------------------------
@@ -89,6 +109,12 @@ class XnSensorImageStream : public XnImageStream, public IXnSensorStream
virtual XnStatus SetImageQuality(XnUInt32 nQuality);
XnStatus SetCropping(const XnCropping* pCropping);
XnStatus SetActualRead(XnBool bRead);
+ XnStatus SetSharpness(XnInt32 nValue);
+ XnStatus SetColorTemperature(XnInt32 nValue);
+ XnStatus SetBacklightCompensation(XnInt32 nValue);
+ XnStatus SetGain(XnInt32 nValue);
+ XnStatus SetExposure(XnInt32 nValue);
+ XnStatus SetLowLightCompensation(XnInt32 nValue);
private:
XnStatus ValidateMode();
@@ -98,6 +124,12 @@ class XnSensorImageStream : public XnImageStream, public IXnSensorStream
static XnStatus XN_CALLBACK_TYPE SetAntiFlickerCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetImageQualityCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
static XnStatus XN_CALLBACK_TYPE SetActualReadCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetSharpnessCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetColorTemperatureCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetBacklightCompensationCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetGainCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetExposureCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+ static XnStatus XN_CALLBACK_TYPE SetLowLightCompensationCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
//---------------------------------------------------------------------------
// Members
@@ -110,6 +142,19 @@ class XnSensorImageStream : public XnImageStream, public IXnSensorStream
XnActualIntProperty m_AntiFlicker;
XnActualIntProperty m_ImageQuality;
+ XnActualIntProperty m_Brightness;
+ XnActualIntProperty m_Contrast;
+ XnActualIntProperty m_Saturation;
+ XnActualIntProperty m_Sharpness;
+ XnActualIntProperty m_ColorTemperature;
+ XnActualIntProperty m_BackLightCompensation;
+ XnActualIntProperty m_Gain;
+ XnActualIntProperty m_Exposure;
+ XnActualIntProperty m_Zoom;
+ XnActualIntProperty m_Pan;
+ XnActualIntProperty m_Tilt;
+ XnActualIntProperty m_LowLightCompensation;
+
XnActualIntProperty m_FirmwareMirror;
XnActualIntProperty m_FirmwareCropSizeX;
@@ -117,6 +162,10 @@ class XnSensorImageStream : public XnImageStream, public IXnSensorStream
XnActualIntProperty m_FirmwareCropOffsetX;
XnActualIntProperty m_FirmwareCropOffsetY;
XnActualIntProperty m_FirmwareCropEnabled;
+ XnActualIntProperty m_FirmwareExposure;
+ XnActualIntProperty m_FirmwareAutoExposure;
+ XnActualIntProperty m_FirmwareColorTemperature;
+ XnActualIntProperty m_FirmwareAutoWhiteBalance;
XnActualIntProperty m_ActualRead;
};
diff --git a/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp
index 047dce3..51cef14 100644
--- a/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -34,9 +28,21 @@
// XnSensorMapGenerator class
//---------------------------------------------------------------------------
XnSensorMapGenerator::XnSensorMapGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName) :
- XnSensorGenerator(context, sensor, pSensor, strStreamName)
+ XnSensorGenerator(context, sensor, pSensor, strStreamName),
+ m_nSupportedModesCount(0),
+ m_aSupportedModes(NULL)
{}
+
+XnSensorMapGenerator::~XnSensorMapGenerator()
+{
+ if (m_aSupportedModes != NULL)
+ {
+ xnOSFree(m_aSupportedModes);
+ m_aSupportedModes = NULL;
+ }
+}
+
XnStatus XnSensorMapGenerator::Init()
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -44,44 +50,29 @@ XnStatus XnSensorMapGenerator::Init()
nRetVal = XnSensorGenerator::Init();
XN_IS_STATUS_OK(nRetVal);
- XnMapOutputMode mode;
-
- // QVGA 30
- mode.nXRes = XN_QVGA_X_RES;
- mode.nYRes = XN_QVGA_Y_RES;
- mode.nFPS = 30;
- nRetVal = m_SupportedModes.AddLast(mode);
+ // get supported modes
+ XnUInt64 nCount;
+ nRetVal = GetIntProperty(XN_STREAM_PROPERTY_SUPPORT_MODES_COUNT, nCount);
XN_IS_STATUS_OK(nRetVal);
- // QVGA 60
- mode.nXRes = XN_QVGA_X_RES;
- mode.nYRes = XN_QVGA_Y_RES;
- mode.nFPS = 60;
- nRetVal = m_SupportedModes.AddLast(mode);
- XN_IS_STATUS_OK(nRetVal);
+ m_aSupportedModes = (SupportedMode*)xnOSMalloc(sizeof(SupportedMode) * (XnSizeT)nCount);
+ XN_VALIDATE_ALLOC_PTR(m_aSupportedModes);
+ m_nSupportedModesCount = (XnUInt32)nCount;
- // VGA 30
- mode.nXRes = XN_VGA_X_RES;
- mode.nYRes = XN_VGA_Y_RES;
- mode.nFPS = 30;
- nRetVal = m_SupportedModes.AddLast(mode);
+ const XnUInt32 nAllocCount = 150;
+ XnCmosPreset aPresets[nAllocCount];
+ XN_ASSERT(nAllocCount >= m_nSupportedModesCount);
+ nRetVal = GetGeneralProperty(XN_STREAM_PROPERTY_SUPPORT_MODES, m_nSupportedModesCount*sizeof(XnCmosPreset), aPresets);
XN_IS_STATUS_OK(nRetVal);
- if (m_Version.FWVer >= XN_SENSOR_FW_VER_5_2)
+ // Keep those modes
+ XnBool bOK = TRUE;
+ for (XnUInt32 i = 0; i < m_nSupportedModesCount; ++i)
{
- // QVGA 25
- mode.nXRes = XN_QVGA_X_RES;
- mode.nYRes = XN_QVGA_Y_RES;
- mode.nFPS = 25;
- nRetVal = m_SupportedModes.AddLast(mode);
- XN_IS_STATUS_OK(nRetVal);
-
- // VGA 25
- mode.nXRes = XN_VGA_X_RES;
- mode.nYRes = XN_VGA_Y_RES;
- mode.nFPS = 25;
- nRetVal = m_SupportedModes.AddLast(mode);
- XN_IS_STATUS_OK(nRetVal);
+ m_aSupportedModes[i].nInputFormat = aPresets[i].nFormat;
+ bOK = XnDDKGetXYFromResolution((XnResolutions)aPresets[i].nResolution, &m_aSupportedModes[i].OutputMode.nXRes, &m_aSupportedModes[i].OutputMode.nYRes);
+ XN_ASSERT(bOK);
+ m_aSupportedModes[i].OutputMode.nFPS = aPresets[i].nFPS;
}
return (XN_STATUS_OK);
@@ -95,31 +86,36 @@ XnBool XnSensorMapGenerator::IsCapabilitySupported(const XnChar* strCapabilityNa
XnUInt32 XnSensorMapGenerator::GetSupportedMapOutputModesCount()
{
- return m_SupportedModes.Size();
+ return m_nSupportedModesCount;
}
XnStatus XnSensorMapGenerator::GetSupportedMapOutputModes(XnMapOutputMode aModes[], XnUInt32& nCount)
{
- XnStatus nRetVal = XN_STATUS_OK;
-
XN_VALIDATE_INPUT_PTR(aModes);
- if (nCount < m_SupportedModes.Size())
+ if (nCount < m_nSupportedModesCount)
{
return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
}
- XnUInt32 i = 0;
- for (XnMapOutputModeList::Iterator it = m_SupportedModes.begin(); it != m_SupportedModes.end(); ++it, ++i)
+ for (XnUInt32 i = 0; i < m_nSupportedModesCount; ++i)
{
- aModes[i] = *it;
+ aModes[i] = m_aSupportedModes[i].OutputMode;
}
- nCount = m_SupportedModes.Size();
+ nCount = m_nSupportedModesCount;
return (XN_STATUS_OK);
}
+XnBool Equals(const XnMapOutputMode& mode1, const XnMapOutputMode& mode2)
+{
+ return (
+ mode1.nXRes == mode2.nXRes &&
+ mode1.nYRes == mode2.nYRes &&
+ mode1.nFPS == mode2.nFPS);
+}
+
XnStatus XnSensorMapGenerator::SetMapOutputMode(const XnMapOutputMode& Mode)
{
XnStatus nRetVal = XN_STATUS_OK;
@@ -127,19 +123,52 @@ XnStatus XnSensorMapGenerator::SetMapOutputMode(const XnMapOutputMode& Mode)
XnMapOutputMode current;
GetMapOutputMode(current);
- if (current.nFPS == Mode.nFPS &&
- current.nXRes == Mode.nXRes &&
- current.nYRes == Mode.nYRes)
+ if (Equals(current, Mode))
{
return (XN_STATUS_OK);
}
+ // check if this mode is supported. If it is, make sure current input format is OK
+ XnUInt64 nCurrInputFormat;
+ nRetVal = GetIntProperty(XN_STREAM_PROPERTY_INPUT_FORMAT, nCurrInputFormat);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnUInt32 nChosenInputFormat = XN_MAX_UINT32;
+
+ for (XnUInt32 i = 0; i < m_nSupportedModesCount; ++i)
+ {
+ if (Equals(Mode, m_aSupportedModes[i].OutputMode))
+ {
+ // if current input format is supported, it will always be preferred.
+ if (m_aSupportedModes[i].nInputFormat == nCurrInputFormat)
+ {
+ nChosenInputFormat = (XnUInt32)nCurrInputFormat;
+ break;
+ }
+ else if (nChosenInputFormat == XN_MAX_UINT32)
+ {
+ nChosenInputFormat = m_aSupportedModes[i].nInputFormat;
+ // don't break yet. we might find our input format
+ }
+ }
+ }
+
+ if (nChosenInputFormat == XN_MAX_UINT32) // not found
+ {
+ return XN_STATUS_BAD_PARAM;
+ }
+
XN_PROPERTY_SET_CREATE_ON_STACK(props);
XnPropertySetAddModule(&props, m_strModule);
XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_X_RES, Mode.nXRes);
XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_Y_RES, Mode.nYRes);
XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_FPS, Mode.nFPS);
+ if (nChosenInputFormat != nCurrInputFormat)
+ {
+ XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_INPUT_FORMAT, nChosenInputFormat);
+ }
+
nRetVal = m_pSensor->BatchConfig(&props);
XN_IS_STATUS_OK(nRetVal);
diff --git a/Source/XnDeviceSensorV2/XnSensorMapGenerator.h b/Source/XnDeviceSensorV2/XnSensorMapGenerator.h
index 05af932..d3be5a4 100644
--- a/Source/XnDeviceSensorV2/XnSensorMapGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorMapGenerator.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_MAP_GENERATOR_H__
#define __XN_SENSOR_MAP_GENERATOR_H__
@@ -37,6 +31,10 @@
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorMapGenerator :
public XnSensorGenerator,
virtual public xn::ModuleMapGenerator,
@@ -44,6 +42,7 @@ class XnSensorMapGenerator :
{
public:
XnSensorMapGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
+ virtual ~XnSensorMapGenerator();
XnStatus Init();
@@ -66,9 +65,16 @@ class XnSensorMapGenerator :
protected:
virtual void FilterProperties(XnActualPropertiesHash* pHash);
- XN_DECLARE_LIST(XnMapOutputMode, XnMapOutputModeList);
+ struct SupportedMode
+ {
+ XnMapOutputMode OutputMode;
+ XnUInt32 nInputFormat;
+ };
- XnMapOutputModeList m_SupportedModes;
+ SupportedMode* m_aSupportedModes;
+ XnUInt32 m_nSupportedModesCount;
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_MAP_GENERATOR_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorOpenNiteImpl.cpp b/Source/XnDeviceSensorV2/XnSensorOpenNiteImpl.cpp
index fb6c55b..db16918 100644
--- a/Source/XnDeviceSensorV2/XnSensorOpenNiteImpl.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorOpenNiteImpl.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -40,15 +34,7 @@
// Exporting
//---------------------------------------------------------------------------
-class SensorModule : public xn::Module
-{
- XnStatus Load()
- {
- return XnSensorClient::TakeServerLocation();
- }
-};
-
-XN_EXPORT_MODULE(SensorModule)
+XN_EXPORT_MODULE(xn::Module)
XN_EXPORT_DEVICE(XnExportedSensorDevice)
XN_EXPORT_DEPTH(XnExportedSensorDepthGenerator)
XN_EXPORT_IMAGE(XnExportedSensorImageGenerator)
diff --git a/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp b/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp
index 4cbd493..946cd40 100644
--- a/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -37,7 +31,8 @@
XnSensorProductionNode::XnSensorProductionNode(xn::Context& context, const XnChar* strInstanceName, XnDeviceBase* pSensor, const XnChar* strModuleName) :
m_Context(context),
m_pSensor(pSensor),
- m_pNotifications(NULL)
+ m_pNotifications(NULL),
+ m_pCookie(NULL)
{
strcpy(m_strInstanceName, strInstanceName);
strcpy(m_strModule, strModuleName);
@@ -88,9 +83,14 @@ XnStatus XnSensorProductionNode::GetRealProperty(const XnChar* strName, XnDouble
return m_pSensor->GetProperty(m_strModule, strName, &dValue);
}
-XnStatus XnSensorProductionNode::GetStringProperty(const XnChar* strName, XnChar* csValue) const
+XnStatus XnSensorProductionNode::GetStringProperty(const XnChar* strName, XnChar* csValue, XnUInt32 nBufSize) const
{
- return m_pSensor->GetProperty(m_strModule, strName, csValue);
+ XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
+ XnStatus nRetVal = m_pSensor->GetProperty(m_strModule, strName, strValue);
+ XN_IS_STATUS_OK(nRetVal);
+ nRetVal = xnOSStrCopy(csValue, strValue, nBufSize);
+ XN_IS_STATUS_OK(nRetVal);
+ return XN_STATUS_OK;
}
XnStatus XnSensorProductionNode::GetGeneralProperty(const XnChar* strName, XnUInt32 nBufferSize, void* pBuffer) const
@@ -106,7 +106,7 @@ XnStatus XnSensorProductionNode::SetLockState(XnBool bLocked)
XnBool XnSensorProductionNode::GetLockState()
{
XnUInt64 nValue = FALSE;
- XnStatus nRetVal = m_pSensor->GetProperty(m_strModule, XN_MODULE_PROPERTY_LOCK, &nValue);
+ m_pSensor->GetProperty(m_strModule, XN_MODULE_PROPERTY_LOCK, &nValue);
return (nValue == TRUE);
}
diff --git a/Source/XnDeviceSensorV2/XnSensorProductionNode.h b/Source/XnDeviceSensorV2/XnSensorProductionNode.h
index 19e02ee..1eece78 100644
--- a/Source/XnDeviceSensorV2/XnSensorProductionNode.h
+++ b/Source/XnDeviceSensorV2/XnSensorProductionNode.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_PRODUCTION_NODE_H__
#define __XN_SENSOR_PRODUCTION_NODE_H__
@@ -41,6 +35,10 @@ class XnMultiPropChangedHandler; // forward declaration
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
+// disable the "inherits via dominance" warning. This is exactly what we want.
+#pragma warning (push)
+#pragma warning (disable: 4250)
+
class XnSensorProductionNode :
virtual public xn::ModuleProductionNode,
virtual public xn::ModuleLockAwareInterface,
@@ -58,7 +56,7 @@ class XnSensorProductionNode :
XnStatus SetGeneralProperty(const XnChar* strName, XnUInt32 nBufferSize, const void* pBuffer);
XnStatus GetIntProperty(const XnChar* strName, XnUInt64& nValue) const;
XnStatus GetRealProperty(const XnChar* strName, XnDouble& dValue) const;
- XnStatus GetStringProperty(const XnChar* strName, XnChar* csValue) const;
+ XnStatus GetStringProperty(const XnChar* strName, XnChar* csValue, XnUInt32 nBufSize) const;
XnStatus GetGeneralProperty(const XnChar* strName, XnUInt32 nBufferSize, void* pBuffer) const;
// Lock Aware
@@ -113,4 +111,6 @@ class XnSensorProductionNode :
XnCallbackHandle m_hGenProps;
};
+#pragma warning (pop)
+
#endif // __XN_SENSOR_PRODUCTION_NODE_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorServer.cpp b/Source/XnDeviceSensorV2/XnSensorServer.cpp
index c9e5222..0747d84 100644
--- a/Source/XnDeviceSensorV2/XnSensorServer.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorServer.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -32,155 +26,37 @@
#include "XnSensorClientServer.h"
#include
#include
-#include
#include
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
-#define XN_SENSOR_DEFAULT_SERVER_WAIT_FOR_CLIENT_TIME 10000
#define XN_SENSOR_SERVER_ACCEPT_CONNECTION_TIMEOUT 100
-#define XN_SENSOR_TERMINATE_READER_THREAD_TIMEOUT 5000
-#define XN_MASK_SENSOR_SERVER_COMM_DUMP "SensorServerComm"
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-typedef struct XnDeviceString
-{
- XnChar str[XN_DEVICE_MAX_STRING_LENGTH];
-} XnDeviceString;
-
-typedef struct XnServerStream
-{
- XnChar strType[XN_DEVICE_MAX_STRING_LENGTH];
- XnUInt32 nRefCount;
- XnUInt32 nOpenRefCount;
- XnStreamData* pStreamData;
- XnBool bNewData;
-} XnServerStream;
-
-XN_DECLARE_STRINGS_HASH(XnDeviceString, XnNamesHash);
-XN_DECLARE_STRINGS_HASH(XnServerStream, XnServerStreamsHash);
-
-struct XnSensorServer::XnClient
-{
- XnClient()
- {
- nID = 0;
- hSocket = NULL;
- hThread = NULL;
- pStream = NULL;
- pPrivateIncomingPacker = NULL;
- pPrivateOutgoingPacker = NULL;
- pServer = NULL;
- pStreamDataSet = NULL;
- XnDeviceString deviceModule = { XN_MODULE_NAME_DEVICE };
- clientToServerNames.Set(XN_MODULE_NAME_DEVICE, deviceModule);
- serverToClientNames.Set(XN_MODULE_NAME_DEVICE, deviceModule);
- bShouldRun = TRUE;
- }
-
- ~XnClient()
- {
- XN_DELETE(pPrivateIncomingPacker);
- XN_DELETE(pPrivateOutgoingPacker);
- XN_DELETE(pStream);
- if (hLock != NULL)
- {
- xnOSCloseCriticalSection(&hLock);
- hLock = NULL;
- }
- if (pStreamDataSet != NULL)
- {
- XnStreamDataSetDestroy(&pStreamDataSet);
- }
- if (hSocket != NULL)
- {
- xnOSCloseSocket(hSocket);
- }
- }
-
- const XnChar* ToServerModule(const XnChar* strClientModule)
- {
- XnNamesHash::Iterator it = clientToServerNames.end();
- if (XN_STATUS_OK != clientToServerNames.Find(strClientModule, it))
- {
- return NULL;
- }
-
- return it.Value().str;
- }
-
- const XnChar* FromServerModule(const XnChar* strServerModule)
- {
- XnNamesHash::Iterator it = serverToClientNames.end();
- if (XN_STATUS_OK != serverToClientNames.Find(strServerModule, it))
- {
- return NULL;
- }
-
- return it.Value().str;
- }
-
- XnBool IsStreamOpen(const XnChar* strServerStream)
- {
- XnNamesHash::Iterator it = serverToClientNames.end();
- return (XN_STATUS_OK == openStreams.Find(strServerStream, it));
- }
-
- XnUInt32 nID;
- XN_SOCKET_HANDLE hSocket;
- XN_THREAD_HANDLE hThread;
- XN_CRITICAL_SECTION_HANDLE hLock;
- XnIONetworkStream* pStream;
- XnDataPacker* pPrivateIncomingPacker;
- XnDataPacker* pPrivateOutgoingPacker;
- XnSensorServer* pServer;
- XnStreamDataSet* pStreamDataSet;
- XnNamesHash clientToServerNames;
- XnNamesHash serverToClientNames;
- volatile XnBool bShouldRun;
- XnNamesHash openStreams;
-};
-
-#define XN_SENSOR_SERVER_LOCK_BLOCK XnAutoCSLocker __locker(m_hSensorLock);
-#define XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK XnAutoCSLocker __locker(pClient->hLock);
//---------------------------------------------------------------------------
// XnSensorServer class
//---------------------------------------------------------------------------
-XnSensorServer::XnSensorServer() :
- m_bSensorOpen(FALSE),
+XnSensorServer::XnSensorServer(const XnChar* strConfigFile) :
m_hListenSocket(NULL),
- m_hReaderThread(NULL),
- m_hNewDataEvent(NULL),
m_hServerRunningEvent(NULL),
m_hServerRunningMutex(NULL),
- m_hSensorLock(NULL),
- m_hBroadcastingLock(NULL),
- m_hClientsCriticalSection(NULL),
+ m_hSessionsLock(NULL),
m_nLastClientID(0),
- m_pServerStreams(NULL),
- m_noClientTimeout(XN_MODULE_PROPERTY_SERVER_NO_CLIENTS_TIMEOUT, XN_SENSOR_DEFAULT_SERVER_WAIT_FOR_CLIENT_TIME),
- m_startNewLog(XN_MODULE_PROPERTY_SERVER_START_NEW_LOG_FILE),
- m_nErrorState(XN_STATUS_OK)
+ m_nErrorState(XN_STATUS_OK),
+ m_sensorsManager(strConfigFile),
+ m_strConfigFile(strConfigFile)
{
- m_noClientTimeout.UpdateSetCallbackToDefault();
- m_startNewLog.UpdateSetCallback(StartNewLogCallback, this);
-
- m_serverDump = XN_DUMP_CLOSED;
- xnDumpInit(&m_serverDump, XN_MASK_SENSOR_SERVER_COMM_DUMP, "TS,Type,Size,Client\n", "%s.csv", XN_MASK_SENSOR_SERVER_COMM_DUMP);
}
XnSensorServer::~XnSensorServer()
{
- ShutdownServer();
+ Free();
}
-XnStatus XnSensorServer::Run(const XnChar* strConfigFile)
+XnStatus XnSensorServer::Run()
{
//Initialize server
- XnStatus nRetVal = InitServer(strConfigFile);
+ XnStatus nRetVal = InitServer();
if (nRetVal == XN_STATUS_OK)
{
@@ -188,8 +64,7 @@ XnStatus XnSensorServer::Run(const XnChar* strConfigFile)
nRetVal = ServerMainLoop();
}
- //Shutdown the server
- ShutdownServer();
+ Free();
return nRetVal;
}
@@ -205,10 +80,19 @@ XnBool XnSensorServer::IsServerRunning()
return xnOSIsEventSet(m_hServerRunningEvent);
}
-XnStatus XnSensorServer::InitServer(const XnChar* strConfigFile)
+XnStatus XnSensorServer::InitServer()
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = xnOSCreateNamedMutex(&m_hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_NAME);
+
+ XnBool bEnableMultiUsers = FALSE;
+
+ XnUInt32 nValue;
+ if (XN_STATUS_OK == xnOSReadIntFromINI(m_strConfigFile, XN_SENSOR_SERVER_CONFIG_FILE_SECTION, XN_MODULE_PROPERTY_ENABLE_MULTI_USERS, &nValue))
+ {
+ bEnableMultiUsers = (nValue == TRUE);
+ }
+
+ nRetVal = xnOSCreateNamedMutexEx(&m_hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_NAME, bEnableMultiUsers);
XN_IS_STATUS_OK(nRetVal);
XnAutoMutexLocker serverRunningLock(m_hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_TIMEOUT);
@@ -225,10 +109,10 @@ XnStatus XnSensorServer::InitServer(const XnChar* strConfigFile)
/*Create the Server Running event.
This is created as a manual-reset event, because only the server resets it when it's shutting down. */
- nRetVal = xnOSOpenNamedEvent(&m_hServerRunningEvent, XN_SENSOR_SERVER_RUNNING_EVENT_NAME);
+ nRetVal = xnOSOpenNamedEventEx(&m_hServerRunningEvent, XN_SENSOR_SERVER_RUNNING_EVENT_NAME, bEnableMultiUsers);
if (nRetVal != XN_STATUS_OK)
{
- nRetVal = xnOSCreateNamedEvent(&m_hServerRunningEvent, XN_SENSOR_SERVER_RUNNING_EVENT_NAME, TRUE);
+ nRetVal = xnOSCreateNamedEventEx(&m_hServerRunningEvent, XN_SENSOR_SERVER_RUNNING_EVENT_NAME, TRUE, bEnableMultiUsers);
XN_IS_STATUS_OK(nRetVal);
}
@@ -241,25 +125,15 @@ XnStatus XnSensorServer::InitServer(const XnChar* strConfigFile)
return XN_STATUS_DEVICE_SERVER_ALREADY_RUNNING;
}
- nRetVal = m_sensor.SetGlobalConfigFile(strConfigFile);
- XN_IS_STATUS_OK(nRetVal);
-
- // read default timeout from file
- nRetVal = m_noClientTimeout.ReadValueFromFile(strConfigFile, XN_CONFIG_FILE_SERVER_SECTION);
+ nRetVal = m_sensorsManager.Init();
XN_IS_STATUS_OK(nRetVal);
// init network
nRetVal = xnOSInitNetwork();
XN_IS_STATUS_OK(nRetVal);
- // create locks
- nRetVal = xnOSCreateCriticalSection(&m_hSensorLock);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = xnOSCreateCriticalSection(&m_hBroadcastingLock);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = xnOSCreateCriticalSection(&m_hClientsCriticalSection);
+ // create lock
+ nRetVal = xnOSCreateCriticalSection(&m_hSessionsLock);
XN_IS_STATUS_OK(nRetVal);
// create the listen socket
@@ -270,18 +144,6 @@ XnStatus XnSensorServer::InitServer(const XnChar* strConfigFile)
nRetVal = xnOSBindSocket(m_hListenSocket);
XN_IS_STATUS_OK(nRetVal);
- // register to events
- nRetVal = m_sensor.OnStreamCollectionChangedEvent().Register(StreamCollectionChangedCallback, this);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = m_sensor.OnNewStreamDataEvent().Register(NewStreamDataCallback, this);
- XN_IS_STATUS_OK(nRetVal);
-
- XN_VALIDATE_NEW(m_pServerStreams, XnServerStreamsHash);
-
- nRetVal = xnOSCreateEvent(&m_hNewDataEvent, FALSE);
- XN_IS_STATUS_OK(nRetVal);
-
// start listening
nRetVal = xnOSListenSocket(m_hListenSocket);
XN_IS_STATUS_OK(nRetVal);
@@ -292,65 +154,55 @@ XnStatus XnSensorServer::InitServer(const XnChar* strConfigFile)
nRetVal = xnOSSetEvent(m_hServerRunningEvent);
XN_IS_STATUS_OK(nRetVal);
- // start reader thread
- nRetVal = xnOSCreateThread(ReaderThread, this, &m_hReaderThread);
- XN_IS_STATUS_OK(nRetVal);
+ xnOSGetTimeStamp(&m_nLastSessionActivity);
return (XN_STATUS_OK);
}
-XnStatus XnSensorServer::OpenSensor(const XnChar* strConnectionString)
+XnStatus XnSensorServer::ServerMainLoop()
{
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnDeviceConfig config;
- config.DeviceMode = XN_DEVICE_MODE_READ;
- config.cpConnectionString = strConnectionString;
- config.pInitialValues = NULL;
- config.SharingMode = XN_DEVICE_SHARED;
-
- nRetVal = m_sensor.Init(&config);
- XN_IS_STATUS_OK(nRetVal);
-
- XN_VALIDATE_ADD_PROPERTIES(m_sensor.DeviceModule(),
- &m_startNewLog, &m_noClientTimeout);
-
- // configure from global file
- nRetVal = m_sensor.ConfigureModuleFromGlobalFile(XN_MODULE_NAME_DEVICE, XN_CONFIG_FILE_SERVER_SECTION);
- XN_IS_STATUS_OK(nRetVal);
+ for (;;)
+ {
+ CheckForNewClients(XN_SENSOR_SERVER_ACCEPT_CONNECTION_TIMEOUT);
- // register to all properties
- XN_PROPERTY_SET_CREATE_ON_STACK(props);
- nRetVal = m_sensor.DeviceModule()->GetAllProperties(&props);
- XN_IS_STATUS_OK(nRetVal);
+ // do some clean-up
+ m_sensorsManager.CleanUp();
+ CleanUpSessions();
- nRetVal = RegisterToProps(&props);
- XN_IS_STATUS_OK(nRetVal);
+ // now check if we should shutdown
+ if (ShutdownIfPossible())
+ {
+ break;
+ }
+ }
- return (XN_STATUS_OK);
+ return XN_STATUS_OK;
}
-XnStatus XnSensorServer::ServerMainLoop()
+void XnSensorServer::CheckForNewClients(XnUInt32 nTimeout)
{
XnStatus nRetVal = XN_STATUS_OK;
- XnUInt64 nNow = 0;
- XnUInt64 nLastClientRemovedTimestamp = 0;
- XnUInt64 nTimeSinceNoClients = 0;
- XnBool bQuit = FALSE;
- XN_SOCKET_HANDLE hClientSocket = NULL;
- XnBool bNoClients = FALSE;
-
- xnOSGetTimeStamp(&nLastClientRemovedTimestamp);
- while (!bQuit)
+ // run in loop until we break due to timeout
+ XN_SOCKET_HANDLE hClientSocket;
+ for (;;)
{
- nRetVal = xnOSAcceptSocket(m_hListenSocket, &hClientSocket, XN_SENSOR_SERVER_ACCEPT_CONNECTION_TIMEOUT);
- if (nRetVal == XN_STATUS_OK)
+ nRetVal = xnOSAcceptSocket(m_hListenSocket, &hClientSocket, nTimeout);
+ if (nRetVal == XN_STATUS_OS_NETWORK_TIMEOUT)
+ {
+ return;
+ }
+ else if (nRetVal != XN_STATUS_OK)
+ {
+ //Any other error beside timeout is not expected, but we treat it the same.
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "failed to accept connection: %s", xnGetStatusString(nRetVal));
+ }
+ else
{
xnLogInfo(XN_MASK_SENSOR_SERVER, "New client trying to connect...");
//TODO: Check if we don't have too many clients
- nRetVal = AddClient(hClientSocket);
+ nRetVal = AddSession(hClientSocket);
if (nRetVal != XN_STATUS_OK)
{
xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed to add new client: %s", xnGetStatusString(nRetVal));
@@ -358,66 +210,107 @@ XnStatus XnSensorServer::ServerMainLoop()
//Still in loop
}
}
- else // no client trying to connect, do some clean up work
+ }
+}
+
+void XnSensorServer::CleanUpSessions()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnAutoCSLocker locker(m_hSessionsLock);
+ if (!m_sessions.IsEmpty())
+ {
+ XnSessionsList::Iterator it = m_sessions.begin();
+ while (it != m_sessions.end())
{
- if (nRetVal != XN_STATUS_OS_NETWORK_TIMEOUT)
+ XnSessionsList::Iterator curr = it;
+ ++it;
+
+ XnServerSession* pSession = *curr;
+ if (pSession->HasEnded())
{
- //Any other error beside timeout is not expected, but we treat it the same.
- xnLogWarning(XN_MASK_SENSOR_SERVER, "failed to accept connection: %s", xnGetStatusString(nRetVal));
+ nRetVal = RemoveSession(curr);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "failed to remove session: %s", xnGetStatusString(nRetVal));
+ }
}
+ }
+ }
+}
- // remove all non-active clients
- xnOSEnterCriticalSection(&m_hClientsCriticalSection);
+XnBool XnSensorServer::ShutdownIfPossible()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // lock sessions list
+ XnAutoCSLocker locker(m_hSessionsLock);
+
+ // check if no sessions and no sensors
+ if (CanShutdown())
+ {
+ // lock the running lock
+ XnAutoMutexLocker serverRunningLock(m_hServerRunningMutex, XN_SENSOR_SERVER_RUNNING_MUTEX_TIMEOUT);
+ nRetVal = serverRunningLock.GetStatus();
+ if (nRetVal == XN_STATUS_OK)
+ {
+ // make sure no client is waiting to connect
+ CheckForNewClients(0);
- if (!m_clients.IsEmpty())
+ // re-check shutdown condition
+ if (CanShutdown())
{
- // create a list of all clients to be removed
- XnClientsList toRemove;
- for (XnClientsList::Iterator it = m_clients.begin(); it != m_clients.end(); ++it)
- {
- XnClient* pClient = *it;
- if (!pClient->bShouldRun)
- {
- toRemove.AddLast(pClient);
- }
- }
+ xnLogInfo(XN_MASK_SENSOR_SERVER, "No sensors are open and no client is connected. Shutting down...");
- // now actually remove them
- for (XnClientsList::Iterator it = toRemove.begin(); it != toRemove.end(); ++it)
+ // reset the event (to notify server is no longer up)
+ nRetVal = xnOSResetEvent(m_hServerRunningEvent);
+ if (nRetVal != XN_STATUS_OK)
{
- XnClient* pClient = *it;
- RemoveClient(pClient);
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed to reset sensor server event: %s - proceeding with shutdown.", xnGetStatusString(nRetVal));
+ XN_ASSERT(FALSE);
}
- // check if there are any clients left
- if (m_clients.IsEmpty())
- {
- xnOSGetTimeStamp(&nLastClientRemovedTimestamp);
+ // and close the socket (to free the port for another server)
+ xnOSCloseSocket(m_hListenSocket);
+ m_hListenSocket = NULL;
- // do some clean-up (so that next client will behave as if it started the server)
- ReturnToDefaults();
- }
+ return TRUE;
}
+ }
+ }
+
+ return FALSE;
+}
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
+void XnSensorServer::Free()
+{
+ if (m_hServerRunningEvent != NULL)
+ {
+ xnOSCloseEvent(&m_hServerRunningEvent);
+ m_hServerRunningEvent = NULL;
+ }
- // if too much time has passed and no client has connected, shut down
- xnOSEnterCriticalSection(&m_hClientsCriticalSection);
- bNoClients = m_clients.IsEmpty();
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
-
- xnOSGetTimeStamp(&nNow);
+ if (m_hListenSocket != NULL)
+ {
+ xnOSCloseSocket(m_hListenSocket);
+ m_hListenSocket = NULL;
+ }
- nTimeSinceNoClients = (nNow - nLastClientRemovedTimestamp);
- if (bNoClients && (nTimeSinceNoClients >= m_noClientTimeout.GetValue()))
- {
- xnLogInfo(XN_MASK_SENSOR_SERVER, "No client connection for %u ms. Shutting down...", m_noClientTimeout.GetValue());
- bQuit = TRUE;
- }
- }
+ if (m_hSessionsLock != NULL)
+ {
+ xnOSCloseCriticalSection(&m_hSessionsLock);
+ m_hSessionsLock = NULL;
}
+}
- return XN_STATUS_OK;
+XnBool XnSensorServer::CanShutdown()
+{
+ XnUInt64 nNow;
+ xnOSGetTimeStamp(&nNow);
+
+ XnAutoCSLocker locker(m_hSessionsLock);
+ return (!m_sensorsManager.HasOpenSensors() && m_sessions.IsEmpty() &&
+ (nNow - m_nLastSessionActivity) > m_sensorsManager.GetTimeout());
}
void XnSensorServer::ShutdownServer()
@@ -446,35 +339,7 @@ void XnSensorServer::ShutdownServer()
m_hServerRunningEvent = NULL;
}
- nRetVal = m_sensor.Destroy();
- if (nRetVal != XN_STATUS_OK)
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed to destroy sensor: %s", xnGetStatusString(nRetVal));
- XN_ASSERT(FALSE);
- }
-
- XN_DELETE(m_pServerStreams);
- m_pServerStreams = NULL;
-
- for (XnPropertySetData::Iterator it = m_allStreamsProps.begin(); it != m_allStreamsProps.end(); ++it)
- {
- XN_DELETE(it.Value());
- }
- m_allStreamsProps.Clear();
-
- XN_ASSERT(m_clients.IsEmpty());
-
- if (m_hNewDataEvent != NULL)
- {
- xnOSCloseEvent(&m_hNewDataEvent);
- m_hNewDataEvent = NULL;
- }
-
- if (m_hReaderThread != NULL)
- {
- xnOSWaitAndTerminateThread(&m_hReaderThread, XN_SENSOR_TERMINATE_READER_THREAD_TIMEOUT);
- m_hReaderThread = NULL;
- }
+ XN_ASSERT(m_sessions.IsEmpty());
if (m_hListenSocket != NULL)
{
@@ -482,1485 +347,78 @@ void XnSensorServer::ShutdownServer()
m_hListenSocket = NULL;
}
- if (m_hClientsCriticalSection != NULL)
- {
- xnOSCloseCriticalSection(&m_hClientsCriticalSection);
- m_hClientsCriticalSection = NULL;
- }
-
- if (m_hBroadcastingLock != NULL)
- {
- xnOSCloseCriticalSection(&m_hBroadcastingLock);
- m_hBroadcastingLock = NULL;
- }
-
- if (m_hSensorLock != NULL)
+ if (m_hSessionsLock != NULL)
{
- xnOSCloseCriticalSection(&m_hSensorLock);
- m_hSensorLock = NULL;
+ xnOSCloseCriticalSection(&m_hSessionsLock);
+ m_hSessionsLock = NULL;
}
}
-XnStatus XnSensorServer::RegisterToProps(XnPropertySet* pProps)
+XnStatus XnSensorServer::AddSession(XN_SOCKET_HANDLE hClientSocket)
{
XnStatus nRetVal = XN_STATUS_OK;
-
- for (XnPropertySetData::Iterator itMod = pProps->pData->begin(); itMod != pProps->pData->end(); ++itMod)
- {
- XnActualPropertiesHash* pHash = itMod.Value();
- XnDeviceModule* pModule;
- nRetVal = m_sensor.FindModule(itMod.Key(), &pModule);
- XN_IS_STATUS_OK(nRetVal);
+ XnUInt32 nID = 0;
- for (XnActualPropertiesHash::Iterator itProp = pHash->begin(); itProp != pHash->end(); ++itProp)
- {
- XnProperty* pProp;
- nRetVal = pModule->GetProperty(itProp.Key(), &pProp);
- XN_IS_STATUS_OK(nRetVal);
-
- // no need to keep the handle. We only want to unregister when the stream is destroyed, and then
- // it happens anyway.
- nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this);
- XN_IS_STATUS_OK(nRetVal);
- }
+ {
+ XnAutoCSLocker locker(m_hSessionsLock);
+ ++m_nLastClientID;
+ nID = m_nLastClientID;
}
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::OnNewServerEvent(const XnUChar* pData, XnUInt32 nDataSize, XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- nRetVal = pClient->pStream->WriteData(pData, nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-void XnSensorServer::DumpMessage(const XnChar* strType, XnUInt32 nSize /* = 0 */, XnUInt32 nClientID /* = 0 */, const XnChar* strComment /* = "" */ )
-{
- XnUInt64 nNow;
- xnOSGetHighResTimeStamp(&nNow);
-
- xnDumpWriteString(m_serverDump, "%llu,%s,%d,%d,%s\n", nNow, strType, nSize, nClientID, strComment);
-}
-
-XnStatus XnSensorServer::OnStreamAdded(const XnChar* StreamName)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // get all props
- XN_PROPERTY_SET_CREATE_ON_STACK(props);
- nRetVal = m_sensor.GetAllProperties(&props, FALSE, StreamName);
- XN_IS_STATUS_OK(nRetVal);
-
- // register to all props
- nRetVal = RegisterToProps(&props);
- XN_IS_STATUS_OK(nRetVal);
-
- XnActualPropertiesHash* pStreamProps = props.pData->begin().Value();
-
- // take type
- XnProperty* pProp = NULL;
- nRetVal = pStreamProps->Get(XN_STREAM_PROPERTY_TYPE, pProp);
- XN_IS_STATUS_OK(nRetVal);
- XnActualStringProperty* pTypeProp = (XnActualStringProperty*)pProp;
+ // create new session
+ XnServerSession* pSession;
+ XN_VALIDATE_NEW(pSession, XnServerSession, &m_sensorsManager, nID, hClientSocket, &m_logger);
- nRetVal = XnPropertySetDataDetachModule(props.pData, StreamName, &pStreamProps);
- XN_IS_STATUS_OK(nRetVal);
-
- // add it to property list
- nRetVal = XnPropertySetDataAttachModule(&m_allStreamsProps, StreamName, pStreamProps);
- XN_IS_STATUS_OK(nRetVal);
-
- // create stream data
- XnServerStream serverStream;
- xnOSMemSet(&serverStream, 0, sizeof(serverStream));
- strcpy(serverStream.strType, StreamName);
- nRetVal = m_sensor.CreateStreamData(StreamName, &serverStream.pStreamData);
- XN_IS_STATUS_OK(nRetVal);
+ nRetVal = pSession->Init();
+ if (nRetVal != XN_STATUS_OK)
+ {
+ XN_DELETE(pSession);
+ return (nRetVal);
+ }
- nRetVal = m_pServerStreams->Set(StreamName, serverStream);
- XN_IS_STATUS_OK(nRetVal);
+ // add it to list in a lock
+ {
+ XnAutoCSLocker locker(m_hSessionsLock);
+ nRetVal = m_sessions.AddLast(pSession);
+ }
+ if (nRetVal != XN_STATUS_OK)
+ {
+ XN_DELETE(pSession);
+ return (nRetVal);
+ }
return (XN_STATUS_OK);
}
-XnStatus XnSensorServer::OnStreamRemoved(const XnChar* StreamName)
+XnStatus XnSensorServer::RemoveSession(XnSessionsList::ConstIterator it)
{
XnStatus nRetVal = XN_STATUS_OK;
-
- // no need to unregister from its props - they do not exist anymore.
-
- // remove stream data
- XnServerStream* pServerStream;
- nRetVal = m_pServerStreams->Get(StreamName, pServerStream);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = m_sensor.DestroyStreamData(&pServerStream->pStreamData);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = m_pServerStreams->Remove(StreamName);
- XN_IS_STATUS_OK(nRetVal);
- // remove from our list
- XnActualPropertiesHash* pStreamProps = NULL;
- nRetVal = XnPropertySetDataDetachModule(&m_allStreamsProps, StreamName, &pStreamProps);
- XN_IS_STATUS_OK(nRetVal);
+ XnServerSession* pSession = *it;
- XN_DELETE(pStreamProps);
-
- return (XN_STATUS_OK);
-}
+ XnUInt32 nID = pSession->ID();
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Removing client %u...", nID);
-XnStatus XnSensorServer::OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- switch (EventType)
{
- case XN_DEVICE_STREAM_ADDED:
- {
- nRetVal = OnStreamAdded(StreamName);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_DEVICE_STREAM_DELETED:
- {
- nRetVal = OnStreamRemoved(StreamName);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- default:
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "unknown event: %d", EventType);
- }
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::OnPropertyChanged(const XnProperty* pProp)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnUInt64 nValue = 0;
- XnDouble dValue = 0;
- XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
- XnGeneralBuffer gbValue = {NULL, 0};
- XnBool bPassPropToClients = TRUE;
+ XnAutoCSLocker locker(m_hSessionsLock);
+ nRetVal = m_sessions.Remove(it);
+ XN_IS_STATUS_OK(nRetVal);
- switch (pProp->GetType())
- {
- case XN_PROPERTY_TYPE_INTEGER:
- {
- XnIntProperty* pIntProp = (XnIntProperty*)pProp;
- nRetVal = pIntProp->GetValue(&nValue);
- XN_IS_STATUS_OK(nRetVal);
- nRetVal = OnIntPropertyChangedInternally(pProp->GetName(), nValue, bPassPropToClients);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PROPERTY_TYPE_REAL:
- {
- XnRealProperty* pRealProp = (XnRealProperty*)pProp;
- nRetVal = pRealProp->GetValue(&dValue);
- XN_IS_STATUS_OK(nRetVal);
- nRetVal = OnRealPropertyChangedInternally(pProp->GetName(), dValue, bPassPropToClients);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PROPERTY_TYPE_STRING:
+ if (m_sessions.IsEmpty())
{
- XnStringProperty* pStringProp = (XnStringProperty*)pProp;
- nRetVal = pStringProp->GetValue(strValue);
- XN_IS_STATUS_OK(nRetVal);
- nRetVal = OnStringPropertyChangedInternally(pProp->GetName(), strValue, bPassPropToClients);
- XN_IS_STATUS_OK(nRetVal);
- break;
+ xnOSGetTimeStamp(&m_nLastSessionActivity);
}
- case XN_PROPERTY_TYPE_GENERAL:
- {
- XnGeneralProperty* pGenProp = (XnGeneralProperty*)pProp;
-
- // find its size from properties map
- XnActualPropertiesHash* pModule;
- nRetVal = m_allStreamsProps.Get(pProp->GetModule(), pModule);
- XN_IS_STATUS_OK(nRetVal);
-
- XnProperty* pActualProp;
- nRetVal = pModule->Get(pProp->GetName(), pActualProp);
- XN_IS_STATUS_OK(nRetVal);
-
- XnActualGeneralProperty* pActualGenProp = (XnActualGeneralProperty*)pActualProp;
-
- // allocate
- nRetVal = XnGeneralBufferAlloc(&gbValue, pActualGenProp->GetValue().nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- // take value
- nRetVal = pGenProp->GetValue(gbValue);
- if (nRetVal != XN_STATUS_OK)
- {
- XnGeneralBufferFree(&gbValue);
- return nRetVal;
- }
+ }
- nRetVal = OnGeneralPropertyChangedInternally(pProp->GetName(), gbValue, bPassPropToClients);
- if (nRetVal != XN_STATUS_OK)
- {
- XnGeneralBufferFree(&gbValue);
- return nRetVal;
- }
+ pSession->Free();
+ XN_DELETE(pSession);
- break;
- }
- default:
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Unknown property type: %d", pProp->GetType());
- }
-
- if (bPassPropToClients)
- {
- xnOSEnterCriticalSection(&m_hClientsCriticalSection);
- for (XnClientsList::Iterator it = m_clients.begin(); it != m_clients.end(); ++it)
- {
- XnClient* pClient = *it;
- const XnChar* strModule = pClient->FromServerModule(pProp->GetModule());
- if (strModule == NULL)
- {
- continue;
- }
-
- // send message
- DumpMessage("PropChange", 0, pClient->nID, pProp->GetName());
- switch (pProp->GetType())
- {
- case XN_PROPERTY_TYPE_INTEGER:
- {
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WriteProperty(strModule, pProp->GetName(), nValue);
- break;
- }
- case XN_PROPERTY_TYPE_REAL:
- {
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WriteProperty(strModule, pProp->GetName(), dValue);
- break;
- }
- case XN_PROPERTY_TYPE_STRING:
- {
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WriteProperty(strModule, pProp->GetName(), strValue);
- break;
- }
- case XN_PROPERTY_TYPE_GENERAL:
- {
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WriteProperty(strModule, pProp->GetName(), gbValue);
- break;
- }
- }
-
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
- XnGeneralBufferFree(&gbValue);
- return nRetVal;
- }
- } // clients loop
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
- }
-
- // free allocated buffer
- XnGeneralBufferFree(&gbValue);
- return XN_STATUS_OK;
-}
-
-XnStatus XnSensorServer::ReadStreams()
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- while (IsServerRunning())
- {
- nRetVal = xnOSWaitEvent(m_hNewDataEvent, XN_NODE_WAIT_FOR_DATA_TIMEOUT);
- if (nRetVal == XN_STATUS_OS_EVENT_TIMEOUT)
- {
- continue;
- }
-
- if (nRetVal != XN_STATUS_OK)
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Got error waiting for new data event: %s", xnGetStatusString(nRetVal));
- }
-
- typedef struct
- {
- XnUInt64 nTimestamp;
- XnUInt32 nFrameID;
- XnChar strName[XN_MAX_NAME_LENGTH];
- } NewStreamData;
-
- NewStreamData aNewStreamData[5];
- XnUInt32 nCount = 0;
-
- // read streams with lock
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- for (XnServerStreamsHash::Iterator it = m_pServerStreams->begin(); it != m_pServerStreams->end(); ++it)
- {
- XnServerStream& stream = it.Value();
-
- if (stream.bNewData)
- {
- // ignore audio (it is read by every client)
- if (strcmp(stream.strType, XN_STREAM_NAME_AUDIO) != 0)
- {
- // read this data
- nRetVal = m_sensor.ReadStream(stream.pStreamData);
- if (nRetVal != XN_STATUS_OK)
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed reading from stream %s (though event was raised): %s", stream.strType, xnGetStatusString(nRetVal));
- stream.bNewData = FALSE;
- continue;
- }
- }
-
- stream.bNewData = FALSE;
-
- aNewStreamData[nCount].nTimestamp = stream.pStreamData->nTimestamp;
- aNewStreamData[nCount].nFrameID = stream.pStreamData->nFrameID;
- strcpy(aNewStreamData[nCount].strName, stream.strType);
- nCount++;
- }
- } // streams loop
- } // lock
-
- // now send notifications (outside of server lock)
- for (XnUInt32 i = 0; i < nCount; ++i)
- {
- xnOSEnterCriticalSection(&m_hClientsCriticalSection);
- for (XnClientsList::Iterator it = m_clients.begin(); it != m_clients.end(); ++it)
- {
- XnClient* pClient = *it;
-
- // check if client has stream open
- if (!pClient->IsStreamOpen(aNewStreamData[i].strName))
- {
- continue;
- }
-
- // notify about the new data
- const XnChar* strStreamName = pClient->FromServerModule(aNewStreamData[i].strName);
- if (strStreamName != NULL)
- {
- XnSensorServerNewStreamData message;
- xnOSMemSet(&message, 0, sizeof(message));
- message.nTimestamp = aNewStreamData[i].nTimestamp;
- message.nFrameID = aNewStreamData[i].nFrameID;
- strcpy(message.strStreamName, strStreamName);
- DumpMessage("NewData", sizeof(XnSensorServerNewStreamData), 0, strStreamName);
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WriteCustomData(XN_SENSOR_SERVER_MESSAGE_NEW_STREAM_DATA, &message, sizeof(XnSensorServerNewStreamData));
- if (nRetVal != XN_STATUS_OK)
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed sending new data event to client %d", pClient->nID);
- } //if (nRetVal != XN_STATUS_OK)
- } //if (strStreamName != NULL)
- } //for (clients)
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
- }
-
- } //while (m_bShouldRun)
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::OnNewStreamData(const XnChar* StreamName)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnServerStream* pStream;
- nRetVal = m_pServerStreams->Get(StreamName, pStream);
- XN_IS_STATUS_OK(nRetVal);
-
- pStream->bNewData = TRUE;
-
- nRetVal = xnOSSetEvent(m_hNewDataEvent);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::SendInitialState(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- XN_PROPERTY_SET_CREATE_ON_STACK(props);
-
- // get it
- nRetVal = m_sensor.GetAllProperties(&props, TRUE);
- XN_IS_STATUS_OK(nRetVal);
-
- // and send it
- DumpMessage("InitialState", 0, pClient->nID);
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WritePropertySet(&props);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::AddClient(XN_SOCKET_HANDLE hClientSocket)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // create new client
- XnClient* pClient;
- XN_VALIDATE_NEW(pClient, XnClient);
- pClient->hSocket = hClientSocket;
- pClient->pServer = this;
- pClient->pStream = XN_NEW(XnIONetworkStream, pClient->hSocket);
- pClient->pPrivateIncomingPacker = XN_NEW(XnDataPacker, pClient->pStream, XN_SENSOR_SERVER_CONFIG_PACKER_SIZE);
- pClient->pPrivateOutgoingPacker = XN_NEW(XnDataPacker, pClient->pStream, XN_SENSOR_SERVER_CONFIG_PACKER_SIZE);
-
- if (pClient->pStream == NULL || pClient->pPrivateIncomingPacker == NULL || pClient->pPrivateOutgoingPacker == NULL)
- {
- XN_DELETE(pClient);
- return (XN_STATUS_ALLOC_FAILED);
- }
-
- nRetVal = XnStreamDataSetCreate(&pClient->pStreamDataSet);
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pClient);
- return (XN_STATUS_ALLOC_FAILED);
- }
-
- nRetVal = xnOSCreateCriticalSection(&pClient->hLock);
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pClient);
- return (nRetVal);
- }
-
- nRetVal = pClient->pPrivateIncomingPacker->Init();
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pClient);
- return (nRetVal);
- }
-
- nRetVal = pClient->pPrivateOutgoingPacker->Init();
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pClient);
- return (nRetVal);
- }
-
- // lock the device (so that configuration wouldn't change before we register to it all)
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
-
- m_nLastClientID++;
- pClient->nID = m_nLastClientID;
-
- // create thread
- nRetVal = xnOSCreateThread(ClientThread, pClient, &pClient->hThread);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSLeaveCriticalSection(&m_hSensorLock);
- XN_DELETE(pClient);
- return (nRetVal);
- }
-
- // add it to clients list
- xnOSEnterCriticalSection(&m_hClientsCriticalSection);
- m_clients.AddLast(pClient);
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
-
- } // lock end
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::RemoveClientStream(XnClient* pClient, const XnChar* strName)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- const XnChar* strServerName = pClient->ToServerModule(strName);
- if (strServerName == NULL)
- {
- return XN_STATUS_NO_MATCH;
- }
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u is releasing stream %s", pClient->nID, strServerName);
-
- // first of all, if client had a buffer of this stream, release it
- XnStreamData* pStreamData = NULL;
- nRetVal = XnStreamDataSetGet(pClient->pStreamDataSet, strServerName, &pStreamData);
- if (nRetVal == XN_STATUS_OK)
- {
- XnSharedMemoryBufferPool* pBufferPool = NULL;
- nRetVal = m_sensor.GetSharedBufferPool(strServerName, &pBufferPool);
- XN_IS_STATUS_OK(nRetVal);
-
- if (pStreamData->pInternal->pLockedBuffer != NULL)
- {
- pBufferPool->DecRef(pStreamData->pInternal->pLockedBuffer);
- }
-
- // free data
- XnStreamDataSetRemove(pClient->pStreamDataSet, pStreamData);
- XnStreamDataDestroy(&pStreamData);
- }
-
- // and dec ref it
- XnServerStream* pStream;
- nRetVal = m_pServerStreams->Get(strServerName, pStream);
- if (nRetVal == XN_STATUS_OK)
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- --pStream->nRefCount;
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Stream %s now has %u clients", strServerName, pStream->nRefCount);
-
- if (pStream->nRefCount == 0)
- {
- m_sensor.CloseStream(strServerName);
- m_sensor.DestroyStream(strServerName);
-
- // the rest will be done in the OnStreamRemoved event handler...
- }
- }
-
- // now remove it from client
- pClient->serverToClientNames.Remove(strServerName);
- pClient->clientToServerNames.Remove(strName);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::RemoveClient(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Removing client %u...", pClient->nID);
-
- pClient->bShouldRun = FALSE;
-
- // dec ref of every stream
- while (!pClient->clientToServerNames.IsEmpty())
- {
- RemoveClientStream(pClient, pClient->clientToServerNames.begin().Key());
- }
-
- xnOSEnterCriticalSection(&m_hClientsCriticalSection);
- XnClientsList::ConstIterator it = m_clients.Find(pClient);
- m_clients.Remove(it);
- xnOSLeaveCriticalSection(&m_hClientsCriticalSection);
-
- xnOSWaitAndTerminateThread(&pClient->hThread, 3000);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u removed", pClient->nID);
- XN_DELETE(pClient);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::ReturnToDefaults()
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // This is a bit ugly, but we need to manually set back to default DEVICE properties
- // (we know there aren't any streams and clients, but the Device module always remains)
- nRetVal = m_sensor.SetProperty(XN_MODULE_NAME_DEVICE, XN_MODULE_PROPERTY_FRAME_SYNC, (XnUInt64)FALSE);
- XN_IS_STATUS_OK(nRetVal);
-
- nRetVal = m_sensor.ConfigureModuleFromGlobalFile(XN_MODULE_NAME_DEVICE);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::SendReply(XnClient* pClient, XnSensorServerCustomMessages Type, XnStatus nRC, XnUInt32 nDataSize /* = 0 */, void* pAdditionalData /* = NULL */)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnUChar message[XN_SENSOR_SERVER_MAX_REPLY_SIZE];
- XnSensorClientServerReply* pReply = (XnSensorClientServerReply*)message;
- pReply->nRetVal = nRC;
- pReply->Type = Type;
- pReply->nDataSize = nDataSize;
- xnOSMemCopy(pReply->pData, pAdditionalData, nDataSize);
- XnUChar* pEnd = pReply->pData + nDataSize;
-
- DumpMessage("Reply", nDataSize, pClient->nID);
-
- // lock this so that messages don't mix up
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
-
- nRetVal = pClient->pPrivateOutgoingPacker->WriteCustomData(Type, message, pEnd - message);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleOpenSensor(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strConnectionString[XN_DEVICE_MAX_STRING_LENGTH];
- XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_OPEN_SENSOR, strConnectionString, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to open sensor %s", pClient->nID, strConnectionString);
-
- // make sure sensor is open
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- if (!m_bSensorOpen)
- {
- nRetVal = OpenSensor(strConnectionString);
- m_bSensorOpen = (nRetVal == XN_STATUS_OK);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- // sensor is open. send client its initial state
- nRetVal = SendInitialState(pClient);
- }
- }
-
- // if an error occurred, send it to the client
- if (nRetVal != XN_STATUS_OK)
- {
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
- }
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleSetIntProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
- XnUInt64 nValue;
- nRetVal = pClient->pPrivateIncomingPacker->ReadProperty(strModule, strProp, &nValue);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", pClient->nID, strModule, strProp);
-
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.SetProperty(pClient->ToServerModule(strModule), strProp, nValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleSetRealProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
- XnDouble dValue;
- nRetVal = pClient->pPrivateIncomingPacker->ReadProperty(strModule, strProp, &dValue);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", pClient->nID, strModule, strProp);
-
- // set
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.SetProperty(pClient->ToServerModule(strModule), strProp, dValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleSetStringProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
- nRetVal = pClient->pPrivateIncomingPacker->ReadProperty(strModule, strProp, strValue);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", pClient->nID, strModule, strProp);
-
- // set
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.SetProperty(pClient->ToServerModule(strModule), strProp, strValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleSetGeneralProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
- XnGeneralBuffer gbValue;
- nRetVal = pClient->pPrivateIncomingPacker->ReadProperty(strModule, strProp, &gbValue);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", pClient->nID, strModule, strProp);
-
- // set
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.SetProperty(pClient->ToServerModule(strModule), strProp, gbValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleGetIntProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnSensorServerMessageGetPropertyRequest request;
- XnUInt32 nDataSize = sizeof(request);
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY, &request, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
- if (nDataSize != sizeof(request))
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
- }
-
- XnUInt64 nValue;
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
-
- nRetVal = m_sensor.GetProperty(pClient->ToServerModule(request.strModuleName), request.strPropertyName, &nValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY, nRetVal, sizeof(nValue), &nValue);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleGetRealProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnSensorServerMessageGetPropertyRequest request;
- XnUInt32 nDataSize = sizeof(request);
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY, &request, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
- if (nDataSize != sizeof(request))
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
- }
-
- XnDouble dValue;
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
-
- nRetVal = m_sensor.GetProperty(pClient->ToServerModule(request.strModuleName), request.strPropertyName, &dValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY, nRetVal, sizeof(dValue), &dValue);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleGetStringProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnSensorServerMessageGetPropertyRequest request;
- XnUInt32 nDataSize = sizeof(request);
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY, &request, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
- if (nDataSize != sizeof(request))
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
- }
-
- XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
-
- nRetVal = m_sensor.GetProperty(pClient->ToServerModule(request.strModuleName), request.strPropertyName, strValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY, nRetVal, sizeof(strValue), strValue);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleGetGeneralProperty(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnUChar bufValue[XN_SENSOR_SERVER_MAX_REPLY_SIZE];
- XnSensorServerMessageGetPropertyRequest* pRequest = (XnSensorServerMessageGetPropertyRequest*)bufValue;
- XnUChar* pData = bufValue + sizeof(XnSensorServerMessageGetPropertyRequest);
- XnUInt32 nDataSize = XN_SENSOR_SERVER_MAX_REPLY_SIZE;
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY, bufValue, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- if (nDataSize < sizeof(XnSensorServerMessageGetPropertyRequest))
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
- }
-
- XnGeneralBuffer gbValue = XnGeneralBufferPack(pData, pRequest->nSize);
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.GetProperty(pClient->ToServerModule(pRequest->strModuleName), pRequest->strPropertyName, gbValue);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY, nRetVal, pRequest->nSize, pData);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleConfigFromINIFile(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnSensorServerMessageIniFile message;
- XnUInt32 nDataSize = sizeof(message);
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_INI_FILE, (XnUChar*)&message, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- if (nDataSize != sizeof(message))
- {
- XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
- }
-
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.LoadConfigFromFile(message.strFileName, message.strSectionName);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleBatchConfig(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XN_PROPERTY_SET_CREATE_ON_STACK(props);
-
- nRetVal = pClient->pPrivateIncomingPacker->ReadPropertySet(&props);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested a batch config", pClient->nID);
-
- XN_PROPERTY_SET_CREATE_ON_STACK(serverProps);
- for (XnPropertySetData::Iterator it = props.pData->begin(); it != props.pData->end(); ++it)
- {
- if (nRetVal == XN_STATUS_OK)
- {
- nRetVal = XnPropertySetCloneModule(&props, &serverProps, it.Key(), pClient->ToServerModule(it.Key()));
- }
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- nRetVal = m_sensor.BatchConfig(&serverProps);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleNewStream(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XN_PROPERTY_SET_CREATE_ON_STACK(props);
-
- XnChar strType[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];
- nRetVal = pClient->pPrivateIncomingPacker->ReadNewStream(strType, strName, &props);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to create stream '%s' (%s)", pClient->nID, strName, strType);
-
- XnPropertySet* pInitialValues = &props;
- if (props.pData->begin() == props.pData->end())
- {
- pInitialValues = NULL;
- }
-
- // if a stream of this type already exists, take it instead
- XnServerStream* pServerStream;
-
- XN_SENSOR_SERVER_LOCK_BLOCK;
-
- if (XN_STATUS_OK == m_pServerStreams->Get(strType, pServerStream))
- {
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Stream %s already exists.", strType);
- // configure it
- if (pInitialValues != NULL)
- {
- nRetVal = m_sensor.BatchConfig(pInitialValues);
- }
- }
- else
- {
- // create the stream
- nRetVal = m_sensor.CreateStream(strType, strType, pInitialValues);
-
- if (nRetVal == XN_STATUS_OK)
- {
- nRetVal = m_pServerStreams->Get(strType, pServerStream);
- }
- }
-
- // send client the new stream data
- if (nRetVal == XN_STATUS_OK)
- {
- XN_PROPERTY_SET_CREATE_ON_STACK(streamProps);
- XN_PROPERTY_SET_CREATE_ON_STACK(clientStreamProps);
-
- if (nRetVal == XN_STATUS_OK)
- {
- // take properties
- nRetVal = m_sensor.GetAllProperties(&streamProps, FALSE, strType);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- // copy relevant ones
- nRetVal = XnPropertySetCloneModule(&streamProps, &clientStreamProps, strType, strName);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- // now change the state property. It should be OFF, and not the real value (each client has
- // its own stream state).
- nRetVal = XnPropertySetRemoveProperty(&clientStreamProps, strName, XN_STREAM_PROPERTY_STATE);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- nRetVal = XnPropertySetAddIntProperty(&clientStreamProps, strName, XN_STREAM_PROPERTY_STATE, FALSE);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- DumpMessage("NewStream", 0, pClient->nID, strName);
- {
- XN_SENSOR_SERVER_CLIENT_LOCK_BLOCK;
- nRetVal = pClient->pPrivateOutgoingPacker->WriteNewStream(strType, strName, &clientStreamProps);
- }
- }
- }
-
- // add ref to it
- if (nRetVal == XN_STATUS_OK)
- {
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u adding ref to stream '%s'", pClient->nID, strType);
- ++pServerStream->nRefCount;
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Stream %s now has %u clients.", strType, pServerStream->nRefCount);
- }
-
- // now add it to client data
- XnStreamData* pStreamData = NULL;
- if (nRetVal == XN_STATUS_OK)
- {
- // add names mapping
- XnDeviceString str;
- strcpy(str.str, strType);
- pClient->clientToServerNames.Set(strName, str);
- strcpy(str.str, strName);
- pClient->serverToClientNames.Set(strType, str);
-
- // create client stream data
- nRetVal = m_sensor.CreateStreamData(strType, &pStreamData);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- // and add it to set
- nRetVal = XnStreamDataSetAdd(pClient->pStreamDataSet, pStreamData);
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleRemoveStream(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];
- nRetVal = pClient->pPrivateIncomingPacker->ReadStreamRemoved(strName);
- XN_IS_STATUS_OK(nRetVal);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to close stream %s", pClient->nID, strName);
-
- nRetVal = RemoveClientStream(pClient, strName);
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleReadStream(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
- XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(XN_SENSOR_SERVER_MESSAGE_READ_STREAM, strStreamName, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- const XnChar* strServerName = pClient->ToServerModule(strStreamName);
-
- // take client stream data and server stream data
- XnStreamData* pStreamData;
- nRetVal = XnStreamDataSetGet(pClient->pStreamDataSet, strServerName, &pStreamData);
-
- XnServerStream* pServerStream = NULL;
-
- if (nRetVal == XN_STATUS_OK)
- {
- nRetVal = m_pServerStreams->Get(strServerName, pServerStream);
- }
-
- XnSharedMemoryBufferPool* pBufferPool = NULL;
- XnBuffer* pDecRef = NULL;
- if (nRetVal == XN_STATUS_OK)
- {
- pDecRef = pStreamData->pInternal->pLockedBuffer;
- nRetVal = m_sensor.GetSharedBufferPool(strServerName, &pBufferPool);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- // take server data for this stream, and add ref to it
- XN_SENSOR_SERVER_LOCK_BLOCK;
- pStreamData->nDataSize = pServerStream->pStreamData->nDataSize;
- pStreamData->nFrameID = pServerStream->pStreamData->nFrameID;
- pStreamData->nTimestamp = pServerStream->pStreamData->nTimestamp;
- pStreamData->pData = pServerStream->pStreamData->pData;
- pStreamData->pInternal->pLockedBuffer = pServerStream->pStreamData->pInternal->pLockedBuffer;
-
- if (pStreamData->pInternal->pLockedBuffer != NULL)
- {
- pBufferPool->AddRef(pStreamData->pInternal->pLockedBuffer);
- }
-
- if (pDecRef != NULL)
- {
- pBufferPool->DecRef(pDecRef);
- }
-
- XnSensorServerReadReply reply;
- reply.nDataSize = pStreamData->nDataSize;
- reply.nFrameID = pStreamData->nFrameID;
- reply.nTimestamp = pStreamData->nTimestamp;
- reply.nOffset = pBufferPool->GetBufferOffset(pStreamData->pInternal->pLockedBuffer);
-
- DumpMessage("Data", sizeof(reply), 0, strStreamName);
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_READ_STREAM, XN_STATUS_OK, sizeof(reply), &reply);
- XN_IS_STATUS_OK(nRetVal);
- }
- else
- {
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
- }
-
- return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorServer::HandleSetStreamState(XnClient* pClient, XnBool bRequestOpen)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- // read it
- XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
- XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
- XnUInt32 nType = bRequestOpen ? XN_SENSOR_SERVER_MESSAGE_OPEN_STREAM : XN_SENSOR_SERVER_MESSAGE_CLOSE_STREAM;
- nRetVal = pClient->pPrivateIncomingPacker->ReadCustomData(nType, strStreamName, &nDataSize);
- XN_IS_STATUS_OK(nRetVal);
-
- const XnChar* strServerName = pClient->ToServerModule(strStreamName);
-
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to %s stream %s", pClient->nID, bRequestOpen ? "open" : "close", strServerName);
-
- {
- XN_SENSOR_SERVER_LOCK_BLOCK;
- XnServerStream* pServerStream = NULL;
-
- if (nRetVal == XN_STATUS_OK)
- {
- nRetVal = m_pServerStreams->Get(strServerName, pServerStream);
- }
-
- if (nRetVal == XN_STATUS_OK)
- {
- // check if this stream is currently open for this client (meaning, client
- // receives its data)
- XnBool bIsOpenForClient = FALSE;
- XnNamesHash::Iterator it = pClient->openStreams.end();
- bIsOpenForClient = (pClient->openStreams.Find(strServerName, it) == XN_STATUS_OK);
-
- if (bRequestOpen && !bIsOpenForClient)
- {
- XnDeviceString dummy;
- nRetVal = pClient->openStreams.Set(strServerName, dummy);
-
- if (nRetVal == XN_STATUS_OK)
- {
- pServerStream->nOpenRefCount++;
-
- if (pServerStream->nOpenRefCount == 1) // first one to open
- {
- // open it
- nRetVal = m_sensor.OpenStream(strServerName);
- }
-
- if (nRetVal != XN_STATUS_OK)
- {
- xnLogError(XN_MASK_SENSOR_SERVER, "Failed to open stream: %s", xnGetStatusString(nRetVal));
- XN_ASSERT(pServerStream->nOpenRefCount > 0);
- --pServerStream->nOpenRefCount;
- pClient->openStreams.Remove(strServerName);
- }
- else
- {
- xnLogInfo(XN_MASK_SENSOR_SERVER, "Stream %s is now open by %u clients.", strServerName, pServerStream->nOpenRefCount);
- }
- }
- }
- else if (!bRequestOpen && bIsOpenForClient)
- {
- pClient->openStreams.Remove(strServerName);
- xnLogInfo(XN_MASK_SENSOR_SERVER, "Stream %s is now open by %u clients.", strServerName, pServerStream->nOpenRefCount);
- --pServerStream->nOpenRefCount;
-
- if (pServerStream->nOpenRefCount == 0)
- {
- m_sensor.CloseStream(strServerName);
- }
- }
- else
- {
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client requested to %s stream %s, but this was already the state.", bRequestOpen ? "open" : "close", strServerName);
- }
- }
- }
-
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nRetVal);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
-}
-
-
-XnStatus XnSensorServer::HandleSingleRequest(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnPackedDataType nType;
- nRetVal = pClient->pPrivateIncomingPacker->ReadNextObject(&nType);
- XN_IS_STATUS_OK(nRetVal);
-
- XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
- XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
-
- switch (nType)
- {
- case XN_SENSOR_SERVER_MESSAGE_OPEN_SENSOR:
- {
- nRetVal = HandleOpenSensor(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_INT_PROPERTY:
- {
- nRetVal = HandleSetIntProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_REAL_PROPERTY:
- {
- nRetVal = HandleSetRealProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_STRING_PROPERTY:
- {
- nRetVal = HandleSetStringProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_GENERAL_PROPERTY:
- {
- nRetVal = HandleSetGeneralProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY:
- {
- nRetVal = HandleGetIntProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY:
- {
- nRetVal = HandleGetRealProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY:
- {
- nRetVal = HandleGetStringProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY:
- {
- nRetVal = HandleGetGeneralProperty(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_INI_FILE:
- {
- nRetVal = HandleConfigFromINIFile(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_PROPERTY_SET:
- {
- nRetVal = HandleBatchConfig(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_NEW_STREAM:
- {
- nRetVal = HandleNewStream(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_PACKED_STREAM_REMOVED:
- {
- nRetVal = HandleRemoveStream(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_READ_STREAM:
- {
- nRetVal = HandleReadStream(pClient);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_OPEN_STREAM:
- {
- nRetVal = HandleSetStreamState(pClient, TRUE);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
- case XN_SENSOR_SERVER_MESSAGE_CLOSE_STREAM:
- {
- nRetVal = HandleSetStreamState(pClient, FALSE);
- XN_IS_STATUS_OK(nRetVal);
- break;
- }
-
- case XN_SENSOR_SERVER_MESSAGE_BYE:
- {
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Received BYE from client %u", pClient->nID);
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_BYE, nRetVal, 0, NULL);
- if (nRetVal != XN_STATUS_OK)
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed to send BYE reply to client %u: %s", pClient->nID, xnGetStatusString(nRetVal));
- }
- pClient->bShouldRun = FALSE; //Signal the client to stop
-
- break;
- }
-
- default:
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Unknown client request: %d", nType);
- nRetVal = SendReply(pClient, XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, XN_STATUS_ERROR);
- XN_IS_STATUS_OK(nRetVal);
-
- return XN_STATUS_ERROR;
- }
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u removed", nID);
return (XN_STATUS_OK);
}
-XnStatus XnSensorServer::ServeClient(XnClient* pClient)
-{
- XnStatus nRetVal = XN_STATUS_OK;
-
- while (IsServerRunning() && pClient->bShouldRun)
- {
- if (!pClient->pStream->IsConnected())
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u socket was closed.", pClient->nID);
- break;
- }
-
- nRetVal = HandleSingleRequest(pClient);
- if ((nRetVal != XN_STATUS_OK) &&
- (nRetVal != XN_STATUS_OS_NETWORK_CONNECTION_CLOSED) &&
- (nRetVal != XN_STATUS_OS_NETWORK_TIMEOUT))
- {
- xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed processing client request: %s", xnGetStatusString(nRetVal));
- }
- }
-
- // We cannot RemoveClient from this thread (as part of it is to close the thread). Instead, signal that
- // client has stopped, and let server main thread wait for exit.
- pClient->bShouldRun = FALSE;
-
- return (XN_STATUS_OK);
-}
-
-XN_THREAD_PROC XnSensorServer::ClientThread(XN_THREAD_PARAM pThreadParam)
-{
- XnClient* pClient = (XnClient*)pThreadParam;
- XnStatus nRetVal = pClient->pServer->ServeClient(pClient);
- XN_THREAD_PROC_RETURN(nRetVal);
-}
-
-XN_THREAD_PROC XnSensorServer::ReaderThread(XN_THREAD_PARAM pThreadParam)
-{
- XnSensorServer* pThis = (XnSensorServer*)pThreadParam;
- XnStatus nRetVal = pThis->ReadStreams();
- XN_THREAD_PROC_RETURN(nRetVal);
-}
-
-void XnSensorServer::StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie)
-{
- XnSensorServer* pThis = (XnSensorServer*)pCookie;
- pThis->OnStreamCollectionChanged(StreamName, EventType);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensorServer::PropertyChangedCallback(const XnProperty* pProp, void* pCookie)
-{
- XnSensorServer* pThis = (XnSensorServer*)pCookie;
- return pThis->OnPropertyChanged(pProp);
-}
-
-void XN_CALLBACK_TYPE XnSensorServer::NewServerEventCallback(const XnUChar* pData, XnUInt32 nDataSize, void* pCookie)
-{
- XnClient* pClient = (XnClient*)pCookie;
- pClient->pServer->OnNewServerEvent(pData, nDataSize, pClient);
-}
-
-void XN_CALLBACK_TYPE XnSensorServer::NewStreamDataCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, void* pCookie)
-{
- XnSensorServer* pThis = (XnSensorServer*)pCookie;
- pThis->OnNewStreamData(StreamName);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensorServer::StartNewLogCallback(XnIntProperty* pSender, XnUInt64 nValue, void* pCookie)
-{
- xnLogVerbose(XN_MASK_SENSOR_SERVER, "Closing current log file...");
- return xnLogStartNewFile();
-}
-
-XnStatus XnSensorServer::OnIntPropertyChangedInternally(const XnChar* strPropName, XnUInt64 nValue, XnBool& bPassPropToClients)
-{
- XnStatus nRetVal = XN_STATUS_OK;
- bPassPropToClients = TRUE;
-
- if (strcmp(strPropName, XN_STREAM_PROPERTY_STATE) == 0)
- {
- // ignore STATE property (every client has its own value)
- bPassPropToClients = FALSE;
- }
- else if (strcmp(strPropName, XN_MODULE_PROPERTY_ERROR_STATE) == 0)
- {
- XnStatus nOldErrorState = m_nErrorState;
- m_nErrorState = (XnStatus)nValue;
- switch (m_nErrorState)
- {
- case XN_STATUS_DEVICE_NOT_CONNECTED:
- //TODO: Handle disconnection
- break;
- case XN_STATUS_OK:
- if (nOldErrorState == XN_STATUS_DEVICE_NOT_CONNECTED)
- {
- //TODO: Handle re-connection
- break;
- }
- }
- }
-
- return XN_STATUS_OK;
-}
-
-XnStatus XnSensorServer::OnRealPropertyChangedInternally(const XnChar* strPropName, XnDouble dValue, XnBool& bPassPropToClients)
-{
- bPassPropToClients = TRUE;
- return XN_STATUS_OK;
-}
-
-XnStatus XnSensorServer::OnStringPropertyChangedInternally(const XnChar* strPropName, const XnChar* strValue, XnBool& bPassPropToClients)
-{
- bPassPropToClients = TRUE;
- return XN_STATUS_OK;
-}
-
-XnStatus XnSensorServer::OnGeneralPropertyChangedInternally(const XnChar* strPropName, const XnGeneralBuffer &gbValue, XnBool& bPassPropToClients)
-{
- bPassPropToClients = TRUE;
- return XN_STATUS_OK;
-}
-
XN_DEVICE_API XnStatus XnSensorServerGetGlobalConfigFile(const XnChar* strConfigDir, XnChar* strConfigFile, XnUInt32 nBufSize)
{
return XnSensor::ResolveGlobalConfigFileName(strConfigFile, nBufSize, strConfigDir);
@@ -1968,7 +426,7 @@ XN_DEVICE_API XnStatus XnSensorServerGetGlobalConfigFile(const XnChar* strConfig
XN_DEVICE_API XnStatus XnSensorServerRun(const XnChar* strConfigFile)
{
- XnSensorServer server;
- return server.Run(strConfigFile);
+ XnSensorServer server(strConfigFile);
+ return server.Run();
}
diff --git a/Source/XnDeviceSensorV2/XnSensorServer.h b/Source/XnDeviceSensorV2/XnSensorServer.h
index 1792a9f..797e1b1 100644
--- a/Source/XnDeviceSensorV2/XnSensorServer.h
+++ b/Source/XnDeviceSensorV2/XnSensorServer.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_SERVER_H__
#define __XN_SENSOR_SERVER_H__
@@ -34,11 +29,9 @@
#include "XnSensor.h"
#include
#include "XnSensorClientServer.h"
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-#define XN_CONFIG_FILE_SERVER_SECTION "Server"
+#include "XnServerLogger.h"
+#include "XnSensorsManager.h"
+#include "XnServerSession.h"
//---------------------------------------------------------------------------
// XnSensorServer class
@@ -48,91 +41,41 @@ class XnServerStreamsHash;
class XnSensorServer
{
public:
- XnSensorServer();
+ XnSensorServer(const XnChar* strConfigFile);
~XnSensorServer();
- XnStatus Run(const XnChar* strConfigFile);
+ XnStatus Run();
XnBool IsServerRunning();
private:
- struct XnClient; // Forward Declaration
+ XN_DECLARE_LIST(XnServerSession*, XnSessionsList);
- XnStatus InitServer(const XnChar* strConfigFile);
+ XnStatus InitServer();
XnStatus ServerMainLoop();
void ShutdownServer();
- XnStatus OpenSensor(const XnChar* strConnectionString);
- XnStatus SendInitialState(XnClient* pClient);
- XnStatus ServeClient(XnClient* pClient);
- XnStatus SendReply(XnClient* pClient, XnSensorServerCustomMessages Type, XnStatus nRC, XnUInt32 nDataSize = 0, void* pAdditionalData = NULL);
- XnStatus HandleSingleRequest(XnClient* pClient);
- XnStatus HandleOpenSensor(XnClient* pClient);
- XnStatus HandleSetIntProperty(XnClient* pClient);
- XnStatus HandleSetRealProperty(XnClient* pClient);
- XnStatus HandleSetStringProperty(XnClient* pClient);
- XnStatus HandleSetGeneralProperty(XnClient* pClient);
- XnStatus HandleGetIntProperty(XnClient* pClient);
- XnStatus HandleGetRealProperty(XnClient* pClient);
- XnStatus HandleGetStringProperty(XnClient* pClient);
- XnStatus HandleGetGeneralProperty(XnClient* pClient);
- XnStatus HandleConfigFromINIFile(XnClient* pClient);
- XnStatus HandleBatchConfig(XnClient* pClient);
- XnStatus HandleNewStream(XnClient* pClient);
- XnStatus HandleRemoveStream(XnClient* pClient);
- XnStatus HandleReadStream(XnClient* pClient);
- XnStatus HandleSetStreamState(XnClient* pClient, XnBool bOpen);
-
- XnStatus AddClient(XN_SOCKET_HANDLE hClientSocket);
- XnStatus RemoveClientStream(XnClient* pClient, const XnChar* strName);
- XnStatus RemoveClient(XnClient* pClient);
- XnStatus ReadStreams();
+ void CheckForNewClients(XnUInt32 nTimeout);
+ void CleanUpSessions();
+ XnBool ShutdownIfPossible();
+ XnBool CanShutdown();
+ void Free();
+ XnStatus AddSession(XN_SOCKET_HANDLE hClientSocket);
+ XnStatus RemoveSession(XnSessionsList::ConstIterator it);
XnStatus ReturnToDefaults();
- XnStatus OnStreamAdded(const XnChar* StreamName);
- XnStatus OnStreamRemoved(const XnChar* StreamName);
- XnStatus OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType);
- XnStatus OnPropertyChanged(const XnProperty* pProp);
- XnStatus OnNewServerEvent(const XnUChar* pData, XnUInt32 nDataSize, XnClient* pClient);
- XnStatus OnNewStreamData(const XnChar* StreamName);
-
- XnStatus RegisterToProps(XnPropertySet* pProps);
-
- void DumpMessage(const XnChar* strType, XnUInt32 nSize = 0, XnUInt32 nClientID = 0, const XnChar* strComment = "");
-
- static XN_THREAD_PROC ClientThread(XN_THREAD_PARAM pThreadParam);
- static XN_THREAD_PROC ReaderThread(XN_THREAD_PARAM pThreadParam);
-
- static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
- static XnStatus XN_CALLBACK_TYPE PropertyChangedCallback(const XnProperty* pProp, void* pCookie);
- static void XN_CALLBACK_TYPE NewServerEventCallback(const XnUChar* pData, XnUInt32 nDataSize, void* pCookie);
- static void XN_CALLBACK_TYPE NewStreamDataCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, void* pCookie);
- static XnStatus XN_CALLBACK_TYPE StartNewLogCallback(XnIntProperty* pSender, XnUInt64 nValue, void* pCookie);
-
- XN_DECLARE_LIST(XnClient*, XnClientsList);
- XnStatus OnIntPropertyChangedInternally(const XnChar* strPropName, XnUInt64 nValue, XnBool& bPassPropToClients);
- XnStatus OnRealPropertyChangedInternally(const XnChar* strPropName, XnDouble dValue, XnBool& bPassPropToClients);
- XnStatus OnStringPropertyChangedInternally(const XnChar* strPropName, const XnChar* strValue, XnBool &bPassPropToClients);
- XnStatus OnGeneralPropertyChangedInternally(const XnChar* strPropName, const XnGeneralBuffer &gbValue, XnBool& bPassPropToClients);
XN_SOCKET_HANDLE m_hListenSocket;
- XN_THREAD_HANDLE m_hReaderThread;
- XN_EVENT_HANDLE m_hNewDataEvent;
XN_EVENT_HANDLE m_hServerRunningEvent; //This event is set as long as the server is running and servicing requests
XN_MUTEX_HANDLE m_hServerRunningMutex; //This mutex protects m_hServerRunningEvent
- XN_CRITICAL_SECTION_HANDLE m_hSensorLock;
- XN_CRITICAL_SECTION_HANDLE m_hBroadcastingLock;
- XN_CRITICAL_SECTION_HANDLE m_hClientsCriticalSection;
+ XN_CRITICAL_SECTION_HANDLE m_hSessionsLock;
- XnClientsList m_clients;
- XnBool m_bSensorOpen;
- XnSensor m_sensor;
- XnPropertySetData m_allStreamsProps;
- XnServerStreamsHash* m_pServerStreams;
+ XnSessionsList m_sessions;
XnUInt32 m_nLastClientID;
- XnDump m_serverDump;
XnStatus m_nErrorState;
- XnActualIntProperty m_noClientTimeout;
- XnIntProperty m_startNewLog;
+ XnSensorsManager m_sensorsManager;
+ XnServerLogger m_logger;
+ XnUInt64 m_nLastSessionActivity;
+ const XnChar* m_strConfigFile;
};
#endif //__XN_SENSOR_SERVER_H__
diff --git a/Source/XnDeviceSensorV2/XnSensorServerRunner.h b/Source/XnDeviceSensorV2/XnSensorServerRunner.h
index 97c1cae..84c9011 100644
--- a/Source/XnDeviceSensorV2/XnSensorServerRunner.h
+++ b/Source/XnDeviceSensorV2/XnSensorServerRunner.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_SERVER_RUNNER_H__
#define __XN_SENSOR_SERVER_RUNNER_H__
diff --git a/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp b/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp
index 847929a..d5385ba 100644
--- a/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -175,10 +169,13 @@ XnStatus XnSensorStreamHelper::Close()
{
XnStatus nRetVal = XN_STATUS_OK;
- nRetVal = m_pSensorStream->CloseStreamImpl();
- XN_IS_STATUS_OK(nRetVal);
+ if (GetFirmware()->GetStreams()->IsClaimed(m_pStream->GetType(), m_pStream))
+ {
+ nRetVal = m_pSensorStream->CloseStreamImpl();
+ XN_IS_STATUS_OK(nRetVal);
- GetFirmware()->GetStreams()->ReleaseStream(m_pStream->GetType(), m_pStream);
+ GetFirmware()->GetStreams()->ReleaseStream(m_pStream->GetType(), m_pStream);
+ }
return (XN_STATUS_OK);
}
diff --git a/Source/XnDeviceSensorV2/XnSensorStreamHelper.h b/Source/XnDeviceSensorV2/XnSensorStreamHelper.h
index 95ddb78..ebc0a3e 100644
--- a/Source/XnDeviceSensorV2/XnSensorStreamHelper.h
+++ b/Source/XnDeviceSensorV2/XnSensorStreamHelper.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SENSOR_STREAM_HELPER_H__
#define __XN_SENSOR_STREAM_HELPER_H__
diff --git a/Source/XnDeviceSensorV2/XnSensorsManager.cpp b/Source/XnDeviceSensorV2/XnSensorsManager.cpp
new file mode 100644
index 0000000..fe50abe
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnSensorsManager.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnSensorsManager.h"
+#include "XnSensorClientServer.h"
+
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+#define XN_SENSOR_DEFAULT_SERVER_WAIT_FOR_CLIENT_TIME 10000
+
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+XnSensorsManager::XnSensorsManager(const XnChar* strGlobalConfigFile) :
+ m_noClientTimeout(XN_MODULE_PROPERTY_SERVER_NO_CLIENTS_TIMEOUT, XN_SENSOR_DEFAULT_SERVER_WAIT_FOR_CLIENT_TIME),
+ m_startNewLog(XN_MODULE_PROPERTY_SERVER_START_NEW_LOG_FILE),
+ m_hLock(NULL)
+{
+ m_noClientTimeout.UpdateSetCallbackToDefault();
+ m_startNewLog.UpdateSetCallback(StartNewLogCallback, this);
+
+ strcpy(m_strGlobalConfigFile, strGlobalConfigFile);
+}
+
+XnSensorsManager::~XnSensorsManager()
+{
+ Free();
+}
+
+XnStatus XnSensorsManager::Init()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = xnOSCreateCriticalSection(&m_hLock);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // read default timeout from file
+ nRetVal = m_noClientTimeout.ReadValueFromFile(m_strGlobalConfigFile, XN_SENSOR_SERVER_CONFIG_FILE_SECTION);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+void XnSensorsManager::Free()
+{
+ // close all sensors
+ while (m_sensors.begin() != m_sensors.end())
+ {
+ ReferencedSensor& sensor = m_sensors.begin().Value();
+ XN_DELETE(sensor.pInvoker);
+ }
+
+ if (m_hLock != NULL)
+ {
+ xnOSCloseCriticalSection(&m_hLock);
+ m_hLock = NULL;
+ }
+}
+
+XnStatus XnSensorsManager::GetSensor(const XnChar* strDevicePath, XnServerSensorInvoker** ppInvoker)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // check if the sensor is already open
+ XnAutoCSLocker locker(m_hLock);
+ ReferencedSensor* pSensor;
+ nRetVal = m_sensors.Get(strDevicePath, pSensor);
+ if (nRetVal == XN_STATUS_NO_MATCH)
+ {
+ // not open. open it now
+ xnLogInfo(XN_MASK_SENSOR_SERVER, "Opening sensor '%s'...", strDevicePath);
+
+ ReferencedSensor sensor;
+ sensor.nRefCount = 0;
+ XN_VALIDATE_NEW(sensor.pInvoker, XnServerSensorInvoker);
+
+ XnProperty* aAdditionalProps[] = { &m_noClientTimeout, &m_startNewLog };
+ nRetVal = sensor.pInvoker->Init(strDevicePath, m_strGlobalConfigFile, sizeof(aAdditionalProps)/sizeof(XnProperty*), aAdditionalProps);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // add it to map
+ nRetVal = m_sensors.Set(sensor.pInvoker->GetDevicePath(), sensor);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // and take a reference to it
+ nRetVal = m_sensors.Get(sensor.pInvoker->GetDevicePath(), pSensor);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ ++pSensor->nRefCount;
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Sensor '%s' now has %u sessions", pSensor->pInvoker->GetDevicePath(), pSensor->nRefCount);
+
+ *ppInvoker = pSensor->pInvoker;
+
+ return (XN_STATUS_OK);
+}
+
+void XnSensorsManager::ReleaseSensor(XnServerSensorInvoker* pInvoker)
+{
+ XnAutoCSLocker locker(m_hLock);
+ ReferencedSensor* pSensor;
+ XnStatus nRetVal = m_sensors.Get(pInvoker->GetDevicePath(), pSensor);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_SERVER, "Trying to release a sensor that is not in the map!");
+ return;
+ }
+
+ --pSensor->nRefCount;
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Sensor '%s' now has %u sessions", pInvoker->GetDevicePath(), pSensor->nRefCount);
+
+ if (pSensor->nRefCount == 0)
+ {
+ // store current time. Then, in CleanUp() if timeout passed, sensor will be closed
+ xnOSGetTimeStamp(&pSensor->nNoClientsTime);
+
+ // do some clean-up (so that next client will behave as if it started the server)
+
+ // This is a bit ugly, but we need to manually set back to default DEVICE properties
+ // (we know there aren't any streams and clients, but the Device module always remains)
+ nRetVal = pSensor->pInvoker->SetIntProperty(XN_MODULE_NAME_DEVICE, XN_MODULE_PROPERTY_FRAME_SYNC, (XnUInt64)FALSE);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_SERVER, "Failed resetting FrameSync: %s", xnGetStatusString(nRetVal));
+ }
+
+ nRetVal = pSensor->pInvoker->ConfigureModuleFromGlobalFile(XN_MODULE_NAME_DEVICE);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_SERVER, "Failed configuring device from global config file: %s", xnGetStatusString(nRetVal));
+ }
+ }
+}
+
+void XnSensorsManager::CleanUp()
+{
+ // go over sensors list. each sensor that is not open by any session, and timeout has passed should
+ // be closed and removed
+ XnAutoCSLocker locker(m_hLock);
+
+ XnUInt64 nNow;
+ xnOSGetTimeStamp(&nNow);
+ XnSensorsHash::Iterator it = m_sensors.begin();
+ while (it != m_sensors.end())
+ {
+ XnSensorsHash::Iterator curr = it;
+ ++it;
+
+ ReferencedSensor& sensor = curr.Value();
+ if (sensor.nRefCount == 0 && (nNow - sensor.nNoClientsTime) > m_noClientTimeout.GetValue())
+ {
+ xnLogInfo(XN_MASK_SENSOR_SERVER, "No session holding sensor '%s' for %u ms. Shutting down...", curr.Key(), m_noClientTimeout.GetValue());
+ XN_DELETE(sensor.pInvoker);
+ m_sensors.Remove(curr);
+ }
+ }
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensorsManager::StartNewLogCallback(XnIntProperty* /*pSender*/, XnUInt64 /*nValue*/, void* /*pCookie*/)
+{
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Closing current log file...");
+ return xnLogStartNewFile();
+}
+
diff --git a/Source/XnDeviceSensorV2/XnSensorsManager.h b/Source/XnDeviceSensorV2/XnSensorsManager.h
new file mode 100644
index 0000000..b31e2f2
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnSensorsManager.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+#ifndef __XN_SENSORS_MANAGER_H__
+#define __XN_SENSORS_MANAGER_H__
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnServerSensorInvoker.h"
+#include
+
+//---------------------------------------------------------------------------
+// Types
+//---------------------------------------------------------------------------
+class XnSensorsManager
+{
+public:
+ XnSensorsManager(const XnChar* strGlobalConfigFile);
+ ~XnSensorsManager();
+
+ XnStatus Init();
+ void Free();
+
+ XnUInt64 GetTimeout() { return m_noClientTimeout.GetValue(); }
+
+ XnStatus GetSensor(const XnChar* strDevicePath, XnServerSensorInvoker** ppInvoker);
+ void ReleaseSensor(XnServerSensorInvoker* pInvoker);
+
+ void CleanUp();
+ inline XnBool HasOpenSensors() { return m_sensors.begin() != m_sensors.end(); }
+
+private:
+ typedef struct
+ {
+ XnUInt64 nNoClientsTime;
+ XnServerSensorInvoker* pInvoker;
+ XnUInt32 nRefCount;
+ } ReferencedSensor;
+
+ XN_DECLARE_STRINGS_HASH(ReferencedSensor, XnSensorsHash);
+
+ static XnStatus XN_CALLBACK_TYPE StartNewLogCallback(XnIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+
+ XnChar m_strGlobalConfigFile[XN_FILE_MAX_PATH];
+ XN_CRITICAL_SECTION_HANDLE m_hLock;
+ XnSensorsHash m_sensors;
+ XnActualIntProperty m_noClientTimeout;
+ XnIntProperty m_startNewLog;
+ XnUInt64 nNoClientsTime;
+};
+
+#endif // __XN_SENSORS_MANAGER_H__
\ No newline at end of file
diff --git a/Include/XnCommon.h b/Source/XnDeviceSensorV2/XnServerLogger.h
similarity index 50%
rename from Include/XnCommon.h
rename to Source/XnDeviceSensorV2/XnServerLogger.h
index ef5b9ee..045c7ba 100644
--- a/Include/XnCommon.h
+++ b/Source/XnDeviceSensorV2/XnServerLogger.h
@@ -1,62 +1,59 @@
-/*****************************************************************************
-* *
-* PrimeSense Common *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Common is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Common is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Common. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
-#ifndef __XN_COMMON_H__
-#define __XN_COMMON_H__
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+#ifndef __XN_SERVER_LOGGER_H__
+#define __XN_SERVER_LOGGER_H__
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
-#include
+#include
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
-#define XN_VENDOR_PRIMESENSE "PrimeSense"
+#define XN_MASK_SENSOR_SERVER_COMM_DUMP "SensorServerComm"
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
-typedef enum XnPrimeSenseErrorModules
+class XnServerLogger
{
- XN_ERROR_GROUP_SECURITY = 0,
- XN_ERROR_GROUP_FORMATS = 1000,
- XN_ERROR_GROUP_DDK = 2000,
- XN_ERROR_GROUP_DEVICE = 3000,
- XN_ERROR_GROUP_IO = 4000,
- XN_ERROR_GROUP_EE_CORE = 5000,
- XN_ERROR_GROUP_EE_FRAMEWORK = 6000,
- XN_ERROR_GROUP_EE_NITE = 7000,
-} XnPrimeSenseErrorModules;
-
-#define XN_PS_STATUS_MESSAGE_MAP_START(module) \
- XN_STATUS_MESSAGE_MAP_START_FROM(XN_ERROR_GROUP_PRIMESENSE, module)
-
-#define XN_PS_STATUS_MESSAGE_MAP_END(module) \
- XN_STATUS_MESSAGE_MAP_END_FROM(XN_ERROR_GROUP_PRIMESENSE, module)
+public:
+ inline XnServerLogger() : m_dump(NULL)
+ {
+ m_dump = xnDumpFileOpen(XN_MASK_SENSOR_SERVER_COMM_DUMP, "%s.csv", XN_MASK_SENSOR_SERVER_COMM_DUMP);
+ xnDumpFileWriteString(m_dump, "TS,Type,Size,Client\n");
+ }
+
+ inline void DumpMessage(const XnChar* strType, XnUInt32 nSize = 0, XnUInt32 nClientID = 0, const XnChar* strComment = "")
+ {
+ XnUInt64 nNow;
+ xnOSGetHighResTimeStamp(&nNow);
+ xnDumpFileWriteString(m_dump, "%llu,%s,%d,%d,%s\n", nNow, strType, nSize, nClientID, strComment);
+ }
+
+private:
+ XnDumpFile* m_dump;
+};
+
+#endif // __XN_SERVER_LOGGER_H__
-#endif // __XN_COMMON_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp b/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp
new file mode 100644
index 0000000..8b2925d
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp
@@ -0,0 +1,652 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnServerSensorInvoker.h"
+#include "XnSensorClientServer.h"
+#include
+
+//---------------------------------------------------------------------------
+// Defines
+//---------------------------------------------------------------------------
+#define XN_SENSOR_TERMINATE_READER_THREAD_TIMEOUT 5000
+
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+XnServerSensorInvoker::XnServerSensorInvoker() :
+ m_hSensorLock(NULL),
+ m_hReaderThread(NULL),
+ m_hNewDataEvent(NULL),
+ m_bShouldRun(TRUE),
+ m_errorState(XN_STATUS_OK)
+{
+}
+
+XnServerSensorInvoker::~XnServerSensorInvoker()
+{
+ Free();
+}
+
+XnStatus XnServerSensorInvoker::Init(const XnChar* strDevicePath, const XnChar* strGlobalConfigFile, XnUInt32 nAdditionalProps, XnProperty** aAdditionalProps)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_sensor.SetGlobalConfigFile(strGlobalConfigFile);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = xnOSCreateCriticalSection(&m_hSensorLock);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnDeviceConfig config;
+ config.DeviceMode = XN_DEVICE_MODE_READ;
+ config.cpConnectionString = strDevicePath;
+ config.pInitialValues = NULL;
+ config.SharingMode = XN_DEVICE_SHARED;
+
+ nRetVal = m_sensor.Init(&config);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_sensor.DeviceModule()->AddProperties(aAdditionalProps, nAdditionalProps);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // configure from global file
+ nRetVal = m_sensor.ConfigureModuleFromGlobalFile(XN_MODULE_NAME_DEVICE, XN_SENSOR_SERVER_CONFIG_FILE_SECTION);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // register to events
+ nRetVal = m_sensor.OnStreamCollectionChangedEvent().Register(StreamCollectionChangedCallback, this);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_sensor.OnNewStreamDataEvent().Register(NewStreamDataCallback, this);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // register to all properties
+ XN_PROPERTY_SET_CREATE_ON_STACK(props);
+ nRetVal = m_sensor.DeviceModule()->GetAllProperties(&props);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = RegisterToProps(&props);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = xnOSCreateEvent(&m_hNewDataEvent, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // start reader thread
+ nRetVal = xnOSCreateThread(ReaderThread, this, &m_hReaderThread);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+void XnServerSensorInvoker::Free()
+{
+ m_bShouldRun = FALSE;
+
+ if (m_hReaderThread != NULL)
+ {
+ xnOSWaitAndTerminateThread(&m_hReaderThread, XN_SENSOR_TERMINATE_READER_THREAD_TIMEOUT);
+ m_hReaderThread = NULL;
+ }
+
+ XnStatus nRetVal = m_sensor.Destroy();
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed to destroy sensor: %s", xnGetStatusString(nRetVal));
+ XN_ASSERT(FALSE);
+ }
+
+ if (m_hNewDataEvent != NULL)
+ {
+ xnOSCloseEvent(&m_hNewDataEvent);
+ m_hNewDataEvent = NULL;
+ }
+
+ if (m_hSensorLock != NULL)
+ {
+ xnOSCloseCriticalSection(&m_hSensorLock);
+ m_hSensorLock = NULL;
+ }
+}
+
+const XnChar* XnServerSensorInvoker::GetDevicePath()
+{
+ return m_sensor.GetUSBPath();
+}
+
+XnStatus XnServerSensorInvoker::RegisterToProps(XnPropertySet* pProps)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ for (XnPropertySetData::Iterator itMod = pProps->pData->begin(); itMod != pProps->pData->end(); ++itMod)
+ {
+ XnActualPropertiesHash* pHash = itMod.Value();
+
+ XnDeviceModule* pModule;
+ nRetVal = m_sensor.FindModule(itMod.Key(), &pModule);
+ XN_IS_STATUS_OK(nRetVal);
+
+ for (XnActualPropertiesHash::Iterator itProp = pHash->begin(); itProp != pHash->end(); ++itProp)
+ {
+ XnProperty* pProp;
+ nRetVal = pModule->GetProperty(itProp.Key(), &pProp);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // no need to keep the handle. We only want to unregister when the stream is destroyed, and then
+ // it happens anyway.
+ nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::GetIntProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt64* pnValue)
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.GetProperty(strModule, strProperty, pnValue);
+}
+
+XnStatus XnServerSensorInvoker::GetRealProperty( const XnChar* strModule, const XnChar* strProperty, XnDouble* pdValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.GetProperty(strModule, strProperty, pdValue);
+}
+
+XnStatus XnServerSensorInvoker::GetStringProperty( const XnChar* strModule, const XnChar* strProperty, XnChar* strValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.GetProperty(strModule, strProperty, strValue);
+}
+
+XnStatus XnServerSensorInvoker::GetGeneralProperty( const XnChar* strModule, const XnChar* strProperty, XnGeneralBuffer& gbValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.GetProperty(strModule, strProperty, gbValue);
+}
+
+XnStatus XnServerSensorInvoker::SetIntProperty( const XnChar* strModule, const XnChar* strProperty, XnUInt64 nValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.SetProperty(strModule, strProperty, nValue);
+}
+
+XnStatus XnServerSensorInvoker::SetRealProperty( const XnChar* strModule, const XnChar* strProperty, XnDouble dValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.SetProperty(strModule, strProperty, dValue);
+}
+
+XnStatus XnServerSensorInvoker::SetStringProperty( const XnChar* strModule, const XnChar* strProperty, const XnChar* strValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.SetProperty(strModule, strProperty, strValue);
+}
+
+XnStatus XnServerSensorInvoker::SetGeneralProperty( const XnChar* strModule, const XnChar* strProperty, const XnGeneralBuffer& gbValue )
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.SetProperty(strModule, strProperty, gbValue);
+}
+
+XnStatus XnServerSensorInvoker::GetAllProperties(XnPropertySet* pSet, XnBool bNoStreams, const XnChar* strModule)
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.GetAllProperties(pSet, bNoStreams, strModule);
+}
+
+XnStatus XnServerSensorInvoker::LoadConfigFromFile(const XnChar* strFileName, const XnChar* strSectionName)
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.LoadConfigFromFile(strFileName, strSectionName);
+}
+
+XnStatus XnServerSensorInvoker::BatchConfig(const XnPropertySet* pChangeSet)
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.BatchConfig(pChangeSet);
+}
+
+XnStatus XnServerSensorInvoker::ConfigureModuleFromGlobalFile(const XnChar* strModule)
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.ConfigureModuleFromGlobalFile(strModule);
+}
+
+XnStatus XnServerSensorInvoker::CreateStreamData(const XnChar* strStreamName, XnStreamData** ppStreamData)
+{
+ XnAutoCSLocker lock(m_hSensorLock);
+ return m_sensor.CreateStreamData(strStreamName, ppStreamData);
+}
+
+XnStatus XnServerSensorInvoker::GetStream(const XnChar* strType, const XnPropertySet* pInitialValues)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // check if stream already exists
+ XnAutoCSLocker locker(m_hSensorLock);
+ SensorInvokerStream* pStream;
+ nRetVal = m_streams.Get(strType, pStream);
+ if (nRetVal == XN_STATUS_OK)
+ {
+ // stream already exists. add ref to it, and try to configure it according to request
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Stream %s already exists.", strType);
+
+ // configure it
+ if (pInitialValues != NULL)
+ {
+ nRetVal = m_sensor.BatchConfig(pInitialValues);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ }
+ else if (nRetVal == XN_STATUS_NO_MATCH)
+ {
+ // stream doesn't exist. create it (more happens in the OnStreamAdded event handler)
+ nRetVal = m_sensor.CreateStream(strType, strType, pInitialValues);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // now take it from the hash
+ nRetVal = m_streams.Get(strType, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ else
+ {
+ return (nRetVal);
+ }
+
+ ++pStream->nRefCount;
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Stream %s now has %u clients.", strType, pStream->nRefCount);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::ReleaseStream(const XnChar* strType)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnAutoCSLocker locker(m_hSensorLock);
+ SensorInvokerStream* pStream;
+ nRetVal = m_streams.Get(strType, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ --pStream->nRefCount;
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Stream %s now has %u clients", strType, pStream->nRefCount);
+
+ if (pStream->nRefCount == 0)
+ {
+ m_sensor.CloseStream(strType);
+ m_sensor.DestroyStream(strType);
+
+ // the rest will be done in the OnStreamRemoved event handler...
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::OpenStream(const XnChar* strName, NewStreamDataHandler pNewDataHandler, void* pCookie, XnCallbackHandle* phCallback)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnAutoCSLocker locker(m_hSensorLock);
+
+ SensorInvokerStream* pStream;
+ nRetVal = m_streams.Get(strName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // register for new data event
+ nRetVal = pStream->pNewDataEvent->Register(pNewDataHandler, pCookie, phCallback);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // increase open ref count
+ ++pStream->nOpenRefCount;
+
+ if (pStream->nOpenRefCount == 1) // first one to open
+ {
+ // open it
+ nRetVal = m_sensor.OpenStream(strName);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_SERVER, "Failed to open stream: %s", xnGetStatusString(nRetVal));
+ --pStream->nOpenRefCount;
+ pStream->pNewDataEvent->Unregister(*phCallback);
+ return (nRetVal);
+ }
+ }
+
+ xnLogInfo(XN_MASK_SENSOR_SERVER, "Stream %s is now open by %u clients.", strName, pStream->nOpenRefCount);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::CloseStream(const XnChar* strName, XnCallbackHandle hCallback)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnAutoCSLocker locker(m_hSensorLock);
+
+ SensorInvokerStream* pStream;
+ nRetVal = m_streams.Get(strName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // decrease open ref count
+ --pStream->nOpenRefCount;
+
+ xnLogInfo(XN_MASK_SENSOR_SERVER, "Stream %s is now open by %u clients.", strName, pStream->nOpenRefCount);
+
+ // check if we actually need to close it
+ if (pStream->nOpenRefCount == 0)
+ {
+ nRetVal = m_sensor.CloseStream(strName);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogError(XN_MASK_SENSOR_SERVER, "Failed to close stream: %s", xnGetStatusString(nRetVal));
+ ++pStream->nOpenRefCount;
+ return (nRetVal);
+ }
+ }
+
+ // unregister from event
+ pStream->pNewDataEvent->Unregister(hCallback);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::AddRefFrameBuffer(const XnChar* strStreamName, XnBuffer* pBuffer)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnSharedMemoryBufferPool* pBufferPool = NULL;
+ nRetVal = m_sensor.GetSharedBufferPool(strStreamName, &pBufferPool);
+ XN_IS_STATUS_OK(nRetVal);
+
+ pBufferPool->AddRef(pBuffer);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::ReleaseFrameBuffer(const XnChar* strStreamName, XnBuffer* pBuffer)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnSharedMemoryBufferPool* pBufferPool = NULL;
+ nRetVal = m_sensor.GetSharedBufferPool(strStreamName, &pBufferPool);
+ XN_IS_STATUS_OK(nRetVal);
+
+ pBufferPool->DecRef(pBuffer);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::ReadStream(XnStreamData* pStreamData, XnUInt32* pnOffset)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnAutoCSLocker locker(m_hSensorLock);
+ SensorInvokerStream* pStream;
+ nRetVal = m_streams.Get(pStreamData->StreamName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnSharedMemoryBufferPool* pBufferPool = NULL;
+ nRetVal = m_sensor.GetSharedBufferPool(pStreamData->StreamName, &pBufferPool);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // dec ref old data
+ if (pStreamData->pInternal->pLockedBuffer != NULL)
+ {
+ pBufferPool->DecRef(pStreamData->pInternal->pLockedBuffer);
+ }
+
+ // "read"
+ pStreamData->nDataSize = pStream->pStreamData->nDataSize;
+ pStreamData->nFrameID = pStream->pStreamData->nFrameID;
+ pStreamData->nTimestamp = pStream->pStreamData->nTimestamp;
+ pStreamData->pData = pStream->pStreamData->pData;
+ pStreamData->pInternal->pLockedBuffer = pStream->pStreamData->pInternal->pLockedBuffer;
+
+ // add ref to new data
+ if (pStreamData->pInternal->pLockedBuffer != NULL)
+ {
+ pBufferPool->AddRef(pStreamData->pInternal->pLockedBuffer);
+ }
+
+ *pnOffset = pBufferPool->GetBufferOffset(pStreamData->pInternal->pLockedBuffer);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::OnPropertyChanged(const XnProperty* pProp)
+{
+ // some special handling
+ if (strcmp(pProp->GetName(), XN_STREAM_PROPERTY_STATE) == 0)
+ {
+ // ignore STATE property (every client has its own value)
+ return XN_STATUS_OK;
+ }
+ else if (strcmp(pProp->GetName(), XN_MODULE_PROPERTY_ERROR_STATE) == 0)
+ {
+ XnActualIntProperty* pActualIntProp = (XnActualIntProperty*)pProp;
+ XnStatus nOldErrorState = m_errorState;
+ m_errorState = (XnStatus)pActualIntProp->GetValue();
+ switch (m_errorState)
+ {
+ case XN_STATUS_DEVICE_NOT_CONNECTED:
+ //TODO: Handle disconnection
+ break;
+ case XN_STATUS_OK:
+ if (nOldErrorState == XN_STATUS_DEVICE_NOT_CONNECTED)
+ {
+ //TODO: Handle re-connection
+ break;
+ }
+ }
+ }
+
+ // raise event
+ m_propChangedEvent.Raise(pProp);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::OnStreamAdded(const XnChar* StreamName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // get all props
+ XN_PROPERTY_SET_CREATE_ON_STACK(props);
+ nRetVal = m_sensor.GetAllProperties(&props, FALSE, StreamName);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // register to all props
+ nRetVal = RegisterToProps(&props);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnActualPropertiesHash* pStreamProps = props.pData->begin().Value();
+
+ // take type
+ XnProperty* pProp = NULL;
+ nRetVal = pStreamProps->Get(XN_STREAM_PROPERTY_TYPE, pProp);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // create stream data
+ SensorInvokerStream serverStream;
+ xnOSMemSet(&serverStream, 0, sizeof(serverStream));
+ strcpy(serverStream.strType, StreamName);
+
+ XN_VALIDATE_NEW(serverStream.pNewDataEvent, NewStreamDataEvent);
+
+ nRetVal = m_sensor.CreateStreamData(StreamName, &serverStream.pStreamData);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ XN_DELETE(serverStream.pNewDataEvent);
+ return (nRetVal);
+ }
+
+ nRetVal = m_streams.Set(StreamName, serverStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::OnStreamRemoved(const XnChar* StreamName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // no need to unregister from its props - they do not exist anymore.
+
+ // remove stream data
+ SensorInvokerStream* pServerStream;
+ nRetVal = m_streams.Get(StreamName, pServerStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_sensor.DestroyStreamData(&pServerStream->pStreamData);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XN_DELETE(pServerStream->pNewDataEvent);
+
+ nRetVal = m_streams.Remove(StreamName);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ switch (EventType)
+ {
+ case XN_DEVICE_STREAM_ADDED:
+ {
+ nRetVal = OnStreamAdded(StreamName);
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_DEVICE_STREAM_DELETED:
+ {
+ nRetVal = OnStreamRemoved(StreamName);
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ default:
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "unknown event: %d", EventType);
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::OnNewStreamData(const XnChar* StreamName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // no need to lock the sensor (this might cause a dead lock).
+ // Instead, only lock the streams collection (so it wouldn't change while we search for the stream)
+ SensorInvokerStream* pStream;
+ nRetVal = m_streams.Get(StreamName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ pStream->bNewData = TRUE;
+
+ nRetVal = xnOSSetEvent(m_hNewDataEvent);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSensorInvoker::ReadStreams()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // wait for new data to be available
+ nRetVal = xnOSWaitEvent(m_hNewDataEvent, XN_NODE_WAIT_FOR_DATA_TIMEOUT);
+ if (nRetVal == XN_STATUS_OS_EVENT_TIMEOUT)
+ {
+ return XN_STATUS_OK;
+ }
+ else if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Got error waiting for new data event: %s", xnGetStatusString(nRetVal));
+ // but continue anyway
+ }
+
+ // lock sensor (we iterate over streams list. make sure no stream is added/removed from the list)
+ {
+ XnLockedServerStreamsHash lockedHash = m_streams.GetLockedHashForIterating();
+ for (XnLockedServerStreamsHash::Iterator it = lockedHash.begin(); it != lockedHash.end(); ++it)
+ {
+ SensorInvokerStream& stream = it.Value();
+
+ if (stream.bNewData)
+ {
+ // ignore audio (it is read by every client)
+ if (strcmp(stream.strType, XN_STREAM_NAME_AUDIO) != 0)
+ {
+ // read this data
+ nRetVal = m_sensor.ReadStream(stream.pStreamData);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed reading from stream %s (though event was raised): %s", stream.strType, xnGetStatusString(nRetVal));
+ stream.bNewData = FALSE;
+ continue;
+ }
+ }
+
+ stream.bNewData = FALSE;
+
+ stream.pNewDataEvent->Raise(stream.strType, stream.pStreamData->nTimestamp, stream.pStreamData->nFrameID);
+ }
+ } // streams loop
+ } // lock
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XN_CALLBACK_TYPE XnServerSensorInvoker::PropertyChangedCallback(const XnProperty* pProp, void* pCookie)
+{
+ XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
+ pThis->OnPropertyChanged(pProp);
+ return XN_STATUS_OK;
+}
+
+void XN_CALLBACK_TYPE XnServerSensorInvoker::StreamCollectionChangedCallback(XnDeviceHandle /*DeviceHandle*/, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie)
+{
+ XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
+ pThis->OnStreamCollectionChanged(StreamName, EventType);
+}
+
+void XN_CALLBACK_TYPE XnServerSensorInvoker::NewStreamDataCallback(XnDeviceHandle /*DeviceHandle*/, const XnChar* StreamName, void* pCookie)
+{
+ XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
+ pThis->OnNewStreamData(StreamName);
+}
+
+XN_THREAD_PROC XnServerSensorInvoker::ReaderThread(XN_THREAD_PARAM pThreadParam)
+{
+ XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pThreadParam;
+ while (pThis->m_bShouldRun)
+ {
+ pThis->ReadStreams();
+ }
+ XN_THREAD_PROC_RETURN(0);
+}
+
diff --git a/Source/XnDeviceSensorV2/XnServerSensorInvoker.h b/Source/XnDeviceSensorV2/XnServerSensorInvoker.h
new file mode 100644
index 0000000..dbeeb29
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnServerSensorInvoker.h
@@ -0,0 +1,208 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+#ifndef __XN_SERVER_SENSOR_INVOKER_H__
+#define __XN_SERVER_SENSOR_INVOKER_H__
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnSensor.h"
+#include
+#include
+
+//---------------------------------------------------------------------------
+// Types
+//---------------------------------------------------------------------------
+
+class XnServerSensorInvoker
+{
+private:
+ XN_DECLARE_EVENT_3ARG(NewStreamDataEvent, INewStreamDataEvent, const XnChar*, strStreamName, XnUInt64, nTimestamp, XnUInt32, nFrameID);
+
+public:
+ XnServerSensorInvoker();
+ ~XnServerSensorInvoker();
+
+ XnStatus Init(const XnChar* strDevicePath, const XnChar* strGlobalConfigFile, XnUInt32 nAdditionalProps, XnProperty** aAdditionalProps);
+ void Free();
+
+ const XnChar* GetDevicePath();
+
+ XnStatus GetIntProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt64* pnValue);
+ XnStatus GetRealProperty(const XnChar* strModule, const XnChar* strProperty, XnDouble* pdValue);
+ XnStatus GetStringProperty(const XnChar* strModule, const XnChar* strProperty, XnChar* strValue);
+ XnStatus GetGeneralProperty(const XnChar* strModule, const XnChar* strProperty, XnGeneralBuffer& gbValue);
+
+ XnStatus SetIntProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt64 nValue);
+ XnStatus SetRealProperty(const XnChar* strModule, const XnChar* strProperty, XnDouble dValue);
+ XnStatus SetStringProperty(const XnChar* strModule, const XnChar* strProperty, const XnChar* strValue);
+ XnStatus SetGeneralProperty(const XnChar* strModule, const XnChar* strProperty, const XnGeneralBuffer& gbValue);
+
+ XnStatus GetAllProperties(XnPropertySet* pSet, XnBool bNoStreams = FALSE, const XnChar* strModule = NULL);
+
+ XnStatus LoadConfigFromFile(const XnChar* strFileName, const XnChar* strSectionName);
+ XnStatus BatchConfig(const XnPropertySet* pChangeSet);
+ XnStatus ConfigureModuleFromGlobalFile(const XnChar* strModule);
+
+ XnStatus CreateStreamData(const XnChar* strStreamName, XnStreamData** ppStreamData);
+
+ XnStatus GetStream(const XnChar* strType, const XnPropertySet* pInitialValues);
+ XnStatus ReleaseStream(const XnChar* strType);
+
+ typedef INewStreamDataEvent::HandlerPtr NewStreamDataHandler;
+ XnStatus OpenStream(const XnChar* strName, NewStreamDataHandler pNewDataHandler, void* pCookie, XnCallbackHandle* phCallback);
+ XnStatus CloseStream(const XnChar* strName, XnCallbackHandle hCallback);
+
+ XnStatus AddRefFrameBuffer(const XnChar* strStreamName, XnBuffer* pBuffer);
+ XnStatus ReleaseFrameBuffer(const XnChar* strStreamName, XnBuffer* pBuffer);
+
+ XnStatus ReadStream(XnStreamData* pStreamData, XnUInt32* pnOffset);
+
+ XN_DECLARE_EVENT_1ARG(PropChangeEvent, IPropChangeEvent, const XnProperty*, pProp);
+ IPropChangeEvent& PropChangedEvent() { return m_propChangedEvent; }
+
+private:
+ // Types
+ typedef struct SensorInvokerStream
+ {
+ XnChar strType[XN_DEVICE_MAX_STRING_LENGTH];
+ XnUInt32 nRefCount;
+ XnUInt32 nOpenRefCount;
+ XnStreamData* pStreamData;
+ XnBool bNewData;
+ NewStreamDataEvent* pNewDataEvent;
+ } SensorInvokerStream;
+
+ XN_DECLARE_STRINGS_HASH(SensorInvokerStream, _XnServerStreamsHash);
+
+ class XnServerStreamsHash;
+
+ class XnLockedServerStreamsHash
+ {
+ public:
+ inline XnLockedServerStreamsHash(const XnLockedServerStreamsHash& other) :
+ m_hash(other.m_hash),
+ m_locker(other.m_locker)
+ {}
+
+ inline XnLockedServerStreamsHash& operator=(const XnLockedServerStreamsHash& other)
+ {
+ this->m_hash = other.m_hash;
+ this->m_locker = other.m_locker;
+ return *this;
+ }
+
+ inline _XnServerStreamsHash::Iterator begin()
+ {
+ return m_hash.begin();
+ }
+
+ inline _XnServerStreamsHash::Iterator end()
+ {
+ return m_hash.end();
+ }
+
+ typedef _XnServerStreamsHash::Iterator Iterator;
+
+ private:
+ inline XnLockedServerStreamsHash(_XnServerStreamsHash& hash, XN_CRITICAL_SECTION_HANDLE hLock) :
+ m_hash(hash),
+ m_locker(hLock)
+ {}
+
+ friend class XnServerSensorInvoker::XnServerStreamsHash;
+
+ _XnServerStreamsHash& m_hash;
+ XnAutoCSLocker m_locker;
+ };
+
+ class XnServerStreamsHash
+ {
+ public:
+ XnServerStreamsHash()
+ {
+ XnStatus nRetVal = xnOSCreateCriticalSection(&m_hLock);
+ XN_ASSERT(nRetVal == XN_STATUS_OK);
+ }
+
+ ~XnServerStreamsHash()
+ {
+ XnStatus nRetVal = xnOSCloseCriticalSection(&m_hLock);
+ XN_ASSERT(nRetVal == XN_STATUS_OK);
+ }
+
+ inline XnStatus Set(const XnChar* strName, const SensorInvokerStream& stream)
+ {
+ XnAutoCSLocker locker(m_hLock);
+ return m_hash.Set(strName, stream);
+ }
+
+ inline XnStatus Get(const XnChar* strName, SensorInvokerStream*& pStream)
+ {
+ XnAutoCSLocker locker(m_hLock);
+ return m_hash.Get(strName, pStream);
+ }
+
+ inline XnStatus Remove(const XnChar* strName)
+ {
+ XnAutoCSLocker locker(m_hLock);
+ return m_hash.Remove(strName);
+ }
+
+ inline XnLockedServerStreamsHash GetLockedHashForIterating()
+ {
+ return XnLockedServerStreamsHash(m_hash, m_hLock);
+ }
+
+ private:
+ XN_CRITICAL_SECTION_HANDLE m_hLock;
+ _XnServerStreamsHash m_hash;
+ };
+
+ // Functions
+ XnStatus RegisterToProps(XnPropertySet* pProps);
+
+ XnStatus OnPropertyChanged(const XnProperty* pProp);
+ XnStatus OnStreamAdded(const XnChar* StreamName);
+ XnStatus OnStreamRemoved(const XnChar* StreamName);
+ XnStatus OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType);
+ XnStatus OnNewStreamData(const XnChar* StreamName);
+ XnStatus ReadStreams();
+
+ static XnStatus XN_CALLBACK_TYPE PropertyChangedCallback(const XnProperty* pProp, void* pCookie);
+ static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
+ static void XN_CALLBACK_TYPE NewStreamDataCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, void* pCookie);
+ static XN_THREAD_PROC ReaderThread(XN_THREAD_PARAM pThreadParam);
+
+ // Members
+ XnSensor m_sensor;
+ XN_CRITICAL_SECTION_HANDLE m_hSensorLock;
+ XN_THREAD_HANDLE m_hReaderThread;
+ XN_EVENT_HANDLE m_hNewDataEvent;
+ volatile XnBool m_bShouldRun;
+ XnStatus m_errorState;
+
+ PropChangeEvent m_propChangedEvent;
+ XnServerStreamsHash m_streams;
+};
+
+#endif // __XN_SERVER_SENSOR_INVOKER_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnServerSession.cpp b/Source/XnDeviceSensorV2/XnServerSession.cpp
new file mode 100644
index 0000000..d128fa2
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnServerSession.cpp
@@ -0,0 +1,1207 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnServerSession.h"
+#include "XnSensorClientServer.h"
+#include
+#include
+
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+XnServerSession::XnServerSession(XnSensorsManager* pSensorsManager, XnUInt32 nID, XN_SOCKET_HANDLE hSocket, XnServerLogger* pLogger) :
+ m_pSensorsManager(pSensorsManager),
+ m_nID(nID),
+ m_hSocket(hSocket),
+ m_hThread(NULL),
+ m_hCommLock(NULL),
+ m_hStreamsLock(NULL),
+ m_ioStream(hSocket),
+ m_privateIncomingPacker(&m_ioStream, XN_SENSOR_SERVER_CONFIG_PACKER_SIZE),
+ m_privateOutgoingPacker(&m_ioStream, XN_SENSOR_SERVER_CONFIG_PACKER_SIZE),
+ m_pStreamDataSet(NULL),
+ m_bShouldRun(TRUE),
+ m_bHasEnded(FALSE),
+ m_pSensor(NULL),
+ m_pLogger(pLogger),
+ m_hProprtyChangeCallback(NULL)
+{
+ SessionStream stream;
+ strcpy(stream.strStreamName, XN_MODULE_NAME_DEVICE);
+ strcpy(stream.strClientStreamName, XN_MODULE_NAME_DEVICE);
+ stream.bIsOpen = FALSE;
+ m_streamsHash.Set(XN_MODULE_NAME_DEVICE, stream);
+}
+
+XnServerSession::~XnServerSession()
+{
+ Free();
+}
+
+XnStatus XnServerSession::Init()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_privateIncomingPacker.Init();
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_privateOutgoingPacker.Init();
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = XnStreamDataSetCreate(&m_pStreamDataSet);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = xnOSCreateCriticalSection(&m_hCommLock);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = xnOSCreateCriticalSection(&m_hStreamsLock);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // start thread
+ nRetVal = xnOSCreateThread(ServeThreadCallback, this, &m_hThread);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+void XnServerSession::Free()
+{
+ if (m_hThread != NULL)
+ {
+ xnOSWaitAndTerminateThread(&m_hThread, 2000);
+ m_hThread = NULL;
+ }
+
+ if (m_hStreamsLock != NULL)
+ {
+ xnOSCloseCriticalSection(&m_hStreamsLock);
+ m_hStreamsLock = NULL;
+ }
+
+ if (m_hCommLock != NULL)
+ {
+ xnOSCloseCriticalSection(&m_hCommLock);
+ m_hCommLock = NULL;
+ }
+
+ if (m_pStreamDataSet != NULL)
+ {
+ XnStreamDataSetDestroy(&m_pStreamDataSet);
+ m_pStreamDataSet = NULL;
+ }
+
+ if (m_hSocket != NULL)
+ {
+ xnOSCloseSocket(m_hSocket);
+ m_hSocket = NULL;
+ }
+
+ m_privateIncomingPacker.Free();
+ m_privateOutgoingPacker.Free();
+}
+
+XnStatus XnServerSession::SendReply(XnSensorServerCustomMessages Type, XnStatus nRC, XnUInt32 nDataSize /* = 0 */, void* pAdditionalData /* = NULL */)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnUChar message[XN_SENSOR_SERVER_MAX_REPLY_SIZE];
+ XnSensorClientServerReply* pReply = (XnSensorClientServerReply*)message;
+ pReply->nRetVal = nRC;
+ pReply->Type = Type;
+ pReply->nDataSize = nDataSize;
+ xnOSMemCopy(pReply->pData, pAdditionalData, nDataSize);
+ XnUChar* pEnd = pReply->pData + nDataSize;
+
+ m_pLogger->DumpMessage("Reply", nDataSize, m_nID);
+
+ // lock this so that messages don't mix up
+ {
+ XnAutoCSLocker lock(m_hCommLock);
+ nRetVal = m_privateOutgoingPacker.WriteCustomData(Type, message, (XnUInt32)(pEnd - message));
+ }
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::SendInitialState()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XN_PROPERTY_SET_CREATE_ON_STACK(props);
+
+ // get it
+ nRetVal = m_pSensor->GetAllProperties(&props, TRUE);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // and send it
+ m_pLogger->DumpMessage("InitialState", 0, m_nID);
+
+ {
+ XnAutoCSLocker lock(m_hCommLock);
+ nRetVal = m_privateOutgoingPacker.WritePropertySet(&props);
+ }
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::FindStreamByServerName(const XnChar* strName, SessionStream** ppStream)
+{
+ for (SessionStreamsHash::Iterator it = m_streamsHash.begin(); it != m_streamsHash.end(); ++it)
+ {
+ SessionStream* pStream = &it.Value();
+ if (strcmp(pStream->strStreamName, strName) == 0)
+ {
+ *ppStream = pStream;
+ return XN_STATUS_OK;
+ }
+ }
+
+ *ppStream = NULL;
+ return (XN_STATUS_NO_MATCH);
+}
+
+XnStatus XnServerSession::HandleOpenSensor()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strConnectionString[XN_DEVICE_MAX_STRING_LENGTH];
+ XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_OPEN_SENSOR, strConnectionString, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to open sensor %s", m_nID, strConnectionString);
+
+ XnStatus nActionResult = OpenSensorImpl(strConnectionString);
+
+ if (nActionResult == XN_STATUS_OK)
+ {
+ // sensor is open. send client its initial state
+ nActionResult = SendInitialState();
+ }
+
+ // if an error occurred, send it to the client
+ if (nActionResult != XN_STATUS_OK)
+ {
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::OpenSensorImpl(const XnChar* strConnectionString)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ nRetVal = m_pSensorsManager->GetSensor(strConnectionString, &m_pSensor);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->PropChangedEvent().Register(PropertyChangedCallback, this, &m_hProprtyChangeCallback);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::CloseSensorImpl()
+{
+ if (m_pSensor == NULL)
+ {
+ return XN_STATUS_OK;
+ }
+
+ // unregister from events
+ m_pSensor->PropChangedEvent().Unregister(m_hProprtyChangeCallback);
+ m_hProprtyChangeCallback = NULL;
+
+ // release all streams
+ XnAutoCSLocker locker(m_hStreamsLock);
+ SessionStreamsHash::Iterator it = m_streamsHash.begin();
+ while (it != m_streamsHash.end())
+ {
+ SessionStreamsHash::Iterator curr = it;
+ ++it;
+ const XnChar* strName = curr.Key();
+ if (strcmp(strName, XN_MODULE_NAME_DEVICE) != 0)
+ {
+ RemoveStreamImpl(strName);
+ }
+ else
+ {
+ // just remove it from the map
+ m_streamsHash.Remove(curr);
+ }
+ }
+
+ // release sensor
+ if (m_pSensor != NULL)
+ {
+ m_pSensorsManager->ReleaseSensor(m_pSensor);
+ m_pSensor = NULL;
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleSetIntProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
+ XnUInt64 nValue;
+ nRetVal = m_privateIncomingPacker.ReadProperty(strModule, strProp, &nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = SetIntPropertyImpl(strModule, strProp, nValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::SetIntPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnUInt64 nValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->SetIntProperty(pStream->strStreamName, strProp, nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleSetRealProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
+ XnDouble dValue;
+ nRetVal = m_privateIncomingPacker.ReadProperty(strModule, strProp, &dValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = SetRealPropertyImpl(strModule, strProp, dValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::SetRealPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnDouble dValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->SetRealProperty(pStream->strStreamName, strProp, dValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleSetStringProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
+ nRetVal = m_privateIncomingPacker.ReadProperty(strModule, strProp, strValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = SetStringPropertyImpl(strModule, strProp, strValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::SetStringPropertyImpl(const XnChar* strModule, const XnChar* strProp, const XnChar* strValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->SetStringProperty(pStream->strStreamName, strProp, strValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleSetGeneralProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
+ XnGeneralBuffer gbValue;
+ nRetVal = m_privateIncomingPacker.ReadProperty(strModule, strProp, &gbValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = SetGeneralPropertyImpl(strModule, strProp, gbValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::SetGeneralPropertyImpl(const XnChar* strModule, const XnChar* strProp, const XnGeneralBuffer& gbValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->SetGeneralProperty(pStream->strStreamName, strProp, gbValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleGetIntProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnSensorServerMessageGetPropertyRequest request;
+ XnUInt32 nDataSize = sizeof(request);
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY, &request, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+ if (nDataSize != sizeof(request))
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
+ }
+
+ // get
+ XnUInt64 nValue;
+ XnStatus nActionResult = GetIntPropertyImpl(request.strModuleName, request.strPropertyName, &nValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY, nActionResult, sizeof(nValue), &nValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::GetIntPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnUInt64* pnValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->GetIntProperty(pStream->strStreamName, strProp, pnValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleGetRealProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnSensorServerMessageGetPropertyRequest request;
+ XnUInt32 nDataSize = sizeof(request);
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY, &request, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+ if (nDataSize != sizeof(request))
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
+ }
+
+ // get
+ XnDouble dValue;
+ XnStatus nActionResult = GetRealPropertyImpl(request.strModuleName, request.strPropertyName, &dValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY, nActionResult, sizeof(dValue), &dValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::GetRealPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnDouble* pdValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->GetRealProperty(pStream->strStreamName, strProp, pdValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleGetStringProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnSensorServerMessageGetPropertyRequest request;
+ XnUInt32 nDataSize = sizeof(request);
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY, &request, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+ if (nDataSize != sizeof(request))
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
+ }
+
+ // get
+ XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
+ XnStatus nActionResult = GetStringPropertyImpl(request.strModuleName, request.strPropertyName, strValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY, nActionResult, sizeof(strValue), strValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::GetStringPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnChar* strValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->GetStringProperty(pStream->strStreamName, strProp, strValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleGetGeneralProperty()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnUChar bufValue[XN_SENSOR_SERVER_MAX_REPLY_SIZE];
+ XnSensorServerMessageGetPropertyRequest* pRequest = (XnSensorServerMessageGetPropertyRequest*)bufValue;
+ XnUChar* pData = bufValue + sizeof(XnSensorServerMessageGetPropertyRequest);
+ XnUInt32 nDataSize = XN_SENSOR_SERVER_MAX_REPLY_SIZE;
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY, bufValue, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (nDataSize < sizeof(XnSensorServerMessageGetPropertyRequest))
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
+ }
+
+ // get
+ XnGeneralBuffer gbValue = XnGeneralBufferPack(pData, pRequest->nSize);
+ XnStatus nActionResult = GetGeneralPropertyImpl(pRequest->strModuleName, pRequest->strPropertyName, gbValue);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY, nActionResult, pRequest->nSize, pData);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::GetGeneralPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnGeneralBuffer& gbValue)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strModule, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->GetGeneralProperty(pStream->strStreamName, strProp, gbValue);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleConfigFromINIFile()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnSensorServerMessageIniFile message;
+ XnUInt32 nDataSize = sizeof(message);
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_INI_FILE, (XnUChar*)&message, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (nDataSize != sizeof(message))
+ {
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Sensor server protocol error - invalid size!");
+ }
+
+ // load
+ XnStatus nActionResult = ConfigFromINIFileImpl(message.strFileName, message.strSectionName);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::ConfigFromINIFileImpl(const XnChar* strFileName, const XnChar* strSectionName)
+{
+ return m_pSensor->LoadConfigFromFile(strFileName, strSectionName);
+}
+
+XnStatus XnServerSession::HandleBatchConfig()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XN_PROPERTY_SET_CREATE_ON_STACK(props);
+
+ nRetVal = m_privateIncomingPacker.ReadPropertySet(&props);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = BatchConfigImpl(&props);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::BatchConfigImpl(const XnPropertySet* pProps)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested a batch config", m_nID);
+
+ XN_PROPERTY_SET_CREATE_ON_STACK(serverProps);
+ for (XnPropertySetData::Iterator it = pProps->pData->begin(); it != pProps->pData->end(); ++it)
+ {
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(it.Key(), pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = XnPropertySetCloneModule(pProps, &serverProps, it.Key(), pStream->strStreamName);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ nRetVal = m_pSensor->BatchConfig(&serverProps);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleNewStream()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XN_PROPERTY_SET_CREATE_ON_STACK(props);
+
+ XnChar strType[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];
+ nRetVal = m_privateIncomingPacker.ReadNewStream(strType, strName, &props);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnPropertySet* pInitialValues = &props;
+ if (props.pData->begin() == props.pData->end())
+ {
+ pInitialValues = NULL;
+ }
+
+ XnStatus nActionResult = NewStreamImpl(strType, strName, pInitialValues);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::NewStreamImpl(const XnChar* strType, const XnChar* strName, const XnPropertySet* pInitialValues)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to create stream '%s' (%s)", m_nID, strName, strType);
+
+ nRetVal = m_pSensor->GetStream(strType, pInitialValues);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // send client the new stream data
+ XN_PROPERTY_SET_CREATE_ON_STACK(streamProps);
+ XN_PROPERTY_SET_CREATE_ON_STACK(clientStreamProps);
+
+ // take properties
+ nRetVal = m_pSensor->GetAllProperties(&streamProps, FALSE, strType);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // copy relevant ones
+ nRetVal = XnPropertySetCloneModule(&streamProps, &clientStreamProps, strType, strName);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // now change the state property. It should be OFF, and not the real value (each client has
+ // its own stream state).
+ nRetVal = XnPropertySetRemoveProperty(&clientStreamProps, strName, XN_STREAM_PROPERTY_STATE);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = XnPropertySetAddIntProperty(&clientStreamProps, strName, XN_STREAM_PROPERTY_STATE, FALSE);
+ XN_IS_STATUS_OK(nRetVal);
+
+ m_pLogger->DumpMessage("NewStream", 0, m_nID, strName);
+
+ {
+ XnAutoCSLocker lock(m_hCommLock);
+ nRetVal = m_privateOutgoingPacker.WriteNewStream(strType, strName, &clientStreamProps);
+ }
+ XN_IS_STATUS_OK(nRetVal);
+
+ // now add it to client data
+ nRetVal = AddSessionModule(strName, strType);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // create client stream data
+ XnStreamData* pStreamData = NULL;
+ nRetVal = m_pSensor->CreateStreamData(strType, &pStreamData);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // and add it to set
+ nRetVal = XnStreamDataSetAdd(m_pStreamDataSet, pStreamData);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleRemoveStream()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];
+ nRetVal = m_privateIncomingPacker.ReadStreamRemoved(strName);
+ XN_IS_STATUS_OK(nRetVal);
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to remove stream %s", m_nID, strName);
+ XnStatus nActionResult = RemoveStreamImpl(strName);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::RemoveStreamImpl(const XnChar* strName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // first close it (so that ref count will be consistent)
+ if (pStream->bIsOpen)
+ {
+ nRetVal = CloseStreamImpl(strName);
+ XN_IS_STATUS_OK(nRetVal);
+ pStream->bIsOpen = FALSE;
+ }
+
+ // release that stream
+ nRetVal = m_pSensor->ReleaseStream(pStream->strStreamName);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // if client had a buffer of this stream, release it
+ XnStreamData* pStreamData = NULL;
+ nRetVal = XnStreamDataSetGet(m_pStreamDataSet, pStream->strStreamName, &pStreamData);
+ if (nRetVal == XN_STATUS_OK)
+ {
+ if (pStreamData->pInternal->pLockedBuffer != NULL)
+ {
+ m_pSensor->ReleaseFrameBuffer(pStream->strStreamName, pStreamData->pInternal->pLockedBuffer);
+ }
+
+ // free data
+ XnStreamDataSetRemove(m_pStreamDataSet, pStreamData);
+ XnStreamDataDestroy(&pStreamData);
+ }
+
+ // now remove it from client
+ nRetVal = RemoveSessionModule(strName);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleOpenStream()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
+ XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
+ XnUInt32 nType = XN_SENSOR_SERVER_MESSAGE_OPEN_STREAM;
+ nRetVal = m_privateIncomingPacker.ReadCustomData(nType, strStreamName, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = OpenStreamImpl(strStreamName);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::OpenStreamImpl(const XnChar* strName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to open stream %s", m_nID, strName);
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (!pStream->bIsOpen)
+ {
+ nRetVal = m_pSensor->OpenStream(pStream->strStreamName, StreamNewDataCallback, pStream, &pStream->hNewDataCallback);
+ XN_IS_STATUS_OK(nRetVal);
+ pStream->bIsOpen = TRUE;
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleCloseStream()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
+ XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
+ XnUInt32 nType = XN_SENSOR_SERVER_MESSAGE_CLOSE_STREAM;
+ nRetVal = m_privateIncomingPacker.ReadCustomData(nType, strStreamName, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStatus nActionResult = CloseStreamImpl(strStreamName);
+
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::CloseStreamImpl(const XnChar* strName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to close stream %s", m_nID, strName);
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ if (pStream->bIsOpen)
+ {
+ nRetVal = m_pSensor->CloseStream(pStream->strStreamName, pStream->hNewDataCallback);
+ XN_IS_STATUS_OK(nRetVal);
+ pStream->bIsOpen = FALSE;
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleReadStream()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // read it
+ XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
+ XnUInt32 nDataSize = XN_DEVICE_MAX_STRING_LENGTH;
+ nRetVal = m_privateIncomingPacker.ReadCustomData(XN_SENSOR_SERVER_MESSAGE_READ_STREAM, strStreamName, &nDataSize);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnSensorServerReadReply reply;
+ XnStatus nActionResult = ReadStreamImpl(strStreamName, &reply);
+ if (nActionResult == XN_STATUS_OK)
+ {
+ m_pLogger->DumpMessage("Data", sizeof(reply), 0, strStreamName);
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_READ_STREAM, XN_STATUS_OK, sizeof(reply), &reply);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+ else
+ {
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
+ XN_IS_STATUS_OK(nRetVal);
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::ReadStreamImpl(const XnChar* strName, XnSensorServerReadReply* pReply)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(strName, pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ XnStreamData* pStreamData;
+ nRetVal = XnStreamDataSetGet(m_pStreamDataSet, pStream->strStreamName, &pStreamData);
+ XN_IS_STATUS_OK(nRetVal);
+
+ nRetVal = m_pSensor->ReadStream(pStreamData, &pReply->nOffset);
+ XN_IS_STATUS_OK(nRetVal);
+
+ pReply->nDataSize = pStreamData->nDataSize;
+ pReply->nFrameID = pStreamData->nFrameID;
+ pReply->nTimestamp = pStreamData->nTimestamp;
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleCloseSession()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ xnLogVerbose(XN_MASK_SENSOR_SERVER, "Received BYE from client %u", m_nID);
+
+ XnStatus nActionResult = CloseSessionImpl();
+ XN_ASSERT(nActionResult == XN_STATUS_OK);
+ XN_REFERENCE_VARIABLE(nActionResult);
+
+ // client shouldn't care if close succeeded or not. always send OK.
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_BYE, XN_STATUS_OK);
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed to send BYE reply to client %u: %s", m_nID, xnGetStatusString(nRetVal));
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::CloseSessionImpl()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // stop processing messages
+ m_bShouldRun = FALSE;
+
+ // close sensor
+ nRetVal = CloseSensorImpl();
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::HandleSingleRequest()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnUInt32 nType;
+ nRetVal = m_privateIncomingPacker.ReadNextObject(&nType);
+ XN_IS_STATUS_OK(nRetVal);
+
+ switch (nType)
+ {
+ case XN_SENSOR_SERVER_MESSAGE_OPEN_SENSOR:
+ {
+ nRetVal = HandleOpenSensor();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_INT_PROPERTY:
+ {
+ nRetVal = HandleSetIntProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_REAL_PROPERTY:
+ {
+ nRetVal = HandleSetRealProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_STRING_PROPERTY:
+ {
+ nRetVal = HandleSetStringProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_GENERAL_PROPERTY:
+ {
+ nRetVal = HandleSetGeneralProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY:
+ {
+ nRetVal = HandleGetIntProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY:
+ {
+ nRetVal = HandleGetRealProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY:
+ {
+ nRetVal = HandleGetStringProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY:
+ {
+ nRetVal = HandleGetGeneralProperty();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_INI_FILE:
+ {
+ nRetVal = HandleConfigFromINIFile();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_PROPERTY_SET:
+ {
+ nRetVal = HandleBatchConfig();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_NEW_STREAM:
+ {
+ nRetVal = HandleNewStream();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PACKED_STREAM_REMOVED:
+ {
+ nRetVal = HandleRemoveStream();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_READ_STREAM:
+ {
+ nRetVal = HandleReadStream();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_OPEN_STREAM:
+ {
+ nRetVal = HandleOpenStream();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_SENSOR_SERVER_MESSAGE_CLOSE_STREAM:
+ {
+ nRetVal = HandleCloseStream();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+
+ case XN_SENSOR_SERVER_MESSAGE_BYE:
+ {
+ nRetVal = HandleCloseSession();
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+
+ default:
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Unknown client request: %u", nType);
+ nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, XN_STATUS_ERROR);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return XN_STATUS_ERROR;
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::ServeThread()
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ while (m_bShouldRun)
+ {
+ if (!m_ioStream.IsConnected())
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u socket was closed. Closing session...", m_nID);
+ CloseSessionImpl();
+ break;
+ }
+
+ nRetVal = HandleSingleRequest();
+ if ((nRetVal != XN_STATUS_OK) &&
+ (nRetVal != XN_STATUS_OS_NETWORK_CONNECTION_CLOSED) &&
+ (nRetVal != XN_STATUS_OS_NETWORK_TIMEOUT))
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed processing client request: %s", xnGetStatusString(nRetVal));
+ }
+ }
+
+ // We cannot RemoveClient from this thread (as part of it is to close the thread). Instead, signal that
+ // client has stopped, and let server main thread wait for exit.
+ m_bHasEnded = TRUE;
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::AddSessionModule(const XnChar* clientName, const XnChar* serverName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream stream;
+ strcpy(stream.strClientStreamName, clientName);
+ strcpy(stream.strStreamName, serverName);
+ stream.bIsOpen = FALSE;
+ stream.pSession = this;
+
+ nRetVal = m_streamsHash.Set(clientName, stream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::RemoveSessionModule(const XnChar* clientName)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ SessionStream* pStream;
+ nRetVal = m_streamsHash.Get(clientName, pStream);
+ if (nRetVal == XN_STATUS_OK)
+ {
+ m_streamsHash.Remove(clientName);
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::OnPropertyChanged(const XnProperty* pProp)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ XnAutoCSLocker streamLocker(m_hStreamsLock);
+
+ SessionStream* pStream = NULL;
+ nRetVal = FindStreamByServerName(pProp->GetModule(), &pStream);
+ XN_IS_STATUS_OK(nRetVal);
+
+ // send message
+ m_pLogger->DumpMessage("PropChange", 0, m_nID, pProp->GetName());
+
+ XnAutoCSLocker commLocker(m_hCommLock);
+ switch (pProp->GetType())
+ {
+ case XN_PROPERTY_TYPE_INTEGER:
+ {
+ XnActualIntProperty* pActualProp = (XnActualIntProperty*)pProp;
+ nRetVal = m_privateOutgoingPacker.WriteProperty(pStream->strClientStreamName, pProp->GetName(), pActualProp->GetValue());
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PROPERTY_TYPE_REAL:
+ {
+ XnActualRealProperty* pActualProp = (XnActualRealProperty*)pProp;
+ nRetVal = m_privateOutgoingPacker.WriteProperty(pStream->strClientStreamName, pProp->GetName(), pActualProp->GetValue());
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PROPERTY_TYPE_STRING:
+ {
+ XnActualStringProperty* pActualProp = (XnActualStringProperty*)pProp;
+ nRetVal = m_privateOutgoingPacker.WriteProperty(pStream->strClientStreamName, pProp->GetName(), pActualProp->GetValue());
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ case XN_PROPERTY_TYPE_GENERAL:
+ {
+ XnActualGeneralProperty* pActualProp = (XnActualGeneralProperty*)pProp;
+ nRetVal = m_privateOutgoingPacker.WriteProperty(pStream->strClientStreamName, pProp->GetName(), pActualProp->GetValue());
+ XN_IS_STATUS_OK(nRetVal);
+ break;
+ }
+ default:
+ XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_SENSOR_SERVER, "Unknown property type: %d", pProp->GetType());
+ }
+
+ return (XN_STATUS_OK);
+}
+
+XnStatus XnServerSession::OnNewData(SessionStream* pStream, XnUInt64 nTimestamp, XnUInt32 nFrameID)
+{
+ XnStatus nRetVal = XN_STATUS_OK;
+
+ // send to client
+ XnSensorServerNewStreamData message;
+ xnOSMemSet(&message, 0, sizeof(message));
+ message.nTimestamp = nTimestamp;
+ message.nFrameID = nFrameID;
+ strcpy(message.strStreamName, pStream->strClientStreamName);
+ m_pLogger->DumpMessage("NewData", sizeof(XnSensorServerNewStreamData), 0, pStream->strClientStreamName);
+
+ XnAutoCSLocker locker(m_hCommLock);
+ nRetVal = m_privateOutgoingPacker.WriteCustomData(XN_SENSOR_SERVER_MESSAGE_NEW_STREAM_DATA, &message, sizeof(XnSensorServerNewStreamData));
+ if (nRetVal != XN_STATUS_OK)
+ {
+ xnLogWarning(XN_MASK_SENSOR_SERVER, "Failed sending new data event to client %d", m_nID);
+ }
+
+ return (XN_STATUS_OK);
+}
+
+void XN_CALLBACK_TYPE XnServerSession::PropertyChangedCallback(const XnProperty* pProp, void* pCookie)
+{
+ XnServerSession* pThis = (XnServerSession*)pCookie;
+ pThis->OnPropertyChanged(pProp);
+}
+
+void XN_CALLBACK_TYPE XnServerSession::StreamNewDataCallback(const XnChar* /*strName*/, XnUInt64 nTimestamp, XnUInt32 nFrameID, void* pCookie)
+{
+ SessionStream* pStream = (SessionStream*)pCookie;
+ pStream->pSession->OnNewData(pStream, nTimestamp, nFrameID);
+}
+
+XN_THREAD_PROC XnServerSession::ServeThreadCallback(XN_THREAD_PARAM pThreadParam)
+{
+ XnServerSession* pThis = (XnServerSession*)pThreadParam;
+ XnStatus nRetVal = pThis->ServeThread();
+ XN_THREAD_PROC_RETURN(nRetVal);
+}
+
diff --git a/Source/XnDeviceSensorV2/XnServerSession.h b/Source/XnDeviceSensorV2/XnServerSession.h
new file mode 100644
index 0000000..85e9fd9
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnServerSession.h
@@ -0,0 +1,138 @@
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
+#ifndef __XN_SERVER_SESSION_H__
+#define __XN_SERVER_SESSION_H__
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnSensorsManager.h"
+#include
+#include
+#include "XnSensorClientServer.h"
+#include "XnServerLogger.h"
+#include
+
+//---------------------------------------------------------------------------
+// Types
+//---------------------------------------------------------------------------
+
+class XnServerSession
+{
+public:
+ XnServerSession(XnSensorsManager* pSensorsManager, XnUInt32 nID, XN_SOCKET_HANDLE hSocket, XnServerLogger* pLogger);
+ ~XnServerSession() ;
+
+ XnStatus Init();
+ void Free();
+
+ inline XnUInt32 ID() const { return m_nID; }
+ inline XnBool HasEnded() const { return m_bHasEnded; }
+
+private:
+ // Types
+ typedef struct
+ {
+ XnServerSession* pSession;
+ XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
+ XnChar strClientStreamName[XN_DEVICE_MAX_STRING_LENGTH];
+ XnBool bIsOpen;
+ XnCallbackHandle hNewDataCallback;
+ } SessionStream;
+
+ XN_DECLARE_STRINGS_HASH(SessionStream, SessionStreamsHash);
+
+ // Functions
+ XnStatus SendReply(XnSensorServerCustomMessages Type, XnStatus nRC, XnUInt32 nDataSize = 0, void* pAdditionalData = NULL);
+ XnStatus SendInitialState();
+ XnStatus FindStreamByServerName(const XnChar* strName, SessionStream** ppStream);
+
+ XnStatus HandleOpenSensor();
+ XnStatus OpenSensorImpl(const XnChar* strConnectionString);
+ XnStatus CloseSensorImpl();
+ XnStatus HandleSetIntProperty();
+ XnStatus SetIntPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnUInt64 nValue);
+ XnStatus HandleSetRealProperty();
+ XnStatus SetRealPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnDouble dValue);
+ XnStatus HandleSetStringProperty();
+ XnStatus SetStringPropertyImpl(const XnChar* strModule, const XnChar* strProp, const XnChar* strValue);
+ XnStatus HandleSetGeneralProperty();
+ XnStatus SetGeneralPropertyImpl(const XnChar* strModule, const XnChar* strProp, const XnGeneralBuffer& gbValue);
+ XnStatus HandleGetIntProperty();
+ XnStatus GetIntPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnUInt64* pnValue);
+ XnStatus HandleGetRealProperty();
+ XnStatus GetRealPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnDouble* pdValue);
+ XnStatus HandleGetStringProperty();
+ XnStatus GetStringPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnChar* strValue);
+ XnStatus HandleGetGeneralProperty();
+ XnStatus GetGeneralPropertyImpl(const XnChar* strModule, const XnChar* strProp, XnGeneralBuffer& gbValue);
+ XnStatus HandleConfigFromINIFile();
+ XnStatus ConfigFromINIFileImpl(const XnChar* strFileName, const XnChar* strSectionName);
+ XnStatus HandleBatchConfig();
+ XnStatus BatchConfigImpl(const XnPropertySet* pProps);
+ XnStatus HandleNewStream();
+ XnStatus NewStreamImpl(const XnChar* strType, const XnChar* strName, const XnPropertySet* pInitialValues);
+ XnStatus HandleRemoveStream();
+ XnStatus RemoveStreamImpl(const XnChar* strName);
+ XnStatus HandleOpenStream();
+ XnStatus OpenStreamImpl(const XnChar* strName);
+ XnStatus HandleCloseStream();
+ XnStatus CloseStreamImpl(const XnChar* strName);
+ XnStatus HandleReadStream();
+ XnStatus ReadStreamImpl(const XnChar* strName, XnSensorServerReadReply* pReply);
+ XnStatus HandleCloseSession();
+ XnStatus CloseSessionImpl();
+
+ XnStatus HandleSingleRequest();
+
+ XnStatus AddSessionModule(const XnChar* clientName, const XnChar* serverName);
+ XnStatus RemoveSessionModule(const XnChar* clientName);
+
+ XnStatus OnPropertyChanged(const XnProperty* pProp);
+ XnStatus OnNewData(SessionStream* pStream, XnUInt64 nTimestamp, XnUInt32 nFrameID);
+
+ XnStatus ServeThread();
+
+ static void XN_CALLBACK_TYPE PropertyChangedCallback(const XnProperty* pProp, void* pCookie);
+ static void XN_CALLBACK_TYPE StreamNewDataCallback(const XnChar* strName, XnUInt64 nTimestamp, XnUInt32 nFrameID, void* pCookie);
+ static XN_THREAD_PROC ServeThreadCallback(XN_THREAD_PARAM pThreadParam);
+
+ // Members
+ XnSensorsManager* m_pSensorsManager;
+ XnUInt32 m_nID;
+ XN_SOCKET_HANDLE m_hSocket;
+ XN_THREAD_HANDLE m_hThread;
+ XN_CRITICAL_SECTION_HANDLE m_hCommLock;
+ XN_CRITICAL_SECTION_HANDLE m_hStreamsLock;
+ XnIONetworkStream m_ioStream;
+ XnDataPacker m_privateIncomingPacker;
+ XnDataPacker m_privateOutgoingPacker;
+ XnStreamDataSet* m_pStreamDataSet;
+ XnBool m_bShouldRun;
+ XnBool m_bHasEnded;
+ XnServerSensorInvoker* m_pSensor;
+ SessionStreamsHash m_streamsHash;
+ XnServerLogger* m_pLogger;
+ XnCallbackHandle m_hProprtyChangeCallback;
+};
+
+#endif // __XN_SERVER_SESSION_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp
index 4e6d432..87a0ee0 100644
--- a/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp
+++ b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -34,16 +28,17 @@
// Code
//---------------------------------------------------------------------------
-XnSharedMemoryBufferPool::XnSharedMemoryBufferPool(XnUInt32 nBufferCount, const XnChar* strName, XnUInt32 nMaxBufferSize) :
+XnSharedMemoryBufferPool::XnSharedMemoryBufferPool(XnUInt32 nBufferCount, const XnChar* strDeviceName, const XnChar* strStreamName, XnUInt32 nMaxBufferSize, XnBool bAllowOtherUsers) :
XnBufferPool(nBufferCount),
m_nMaxBufferSize(nMaxBufferSize),
+ m_bAllowOtherUsers(bAllowOtherUsers),
m_hSharedMemory(NULL),
m_pSharedMemoryAddress(NULL)
{
// to make the name unique, we'll add process ID
XN_PROCESS_ID procID;
xnOSGetCurrentProcessID(&procID);
- sprintf(m_strName, "%u_%s", procID, strName);
+ sprintf(m_strName, "%u_%s_%s", (XnUInt32)procID, strDeviceName, strStreamName);
}
XnSharedMemoryBufferPool::~XnSharedMemoryBufferPool()
@@ -68,7 +63,7 @@ XnStatus XnSharedMemoryBufferPool::AllocateBuffers()
// first time. allocate shared memory
XnUInt32 nTotalSize = m_nMaxBufferSize * m_nBufferCount;
- nRetVal = xnOSCreateSharedMemory(m_strName, nTotalSize, XN_OS_FILE_READ | XN_OS_FILE_WRITE, &m_hSharedMemory);
+ nRetVal = xnOSCreateSharedMemoryEx(m_strName, nTotalSize, XN_OS_FILE_READ | XN_OS_FILE_WRITE, m_bAllowOtherUsers, &m_hSharedMemory);
XN_IS_STATUS_OK(nRetVal);
void* pAddress;
@@ -96,7 +91,7 @@ XnStatus XnSharedMemoryBufferPool::AllocateBuffers()
pBuffer->SetExternalBuffer(m_pSharedMemoryAddress + i*m_nMaxBufferSize, m_nMaxBufferSize);
- xnDumpWriteString(Dump(), "Allocated buffer %u with size %u\n", i, m_nMaxBufferSize);
+ xnDumpFileWriteString(Dump(), "Allocated buffer %u with size %u\n", i, m_nMaxBufferSize);
// add it to free list
m_AllBuffers.AddLast(pBuffer);
diff --git a/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h
index 43b27ba..9f3f435 100644
--- a/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h
+++ b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_SHARED_MEMORY_BUFFER_POOL_H__
#define __XN_SHARED_MEMORY_BUFFER_POOL_H__
@@ -39,14 +33,14 @@
class XnSharedMemoryBufferPool : public XnBufferPool
{
public:
- XnSharedMemoryBufferPool(XnUInt32 nBufferCount, const XnChar* strName, XnUInt32 nMaxBufferSize);
+ XnSharedMemoryBufferPool(XnUInt32 nBufferCount, const XnChar* strDeviceName, const XnChar* strStreamName, XnUInt32 nMaxBufferSize, XnBool bAllowOtherUsers);
~XnSharedMemoryBufferPool();
void Free();
inline const XnChar* GetSharedMemoryName() const { return m_strName; }
- inline XnUInt32 GetBufferOffset(XnBuffer* pBuffer) const { return ((XnUChar*)pBuffer->GetData() - m_pSharedMemoryAddress); }
+ inline XnUInt32 GetBufferOffset(XnBuffer* pBuffer) const { return (XnUInt32)((XnUChar*)pBuffer->GetData() - m_pSharedMemoryAddress); }
protected:
virtual XnStatus AllocateBuffers();
@@ -55,6 +49,7 @@ class XnSharedMemoryBufferPool : public XnBufferPool
private:
XnChar m_strName[XN_FILE_MAX_PATH];
XnUInt32 m_nMaxBufferSize;
+ XnBool m_bAllowOtherUsers;
XN_SHARED_MEMORY_HANDLE m_hSharedMemory;
XnUChar* m_pSharedMemoryAddress;
};
diff --git a/Source/XnDeviceSensorV2/XnStreamProcessor.cpp b/Source/XnDeviceSensorV2/XnStreamProcessor.cpp
index 91e68fc..1839c82 100644
--- a/Source/XnDeviceSensorV2/XnStreamProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnStreamProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnStreamProcessor.h b/Source/XnDeviceSensorV2/XnStreamProcessor.h
index 7423299..d0a2551 100644
--- a/Source/XnDeviceSensorV2/XnStreamProcessor.h
+++ b/Source/XnDeviceSensorV2/XnStreamProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_STREAM_PROCESSOR_H__
#define __XN_STREAM_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp
index 326daee..5f611e2 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -67,7 +61,7 @@ XnStatus XnUncompressedBayerProcessor::Init()
return (XN_STATUS_OK);
}
-void XnUncompressedBayerProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
+void XnUncompressedBayerProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
XN_PROFILING_START_SECTION("XnUncompressedBayerProcessor::ProcessFramePacketChunk")
diff --git a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h
index 4227186..7590da8 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_UNCOMPRESSED_BAYER_PROCESSOR_H__
#define __XN_UNCOMPRESSED_BAYER_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp
index faf8bfd..9576b37 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -44,7 +38,7 @@ XnUncompressedDepthProcessor::~XnUncompressedDepthProcessor()
{
}
-void XnUncompressedDepthProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
+void XnUncompressedDepthProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
XN_PROFILING_START_SECTION("XnUncompressedDepthProcessor::ProcessFramePacketChunk")
diff --git a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h
index d5f52eb..043558e 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_UNCOMPRESSED_DEPTH_PROCESSOR_H__
#define __XN_UNCOMPRESSED_DEPTH_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp
index aa61ef4..3c0f311 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -44,7 +38,7 @@ XnUncompressedYUVImageProcessor::~XnUncompressedYUVImageProcessor()
{
}
-void XnUncompressedYUVImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
+void XnUncompressedYUVImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
XN_PROFILING_START_SECTION("XnUncompressedYUVImageProcessor::ProcessFramePacketChunk")
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h
index 7b95d48..3102105 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_UNCOMPRESSED_YUV_IMAGE_PROCESSOR_H__
#define __XN_UNCOMPRESSED_YUV_IMAGE_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp
index aa485e7..24ccea3 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -57,7 +51,7 @@ XnStatus XnUncompressedYUVtoRGBImageProcessor::Init()
return (XN_STATUS_OK);
}
-void XnUncompressedYUVtoRGBImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize)
+void XnUncompressedYUVtoRGBImageProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
{
XN_PROFILING_START_SECTION("XnUncompressedYUVtoRGBImageProcessor::ProcessFramePacketChunk")
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h
index 5412b91..a148edf 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_UNCOMPRESSED_YUV_TO_RGB_IMAGE_PROCESSOR_H__
#define __XN_UNCOMPRESSED_YUV_TO_RGB_IMAGE_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnWholePacketProcessor.cpp b/Source/XnDeviceSensorV2/XnWholePacketProcessor.cpp
index f44b8dc..c5d3b14 100644
--- a/Source/XnDeviceSensorV2/XnWholePacketProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnWholePacketProcessor.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnWholePacketProcessor.h b/Source/XnDeviceSensorV2/XnWholePacketProcessor.h
index 24dbfbf..5a4b099 100644
--- a/Source/XnDeviceSensorV2/XnWholePacketProcessor.h
+++ b/Source/XnDeviceSensorV2/XnWholePacketProcessor.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_WHOLE_PACKET_PROCESSOR_H__
#define __XN_WHOLE_PACKET_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/YUV.cpp b/Source/XnDeviceSensorV2/YUV.cpp
index 6eeb605..c236527 100644
--- a/Source/XnDeviceSensorV2/YUV.cpp
+++ b/Source/XnDeviceSensorV2/YUV.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -55,9 +49,9 @@ void YUV444ToRGB888(XnUInt8 cY, XnUInt8 cU, XnUInt8 cV,
nC = nC * 298 + 128;
- cR = XN_MIN(XN_MAX((nC + 409 * nE) >> 8, 0), 255);
- cG = XN_MIN(XN_MAX((nC - 100 * nD - 208 * nE) >> 8, 0), 255);
- cB = XN_MIN(XN_MAX((nC + 516 * nD ) >> 8, 0), 255);
+ cR = (XnUInt8)XN_MIN(XN_MAX((nC + 409 * nE) >> 8, 0), 255);
+ cG = (XnUInt8)XN_MIN(XN_MAX((nC - 100 * nD - 208 * nE) >> 8, 0), 255);
+ cB = (XnUInt8)XN_MIN(XN_MAX((nC + 516 * nD ) >> 8, 0), 255);
}
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
@@ -69,7 +63,6 @@ void YUV422ToRGB888(const XnUInt8* pYUVImage, XnUInt8* pRGBImage, XnUInt32 nYUVS
const XnUInt8* pRGBOrig = pRGBImage;
const XnUInt8* pRGBLast = pRGBImage + *pnRGBSize - 12;
- const __m128 minus16 = _mm_set_ps1(-16);
const __m128 minus128 = _mm_set_ps1(-128);
const __m128 plus113983 = _mm_set_ps1(1.13983F);
const __m128 minus039466 = _mm_set_ps1(-0.39466F);
@@ -149,29 +142,29 @@ void YUV422ToRGB888(const XnUInt8* pYUVImage, XnUInt8* pRGBImage, XnUInt32 nYUVS
// extract the 4 pixels RGB values.
// because we made sure values are between 0 and 255, we can just take the lower byte
// of each INT16
- pRGBImage[0] = piR[0];
- pRGBImage[1] = piG[0];
- pRGBImage[2] = piB[0];
+ pRGBImage[0] = (XnUInt8)piR[0];
+ pRGBImage[1] = (XnUInt8)piG[0];
+ pRGBImage[2] = (XnUInt8)piB[0];
- pRGBImage[3] = piR[1];
- pRGBImage[4] = piG[1];
- pRGBImage[5] = piB[1];
+ pRGBImage[3] = (XnUInt8)piR[1];
+ pRGBImage[4] = (XnUInt8)piG[1];
+ pRGBImage[5] = (XnUInt8)piB[1];
- pRGBImage[6] = piR[2];
- pRGBImage[7] = piG[2];
- pRGBImage[8] = piB[2];
+ pRGBImage[6] = (XnUInt8)piR[2];
+ pRGBImage[7] = (XnUInt8)piG[2];
+ pRGBImage[8] = (XnUInt8)piB[2];
- pRGBImage[9] = piR[3];
- pRGBImage[10] = piG[3];
- pRGBImage[11] = piB[3];
+ pRGBImage[9] = (XnUInt8)piR[3];
+ pRGBImage[10] = (XnUInt8)piG[3];
+ pRGBImage[11] = (XnUInt8)piB[3];
// advance the streams
pYUVImage += 8;
pRGBImage += 12;
}
- *pnActualRead = pYUVImage - pYUVOrig;
- *pnRGBSize = pRGBImage - pRGBOrig;
+ *pnActualRead = (XnUInt32)(pYUVImage - pYUVOrig);
+ *pnRGBSize = (XnUInt32)(pRGBImage - pRGBOrig);
}
#else // not Win32
@@ -202,10 +195,9 @@ void YUV422ToRGB888(const XnUInt8* pYUVImage, XnUInt8* pRGBImage, XnUInt32 nYUVS
#endif
-void YUV420ToRGB888(const XnUInt8* pYUVImage, XnUInt8* pRGBImage, XnUInt32 nYUVSize, XnUInt32 nRGBSize)
+void YUV420ToRGB888(const XnUInt8* pYUVImage, XnUInt8* pRGBImage, XnUInt32 nYUVSize, XnUInt32 /*nRGBSize*/)
{
const XnUInt8* pLastYUV = pYUVImage + nYUVSize - YUV420_BPP;
- XnUInt8* pLastRGB = pRGBImage + nRGBSize - 12;
while (pYUVImage < pLastYUV && pRGBImage < pYUVImage)
{
diff --git a/Source/XnDeviceSensorV2/YUV.h b/Source/XnDeviceSensorV2/YUV.h
index 2634d72..47ef8e9 100644
--- a/Source/XnDeviceSensorV2/YUV.h
+++ b/Source/XnDeviceSensorV2/YUV.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_YUV_H_
#define _XN_YUV_H_
diff --git a/Source/XnFormats/Xn16zCodec.h b/Source/XnFormats/Xn16zCodec.h
index 27bc664..a45e50b 100644
--- a/Source/XnFormats/Xn16zCodec.h
+++ b/Source/XnFormats/Xn16zCodec.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_16Z_CODEC_H__
#define __XN_16Z_CODEC_H__
diff --git a/Source/XnFormats/Xn16zEmbTablesCodec.h b/Source/XnFormats/Xn16zEmbTablesCodec.h
index 44a35dc..4655d9f 100644
--- a/Source/XnFormats/Xn16zEmbTablesCodec.h
+++ b/Source/XnFormats/Xn16zEmbTablesCodec.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_16Z_EMB_TABLES_CODEC_H__
#define __XN_16Z_EMB_TABLES_CODEC_H__
diff --git a/Source/XnFormats/Xn8zCodec.h b/Source/XnFormats/Xn8zCodec.h
index 1b9f24c..beaae21 100644
--- a/Source/XnFormats/Xn8zCodec.h
+++ b/Source/XnFormats/Xn8zCodec.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_8Z_CODEC_H__
#define __XN_8Z_CODEC_H__
diff --git a/Source/XnFormats/XnCodec.h b/Source/XnFormats/XnCodec.h
index 8718997..a6e8900 100644
--- a/Source/XnFormats/XnCodec.h
+++ b/Source/XnFormats/XnCodec.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_CODEC_H__
#define __XN_CODEC_H__
diff --git a/Source/XnFormats/XnCodecBase.h b/Source/XnFormats/XnCodecBase.h
index bef220f..4a4744a 100644
--- a/Source/XnFormats/XnCodecBase.h
+++ b/Source/XnFormats/XnCodecBase.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_CODEC_BASE_H__
#define __XN_CODEC_BASE_H__
diff --git a/Source/XnFormats/XnCodecs.cpp b/Source/XnFormats/XnCodecs.cpp
index 12b2ebd..73cb5dd 100644
--- a/Source/XnFormats/XnCodecs.cpp
+++ b/Source/XnFormats/XnCodecs.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnFormats/XnFormats.cpp b/Source/XnFormats/XnFormats.cpp
index 37cb216..90151cf 100644
--- a/Source/XnFormats/XnFormats.cpp
+++ b/Source/XnFormats/XnFormats.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnFormats/XnFormats.h b/Source/XnFormats/XnFormats.h
index 80779cc..55484bf 100644
--- a/Source/XnFormats/XnFormats.h
+++ b/Source/XnFormats/XnFormats.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_FORMATS_H_
#define _XN_FORMATS_H_
diff --git a/Source/XnFormats/XnFormatsMirror.cpp b/Source/XnFormats/XnFormatsMirror.cpp
index 3bb3834..aab2219 100644
--- a/Source/XnFormats/XnFormatsMirror.cpp
+++ b/Source/XnFormats/XnFormatsMirror.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -84,7 +78,7 @@ XnStatus XnMirrorTwoBytePixels(XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt32
XnUInt16* pDest = NULL;
XnUInt16* pDestVal = &pLineBuffer[0] + nLineSize - 1;
XnUInt16* pDestEnd = &pLineBuffer[0] - 1;
- XnUInt16 nMemCpyLineSize = nLineSize * sizeof(XnUInt16);
+ XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * sizeof(XnUInt16));
XnUInt16 nValue;
if (nLineSize > XN_MIRROR_MAX_LINE_SIZE)
@@ -120,7 +114,7 @@ XnStatus XnMirrorThreeBytePixels(XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt3
XnUInt8* pDest = NULL;
XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize * 3 - 1;
XnUInt8* pDestEnd = &pLineBuffer[0] - 1;
- XnUInt16 nMemCpyLineSize = nLineSize * 3;
+ XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * 3);
if (nMemCpyLineSize > XN_MIRROR_MAX_LINE_SIZE)
{
diff --git a/Source/XnFormats/XnFormatsStatus.cpp b/Source/XnFormats/XnFormatsStatus.cpp
index cd5d309..41a7773 100644
--- a/Source/XnFormats/XnFormatsStatus.cpp
+++ b/Source/XnFormats/XnFormatsStatus.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
diff --git a/Source/XnFormats/XnJpegCodec.h b/Source/XnFormats/XnJpegCodec.h
index 40728e0..8cf5599 100644
--- a/Source/XnFormats/XnJpegCodec.h
+++ b/Source/XnFormats/XnJpegCodec.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_JPEG_CODEC_H__
#define __XN_JPEG_CODEC_H__
@@ -71,7 +66,9 @@ class XN_FORMATS_CPP_API XnJpegCodec : public XnCodecBase
virtual XnUInt32 GetOverheadSize() const { return 0; }
protected:
- virtual XnStatus CompressImpl(const XnUChar* pData, XnUInt32 nDataSize, XnUChar* pCompressedData, XnUInt32* pnCompressedDataSize)
+ XN_DISABLE_COPY_AND_ASSIGN(XnJpegCodec);
+
+ virtual XnStatus CompressImpl(const XnUChar* pData, XnUInt32 /*nDataSize*/, XnUChar* pCompressedData, XnUInt32* pnCompressedDataSize)
{
if (m_bRGB)
{
diff --git a/Source/XnFormats/XnNiCodec.h b/Source/XnFormats/XnNiCodec.h
index 51b413c..215d127 100644
--- a/Source/XnFormats/XnNiCodec.h
+++ b/Source/XnFormats/XnNiCodec.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_XN_CODEC_H__
#define __XN_XN_CODEC_H__
diff --git a/Source/XnFormats/XnStreamCompression.cpp b/Source/XnFormats/XnStreamCompression.cpp
index aea0a55..836188d 100644
--- a/Source/XnFormats/XnStreamCompression.cpp
+++ b/Source/XnFormats/XnStreamCompression.cpp
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
@@ -73,7 +67,7 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16Z(const XnUInt16* pInput, const X
nCurrValue = *pInput;
nDiffValue = (nLastValue - nCurrValue);
- nAbsDiffValue = abs(nDiffValue);
+ nAbsDiffValue = (XnUInt16)abs(nDiffValue);
if (nAbsDiffValue <= 6)
{
@@ -81,13 +75,13 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16Z(const XnUInt16* pInput, const X
if (cOutStage == 0)
{
- cOutChar = nDiffValue << 4;
+ cOutChar = (XnUInt8)(nDiffValue << 4);
cOutStage = 1;
}
else
{
- cOutChar += nDiffValue;
+ cOutChar += (XnUInt8)nDiffValue;
if (cOutChar == 0x66)
{
@@ -145,7 +139,7 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16Z(const XnUInt16* pInput, const X
{
nDiffValue += 192;
- *pOutput = nDiffValue;
+ *pOutput = (XnUInt8)nDiffValue;
pOutput++;
}
else
@@ -171,7 +165,7 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16Z(const XnUInt16* pInput, const X
pOutput++;
}
- *pnOutputSize = pOutput - pOrigOutput;
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput);
// All is good...
return (XN_STATUS_OK);
@@ -239,7 +233,7 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16ZWithEmbTable(const XnUInt16* pIn
nCurrValue = nEmbTable[*pInput];
nDiffValue = (nLastValue - nCurrValue);
- nAbsDiffValue = abs(nDiffValue);
+ nAbsDiffValue = (XnUInt16)abs(nDiffValue);
if (nAbsDiffValue <= 6)
{
@@ -247,13 +241,13 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16ZWithEmbTable(const XnUInt16* pIn
if (cOutStage == 0)
{
- cOutChar = nDiffValue << 4;
+ cOutChar = (XnUInt8)(nDiffValue << 4);
cOutStage = 1;
}
else
{
- cOutChar += nDiffValue;
+ cOutChar += (XnUInt8)nDiffValue;
if (cOutChar == 0x66)
{
@@ -311,7 +305,7 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16ZWithEmbTable(const XnUInt16* pIn
{
nDiffValue += 192;
- *pOutput = nDiffValue;
+ *pOutput = (XnUInt8)nDiffValue;
pOutput++;
}
else
@@ -337,7 +331,7 @@ XN_FORMATS_API XnStatus XnStreamCompressDepth16ZWithEmbTable(const XnUInt16* pIn
pOutput++;
}
- *pnOutputSize = pOutput - pOrigOutput;
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput);
// All is good...
return (XN_STATUS_OK);
@@ -478,7 +472,7 @@ XN_FORMATS_API XnStatus XnStreamUncompressDepth16Z(const XnUInt8* pInput, const
}
}
- *pnOutputSize = (pOutput - pOrigOutput) * sizeof(XnUInt16);
+ *pnOutputSize = (XnUInt32)((pOutput - pOrigOutput) * sizeof(XnUInt16));
// All is good...
return (XN_STATUS_OK);
@@ -628,7 +622,7 @@ XN_FORMATS_API XnStatus XnStreamUncompressDepth16ZWithEmbTable(const XnUInt8* pI
}
}
- *pnOutputSize = (pOutput - pOrigOutput) * sizeof(XnUInt16);
+ *pnOutputSize = (XnUInt32)((pOutput - pOrigOutput) * sizeof(XnUInt16));
// All is good...
return (XN_STATUS_OK);
@@ -666,7 +660,7 @@ XN_FORMATS_API XnStatus XnStreamCompressImage8Z(const XnUInt8* pInput, const XnU
nCurrValue = *pInput;
nDiffValue = (nLastValue - nCurrValue);
- nAbsDiffValue = abs(nDiffValue);
+ nAbsDiffValue = (XnUInt8)abs(nDiffValue);
if (nAbsDiffValue <= 6)
{
@@ -765,7 +759,7 @@ XN_FORMATS_API XnStatus XnStreamCompressImage8Z(const XnUInt8* pInput, const XnU
pOutput++;
}
- *pnOutputSize = pOutput - pOrigOutput;
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput);
// All is good...
return (XN_STATUS_OK);
@@ -884,7 +878,7 @@ XN_FORMATS_API XnStatus XnStreamUncompressImage8Z(const XnUInt8* pInput, const X
}
}
- *pnOutputSize = (pOutput - pOrigOutput);
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput);
// All is good...
return (XN_STATUS_OK);
@@ -915,7 +909,7 @@ XN_FORMATS_API XnStatus XnStreamCompressConf4(const XnUInt8* pInput, const XnUIn
pOutput++;
}
- *pnOutputSize = pOutput - pOrigOutput;
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput);
// All is good...
return (XN_STATUS_OK);
@@ -963,18 +957,18 @@ XN_FORMATS_API XnStatus XnStreamUncompressConf4(const XnUInt8* pInput, const XnU
pInput+=2;
}
- *pnOutputSize = (pOutput - pOrigOutput);
+ *pnOutputSize = (XnUInt32)(pOutput - pOrigOutput);
// All is good...
return (XN_STATUS_OK);
}
-void XnStreamJPEGCompDummyFunction(struct jpeg_compress_struct* pjCompStruct)
+void XnStreamJPEGCompDummyFunction(struct jpeg_compress_struct* /*pjCompStruct*/)
{
// Dummy libjpeg function to wrap internal buffers usage...
}
-boolean XnStreamJPEGCompDummyFailFunction(struct jpeg_compress_struct* pjCompStruct)
+boolean XnStreamJPEGCompDummyFailFunction(struct jpeg_compress_struct* /*pjCompStruct*/)
{
// If we ever got to the point we need to allocate more memory, something is wrong!
return (FALSE);
@@ -1049,7 +1043,7 @@ XN_FORMATS_API XnStatus XnStreamCompressImage8J(XnStreamCompJPEGContext* pStream
jpeg_finish_compress(pjCompStruct);
- *pnOutputSize -= pjCompStruct->dest->free_in_buffer;
+ *pnOutputSize -= (XnUInt32)pjCompStruct->dest->free_in_buffer;
// All is good...
return (XN_STATUS_OK);
@@ -1097,18 +1091,18 @@ XN_FORMATS_API XnStatus XnStreamCompressImage24J(XnStreamCompJPEGContext* pStrea
jpeg_finish_compress(pjCompStruct);
- *pnOutputSize -= pjCompStruct->dest->free_in_buffer;
+ *pnOutputSize -= (XnUInt32)pjCompStruct->dest->free_in_buffer;
// All is good...
return (XN_STATUS_OK);
}
-void XnStreamJPEGDecompDummyFunction(struct jpeg_decompress_struct* pjDecompStruct)
+void XnStreamJPEGDecompDummyFunction(struct jpeg_decompress_struct* /*pjDecompStruct*/)
{
// Dummy libjpeg function to wrap internal buffers usage...
}
-boolean XnStreamJPEGDecompDummyFailFunction(struct jpeg_decompress_struct* pjDecompStruct)
+boolean XnStreamJPEGDecompDummyFailFunction(struct jpeg_decompress_struct* /*pjDecompStruct*/)
{
// If we ever got to the point we need to allocate more memory, something is wrong!
return (FALSE);
@@ -1192,6 +1186,10 @@ XN_FORMATS_API XnStatus XnStreamFreeUncompressImageJ(XnStreamUncompJPEGContext*
return (XN_STATUS_OK);
}
+// to allow the use of setjmp
+#pragma warning(push)
+#pragma warning(disable: 4611)
+
XN_FORMATS_API XnStatus XnStreamUncompressImageJ(XnStreamUncompJPEGContext* pStreamUncompJPEGContext, const XnUInt8* pInput, const XnUInt32 nInputSize, XnUInt8* pOutput, XnUInt32* pnOutputSize)
{
// Local function variables
@@ -1273,3 +1271,5 @@ XN_FORMATS_API XnStatus XnStreamUncompressImageJ(XnStreamUncompJPEGContext* pStr
// All is good...
return (XN_STATUS_OK);
}
+
+#pragma warning(pop)
diff --git a/Source/XnFormats/XnStreamCompression.h b/Source/XnFormats/XnStreamCompression.h
index 35f31d1..d49723c 100644
--- a/Source/XnFormats/XnStreamCompression.h
+++ b/Source/XnFormats/XnStreamCompression.h
@@ -1,30 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef _XN_STREAMCOMPRESSION_H_
#define _XN_STREAMCOMPRESSION_H_
diff --git a/Source/XnFormats/XnUncompressedCodec.h b/Source/XnFormats/XnUncompressedCodec.h
index cd6e2e5..4853965 100644
--- a/Source/XnFormats/XnUncompressedCodec.h
+++ b/Source/XnFormats/XnUncompressedCodec.h
@@ -1,29 +1,24 @@
-/*****************************************************************************
-* *
-* PrimeSense Sensor 5.0 Alpha *
-* Copyright (C) 2010 PrimeSense Ltd. *
-* *
-* This file is part of PrimeSense Common. *
-* *
-* PrimeSense Sensor is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* PrimeSense Sensor is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with PrimeSense Sensor. If not, see . *
-* *
-*****************************************************************************/
-
-
-
-
-
+/****************************************************************************
+* *
+* PrimeSense Sensor 5.x Alpha *
+* Copyright (C) 2011 PrimeSense Ltd. *
+* *
+* This file is part of PrimeSense Sensor. *
+* *
+* PrimeSense Sensor is free software: you can redistribute it and/or modify*
+* it under the terms of the GNU Lesser General Public License as published *
+* by the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* PrimeSense Sensor is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* You should have received a copy of the GNU Lesser General Public License *
+* along with PrimeSense Sensor. If not, see .*
+* *
+****************************************************************************/
#ifndef __XN_UNCOMPRESSED_CODEC_H__
#define __XN_UNCOMPRESSED_CODEC_H__