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

Merge pull request #201 from davidkline-ms/master

implement holographic services API

merging per approval by hpsin. this closes #88 and closes #127
parents 4c334adf 18f3b280
Loading
Loading
Loading
Loading
+134 −5
Original line number Diff line number Diff line
@@ -29,6 +29,37 @@ 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 devices.</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>
@@ -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
    }
}
+14 −3
Original line number Diff line number Diff line
@@ -478,16 +478,27 @@ namespace Microsoft.Tools.WindowsDevicePortal
        }

        /// <summary>
        /// Object representation of the recording process status
        /// Object representation of the Mixed Reality Capture process status
        /// </summary>
        [DataContract]
        public class MrcProcessStatus
        {
            /// <summary>
            /// Gets the process status
            /// Gets the raw data for the Mixed Reality Capture process status
            /// </summary>
            [DataMember(Name = "MrcProcess")]
            public string MrcProcess { get; private set; }  // TODO this should be an enum
            public string MrcProcessRaw { get; private set; }

            /// <summary>
            /// Gets the status of the Mixed Reality Capture process
            /// </summary>
            public ProcessStatus MrcProcess
            {
                get
                {
                    return (this.MrcProcessRaw == "Running") ? ProcessStatus.Running : ProcessStatus.Stopped;
                }
            }
        }

        /// <summary>