GSXRDevice.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. 
  2. using SC.XR.Unity.Module_InputSystem;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. namespace SC.XR.Unity.Module_Device {
  8. public class GSXRDevice {
  9. public GSXRDevice() {
  10. int fishEyeNum = 0;
  11. int fishEyeW = 0;
  12. int fishEyeH = 0;
  13. API_GSXR_Slam.plugin.GSXR_Get_FishEyeInfo(ref fishEyeNum, ref fishEyeW, ref fishEyeH);
  14. FishEyeNum = fishEyeNum;
  15. FishEyeResolution = new Vector2(fishEyeW, fishEyeH);
  16. SN = API_GSXR_Slam.plugin.SN;
  17. RELEASE_VERSION = API_GSXR_Slam.plugin.RELEASE_VERSION;
  18. FIRMWARE_VERSION = API_GSXR_Slam.plugin.GSXR_Get_ControllerVersion();
  19. DeviceName = API_GSXR_Slam.plugin.GSXR_Get_DeviceName();
  20. INTERNAL_VERSION = API_GSXR_Slam.plugin.GSXR_Get_InternalVersion();
  21. XRType = API_GSXR_Slam.plugin.GSXR_Get_XRType();
  22. IsSupportController = API_GSXR_Slam.plugin.GSXR_Is_SupportController();
  23. IsSupportHandTracking = API_GSXR_Slam.plugin.GSXR_Is_SupportHandTracking();
  24. IsSupportMap = API_GSXR_Slam.plugin.GSXR_Support_Map();
  25. IsSupportPanel = API_GSXR_Slam.plugin.GSXR_Support_Panel();
  26. IsSupportOpticsCalibration = API_GSXR_Slam.plugin.GSXR_Is_SupportOpticsCalibration();
  27. IsSupportEyeTracking = API_GSXR_Slam.plugin.GSXR_Support_EyeTracking();
  28. }
  29. public bool IsSupportController { get; private set; }
  30. public bool IsSupportHandTracking { get; private set; }
  31. public bool IsSupportMap { get; private set; }
  32. public bool IsSupportPanel { get; private set; }
  33. public bool IsSupportOpticsCalibration { get; private set; }
  34. public bool IsSupportEyeTracking { get; private set; }
  35. protected List<InputDeviceType> m_SupportInputDevices = null;
  36. public List<InputDeviceType> SupportInputDevices {
  37. get {
  38. if (m_SupportInputDevices == null) {
  39. m_SupportInputDevices = new List<InputDeviceType>();
  40. m_SupportInputDevices.Add(InputDeviceType.Head);
  41. if (API_GSXR_Slam.plugin.GSXR_Is_SupportController() == true) {
  42. m_SupportInputDevices.Add(InputDeviceType.KS);
  43. }
  44. if (API_GSXR_Slam.plugin.GSXR_Is_SupportHandTracking() == true) {
  45. m_SupportInputDevices.Add(InputDeviceType.GGT26Dof);
  46. }
  47. }
  48. return m_SupportInputDevices;
  49. }
  50. }
  51. public int FishEyeNum { get; private set; }
  52. public Vector2 FishEyeResolution { get; private set; }
  53. public string SN { get; private set; }
  54. public string RELEASE_VERSION { get; private set; }
  55. public XRType XRType { get; private set; }
  56. public string DeviceName { get; private set; }
  57. public string INTERNAL_VERSION { get; private set; }
  58. public float FIRMWARE_VERSION { get; private set; }
  59. public int BatteryLevel {
  60. get => API_GSXR_Slam.plugin.BatteryLevel;
  61. }
  62. public virtual void ShowInfo() {
  63. DebugMy.Log("GSXRDevice:"
  64. + " XRType:" + XRType
  65. + " DeviceName:" + DeviceName
  66. + " SN:" + SN
  67. + " RELEASE_VERSION:" + RELEASE_VERSION
  68. + " FIRMWARE_VERSION:" + FIRMWARE_VERSION
  69. + " IsSupportController:" + IsSupportController
  70. + " IsSupportHandTracking:" + IsSupportHandTracking
  71. + " IsSupportMap:" + IsSupportMap
  72. + " IsSupportPanel:" + IsSupportPanel
  73. + " IsSupportOpticsCalibration:" + IsSupportOpticsCalibration
  74. + " IsSupportEyeTracking:" + IsSupportEyeTracking
  75. + " BatteryLevel:" + BatteryLevel
  76. + " FishEyeNum:" + FishEyeNum
  77. + " FishEyeResolution:" + FishEyeResolution
  78. + " DeviceName:" + DeviceName
  79. + " InternalVesrion:" + INTERNAL_VERSION
  80. , this, true);
  81. }
  82. }
  83. }