diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-12-20 15:07:43 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-12-20 15:07:43 +0200 |
| commit | 64367a944ebddc998b06eb2673928ef95ffc3627 (patch) | |
| tree | b30eff3671d388d23c10a91a82cc25a6d42d548f /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup | |
| parent | 4554080793bd46fcb8f55578d2f67917584dc332 (diff) | |
| parent | d204e56c57dcf52f31c9e64222f32a678150e721 (diff) | |
| download | Tango-64367a944ebddc998b06eb2673928ef95ffc3627.tar.gz Tango-64367a944ebddc998b06eb2673928ef95ffc3627.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup')
3 files changed, 85 insertions, 25 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index ead508488..1f86e0953 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -19,7 +19,9 @@ using Tango.Integration.Operation; using Tango.PMR.Synchronization; using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; +using Tango.PPC.Common.OS; using Tango.PPC.Common.RemoteAssistance; +using Tango.PPC.Common.UWF; using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; @@ -35,6 +37,8 @@ namespace Tango.PPC.Common.MachineSetup public class MachineSetupManager : ExtendedObject, IMachineSetupManager { private IRemoteAssistanceProvider _remoteAssistance; + private IUnifiedWriteFilterManager _uwf; + private IWindowsActivationManager _windows_activation_manager; #region Events @@ -67,9 +71,11 @@ namespace Tango.PPC.Common.MachineSetup /// Initializes a new instance of the <see cref="MachineSetupManager"/> class. /// </summary> /// <param name="remoteAssistance">The remote assistance.</param> - public MachineSetupManager(IRemoteAssistanceProvider remoteAssistance) + public MachineSetupManager(IRemoteAssistanceProvider remoteAssistance, IUnifiedWriteFilterManager unifiedWriterFilterManager, IWindowsActivationManager windowsActivationManager) { _remoteAssistance = remoteAssistance; + _uwf = unifiedWriterFilterManager; + _windows_activation_manager = windowsActivationManager; } #endregion @@ -92,23 +98,7 @@ namespace Tango.PPC.Common.MachineSetup IMachineOperator op = null; - var demoMode = SettingsManager.Default.GetOrCreate<PPCSettings>().DemoMode; - - if (!demoMode) - { - //Connecting to machine... - LogManager.Log("Initiating machine connection..."); - - UpdateProgress("Connecting to machine", "Connecting..."); - op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => - { - UpdateProgress("Connecting to machine", msg); - }); - } - else - { - LogManager.Log("Application in demo mode. Skipping machine connection..."); - } + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); //Connect to machine service and get matching packages for this machine. UpdateProgress("Validating serial number", "Connecting to machine service..."); @@ -122,9 +112,9 @@ namespace Tango.PPC.Common.MachineSetup try { - using (var http = new ProtoWebClient()) + using (var http = new WebTransportClient()) { - setup_response = await http.Post<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/Synchronization/MachineSetup", request); + setup_response = await http.PostJson<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/PPC/MachineSetup", request); } } catch (Exception ex) @@ -134,9 +124,38 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log($"Machine setup response received: {Environment.NewLine}{setup_response.ToJsonString()}"); - LogManager.Log("Installing remote assistance..."); - UpdateProgress("Installing remote assistance", "Installing..."); - await _remoteAssistance.InstallRemoteAssistance(); + if (setup_response.SetupFirmware) + { + //Connecting to machine... + LogManager.Log("Initiating machine connection..."); + + UpdateProgress("Connecting to machine", "Connecting..."); + op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => + { + UpdateProgress("Connecting to machine", msg); + }); + } + + if (setup_response.SetupActivation) + { + LogManager.Log("Activating windows license..."); + UpdateProgress("Activating operation system license", "Activating..."); + await _windows_activation_manager.Activate(setup_response.OSKey); + } + + if (setup_response.SetupRemoteAssistance) + { + LogManager.Log("Installing remote assistance..."); + UpdateProgress("Installing remote assistance", "Installing..."); + await _remoteAssistance.InstallRemoteAssistance(serialNumber); + } + + if (setup_response.SetupUWF) + { + LogManager.Log("Activating unified write filter..."); + UpdateProgress("Activating disk protection", "Activating..."); + await _uwf.Setup(); + } //Create temporary folders for packages. var _newPackageTempFolder = TemporaryManager.CreateFolder(); @@ -269,7 +288,7 @@ namespace Tango.PPC.Common.MachineSetup throw LogManager.Log(ex, "Setup manager error while trying to synchronize database."); } - if (!demoMode) + if (setup_response.SetupFirmware) { //Updating firmware UpdateProgress("Updating Firmware", "Connecting to firmware device..."); @@ -307,7 +326,6 @@ namespace Tango.PPC.Common.MachineSetup } else { - LogManager.Log("Application in demo mode. Skipping firmware upgrade..."); result.SetResult(new MachineSetupResult() { UpdatePackagePath = _newPackageTempFolder, diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs new file mode 100644 index 000000000..4c8039544 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineSetup +{ + public class MachineSetupRequest : WebRequestMessage + { + public String SerialNumber { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs new file mode 100644 index 000000000..89450a1d1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.MachineSetup +{ + public class MachineSetupResponse : WebResponseMessage + { + public String Version { get; set; } + + public String BlobAddress { get; set; } + + public String DbAddress { get; set; } + public String DbUserName { get; set; } + public String DbPassword { get; set; } + + public String OSKey { get; set; } + + public bool SetupActivation { get; set; } + public bool SetupRemoteAssistance { get; set; } + public bool SetupUWF { get; set; } + public bool SetupFirmware { get; set; } + public bool IsDemo { get; set; } + } +} |
