Commit 0f7f95c8 authored by Hirsch Singhal's avatar Hirsch Singhal Committed by GitHub
Browse files

v9.2 release (#204)

* DeviceLab sample

* fix GetMrcFileDataAsync
* completes implementation of the mixed reality capture api (issue 71)
* complete implementation of Holographic Perception Simulation Playback API
* implement holographic services API
* increase wrapper version to 0.9.2
* Fix failing MRC test
parent a01ada09
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests

            // Check some known things about this response.
            MrcProcessStatus processStatus = getTask.Result.Status;
            Assert.AreEqual("Running", processStatus.MrcProcess);
            Assert.AreEqual(ProcessStatus.Running, processStatus.MrcProcess);
        }

        /// <summary>
+138 −9
Original line number Diff line number Diff line
@@ -29,11 +29,42 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        public static readonly string HolographicWebManagementHttpSettingsApi = "api/holographic/os/webmanagement/settings/https";

        /// <summary>
        /// Enumeration describing the status of a process
        /// </summary>
        public enum ProcessStatus
        {
            /// <summary>
            /// The process is running
            /// </summary>
            Running = 0,
            
            /// <summary>
            /// The process is stopped
            /// </summary>
            Stopped
        }

        /// <summary>
        /// Gets the status of the Holographic Services on this HoloLens.
        /// </summary>
        /// <returns>HolographicServices object describing the state of the Holographic services.</returns>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<HolographicServices> GetHolographicServiceState()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            return await this.GetAsync<HolographicServices>(HolographicServicesApi);
        }

        /// <summary>
        /// Gets the interpupilary distance registered on the device.
        /// </summary>
        /// <returns>Interpupilary distance, in millimeters.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<float> GetInterPupilaryDistanceAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -50,7 +81,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="httpsRequired">Desired value for HTTPS communication</param>
        /// <returns>True if WiFi based communication requires a secure connection, false otherwise.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task SetIsHttpsRequiredAsync(bool httpsRequired)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -70,7 +101,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="ipd">Interpupilary distance, in millimeters.</param>
        /// <returns>Task for tracking the POST call</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task SetInterPupilaryDistanceAsync(float ipd)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -89,7 +120,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the WiFi http security requirements for communication with the device.
        /// </summary>
        /// <returns>True if WiFi based communication requires a secure connection, false otherwise.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<bool> GetIsHttpsRequiredAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -103,16 +134,59 @@ namespace Microsoft.Tools.WindowsDevicePortal

        #region Data contract
        /// <summary>
        /// Object representation for HTTP settings
        /// Object reporesentation of the status of the Holographic services
        /// </summary>
        [DataContract]
        public class WebManagementHttpSettings
        public class HolographicServices
        {
            /// <summary>
            /// Gets a value indicating whether HTTPS is required
            /// Gets the status for the collection of holographic services
            /// </summary>
            [DataMember(Name = "httpsRequired")]
            public bool IsHttpsRequired { get; private set; }
            [DataMember(Name = "SoftwareStatus")]
            public HolographicSoftwareStatus Status { get; private set; }
        }

        /// <summary>
        /// Object representation of the collection of holographic services.
        /// </summary>
        [DataContract]
        public class HolographicSoftwareStatus
        {
            /// <summary>
            /// Gets the status of dwm.exe
            /// </summary>
            [DataMember(Name = "dwm.exe")]
            public ServiceStatus Dwm { get; private set; }

            /// <summary>
            /// Gets the status of holoshellapp.exe
            /// </summary>
            [DataMember(Name = "holoshellapp.exe")]
            public ServiceStatus HoloShellApp { get; private set; }

            /// <summary>
            /// Gets the status of holosi.exe
            /// </summary>
            [DataMember(Name = "holosi.exe")]
            public ServiceStatus HoloSi { get; private set; }

            /// <summary>
            /// Gets the status of mixedrealitycapture.exe
            /// </summary>
            [DataMember(Name = "mixedrealitycapture.exe")]
            public ServiceStatus MixedRealitytCapture { get; private set; }

            /// <summary>
            /// Gets the status of sihost.exe
            /// </summary>
            [DataMember(Name = "sihost.exe")]
            public ServiceStatus SiHost { get; private set; }

            /// <summary>
            /// Gets the status of spectrum.exe
            /// </summary>
            [DataMember(Name = "spectrum.exe")]
            public ServiceStatus Spectrum { get; private set; }
        }

        /// <summary>
@@ -136,6 +210,61 @@ namespace Microsoft.Tools.WindowsDevicePortal
                set { this.IpdRaw = (int)(value * 1000); }
            }
        }

        /// <summary>
        /// Object representation of the status of a  service
        /// </summary>
        [DataContract]
        public class ServiceStatus
        {
            /// <summary>
            /// Gets the raw value returned for the expected service status
            /// </summary>
            [DataMember(Name = "Expected")]
            public string ExpectedRaw { get; private set; }

            /// <summary>
            /// Gets the raw value returned for the observed service status
            /// </summary>
            [DataMember(Name = "Observed")]
            public string ObservedRaw { get; private set; }

            /// <summary>
            /// Gets the the expected service status
            /// </summary>
            public ProcessStatus Expected
            {
                get
                {
                    return (this.ExpectedRaw == "Running") ? ProcessStatus.Running : ProcessStatus.Stopped;
                }
            }

            /// <summary>
            /// Gets the the observed service status
            /// </summary>
            public ProcessStatus Observed
            {
                get
                {
                    return (this.ObservedRaw == "Running") ? ProcessStatus.Running : ProcessStatus.Stopped;
                }
            }
        }

        /// <summary>
        /// Object representation for HTTP settings
        /// </summary>
        [DataContract]
        public class WebManagementHttpSettings
        {
            /// <summary>
            /// Gets a value indicating whether HTTPS is required
            /// </summary>
            [DataMember(Name = "httpsRequired")]
            public bool IsHttpsRequired { get; private set; }
        }

        #endregion // Data contract
    }
}
+94 −8
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <summary>
        /// API for controlling the Holographic Perception Simulation control stream.
        /// </summary>
        public static readonly string HolographicSimulationStreamApi = "api/holographic/simulation/control/Stream";
        public static readonly string HolographicSimulationStreamApi = "api/holographic/simulation/control/stream";

        /// <summary>
        /// Enumeration defining the control modes used by the Holographic Perception Simulation.
@@ -43,24 +43,86 @@ namespace Microsoft.Tools.WindowsDevicePortal
            /// <summary>
            /// Simulation mode.
            /// </summary>
            Simulation,
            Simulation
        }

        /// <summary>
            /// Remote mode.
        /// Enumeration defining the priority levels for the Holographic Perception Simulation control stream.
        /// </summary>
        public enum SimulationControlStreamPriority
        {
            /// <summary>
            /// Low priority.
            /// </summary>
            Remote,
            Low = 0,

            /// <summary>
            /// Legacy mode.
            /// Normal priority.
            /// </summary>
            Legacy
            Normal
        }

        /// <summary>
        /// Creates a simulation control stream.
        /// </summary>
        /// <param name="priority">The control stream priority.</param>
        /// <returns>The identifier of the created stream.</returns>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<string> CreatePerceptionSimulationControlStreamAsync(SimulationControlStreamPriority priority)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            if (!(await VerifySimulationControlModeAsync(SimulationControlMode.Simulation)))
            {
                throw new InvalidOperationException("The simulation control mode on the target HoloLens must be 'Simulation'.");
            }

            string payload = string.Format(
                "priority={0}",
                (int)priority);

            PerceptionSimulationControlStreamId controlStreamId =  await this.GetAsync<PerceptionSimulationControlStreamId>(
                            HolographicSimulationStreamApi,
                            payload);

            return controlStreamId.StreamId;
        }

        /// <summary>
        /// Deletes a simulation control stream.
        /// </summary>
        /// <param name="streamId">The identifier of the stream to be deleted.</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task DeletePerceptionSimulationControlStreamAsync(string streamId)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            if (!(await VerifySimulationControlModeAsync(SimulationControlMode.Simulation)))
            {
                throw new InvalidOperationException("The simulation control mode on the target HoloLens must be 'Simulation'.");
            }

            string payload = string.Format(
                "streamId={0}",
                streamId);

            await this.DeleteAsync(
                HolographicSimulationStreamApi,
                payload);
        }

        /// <summary>
        /// Gets the perception simulation control mode.
        /// </summary>
        /// <returns>The simulation control mode.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<SimulationControlMode> GetPerceptionSimulationControlModeAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -76,8 +138,8 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// 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>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task SetPerceptionSimulationControlModeAsync(SimulationControlMode mode)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -91,6 +153,17 @@ namespace Microsoft.Tools.WindowsDevicePortal
            await this.PostAsync(HolographicSimulationModeApi, payload);
        }

        /// <summary>
        /// Compares the current simulation control mode with the expected mode.
        /// </summary>
        /// <param name="expectedMode">The simulation control mode that we expect the device to be in.</param>
        /// <returns>The simulation control mode.</returns>
        private async Task<bool> VerifySimulationControlModeAsync(SimulationControlMode expectedMode)
        {
            SimulationControlMode simMode = await this.GetPerceptionSimulationControlModeAsync();
            return (simMode == expectedMode);
        }

        #region Data contract
        /// <summary>
        /// Object representation of Perception Simulation control mode.
@@ -104,6 +177,19 @@ namespace Microsoft.Tools.WindowsDevicePortal
            [DataMember(Name = "mode")]
            public SimulationControlMode Mode { get; private set; }
        }

        /// <summary>
        /// Object representation of the response recevied when creating a Perception Simulation control stream.
        /// </summary>
        [DataContract]
        public class PerceptionSimulationControlStreamId
        {
            /// <summary>
            /// Gets the stream identifier.
            /// </summary>
            [DataMember(Name = "streamId")]
            public string StreamId { get; private set; }
        }
        #endregion // Data contract
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the current thermal stage reading from the device.
        /// </summary>
        /// <returns>ThermalStages enum value.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<ThermalStages> GetThermalStageAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
+291 −21

File changed.

Preview size limit exceeded, changes collapsed.

Loading