Loading WindowsDevicePortalWrapper/TestApp/DevicePortalConnection.cs +5 −6 Original line number Diff line number Diff line Loading @@ -127,13 +127,12 @@ namespace TestApp } /// <summary> /// Creates and sets the device certificate from the raw data. /// Validates and sets the device certificate. /// </summary> /// <param name="certificateData">Raw device certificate data.</param> public void SetDeviceCertificate(byte[] certificateData) /// <param name="certificate">The device's root certificate.</param> public void SetDeviceCertificate(X509Certificate2 certificate) { X509Certificate2 cert = new X509Certificate2(certificateData); if (!cert.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) if (!certificate.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) { throw new DevicePortalException( (HttpStatusCode)0, Loading @@ -142,7 +141,7 @@ namespace TestApp "Failed to download device certificate"); } this.deviceCertificate = cert; this.deviceCertificate = certificate; } /// <summary> Loading WindowsDevicePortalWrapper/TestAppHL/DevicePortalConnection.cs +5 −6 Original line number Diff line number Diff line Loading @@ -127,13 +127,12 @@ namespace TestApp } /// <summary> /// Creates and sets the device certificate from the raw data. /// Validates and sets the device certificate. /// </summary> /// <param name="certificateData">Raw device certificate data.</param> public void SetDeviceCertificate(byte[] certificateData) /// <param name="certificate">The device's root certificate.</param> public void SetDeviceCertificate(X509Certificate2 certificate) { X509Certificate2 cert = new X509Certificate2(certificateData); if (!cert.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) if (!certificate.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) { throw new DevicePortalException( (HttpStatusCode)0, Loading @@ -142,7 +141,7 @@ namespace TestApp "Failed to download device certificate"); } this.deviceCertificate = cert; this.deviceCertificate = certificate; } /// <summary> Loading WindowsDevicePortalWrapper/TestAppHL/Program.cs +19 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ //---------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.Tools.WindowsDevicePortal; Loading @@ -17,6 +18,11 @@ namespace TestApp /// </summary> internal class Program : IDisposable { /// <summary> /// Usage string /// </summary> private const string GeneralUsageMessage = "Usage: /ip:<system-ip or hostname> /user:<WDP username> /pwd:<WDP password> [/ssid:<network ssid> /key:<network key>]"; /// <summary> /// The IP address of the device. /// </summary> Loading Loading @@ -66,18 +72,25 @@ namespace TestApp } catch (Exception e) { // TODO: Make a usage display Console.WriteLine(e.Message); Console.WriteLine(); Console.WriteLine(GeneralUsageMessage); return; } DevicePortal portal = new DevicePortal(new DevicePortalConnection(app.ipAddress, app.userName, app.password)); DevicePortal portal = new DevicePortal( new DevicePortalConnection( app.ipAddress, app.userName, app.password)); portal.ConnectionStatus += app.ConnectionStatusHandler; portal.AppInstallStatus += app.AppInstallStatusHandler; app.mreConnected.Reset(); Console.WriteLine("Connecting..."); Task t = portal.Connect(app.ssid, app.key); Task t = portal.Connect( app.ssid, app.key); app.mreConnected.WaitOne(); Console.WriteLine("Connected to: " + portal.Address); Loading @@ -92,6 +105,9 @@ namespace TestApp getIpdTask.Wait(); Console.WriteLine("IPD: " + getIpdTask.Result.ToString()); Task setIpdTask = portal.SetInterPupilaryDistance(67.5f); setIpdTask.Wait(); Task<BatteryState> batteryTask = portal.GetBatteryState(); batteryTask.Wait(); Console.WriteLine("Battery level: " + batteryTask.Result.Level); Loading WindowsDevicePortalWrapper/TestAppIoT/DevicePortalConnection.cs +3 −3 Original line number Diff line number Diff line Loading @@ -121,10 +121,10 @@ namespace TestAppIoT } /// <summary> /// Creates and sets the device certificate from the raw data. /// Validates and sets the device certificate. /// </summary> /// <param name="certificateData">Raw device certificate data.</param> public void SetDeviceCertificate(byte[] certificateData) /// <param name="certificate">The device's root certificate.</param> public void SetDeviceCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { throw new NotSupportedException("The current version of TestAppIoT does not support device certificates"); } Loading WindowsDevicePortalWrapper/TestAppIoT/Properties/AssemblyInfo.cs +7 −1 Original line number Diff line number Diff line using System.Reflection; //---------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Microsoft Corporation"> // Licensed under the MIT License. See LICENSE.TXT in the project root license information. // </copyright> //---------------------------------------------------------------------------------------------- using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; Loading Loading
WindowsDevicePortalWrapper/TestApp/DevicePortalConnection.cs +5 −6 Original line number Diff line number Diff line Loading @@ -127,13 +127,12 @@ namespace TestApp } /// <summary> /// Creates and sets the device certificate from the raw data. /// Validates and sets the device certificate. /// </summary> /// <param name="certificateData">Raw device certificate data.</param> public void SetDeviceCertificate(byte[] certificateData) /// <param name="certificate">The device's root certificate.</param> public void SetDeviceCertificate(X509Certificate2 certificate) { X509Certificate2 cert = new X509Certificate2(certificateData); if (!cert.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) if (!certificate.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) { throw new DevicePortalException( (HttpStatusCode)0, Loading @@ -142,7 +141,7 @@ namespace TestApp "Failed to download device certificate"); } this.deviceCertificate = cert; this.deviceCertificate = certificate; } /// <summary> Loading
WindowsDevicePortalWrapper/TestAppHL/DevicePortalConnection.cs +5 −6 Original line number Diff line number Diff line Loading @@ -127,13 +127,12 @@ namespace TestApp } /// <summary> /// Creates and sets the device certificate from the raw data. /// Validates and sets the device certificate. /// </summary> /// <param name="certificateData">Raw device certificate data.</param> public void SetDeviceCertificate(byte[] certificateData) /// <param name="certificate">The device's root certificate.</param> public void SetDeviceCertificate(X509Certificate2 certificate) { X509Certificate2 cert = new X509Certificate2(certificateData); if (!cert.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) if (!certificate.IssuerName.Name.Contains(DevicePortalCertificateIssuer)) { throw new DevicePortalException( (HttpStatusCode)0, Loading @@ -142,7 +141,7 @@ namespace TestApp "Failed to download device certificate"); } this.deviceCertificate = cert; this.deviceCertificate = certificate; } /// <summary> Loading
WindowsDevicePortalWrapper/TestAppHL/Program.cs +19 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ //---------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.Tools.WindowsDevicePortal; Loading @@ -17,6 +18,11 @@ namespace TestApp /// </summary> internal class Program : IDisposable { /// <summary> /// Usage string /// </summary> private const string GeneralUsageMessage = "Usage: /ip:<system-ip or hostname> /user:<WDP username> /pwd:<WDP password> [/ssid:<network ssid> /key:<network key>]"; /// <summary> /// The IP address of the device. /// </summary> Loading Loading @@ -66,18 +72,25 @@ namespace TestApp } catch (Exception e) { // TODO: Make a usage display Console.WriteLine(e.Message); Console.WriteLine(); Console.WriteLine(GeneralUsageMessage); return; } DevicePortal portal = new DevicePortal(new DevicePortalConnection(app.ipAddress, app.userName, app.password)); DevicePortal portal = new DevicePortal( new DevicePortalConnection( app.ipAddress, app.userName, app.password)); portal.ConnectionStatus += app.ConnectionStatusHandler; portal.AppInstallStatus += app.AppInstallStatusHandler; app.mreConnected.Reset(); Console.WriteLine("Connecting..."); Task t = portal.Connect(app.ssid, app.key); Task t = portal.Connect( app.ssid, app.key); app.mreConnected.WaitOne(); Console.WriteLine("Connected to: " + portal.Address); Loading @@ -92,6 +105,9 @@ namespace TestApp getIpdTask.Wait(); Console.WriteLine("IPD: " + getIpdTask.Result.ToString()); Task setIpdTask = portal.SetInterPupilaryDistance(67.5f); setIpdTask.Wait(); Task<BatteryState> batteryTask = portal.GetBatteryState(); batteryTask.Wait(); Console.WriteLine("Battery level: " + batteryTask.Result.Level); Loading
WindowsDevicePortalWrapper/TestAppIoT/DevicePortalConnection.cs +3 −3 Original line number Diff line number Diff line Loading @@ -121,10 +121,10 @@ namespace TestAppIoT } /// <summary> /// Creates and sets the device certificate from the raw data. /// Validates and sets the device certificate. /// </summary> /// <param name="certificateData">Raw device certificate data.</param> public void SetDeviceCertificate(byte[] certificateData) /// <param name="certificate">The device's root certificate.</param> public void SetDeviceCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { throw new NotSupportedException("The current version of TestAppIoT does not support device certificates"); } Loading
WindowsDevicePortalWrapper/TestAppIoT/Properties/AssemblyInfo.cs +7 −1 Original line number Diff line number Diff line using System.Reflection; //---------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Microsoft Corporation"> // Licensed under the MIT License. See LICENSE.TXT in the project root license information. // </copyright> //---------------------------------------------------------------------------------------------- using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; Loading