ICameraDataProvider.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal
  10. {
  11. using System;
  12. using System.Runtime.InteropServices;
  13. /// <summary> Callback, called when the camera image. </summary>
  14. /// <param name="rgb_camera_handle"> Handle of the RGB camera.</param>
  15. /// <param name="rgb_camera_image_handle"> Handle of the RGB camera image.</param>
  16. /// <param name="userdata"> The userdata.</param>
  17. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  18. public delegate void CameraImageCallback(UInt64 rgb_camera_handle,
  19. UInt64 rgb_camera_image_handle, UInt64 userdata);
  20. /// <summary> Interface for camera data provider. </summary>
  21. public interface ICameraDataProvider
  22. {
  23. /// <summary> Creates a new bool. </summary>
  24. /// <returns> True if it succeeds, false if it fails. </returns>
  25. bool Create();
  26. /// <summary> Gets raw data. </summary>
  27. /// <param name="imageHandle"> Handle of the image.</param>
  28. /// <param name="eye"> The eye.</param>
  29. /// <param name="ptr"> [in,out] The pointer.</param>
  30. /// <param name="size"> [in,out] The size.</param>
  31. /// <returns> True if it succeeds, false if it fails. </returns>
  32. bool GetRawData(UInt64 imageHandle, int eye, ref IntPtr ptr, ref int size);
  33. /// <summary> Gets a resolution. </summary>
  34. /// <param name="imageHandle"> Handle of the image.</param>
  35. /// <param name="eye"> The eye.</param>
  36. /// <returns> The resolution. </returns>
  37. NativeResolution GetResolution(UInt64 imageHandle, int eye);
  38. /// <summary> Gets hmd time nanos. </summary>
  39. /// <param name="imageHandle"> Handle of the image.</param>
  40. /// <param name="eye"> The eye.</param>
  41. /// <returns> The hmd time nanos. </returns>
  42. UInt64 GetHMDTimeNanos(UInt64 imageHandle, int eye);
  43. /// <summary> Get exposure time. </summary>
  44. /// <param name="imageHandle"> Handle of the image. </param>
  45. /// <param name="eye"> The eye. </param>
  46. /// <returns> Exposure time of the image. </returns>
  47. UInt32 GetExposureTime(UInt64 imageHandle, int eye);
  48. /// <summary> Get Gain. </summary>
  49. /// <param name="imageHandle"> Handle of the image. </param>
  50. /// <param name="eye"> The eye. </param>
  51. /// <returns> Gain of the image. </returns>
  52. UInt32 GetGain(UInt64 imageHandle, int eye);
  53. /// <summary> Callback, called when the set capture. </summary>
  54. /// <param name="callback"> The callback.</param>
  55. /// <param name="userdata"> (Optional) The userdata.</param>
  56. /// <returns> True if it succeeds, false if it fails. </returns>
  57. bool SetCaptureCallback(CameraImageCallback callback, UInt64 userdata = 0);
  58. /// <summary> Sets image format. </summary>
  59. /// <param name="format"> Describes the format to use.</param>
  60. /// <returns> True if it succeeds, false if it fails. </returns>
  61. bool SetImageFormat(CameraImageFormat format);
  62. /// <summary> Starts a capture. </summary>
  63. /// <returns> True if it succeeds, false if it fails. </returns>
  64. bool StartCapture();
  65. /// <summary> Stops a capture. </summary>
  66. /// <returns> True if it succeeds, false if it fails. </returns>
  67. bool StopCapture();
  68. /// <summary> Destroys the image described by imageHandle. </summary>
  69. /// <param name="imageHandle"> Handle of the image.</param>
  70. /// <returns> True if it succeeds, false if it fails. </returns>
  71. bool DestroyImage(UInt64 imageHandle);
  72. /// <summary> Releases this object. </summary>
  73. /// <returns> True if it succeeds, false if it fails. </returns>
  74. bool Release();
  75. }
  76. }