AForge.Video.Kinect.KinectNative.freenect_close_device C# (CSharp) Method

freenect_close_device() private method

private freenect_close_device ( IntPtr device ) : int
device System.IntPtr
return int
        public static extern int freenect_close_device( IntPtr device );

Usage Example

Ejemplo n.º 1
0
        private void Dispose(bool disposing)
        {
            bool needToStopStatusThread = false;

            lock ( openDevices )
            {
                // decrease reference counter and check if we need to close the device
                if (--openDevices[deviceID].ReferenceCounter == 0)
                {
                    if (!openDevices[deviceID].DeviceFailed)
                    {
                        KinectNative.freenect_close_device(rawDevice);
                    }
                    openDevices.Remove(deviceID);
                }

                needToStopStatusThread = (openDevices.Count == 0);
            }

            rawDevice = IntPtr.Zero;

            if (needToStopStatusThread)
            {
                StopStatusThread( );
            }
        }