Loading WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/HoloLens/PerceptionSimulationPlayback.cs +178 −9 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ //---------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; Loading Loading @@ -43,9 +44,9 @@ namespace Microsoft.Tools.WindowsDevicePortal public static readonly string HolographicSimulationPlaybackPlayApi = "api/holographic/simulation/playback/session/play"; /// <summary> /// API for loading or unloading a Holographic Perception Simulation recording. /// API for getting the list of loaded Holographic Perception Simulation files. /// </summary> public static readonly string HolographicSimulationPlaybackRecordingsApi = "api/holographic/simulation/playback/session/files"; public static readonly string HolographicSimulationPlaybackSessionFilesApi = "api/holographic/simulation/playback/session/files"; /// <summary> /// API for retrieving the playback state of a Holographic Perception Simulation recording. Loading Loading @@ -113,6 +114,58 @@ namespace Microsoft.Tools.WindowsDevicePortal await this.DeleteAsync(HolographicSimulationPlaybackFileApi, payload); } /// <summary> /// 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> public async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackFilesAsync() { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } return await this.GetHolographicSimulationPlaybackFilesPrivateAsync(false); } /// <summary> /// 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> public async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackSessionFilesAsync() { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } return await this.GetHolographicSimulationPlaybackFilesPrivateAsync(true); } /// <summary> /// Gets the types of data that are in a loaded Holographic Perception Simulation file. /// </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> public async Task<HolographicSimulationDataTypes> GetHolographicSimulationPlaybackSessionDataTypesAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); return await this.GetAsync<HolographicSimulationDataTypes>( HolographicSimulationPlaybackDataTypesApi, payload); } /// <summary> /// Gets the playback state of a Holographic Simulation recording. /// </summary> Loading Loading @@ -166,10 +219,10 @@ namespace Microsoft.Tools.WindowsDevicePortal /// <summary> /// Loads the specified Holographic Simulation recording. /// </summary> /// <param name="name">The name of the recording to load (ex: testsession.xef).</param> /// <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> public async Task LoadHolographicSimulationRecordingAsync(string name) public async Task LoadHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { Loading @@ -178,18 +231,78 @@ namespace Microsoft.Tools.WindowsDevicePortal string payload = string.Format( "recording={0}", name); recordingName); await this.PostAsync(HolographicSimulationPlaybackSessionFileApi, payload); } /// <summary> /// Pauses playback of a Holographic Perception Simulation recording /// </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> public async Task PauseHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); await this.PostAsync(HolographicSimulationPlaybackPauseApi, payload); } /// <summary> /// Starts playback of a Holographic Perception Simulation recording /// </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> public async Task PlayHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); await this.PostAsync(HolographicSimulationPlaybackPlayApi, payload); } /// <summary> /// Stops playback of a Holographic Perception Simulation recording /// </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> public async Task StopHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); await this.PostAsync(HolographicSimulationPlaybackStopApi, payload); } /// <summary> /// Unloads the specified Holographic Simulation recording. /// </summary> /// <param name="name">The name of the recording to unload (ex: testsession.xef).</param> /// <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> public async Task UnloadHolographicSimulationRecordingAsync(string name) public async Task UnloadHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { Loading @@ -198,14 +311,70 @@ namespace Microsoft.Tools.WindowsDevicePortal string payload = string.Format( "recording={0}", name); recordingName); await this.DeleteAsync(HolographicSimulationPlaybackSessionFileApi, payload); } /// <summary> /// Gets the collection of Holographic Perception Simulation files /// </summary> /// <param name="session">Value indicating whether or not to return loaded files.</param> /// <returns>Collection of Holographic Perception simulation file names</returns> private async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackFilesPrivateAsync(bool session) { string apiPath = session ? HolographicSimulationPlaybackSessionFilesApi : HolographicSimulationPlaybackFilesApi; return await this.GetAsync<HolographicSimulationPlaybackFiles>(apiPath); } #region Data contract /// <summary> /// Object representation of the Holographic Simulation playback state /// Object representing the data types in a Holographic Perception Simulation file /// </summary> [DataContract] public class HolographicSimulationDataTypes { /// <summary> /// Gets a value indicating whether or not the file contains hand data. /// </summary> [DataMember(Name = "hands")] public bool IncludesHands { get; private set; } /// <summary> /// Gets a value indicating whether or not the file contains head data. /// </summary> [DataMember(Name = "head")] public bool IncludesHead { get; private set; } /// <summary> /// Gets a value indicating whether or not the file contains environmentatl data. /// </summary> [DataMember(Name = "environment")] public bool IncludesEnvironment { get; private set; } /// <summary> /// Gets a value indicating whether or not the file contains spatial mapping data. /// </summary> [DataMember(Name = "spatialMapping")] public bool IncludesSpatialMapping { get; private set; } } /// <summary> /// Object representation of the Holographic Perception Simulation files collection /// </summary> [DataContract] public class HolographicSimulationPlaybackFiles { /// <summary> /// Gets the list of recording file names. /// </summary> [DataMember(Name = "recordings")] public List<string> Files { get; private set; } } /// <summary> /// Object representation of the Holographic Perception Simulation playback state /// </summary> [DataContract] public class HolographicSimulationPlaybackSessionState Loading Loading
WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/HoloLens/PerceptionSimulationPlayback.cs +178 −9 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ //---------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; Loading Loading @@ -43,9 +44,9 @@ namespace Microsoft.Tools.WindowsDevicePortal public static readonly string HolographicSimulationPlaybackPlayApi = "api/holographic/simulation/playback/session/play"; /// <summary> /// API for loading or unloading a Holographic Perception Simulation recording. /// API for getting the list of loaded Holographic Perception Simulation files. /// </summary> public static readonly string HolographicSimulationPlaybackRecordingsApi = "api/holographic/simulation/playback/session/files"; public static readonly string HolographicSimulationPlaybackSessionFilesApi = "api/holographic/simulation/playback/session/files"; /// <summary> /// API for retrieving the playback state of a Holographic Perception Simulation recording. Loading Loading @@ -113,6 +114,58 @@ namespace Microsoft.Tools.WindowsDevicePortal await this.DeleteAsync(HolographicSimulationPlaybackFileApi, payload); } /// <summary> /// 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> public async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackFilesAsync() { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } return await this.GetHolographicSimulationPlaybackFilesPrivateAsync(false); } /// <summary> /// 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> public async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackSessionFilesAsync() { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } return await this.GetHolographicSimulationPlaybackFilesPrivateAsync(true); } /// <summary> /// Gets the types of data that are in a loaded Holographic Perception Simulation file. /// </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> public async Task<HolographicSimulationDataTypes> GetHolographicSimulationPlaybackSessionDataTypesAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); return await this.GetAsync<HolographicSimulationDataTypes>( HolographicSimulationPlaybackDataTypesApi, payload); } /// <summary> /// Gets the playback state of a Holographic Simulation recording. /// </summary> Loading Loading @@ -166,10 +219,10 @@ namespace Microsoft.Tools.WindowsDevicePortal /// <summary> /// Loads the specified Holographic Simulation recording. /// </summary> /// <param name="name">The name of the recording to load (ex: testsession.xef).</param> /// <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> public async Task LoadHolographicSimulationRecordingAsync(string name) public async Task LoadHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { Loading @@ -178,18 +231,78 @@ namespace Microsoft.Tools.WindowsDevicePortal string payload = string.Format( "recording={0}", name); recordingName); await this.PostAsync(HolographicSimulationPlaybackSessionFileApi, payload); } /// <summary> /// Pauses playback of a Holographic Perception Simulation recording /// </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> public async Task PauseHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); await this.PostAsync(HolographicSimulationPlaybackPauseApi, payload); } /// <summary> /// Starts playback of a Holographic Perception Simulation recording /// </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> public async Task PlayHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); await this.PostAsync(HolographicSimulationPlaybackPlayApi, payload); } /// <summary> /// Stops playback of a Holographic Perception Simulation recording /// </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> public async Task StopHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { throw new NotSupportedException("This method is only supported on HoloLens."); } string payload = string.Format( "recording={0}", recordingName); await this.PostAsync(HolographicSimulationPlaybackStopApi, payload); } /// <summary> /// Unloads the specified Holographic Simulation recording. /// </summary> /// <param name="name">The name of the recording to unload (ex: testsession.xef).</param> /// <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> public async Task UnloadHolographicSimulationRecordingAsync(string name) public async Task UnloadHolographicSimulationRecordingAsync(string recordingName) { if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily)) { Loading @@ -198,14 +311,70 @@ namespace Microsoft.Tools.WindowsDevicePortal string payload = string.Format( "recording={0}", name); recordingName); await this.DeleteAsync(HolographicSimulationPlaybackSessionFileApi, payload); } /// <summary> /// Gets the collection of Holographic Perception Simulation files /// </summary> /// <param name="session">Value indicating whether or not to return loaded files.</param> /// <returns>Collection of Holographic Perception simulation file names</returns> private async Task<HolographicSimulationPlaybackFiles> GetHolographicSimulationPlaybackFilesPrivateAsync(bool session) { string apiPath = session ? HolographicSimulationPlaybackSessionFilesApi : HolographicSimulationPlaybackFilesApi; return await this.GetAsync<HolographicSimulationPlaybackFiles>(apiPath); } #region Data contract /// <summary> /// Object representation of the Holographic Simulation playback state /// Object representing the data types in a Holographic Perception Simulation file /// </summary> [DataContract] public class HolographicSimulationDataTypes { /// <summary> /// Gets a value indicating whether or not the file contains hand data. /// </summary> [DataMember(Name = "hands")] public bool IncludesHands { get; private set; } /// <summary> /// Gets a value indicating whether or not the file contains head data. /// </summary> [DataMember(Name = "head")] public bool IncludesHead { get; private set; } /// <summary> /// Gets a value indicating whether or not the file contains environmentatl data. /// </summary> [DataMember(Name = "environment")] public bool IncludesEnvironment { get; private set; } /// <summary> /// Gets a value indicating whether or not the file contains spatial mapping data. /// </summary> [DataMember(Name = "spatialMapping")] public bool IncludesSpatialMapping { get; private set; } } /// <summary> /// Object representation of the Holographic Perception Simulation files collection /// </summary> [DataContract] public class HolographicSimulationPlaybackFiles { /// <summary> /// Gets the list of recording file names. /// </summary> [DataMember(Name = "recordings")] public List<string> Files { get; private set; } } /// <summary> /// Object representation of the Holographic Perception Simulation playback state /// </summary> [DataContract] public class HolographicSimulationPlaybackSessionState Loading