Commit a9b4d7a1 authored by David Kline's avatar David Kline
Browse files

fix for issue 181 and updating the connection

parent 7f707bc6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ namespace SampleWdpClient.UniversalWindows
                        // remainder of this session.
                        if (allowUntrusted)
                        {
                            await portal.GetRootDeviceCertificate(true);
                            this.certificate = await portal.GetRootDeviceCertificate(true);
                        }
                        await portal.Connect(manualCertificate: this.certificate);
                    }
+7 −3
Original line number Diff line number Diff line
@@ -87,9 +87,13 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
        /// <summary>
        ///  The Mock will never update the connection.
        /// </summary>
        /// <param name="ipConfig">IP info</param>
        /// <param name="requiresHttps">https required</param>
        public void UpdateConnection(IpConfiguration ipConfig, bool requiresHttps)
        /// <param name="ipConfig">Object that describes the current network configuration.</param>
        /// <param name="requiresHttps">True if an https connection is required, false otherwise.</param>
        /// <param name="preservePort">True if the previous connection's port is to continue to be used, false otherwise.</param>
        public void UpdateConnection(
            IpConfiguration ipConfig, 
            bool requiresHttps,
            bool preservePort)
        {
            throw new NotImplementedException();
        }
+15 −1
Original line number Diff line number Diff line
@@ -256,7 +256,21 @@ namespace Microsoft.Tools.WindowsDevicePortal
                        DeviceConnectionStatus.Connecting,
                        DeviceConnectionPhase.UpdatingDeviceAddress,
                        connectionPhaseDescription);
                    this.deviceConnection.UpdateConnection(await this.GetIpConfig(), requiresHttps);
                    
                    bool preservePort = true;
                    // HoloLens and Mobile are the only devices that support USB.
                    // They require the port to be changed when the connection is updated
                    // to WiFi.
                    if ((this.Platform == DevicePortalPlatforms.HoloLens) ||
                        (this.Platform == DevicePortalPlatforms.Mobile))
                    {
                        preservePort = false;
                    }

                    this.deviceConnection.UpdateConnection(
                        await this.GetIpConfig(), 
                        requiresHttps,
                        preservePort);
                }

                this.SendConnectionStatus(
+129 −13
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <summary>
        /// API for getting a high resolution live Holographic Mixed Reality Capture stream.
        /// </summary>
        public static readonly string MrcLiveStreamHighwResApi = "api/holographic/stream/live_high.mp4";
        public static readonly string MrcLiveStreamHighResApi = "api/holographic/stream/live_high.mp4";

        /// <summary>
        /// API for getting a low resolution live Holographic Mixed Reality Capture stream.
@@ -81,8 +81,8 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// Removes a Mixed Reality Capture file from the device's local storage.
        /// </summary>
        /// <param name="fileName">The name of the file to be deleted.</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 devices.</remarks>
        public async Task DeleteMrcFile(string fileName)
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -95,11 +95,95 @@ namespace Microsoft.Tools.WindowsDevicePortal
                string.Format("filename={0}", Utilities.Hex64Encode(fileName)));
        }

        /// <summary>
        /// Retrieve the Uri for the high resolution Mixed Reality Capture live stream.
        /// </summary>
        /// <param name="includeHolograms">Specifies whether or not to include holograms</param>
        /// <param name="includeColorCamera">Specifies whether or not to include the color camera</param>
        /// <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>
        public Uri GetHighResolutionMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
            bool includeMicrophone = true,
            bool includeAudio = true)
        {
            string payload = string.Format(
                "holo={0}&pv={1}&mic={2}&loopback={3}",
                includeHolograms,
                includeColorCamera,
                includeMicrophone,
                includeAudio).ToLower();

            return Utilities.BuildEndpoint(
                this.deviceConnection.Connection,
                MrcLiveStreamHighResApi,
                payload);
        }

        /// <summary>
        /// Retrieve the Uri for the low resolution Mixed Reality Capture live stream.
        /// </summary>
        /// <param name="includeHolograms">Specifies whether or not to include holograms</param>
        /// <param name="includeColorCamera">Specifies whether or not to include the color camera</param>
        /// <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>
        public Uri GetLowResolutionMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
            bool includeMicrophone = true,
            bool includeAudio = true)
        {
            string payload = string.Format(
                "holo={0}&pv={1}&mic={2}&loopback={3}",
                includeHolograms,
                includeColorCamera,
                includeMicrophone,
                includeAudio).ToLower();

            return Utilities.BuildEndpoint(
                this.deviceConnection.Connection,
                MrcLiveStreamLowResApi,
                payload);
        }

        /// <summary>
        /// Retrieve the Uri for the medium resolution Mixed Reality Capture live stream.
        /// </summary>
        /// <param name="includeHolograms">Specifies whether or not to include holograms</param>
        /// <param name="includeColorCamera">Specifies whether or not to include the color camera</param>
        /// <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>
        public Uri GetMediumResolutionMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
            bool includeMicrophone = true,
            bool includeAudio = true)
        {
            string payload = string.Format(
                "holo={0}&pv={1}&mic={2}&loopback={3}",
                includeHolograms,
                includeColorCamera,
                includeMicrophone,
                includeAudio).ToLower();

            return Utilities.BuildEndpoint(
                this.deviceConnection.Connection,
                MrcLiveStreamMediumResApi,
                payload);
        }

        /// <summary>
        /// Gets the capture file data
        /// </summary>
        /// <param name="fileName">Name of the file to retrieve</param>
        /// <param name="isThumbnailRequest">Whether or not we just want a thumbnail</param>
        /// <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>
        public async Task<byte[]> GetMrcFileData(
@@ -154,6 +238,36 @@ namespace Microsoft.Tools.WindowsDevicePortal
            return mrcFileList;
        }

        /// <summary>
        /// Retrieve the Uri for the Mixed Reality Capture live stream using the default resolution.
        /// </summary>
        /// <param name="includeHolograms">Specifies whether or not to include holograms</param>
        /// <param name="includeColorCamera">Specifies whether or not to include the color camera</param>
        /// <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>
        public Uri GetMrcLiveStreamUri(
            bool includeHolograms = true,
            bool includeColorCamera = true,
            bool includeMicrophone = true,
            bool includeAudio = true)
        {
            string payload = string.Format(
                "holo={0}&pv={1}&mic={2}&loopback={3}",
                includeHolograms,
                includeColorCamera,
                includeMicrophone,
                includeAudio).ToLower();

            return Utilities.BuildEndpoint(
                this.deviceConnection.Connection,
                MrcLiveStreamApi,
                payload);
        }

        // TODO: GetMrcSettings()

        /// <summary>
        /// Gets the status of the reality capture
        /// </summary>
@@ -181,15 +295,17 @@ namespace Microsoft.Tools.WindowsDevicePortal
            return await this.GetMrcFileData(fileName, true);
        }

        // TODO: SetMrcSettings()

        /// <summary>
        /// Starts a Mixed Reality Capture recording.
        /// </summary>
        /// <param name="includeHolograms">Whether to include holograms</param>
        /// <param name="includeColorCamera">Whether to include the color camera</param>
        /// <param name="includeMicrophone">Whether to include microphone data</param>
        /// <param name="includeAudio">Whether to include audio data</param>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <param name="includeHolograms">Specifies whether or not to include holograms</param>
        /// <param name="includeColorCamera">Specifies whether or not to include the color camera</param>
        /// <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>
        public async Task StartMrcRecording(
            bool includeHolograms = true,
            bool includeColorCamera = true,
@@ -216,8 +332,8 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <summary>
        /// Stops the Mixed Reality Capture recording
        /// </summary>
        /// <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 devices.</remarks>
        public async Task StopMrcRecording()
        {
            if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -231,10 +347,10 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// <summary>
        /// Take a Mixed Reality Capture photo
        /// </summary>
        /// <param name="includeHolograms">Whether to include holograms</param>
        /// <param name="includeColorCamera">Whether to include the color camera</param>
        /// <remarks>This method is only supported on HoloLens devices.</remarks>
        /// <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>
        public async Task TakeMrcPhoto(
            bool includeHolograms = true,
            bool includeColorCamera = true)
+3 −1
Original line number Diff line number Diff line
@@ -55,8 +55,10 @@ namespace Microsoft.Tools.WindowsDevicePortal
        /// </summary>
        /// <param name="ipConfig">Object that describes the current network configuration.</param>
        /// <param name="requiresHttps">True if an https connection is required, false otherwise.</param>
        /// <param name="preservePort">True if the previous connection's port is to continue to be used, false otherwise.</param>
        void UpdateConnection(
            IpConfiguration ipConfig,
            bool requiresHttps);
            bool requiresHttps,
            bool preservePort);
    }
}
Loading