LongExposureInfraredFrameReference.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using RootSystem = System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. namespace Windows.Kinect
  5. {
  6. //
  7. // Windows.Kinect.LongExposureInfraredFrameReference
  8. //
  9. public sealed partial class LongExposureInfraredFrameReference : Helper.INativeWrapper
  10. {
  11. internal RootSystem.IntPtr _pNative;
  12. RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
  13. // Constructors and Finalizers
  14. internal LongExposureInfraredFrameReference(RootSystem.IntPtr pNative)
  15. {
  16. _pNative = pNative;
  17. Windows_Kinect_LongExposureInfraredFrameReference_AddRefObject(ref _pNative);
  18. }
  19. ~LongExposureInfraredFrameReference()
  20. {
  21. Dispose(false);
  22. }
  23. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  24. private static extern void Windows_Kinect_LongExposureInfraredFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
  25. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  26. private static extern void Windows_Kinect_LongExposureInfraredFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
  27. private void Dispose(bool disposing)
  28. {
  29. if (_pNative == RootSystem.IntPtr.Zero)
  30. {
  31. return;
  32. }
  33. __EventCleanup();
  34. Helper.NativeObjectCache.RemoveObject<LongExposureInfraredFrameReference>(_pNative);
  35. Windows_Kinect_LongExposureInfraredFrameReference_ReleaseObject(ref _pNative);
  36. _pNative = RootSystem.IntPtr.Zero;
  37. }
  38. // Public Properties
  39. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  40. private static extern long Windows_Kinect_LongExposureInfraredFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
  41. public RootSystem.TimeSpan RelativeTime
  42. {
  43. get
  44. {
  45. if (_pNative == RootSystem.IntPtr.Zero)
  46. {
  47. throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrameReference");
  48. }
  49. return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_LongExposureInfraredFrameReference_get_RelativeTime(_pNative));
  50. }
  51. }
  52. // Public Methods
  53. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  54. private static extern RootSystem.IntPtr Windows_Kinect_LongExposureInfraredFrameReference_AcquireFrame(RootSystem.IntPtr pNative);
  55. public Windows.Kinect.LongExposureInfraredFrame AcquireFrame()
  56. {
  57. if (_pNative == RootSystem.IntPtr.Zero)
  58. {
  59. throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrameReference");
  60. }
  61. RootSystem.IntPtr objectPointer = Windows_Kinect_LongExposureInfraredFrameReference_AcquireFrame(_pNative);
  62. Helper.ExceptionHelper.CheckLastError();
  63. if (objectPointer == RootSystem.IntPtr.Zero)
  64. {
  65. return null;
  66. }
  67. return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.LongExposureInfraredFrame>(objectPointer, n => new Windows.Kinect.LongExposureInfraredFrame(n));
  68. }
  69. private void __EventCleanup()
  70. {
  71. }
  72. }
  73. }