Loading WindowsDevicePortalWrapper/UnitTestProject/Device-VersionTests/IoT/IoT_rs1_release.cs +38 −0 Original line number Diff line number Diff line Loading @@ -286,5 +286,43 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests Assert.AreEqual(false, installTime.IsScheduled); } [TestMethod] public void GetSoftAPSettings_IoT() { TestHelpers.MockHttpResponder.AddMockResponse( DevicePortal.SoftAPSettingsApi, this.PlatformType, this.FriendlyOperatingSystemVersion, HttpMethods.Get); Task<SoftAPSettingsInfo> getTask = TestHelpers.Portal.GetSoftAPSettingsInfo(); getTask.Wait(); Assert.AreEqual(TaskStatus.RanToCompletion, getTask.Status); SoftAPSettingsInfo SoftAPSettings = getTask.Result; // Check some known things about this response. Assert.AreEqual("true", SoftAPSettings.SoftAPEnabled); Assert.AreEqual("SoftAPSsid", SoftAPSettings.SoftApSsid); } [TestMethod] public void GetAllJoynSettings_IoT() { TestHelpers.MockHttpResponder.AddMockResponse( DevicePortal.AllJoynSettingsApi, this.PlatformType, this.FriendlyOperatingSystemVersion, HttpMethods.Get); Task<AllJoynSettingsInfo> getTask = TestHelpers.Portal.GetAllJoynSettingsInfo(); getTask.Wait(); Assert.AreEqual(TaskStatus.RanToCompletion, getTask.Status); AllJoynSettingsInfo AllJoynSettings = getTask.Result; // Check some known things about this response. Assert.AreEqual("IoTCore Onboarding service", AllJoynSettings.AllJoynOnboardingDefaultDescription); Assert.AreEqual("Microsoft", AllJoynSettings.AllJoynOnboardingDefaultManufacturer); } } } WindowsDevicePortalWrapper/UnitTestProject/MockData/IoT/rs1_release/api_iot_iotonboarding_alljoynsettings_IoTRaspberryPi3_rs1_release.dat 0 → 100644 +1 −0 Original line number Diff line number Diff line {"AllJoynOnboardingDefaultDescription" : "IoTCore Onboarding service", "AllJoynOnboardingDefaultManufacturer" : "Microsoft", "AllJoynOnboardingEnabled" : "true", "AllJoynOnboardingModelNumber" : "IoTCore Onboarding"} No newline at end of file WindowsDevicePortalWrapper/UnitTestProject/MockData/IoT/rs1_release/api_iot_iotonboarding_softapsettings_IoTRaspberryPi3_rs1_release.dat 0 → 100644 +1 −0 Original line number Diff line number Diff line {"SoftAPEnabled" : "true", "SoftApPassword" : "p@ssw0rd", "SoftApSsid" : "SoftAPSsid"} No newline at end of file WindowsDevicePortalWrapper/UnitTestProject/UnitTestProject.csproj +6 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,12 @@ <None Include="MockData\IoT\rs1_release\api_iot_device_timezones_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="MockData\IoT\rs1_release\api_iot_iotonboarding_alljoynsettings_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="MockData\IoT\rs1_release\api_iot_iotonboarding_softapsettings_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="MockData\IoT\rs1_release\api_iot_remote_status_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> Loading WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/IoT/DeviceInfo.cs +69 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ namespace Microsoft.Tools.WindowsDevicePortal public static readonly string DisplayResolutionApi = "api/iot/device/displayresolution"; public static readonly string DisplayOrientationApi = "api/iot/device/displayorientation"; public static readonly string DeviceNameApi = "api/iot/device/name"; public static readonly string ResetPasswordApi = "api/iot/device/password"; public static readonly string NewRemoteDebuggingPinApi = "api/iot/device/remotedebuggingpin"; public static readonly string SetTimeZoneApi = "api/iot/device/settimezone"; /// <summary> /// Gets the IoT OS Information. Loading Loading @@ -86,6 +89,65 @@ namespace Microsoft.Tools.WindowsDevicePortal await this.Post(DeviceNameApi, string.Format("newdevicename={0}", Utilities.Hex64Encode(name))); } /// <summary> /// Sets a new password. /// </summary> public async Task SetNewPassword(string oldPassword, string newPassword) { await this.Post( ResetPasswordApi, string.Format("oldpassword={0}&newpassword={1}", Utilities.Hex64Encode(oldPassword), Utilities.Hex64Encode(newPassword))); } /// <summary> /// Sets a new remote debugging pin. /// </summary> public async Task SetNewRemoteDebuggingPin(string newPin) { await this.Post( NewRemoteDebuggingPinApi, string.Format("newpin={0}", Utilities.Hex64Encode(newPin))); } /// <summary> /// Sets controllers drivers. /// </summary> public async Task SetControllersDrivers(string newDriver) { await this.Post( ControllerDriverApi, string.Format("newdriver={0}", Utilities.Hex64Encode(newDriver))); } /// <summary> /// Sets Timezone. /// </summary> public async Task SetTimeZone(int index) { await this.Post( SetTimeZoneApi, string.Format("index={0}", index)); } /// <summary> /// Sets display resolution. /// </summary> public async Task SetDisplayResolution(string displayResolution) { await this.Post( DisplayResolutionApi, string.Format("newdisplayresolution={0}", Utilities.Hex64Encode(displayResolution))); } /// <summary> /// Set display orientation. /// </summary> public async Task SetDisplayOrientation(string displayOrientation) { await this.Post( DisplayOrientationApi, string.Format("newdisplayorientation={0}", Utilities.Hex64Encode(displayOrientation))); } #region Data contract /// <summary> Loading Loading @@ -124,6 +186,7 @@ namespace Microsoft.Tools.WindowsDevicePortal /// </summary> [DataMember(Name = "Current")] public Timezone CurrentTimeZone; /// <summary> /// Gets the list of all timezones /// </summary> Loading Loading @@ -183,31 +246,31 @@ namespace Microsoft.Tools.WindowsDevicePortal public int day { get; set; } /// <summary> /// Gets the current hour information /// Gets the current hour /// </summary> [DataMember(Name = "Hour")] public int hour { get; set; } /// <summary> /// Gets the current minute information /// Gets the current minute /// </summary> [DataMember(Name = "Minute")] public int min { get; set; } /// <summary> /// Gets the current month information /// Gets the current month /// </summary> [DataMember(Name = "Month")] public int month { get; set; } /// <summary> /// Gets the current second information /// Gets the current second /// </summary> [DataMember(Name ="Second")] public int sec { get; set; } /// <summary> /// Gets the current year information /// Gets the current year /// </summary> [DataMember(Name = "Year")] public int year { get; set; } Loading Loading
WindowsDevicePortalWrapper/UnitTestProject/Device-VersionTests/IoT/IoT_rs1_release.cs +38 −0 Original line number Diff line number Diff line Loading @@ -286,5 +286,43 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests Assert.AreEqual(false, installTime.IsScheduled); } [TestMethod] public void GetSoftAPSettings_IoT() { TestHelpers.MockHttpResponder.AddMockResponse( DevicePortal.SoftAPSettingsApi, this.PlatformType, this.FriendlyOperatingSystemVersion, HttpMethods.Get); Task<SoftAPSettingsInfo> getTask = TestHelpers.Portal.GetSoftAPSettingsInfo(); getTask.Wait(); Assert.AreEqual(TaskStatus.RanToCompletion, getTask.Status); SoftAPSettingsInfo SoftAPSettings = getTask.Result; // Check some known things about this response. Assert.AreEqual("true", SoftAPSettings.SoftAPEnabled); Assert.AreEqual("SoftAPSsid", SoftAPSettings.SoftApSsid); } [TestMethod] public void GetAllJoynSettings_IoT() { TestHelpers.MockHttpResponder.AddMockResponse( DevicePortal.AllJoynSettingsApi, this.PlatformType, this.FriendlyOperatingSystemVersion, HttpMethods.Get); Task<AllJoynSettingsInfo> getTask = TestHelpers.Portal.GetAllJoynSettingsInfo(); getTask.Wait(); Assert.AreEqual(TaskStatus.RanToCompletion, getTask.Status); AllJoynSettingsInfo AllJoynSettings = getTask.Result; // Check some known things about this response. Assert.AreEqual("IoTCore Onboarding service", AllJoynSettings.AllJoynOnboardingDefaultDescription); Assert.AreEqual("Microsoft", AllJoynSettings.AllJoynOnboardingDefaultManufacturer); } } }
WindowsDevicePortalWrapper/UnitTestProject/MockData/IoT/rs1_release/api_iot_iotonboarding_alljoynsettings_IoTRaspberryPi3_rs1_release.dat 0 → 100644 +1 −0 Original line number Diff line number Diff line {"AllJoynOnboardingDefaultDescription" : "IoTCore Onboarding service", "AllJoynOnboardingDefaultManufacturer" : "Microsoft", "AllJoynOnboardingEnabled" : "true", "AllJoynOnboardingModelNumber" : "IoTCore Onboarding"} No newline at end of file
WindowsDevicePortalWrapper/UnitTestProject/MockData/IoT/rs1_release/api_iot_iotonboarding_softapsettings_IoTRaspberryPi3_rs1_release.dat 0 → 100644 +1 −0 Original line number Diff line number Diff line {"SoftAPEnabled" : "true", "SoftApPassword" : "p@ssw0rd", "SoftApSsid" : "SoftAPSsid"} No newline at end of file
WindowsDevicePortalWrapper/UnitTestProject/UnitTestProject.csproj +6 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,12 @@ <None Include="MockData\IoT\rs1_release\api_iot_device_timezones_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="MockData\IoT\rs1_release\api_iot_iotonboarding_alljoynsettings_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="MockData\IoT\rs1_release\api_iot_iotonboarding_softapsettings_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Include="MockData\IoT\rs1_release\api_iot_remote_status_IoTRaspberryPi3_rs1_release.dat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> Loading
WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/IoT/DeviceInfo.cs +69 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ namespace Microsoft.Tools.WindowsDevicePortal public static readonly string DisplayResolutionApi = "api/iot/device/displayresolution"; public static readonly string DisplayOrientationApi = "api/iot/device/displayorientation"; public static readonly string DeviceNameApi = "api/iot/device/name"; public static readonly string ResetPasswordApi = "api/iot/device/password"; public static readonly string NewRemoteDebuggingPinApi = "api/iot/device/remotedebuggingpin"; public static readonly string SetTimeZoneApi = "api/iot/device/settimezone"; /// <summary> /// Gets the IoT OS Information. Loading Loading @@ -86,6 +89,65 @@ namespace Microsoft.Tools.WindowsDevicePortal await this.Post(DeviceNameApi, string.Format("newdevicename={0}", Utilities.Hex64Encode(name))); } /// <summary> /// Sets a new password. /// </summary> public async Task SetNewPassword(string oldPassword, string newPassword) { await this.Post( ResetPasswordApi, string.Format("oldpassword={0}&newpassword={1}", Utilities.Hex64Encode(oldPassword), Utilities.Hex64Encode(newPassword))); } /// <summary> /// Sets a new remote debugging pin. /// </summary> public async Task SetNewRemoteDebuggingPin(string newPin) { await this.Post( NewRemoteDebuggingPinApi, string.Format("newpin={0}", Utilities.Hex64Encode(newPin))); } /// <summary> /// Sets controllers drivers. /// </summary> public async Task SetControllersDrivers(string newDriver) { await this.Post( ControllerDriverApi, string.Format("newdriver={0}", Utilities.Hex64Encode(newDriver))); } /// <summary> /// Sets Timezone. /// </summary> public async Task SetTimeZone(int index) { await this.Post( SetTimeZoneApi, string.Format("index={0}", index)); } /// <summary> /// Sets display resolution. /// </summary> public async Task SetDisplayResolution(string displayResolution) { await this.Post( DisplayResolutionApi, string.Format("newdisplayresolution={0}", Utilities.Hex64Encode(displayResolution))); } /// <summary> /// Set display orientation. /// </summary> public async Task SetDisplayOrientation(string displayOrientation) { await this.Post( DisplayOrientationApi, string.Format("newdisplayorientation={0}", Utilities.Hex64Encode(displayOrientation))); } #region Data contract /// <summary> Loading Loading @@ -124,6 +186,7 @@ namespace Microsoft.Tools.WindowsDevicePortal /// </summary> [DataMember(Name = "Current")] public Timezone CurrentTimeZone; /// <summary> /// Gets the list of all timezones /// </summary> Loading Loading @@ -183,31 +246,31 @@ namespace Microsoft.Tools.WindowsDevicePortal public int day { get; set; } /// <summary> /// Gets the current hour information /// Gets the current hour /// </summary> [DataMember(Name = "Hour")] public int hour { get; set; } /// <summary> /// Gets the current minute information /// Gets the current minute /// </summary> [DataMember(Name = "Minute")] public int min { get; set; } /// <summary> /// Gets the current month information /// Gets the current month /// </summary> [DataMember(Name = "Month")] public int month { get; set; } /// <summary> /// Gets the current second information /// Gets the current second /// </summary> [DataMember(Name ="Second")] public int sec { get; set; } /// <summary> /// Gets the current year information /// Gets the current year /// </summary> [DataMember(Name = "Year")] public int year { get; set; } Loading