/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputSystem">The <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem"/> instance that receives data from this provider.</param>
        /// <param name="name">Friendly name of the service.</param>
        /// <param name="priority">Service priority. Used to determine order of instantiation.</param>
        /// <param name="profile">The service's configuration profile.</param>
        public WindowsMixedRealityEyeGazeDataProvider(
            IMixedRealityInputSystem inputSystem,
            string name,
            uint priority,
            BaseMixedRealityProfile profile) : base(inputSystem, name, priority, profile)
        {
            eyesApiAvailable = WindowsApiChecker.IsPropertyAvailable(
                "Windows.UI.Input.Spatial",
                "SpatialPointerPose",
                "Eyes");

#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
            if (eyesApiAvailable)
            {
                eyesApiAvailable &= EyesPose.IsSupported();
            }
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP

            gazeSmoother = new EyeGazeSmoother();

            // Register for these events to forward along, in case code is still registering for the obsolete actions
            gazeSmoother.OnSaccade  += GazeSmoother_OnSaccade;
            gazeSmoother.OnSaccadeX += GazeSmoother_OnSaccadeX;
            gazeSmoother.OnSaccadeY += GazeSmoother_OnSaccadeY;
        }
Beispiel #2
0
 /// <summary>
 /// Triggers a prompt to let the user decide whether to permit using eye tracking
 /// </summary>
 private async void AskForETPermission()
 {
     if (!askedForETAccessAlready)  // Making sure this is only triggered once
     {
         askedForETAccessAlready = true;
         await EyesPose.RequestAccessAsync();
     }
 }
Beispiel #3
0
        private static bool askedForETAccessAlready = false; // To make sure that this is only triggered once.
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP

        #region IMixedRealityCapabilityCheck Implementation

        /// <inheritdoc />
        public bool CheckCapability(MixedRealityCapability capability)
        {
            if (eyesApiAvailable)
            {
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
                return((capability == MixedRealityCapability.EyeTracking) && EyesPose.IsSupported());
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
            }

            return(false);
        }
Beispiel #4
0
        private static bool askedForETAccessAlready = false; // To make sure that this is only triggered once.
#endif // WINDOWS_UWP

        #region IMixedRealityCapabilityCheck Implementation

        /// <inheritdoc />
        public bool CheckCapability(MixedRealityCapability capability)
        {
            if (WindowsApiChecker.UniversalApiContractV8_IsAvailable)
            {
#if WINDOWS_UWP
                return((capability == MixedRealityCapability.EyeTracking) && EyesPose.IsSupported());
#endif // WINDOWS_UWP
            }

            return(false);
        }
Beispiel #5
0
        private static bool askedForETAccessAlready = false; // To make sure that this is only triggered once.
#endif // UNITY_WSA

        #region IMixedRealityCapabilityCheck Implementation

        /// <inheritdoc />
        public bool CheckCapability(MixedRealityCapability capability)
        {
#if UNITY_WSA
            if (typeof(EyesPose).GetMethod("IsSupported") != null)
            {
                return((capability == MixedRealityCapability.EyeTracking) && EyesPose.IsSupported());
            }
#endif // UNITY_WSA

            return(false);
        }
Beispiel #6
0
        /// <summary>
        /// Check whether the Windows Eyes API is available
        /// </summary>
        private void CheckIfEyesApiAvailable()
        {
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
            // Make sure EyeTracking is available on the device
            EyesApiAvailable = WindowsApiChecker.IsPropertyAvailable(
                "Windows.UI.Input.Spatial",
                "SpatialPointerPose",
                "Eyes");

            // If yes, ask for permission to use it
            if (EyesApiAvailable)
            {
                EyesApiAvailable &= EyesPose.IsSupported();
            }
#endif
        }
Beispiel #7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputSystem">The <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem"/> instance that receives data from this provider.</param>
        /// <param name="name">Friendly name of the service.</param>
        /// <param name="priority">Service priority. Used to determine order of instantiation.</param>
        /// <param name="profile">The service's configuration profile.</param>
        public WindowsMixedRealityEyeGazeDataProvider(
            IMixedRealityInputSystem inputSystem,
            string name,
            uint priority,
            BaseMixedRealityProfile profile) : base(inputSystem, name, priority, profile)
        {
            eyesApiAvailable = WindowsApiChecker.IsPropertyAvailable(
                "Windows.UI.Input.Spatial",
                "SpatialPointerPose",
                "Eyes");

#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
            if (eyesApiAvailable)
            {
                eyesApiAvailable &= EyesPose.IsSupported();
            }
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
        }