Commit cd2a7b91 authored by David Kline's avatar David Kline Committed by GitHub
Browse files

Merge pull request #147 from davidkline-ms/master

add recognition of HoloLens emulator
parents 88e57a11 19735dbd
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -80,6 +80,11 @@ namespace Microsoft.Tools.WindowsDevicePortal
            /// Windows IoT on Raspberry Pi 3
            /// </summary>
            IoTRaspberryPi3,

            /// <summary>
            /// A virtual machine. This may or may not be an emulator.
            /// </summary>
            VirtualMachine
        }

        /// <summary>
@@ -229,14 +234,17 @@ namespace Microsoft.Tools.WindowsDevicePortal
                                platform = DevicePortalPlatforms.IoTRaspberryPi3;
                                break;

                            case "Virtual Machine":
                                platform = DevicePortalPlatforms.VirtualMachine;
                                break;

                            default:
                                platform = (DevicePortalPlatforms)Enum.Parse(typeof(DevicePortalPlatforms), this.PlatformName);
                                break;
                        }
                    }
                    catch
                    {
                    }
                    { }

                    return platform;
                }
+4 −5
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
//----------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Threading.Tasks;

@@ -37,7 +36,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task<float> GetInterPupilaryDistance()
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -54,7 +53,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task SetIsHttpsRequired(bool httpsRequired)
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -74,7 +73,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task SetInterPupilaryDistance(float ipd)
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -93,7 +92,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task<bool> GetIsHttpsRequired()
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
+64 −0
Original line number Diff line number Diff line
@@ -4,6 +4,10 @@
// </copyright>
//----------------------------------------------------------------------------------------------

using System;
using System.Runtime.Serialization;
using System.Threading.Tasks;

namespace Microsoft.Tools.WindowsDevicePortal
{
    /// <content>
@@ -20,5 +24,65 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// API for controlling the Holographic Perception Simulation control stream.
        /// </summary>
        public static readonly string HolographicSimulationStreamApi = "api/holographic/simulation/control/Stream";

        /// <summary>
        /// Gets the perception simulation control mode.
        /// </summary>
        /// <returns>The simulation control mode.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task<SimulationControlMode> GetPerceptionSimulationControlMode()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            PerceptionSimulationControlMode controlMode = await this.Get<PerceptionSimulationControlMode>(HolographicSimulationModeApi);
            return controlMode.Mode;
        }

        /// <summary>
        /// Sets the perception simulation control mode.
        /// </summary>
        /// <param name="mode">The simulation control mode.</param>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task SetPerceptionSimulationControlMode(SimulationControlMode mode)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            string payload = string.Format(
                "mode={0}",
                (int)mode);
            await this.Post(HolographicSimulationModeApi, payload);
        }

        #region Data contract
        /// <summary>
        /// Enumeration defining the control modes used by the Holographic Perception Simulation.
        /// </summary>
        public enum SimulationControlMode
        {
            Default = 0,
            Simulation,
            Remote,
            Legacy
        }

        /// <summary>
        /// Object representation of Perception Simulation control mode.
        /// </summary>
        [DataContract]
        public class PerceptionSimulationControlMode
        {
            /// <summary>
            /// Gets or sets the control mode.
            /// </summary>
            [DataMember(Name = "mode")]
            public SimulationControlMode Mode { get; set; }
        }
        #endregion // Data contract
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        public async Task<ThermalStages> GetThermalStage()
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
+7 −7
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <returns>Task tracking the deletion request</returns>
        public async Task DeleteMrcFile(string fileName)
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -99,7 +99,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
            string fileName,
            bool isThumbnailRequest = false)
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -125,7 +125,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <returns>List of the capture files</returns>
        public async Task<MrcFileList> GetMrcFileList()
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -152,7 +152,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <returns>Status of the capture</returns>
        public async Task<MrcStatus> GetMrcStatus()
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -185,7 +185,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
            bool includeMicrophone = true,
            bool includeAudio = true)
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -208,7 +208,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <returns>Task tracking the stop request</returns>
        public async Task StopMrcRecording()
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
@@ -226,7 +226,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
            bool includeHolograms = true,
            bool includeColorCamera = true)
        {
            if (this.Platform != DevicePortalPlatforms.HoloLens)
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }
Loading