Commit d44e7712 authored by David Kline's avatar David Kline Committed by Hirsch Singhal
Browse files

partial implementation of holographic perception (#202)

* partial implementation of holographic perception

* pr feedback change
parent f8e9bf95
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// 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 devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<HolographicServices> GetHolographicServiceState()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -64,7 +64,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// 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))
@@ -81,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))
@@ -101,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))
@@ -120,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))
+81 −3
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.
@@ -56,11 +56,73 @@ namespace Microsoft.Tools.WindowsDevicePortal
            Legacy
        }

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

            /// <summary>
            /// Normal priority.
            /// </summary>
            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> CreatePerceptionSimulationControlStream(SimulationControlStreamPriority priority)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            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 DeletePerceptionSimulationControlStream(string streamId)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
            {
                throw new NotSupportedException("This method is only supported on HoloLens.");
            }

            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))
@@ -72,12 +134,15 @@ namespace Microsoft.Tools.WindowsDevicePortal
            return controlMode.Mode;
        }

        // TODO
        //public async Task GetPerceptionSimulationControlStream()

        /// <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>
        /// <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))
@@ -105,5 +170,18 @@ namespace Microsoft.Tools.WindowsDevicePortal
            public SimulationControlMode Mode { get; private set; }
        }
        #endregion // Data contract

        /// <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; }
        }
    }
}
+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))
+15 −15
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="fileName">The name of the file to be deleted.</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task DeleteMrcFileAsync(string fileName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -103,7 +103,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="includeMicrophone">Specifies whether or not to include microphone data</param>
        /// <param name="includeAudio">Specifies whether or not to include audio data</param>
        /// <returns>Uri used to retreive the Mixed Reality Capture stream.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public Uri GetHighResolutionMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
@@ -131,7 +131,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="includeMicrophone">Specifies whether or not to include microphone data</param>
        /// <param name="includeAudio">Specifies whether or not to include audio data</param>
        /// <returns>Uri used to retreive the Mixed Reality Capture stream.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public Uri GetLowResolutionMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
@@ -159,7 +159,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="includeMicrophone">Specifies whether or not to include microphone data</param>
        /// <param name="includeAudio">Specifies whether or not to include audio data</param>
        /// <returns>Uri used to retreive the Mixed Reality Capture stream.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public Uri GetMediumResolutionMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
@@ -185,7 +185,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="fileName">Name of the file to retrieve.</param>
        /// <param name="isThumbnailRequest">Specifies whether or not we are requesting a thumbnail image.</param>
        /// <returns>Byte array containing the file data.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<byte[]> GetMrcFileDataAsync(
            string fileName,
            bool isThumbnailRequest = false)
@@ -218,7 +218,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the list of capture files
        /// </summary>
        /// <returns>List of the capture files</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<MrcFileList> GetMrcFileListAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -250,7 +250,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="includeMicrophone">Specifies whether or not to include microphone data</param>
        /// <param name="includeAudio">Specifies whether or not to include audio data</param>
        /// <returns>Uri used to retreive the Mixed Reality Capture stream.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public Uri GetMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
@@ -274,7 +274,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the current Mixed Reality Capture settings
        /// </summary>
        /// <returns>MrcSettings object containing the current settings</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<MrcSettings> GetMrcSettingsAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -289,7 +289,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the status of the reality capture
        /// </summary>
        /// <returns>Status of the capture</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<MrcStatus> GetMrcStatusAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -305,7 +305,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="fileName">Name of the capture file</param>
        /// <returns>Byte array containing the thumbnail image data</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<byte[]> GetMrcThumbnailDataAsync(string fileName)
        {
            // GetMrcFileData checks for the appropriate platform. We do not need to duplicate the check here.
@@ -315,9 +315,9 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <summary>
        /// Sets the default Mixed Reality Capture settings
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="settings">Mixed Reality Capture settings to be used as the default.</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task SetMrcSettingsAsync(MrcSettings settings)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -346,7 +346,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="includeMicrophone">Specifies whether or not to include microphone data</param>
        /// <param name="includeAudio">Specifies whether or not to include audio data</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task StartMrcRecordingAsync(
            bool includeHolograms = true,
            bool includeColorCamera = true,
@@ -374,7 +374,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Stops the Mixed Reality Capture recording
        /// </summary>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task StopMrcRecordingAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -391,7 +391,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <param name="includeHolograms">Specifies whether or not to include holograms</param>
        /// <param name="includeColorCamera">Specifies whether or not to include the color camera</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task TakeMrcPhotoAsync(
            bool includeHolograms = true,
            bool includeColorCamera = true)
+10 −10
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="name">The name of the recording to delete (ex: testsession.xef).</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task DeleteHolographicSimulationRecordingAsync(string name)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -118,7 +118,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the collection of Holographic Perception Simulation files on this HoloLens.
        /// </summary>
        /// <returns>HolographicSimulationPlaybackFiles object representing the files on the HoloLens</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackFilesAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -133,7 +133,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Gets the collection of loaded Holographic Perception Simulation files on this HoloLens.
        /// </summary>
        /// <returns>HolographicSimulationPlaybackFiles object representing the files loaded on the HoloLens</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackSessionFilesAsync()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -149,7 +149,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="recordingName">Name of the recording file, with extension.</param>
        /// <returns>HolographicSimulationDataTypes object representing they types of data in the file</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<HolographicSimulationDataTypes> GetHolographicSimulationPlaybackSessionDataTypesAsync(string recordingName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -171,7 +171,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="name">The name of the recording (ex: testsession.xef).</param>
        /// <returns>HolographicSimulationPlaybackStates enum value describing the state of the recording.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task<HolographicSimulationPlaybackStates> GetHolographicSimulationPlaybackStateAsync(string name)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -221,7 +221,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="recordingName">The name of the recording to load (ex: testsession.xef).</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task LoadHolographicSimulationRecordingAsync(string recordingName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -241,7 +241,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="recordingName">The name of the recording to pause</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task PauseHolographicSimulationRecordingAsync(string recordingName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -261,7 +261,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="recordingName">The name of the recording to play</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task PlayHolographicSimulationRecordingAsync(string recordingName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -281,7 +281,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="recordingName">The name of the recording to stop</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task StopHolographicSimulationRecordingAsync(string recordingName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -301,7 +301,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="recordingName">The name of the recording to unload (ex: testsession.xef).</param>
        /// <returns>Task tracking completion of the REST call.</returns>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <remarks>This method is only supported on HoloLens.</remarks>
        public async Task UnloadHolographicSimulationRecordingAsync(string recordingName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
Loading