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

Merge pull request #203 from davidkline-ms/master

merging per approval (after taking pr feedback fix)
parents d44e7712 0dc303d8
Loading
Loading
Loading
Loading
+25 −17
Original line number Diff line number Diff line
@@ -43,17 +43,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
            /// <summary>
            /// Simulation mode.
            /// </summary>
            Simulation,

            /// <summary>
            /// Remote mode.
            /// </summary>
            Remote,

            /// <summary>
            /// Legacy mode.
            /// </summary>
            Legacy
            Simulation
        }

        /// <summary>
@@ -78,13 +68,18 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <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> CreatePerceptionSimulationControlStream(SimulationControlStreamPriority priority)
        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);
@@ -102,13 +97,18 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <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 DeletePerceptionSimulationControlStream(string streamId)
        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);
@@ -134,9 +134,6 @@ namespace Microsoft.Tools.WindowsDevicePortal
            return controlMode.Mode;
        }

        // TODO
        //public async Task GetPerceptionSimulationControlStream()

        /// <summary>
        /// Sets the perception simulation control mode.
        /// </summary>
@@ -156,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.
@@ -169,7 +177,6 @@ namespace Microsoft.Tools.WindowsDevicePortal
            [DataMember(Name = "mode")]
            public SimulationControlMode Mode { get; private set; }
        }
        #endregion // Data contract

        /// <summary>
        /// Object representation of the response recevied when creating a Perception Simulation control stream.
@@ -183,5 +190,6 @@ namespace Microsoft.Tools.WindowsDevicePortal
            [DataMember(Name = "streamId")]
            public string StreamId { get; private set; }
        }
        #endregion // Data contract
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -29,6 +29,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
[assembly: AssemblyVersion("0.9.2.0")]
[assembly: AssemblyFileVersion("0.9.2.0")]
[assembly: ComVisible(false)]
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -37,5 +37,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
[assembly: AssemblyVersion("0.9.2.0")]
[assembly: AssemblyFileVersion("0.9.2.0")]