From bf326e9298d806b24736799e87a33b40b38a4415 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 13 May 2020 23:39:31 +0300 Subject: PPC prevent any update when dyeing. --- .../MachineUpdate/MachineUpdateManager.cs | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 2dfea3ff3..ae77c26d0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -659,10 +659,11 @@ namespace Tango.PPC.Common.MachineUpdate { throw LogManager.Log(new InvalidOperationException("Could not perform an update while the machine is not connected.")); } - if (!op.CanPrint) - { - throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {op.Status} status.")); - } + } + + if (!op.CanPrint) + { + throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {op.Status} status.")); } //Connect to machine service and get matching packages for this machine. @@ -970,6 +971,11 @@ namespace Tango.PPC.Common.MachineUpdate { LogManager.Log("Starting database update..."); + if (!_machineProvider.MachineOperator.CanPrint) + { + throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {_machineProvider.MachineOperator} status.")); + } + UpdateProgress("Updating Database", "Initializing..."); LogManager.Log("Looking for update scripts configuration on application path..."); @@ -1241,10 +1247,11 @@ namespace Tango.PPC.Common.MachineUpdate { throw LogManager.Log(new InvalidOperationException("Could not perform an update while the machine is not connected.")); } - if (!op.CanPrint) - { - throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {op.Status} status.")); - } + } + + if (!op.CanPrint) + { + throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {op.Status} status.")); } UpdateProgress("Exploring package", "Extracting..."); -- cgit v1.3.1 From 70f02677e29c3bd0de8d9f88a0ead8e8e9c69cbc Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 25 May 2020 15:08:38 +0300 Subject: Fixed issue with update error message. --- .../PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index ae77c26d0..29bffb945 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -973,7 +973,7 @@ namespace Tango.PPC.Common.MachineUpdate if (!_machineProvider.MachineOperator.CanPrint) { - throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {_machineProvider.MachineOperator} status.")); + throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {_machineProvider.MachineOperator.Status} status.")); } UpdateProgress("Updating Database", "Initializing..."); -- cgit v1.3.1 From eeec4554288c43663d28fd4dd26d6ff45bcb2eb8 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 17 Jun 2020 12:54:47 +0300 Subject: Synchronized local PPC Schema. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../MachineUpdate/MachineUpdateManager.cs | 1 - 5 files changed, 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index f61a4b74b..b9e4c6096 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 7b3a48f62..255a6f07e 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index b1cb360ee..051a52a09 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 05d79d577..d026c7583 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 29bffb945..82b5a61df 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -1679,7 +1679,6 @@ namespace Tango.PPC.Common.MachineUpdate var response = await CheckForUpdate(_machineProvider.Machine.SerialNumber); if (response.IsUpdateAvailable || response.IsDatabaseUpdateAvailable) { - _checkForUpdateTimer.Interval = TimeSpan.FromMinutes(60).TotalMilliseconds; LogManager.Log($"New {(response.IsDatabaseUpdateAvailable ? "database updates" : "application version")} detected ({response.Version}). Raising event..."); UpdateAvailable?.Invoke(this, response); } -- cgit v1.3.1 From b8cd315d76b07a2886258d56a34b9ad8b57b56fa Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 17 Jun 2020 13:41:58 +0300 Subject: Fixed issue with auto check for update timing PPC. --- .../PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs | 8 +++++++- Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 82b5a61df..c73cc6196 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -106,6 +106,7 @@ namespace Tango.PPC.Common.MachineUpdate _client = ppcWebClient; _machineProvider = machineProvider; _app_manager = applicationManager; + _app_manager.ApplicationReady += _app_manager_ApplicationReady; _packageRunner = packageRunner; _packageRunner.PackageProgress += _packageRunner_PackageProgress; @@ -116,7 +117,7 @@ namespace Tango.PPC.Common.MachineUpdate _checkForUpdateTimer = new System.Timers.Timer(_settings.AutoUpdateCheckInterval.TotalMilliseconds); _checkForUpdateTimer.Elapsed += _checkForUpdateTimer_Elapsed; - _checkForUpdateTimer.Start(); + _checkForUpdateTimer.Stop(); externalBridge.RegisterRequestHandler(this); } @@ -125,6 +126,11 @@ namespace Tango.PPC.Common.MachineUpdate #region Event Handlers + private void _app_manager_ApplicationReady(object sender, EventArgs e) + { + _checkForUpdateTimer.Start(); + } + private void _packageRunner_PackageProgress(object sender, PackageProgressEventArgs e) { UpdateProgress(e.PackageName, e.Message, e.IsIntermediate, e.Progress, e.Total); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + -- cgit v1.3.1 From ddce0f3215746d6884acb94f3cedc613008aed5c Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 27 Aug 2020 00:39:49 +0300 Subject: Improved machine operator firmware upgrade on emulated devices. added isEmulated flag. Dropped the need to modify the FirmwareUpgrade mode when emulated due to this new flag. --- .../BackupRestore/DefaultBackupManager.cs | 12 ++----- .../MachineSetup/MachineSetupManager.cs | 2 +- .../MachineUpdate/MachineUpdateManager.cs | 41 ++++++---------------- .../Operation/IMachineOperator.cs | 5 +-- .../Tango.Integration/Operation/MachineOperator.cs | 17 +++++++-- 5 files changed, 31 insertions(+), 46 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/DefaultBackupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/DefaultBackupManager.cs index 495521dd9..087534d48 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/DefaultBackupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/DefaultBackupManager.cs @@ -510,16 +510,10 @@ namespace Tango.PPC.Common.BackupRestore var stream = new FileStream(tfpFile, FileMode.Open); - if (_machineProvider.Machine.IsDemo) - { - _machineProvider.MachineOperator.FirmwareUpgradeMode = FirmwareUpgradeModes.TFP_PACKAGE; - } - else - { - _machineProvider.MachineOperator.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; - } + _machineProvider.MachineOperator.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; + - var handler = _machineProvider.MachineOperator.UpgradeFirmware(stream).Result; + var handler = _machineProvider.MachineOperator.UpgradeFirmware(stream, _machineProvider.Machine.IsDemo).Result; handler.Failed += (_, ex) => { stream.Dispose(); 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 2177efecc..a2a750805 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -436,7 +436,7 @@ namespace Tango.PPC.Common.MachineSetup UpdateProgress("Updating Firmware", "Loading firmware package..."); var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); var stream = new FileStream(tfpPath, FileMode.Open); - var handler = await op.UpgradeFirmware(stream); + var handler = await op.UpgradeFirmware(stream, setup_response.IsDemo); handler.Failed += (_, ex) => { stream.Dispose(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index c73cc6196..bbc8d93f6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -843,23 +843,16 @@ namespace Tango.PPC.Common.MachineUpdate var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); var stream = new FileStream(tfpPath, FileMode.Open); - if (!_machineProvider.Machine.IsDemo) + if (setupFPGA) { - if (setupFPGA) - { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; - } - else - { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU; - } + op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; } else { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.TFP_PACKAGE; + op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU; } - var handler = await op.UpgradeFirmware(stream); + var handler = await op.UpgradeFirmware(stream, _machineProvider.Machine.IsDemo); handler.Failed += (_, ex) => { stream.Dispose(); @@ -1432,23 +1425,16 @@ namespace Tango.PPC.Common.MachineUpdate var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); var stream = new FileStream(tfpPath, FileMode.Open); - if (!_machineProvider.Machine.IsDemo) + if (setupFPGA) { - if (setupFPGA) - { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; - } - else - { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU; - } + op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; } else { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.TFP_PACKAGE; + op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU; } - var handler = await op.UpgradeFirmware(stream); + var handler = await op.UpgradeFirmware(stream, _machineProvider.Machine.IsDemo); handler.Failed += (_, ex) => { stream.Dispose(); @@ -1543,16 +1529,9 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log("-------------------------------------------------------------------------"); LogManager.Log("Updating Firmware..."); - if (!_machineProvider.Machine.IsDemo) - { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; - } - else - { - op.FirmwareUpgradeMode = FirmwareUpgradeModes.TFP_PACKAGE; - } + op.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; - var handler = await op.UpgradeFirmware(stream); + var handler = await op.UpgradeFirmware(stream, _machineProvider.Machine.IsDemo); handler.Failed += (_, ex) => { stream.Dispose(); diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index bee4a7523..1c239f4f5 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -244,7 +244,7 @@ namespace Tango.Integration.Operation /// Occurs when a head cleaning job has ended. /// event EventHandler HeadCleaningEnded; - + /// /// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages. /// @@ -469,8 +469,9 @@ namespace Tango.Integration.Operation /// Upgrades the firmware. /// /// The TFP stream (Tango Firmware Package File). + /// Specify whether the connected machine is emulated and to skip the actual DFU interface. /// - Task UpgradeFirmware(Stream tfpStream); + Task UpgradeFirmware(Stream tfpStream, bool isEmulated = false); /// /// Directs the embedded device to validate the last uploaded firmware package. diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index de8e118e9..57ba6e727 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -3371,8 +3371,10 @@ namespace Tango.Integration.Operation /// Upgrades the firmware. /// /// The TFP stream (Tango Firmware Package File). + /// Specify whether the connected machine is emulated and to skip the actual DFU interface. /// - public virtual async Task UpgradeFirmware(Stream tfpStream) + /// + public virtual async Task UpgradeFirmware(Stream tfpStream, bool isEmulated = false) { bool cancel = false; ZipFile zip = null; @@ -3493,8 +3495,16 @@ namespace Tango.Integration.Operation try { - LogManager.Log("Upgrading..."); - upgradeManager.PerformUpgrade(data).Wait(); + if (!isEmulated) + { + LogManager.Log("Upgrading..."); + upgradeManager.PerformUpgrade(data).Wait(); + } + else + { + LogManager.Log("Upgrading (emulated)..."); + Thread.Sleep(3000); + } } catch (Exception ex) { @@ -3512,6 +3522,7 @@ namespace Tango.Integration.Operation LogManager.Log("Reconnecting adapter..."); upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Connecting..."); Adapter.Connect().Wait(); + Connect().Wait(); LogManager.Log("Connected..."); -- cgit v1.3.1 From 7428db6eb757e7a77a60d34c1eb67d1b1a936651 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 2 Sep 2020 12:49:20 +0300 Subject: Improved firmware upgrade progress handling. --- .../Views/FirmwareUpgradeView.xaml | 2 +- .../MachineUpdate/MachineUpdateManager.cs | 6 ++-- .../Tango.Integration/Operation/MachineOperator.cs | 34 +++++++++++++--------- .../Upgrade/FirmwareUpgradeHandler.cs | 31 +++++++++++++------- .../Upgrade/FirmwareUpgradeProgressEventArgs.cs | 5 ++-- 5 files changed, 48 insertions(+), 30 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml index 233f8e4cb..5cf23e79e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml @@ -87,7 +87,7 @@ Upgrading Machine Firmware - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index bbc8d93f6..4f8be0a6e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -874,7 +874,7 @@ namespace Tango.PPC.Common.MachineUpdate }; handler.Progress += (_, e) => { - UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); + UpdateProgress("Updating Firmware", e.Message, e.IsIndeterminate, e.Current, e.Total); }; } else @@ -1457,7 +1457,7 @@ namespace Tango.PPC.Common.MachineUpdate }; handler.Progress += (_, e) => { - UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); + UpdateProgress("Updating Firmware", e.Message, e.IsIndeterminate, e.Current, e.Total); }; } else @@ -1550,7 +1550,7 @@ namespace Tango.PPC.Common.MachineUpdate }; handler.Progress += (_, e) => { - UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); + UpdateProgress("Updating Firmware", e.Message, e.IsIndeterminate, e.Current, e.Total); }; } catch (Exception ex) diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 57ba6e727..6887d9859 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -3407,6 +3407,17 @@ namespace Tango.Integration.Operation LogManager.Log("Reading zip stream..."); zip = ZipFile.Read(tfpStream); + double packageUploadTotal = 0; + + try + { + packageUploadTotal = zip.Entries.Sum(x => x.UncompressedSize); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error calculating total package upload bytes."); + } + LogManager.Log("Creating storage manager..."); var storage = CreateStorageManager(); LogManager.Log("Getting storage drive information..."); @@ -3480,8 +3491,7 @@ namespace Tango.Integration.Operation FirmwareUpgradeManager upgradeManager = new FirmwareUpgradeManager(); upgradeManager.UpgradeProgress += (sender, e) => { - upgradeHandler.Total = (long)e.Total; - upgradeHandler.RaiseProgress((long)e.Progress, FirmwareUpgradeStatus.Upgrading, e.State.ToDescription()); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Upgrading, e.State.ToDescription(), false, e.Total, e.Progress); }; LogManager.Log("Disconnecting adapter..."); @@ -3516,21 +3526,21 @@ namespace Tango.Integration.Operation } LogManager.Log("Waiting for the device..."); - upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Waiting for the device..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Upgrading, "Waiting for the device..."); Thread.Sleep(5000); LogManager.Log("Reconnecting adapter..."); - upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Connecting..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Upgrading, "Connecting..."); Adapter.Connect().Wait(); - + Connect().Wait(); LogManager.Log("Connected..."); - upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Connected."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Upgrading, "Connected."); Thread.Sleep(2000); LogManager.Log("Waiting..."); - upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Waiting..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Upgrading, "Waiting..."); Thread.Sleep(2000); Status = MachineStatuses.Upgrading; @@ -3547,7 +3557,6 @@ namespace Tango.Integration.Operation if (package_info.ContainsNoneMcu()) { LogManager.Log("TFP package is enabled. Starting upload..."); - upgradeHandler.Total = zip.Entries.Sum(x => x.UncompressedSize); uploadNext(); } else @@ -3596,7 +3605,7 @@ namespace Tango.Integration.Operation return; } - upgradeHandler.RaiseProgress(upgradeHandler.Current + e.Delta, FirmwareUpgradeStatus.Uploading, $"Uploading '{entry.FileName}'..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Uploading, $"Uploading '{entry.FileName}'...", false, packageUploadTotal, upgradeHandler.Current + e.Delta); }; } catch (Exception ex) @@ -3617,7 +3626,7 @@ namespace Tango.Integration.Operation { LogManager.Log("Validating version..."); streams.ForEach(x => x.Dispose()); - upgradeHandler.RaiseProgress(upgradeHandler.Total, FirmwareUpgradeStatus.Validating, "Validating version..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Validating, "Validating version..."); var validateRequest = new ValidateVersionRequest(); validateRequest.Path = package_folder; var validateResponse = SendRequest(validateRequest, new TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(10), ShouldLog = true }).Result; @@ -3639,7 +3648,7 @@ namespace Tango.Integration.Operation LogManager.Log("Activating version..."); - upgradeHandler.RaiseProgress(upgradeHandler.Total, FirmwareUpgradeStatus.Activating, "Activating version..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Activating, "Activating version..."); var activateRequest = new ActivateVersionRequest(); activateRequest.Path = package_folder; @@ -3649,8 +3658,7 @@ namespace Tango.Integration.Operation { if (!completed && response.Message.Progress > 0) { - upgradeHandler.Total = (long)response.Message.Total; - upgradeHandler.RaiseProgress((long)response.Message.Progress, FirmwareUpgradeStatus.Activating, "Activating version..."); + upgradeHandler.RaiseProgress(FirmwareUpgradeStatus.Activating, "Activating version...", false, response.Message.Total, response.Message.Progress); } }, (ex) => { diff --git a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs index 774824b49..dd42693c4 100644 --- a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs +++ b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs @@ -19,6 +19,8 @@ namespace Tango.Integration.Upgrade internal FirmwareUpgradeHandler() { + IsIndeterminate = true; + Total = 100; Message = "Initializing..."; } @@ -41,8 +43,8 @@ namespace Tango.Integration.Upgrade private set { _status = value; RaisePropertyChangedAuto(); } } - private long _current; - public long Current + private double _current; + public double Current { get { return _current; } internal set @@ -51,13 +53,20 @@ namespace Tango.Integration.Upgrade } } - private long _total; - public long Total + private double _total; + public double Total { get { return _total; } internal set { _total = value; RaisePropertyChangedAuto(); } } + private bool _isIndeterminate; + public bool IsIndeterminate + { + get { return _isIndeterminate; } + set { _isIndeterminate = value; RaisePropertyChangedAuto(); } + } + public Task Cancel() { return Task.Factory.StartNew(() => @@ -71,28 +80,27 @@ namespace Tango.Integration.Upgrade internal void RaiseCompleted() { - Status = FirmwareUpgradeStatus.Completed; - Message = "Completed."; + RaiseProgress(FirmwareUpgradeStatus.Completed, "Firmware upgrade completed.", false, 100, 100); Completed?.Invoke(this, new EventArgs()); } internal void RaiseCanceled() { - Status = FirmwareUpgradeStatus.Canceled; - Message = "Canceled."; + RaiseProgress(FirmwareUpgradeStatus.Canceled, "Firmware upgrade canceled by user.", false, 100, 0); Canceled?.Invoke(this, new EventArgs()); } internal void RaiseFailed(Exception ex) { - Status = FirmwareUpgradeStatus.Failed; - Message = "Failed."; + RaiseProgress(FirmwareUpgradeStatus.Failed, "Firmware upgrade failed.", false, 100, 0); Failed?.Invoke(this, ex); } - internal void RaiseProgress(long current, FirmwareUpgradeStatus status, String message) + internal void RaiseProgress(FirmwareUpgradeStatus status, String message, bool isIndeterminate = true, double total = 100, double current = 0) { + Total = total; Current = current; + IsIndeterminate = isIndeterminate; Status = status; Message = message; @@ -102,6 +110,7 @@ namespace Tango.Integration.Upgrade Status = Status, Total = Total, Message = Message, + IsIndeterminate = IsIndeterminate }); } } diff --git a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs index fa4f4cc96..8315f4026 100644 --- a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs +++ b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs @@ -8,8 +8,9 @@ namespace Tango.Integration.Upgrade { public class FirmwareUpgradeProgressEventArgs : EventArgs { - public long Current { get; set; } - public long Total { get; set; } + public double Current { get; set; } + public double Total { get; set; } + public bool IsIndeterminate { get; set; } public FirmwareUpgradeStatus Status { get; set; } public String Message { get; set; } } -- cgit v1.3.1 From 17a624c8ddacc1dac4904793645d6c893f7ced77 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 24 Sep 2020 23:20:25 +0300 Subject: Changed all PPC updated to based on GUID ! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../MachineSetup/MachineSetupManager.cs | 1 - .../MachineUpdate/IMachineUpdateManager.cs | 13 +++--- .../MachineUpdate/MachineUpdateManager.cs | 47 +++++++++------------ .../DefaultMachineDataSynchronizer.cs | 2 +- .../Tango.PPC.Common/Web/CheckForUpdateRequest.cs | 1 - .../Tango.PPC.Common/Web/DownloadUpdateRequest.cs | 2 +- .../PPC/Tango.PPC.Common/Web/LoginRequest.cs | 1 + .../Tango.PPC.Common/Web/MachineSetupRequest.cs | 1 - .../PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs | 1 - .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 6 +-- .../Configurations/ProvisionMachine.xml | Bin 88354 -> 76348 bytes .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 55424 -> 72920 bytes .../Controllers/PPCController.cs | 10 +++-- 15 files changed, 39 insertions(+), 46 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f8c0132fb..aeb06fad3 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 5cc378c9f..52724650c 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 a2a750805..15902f629 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -247,7 +247,6 @@ namespace Tango.PPC.Common.MachineSetup } MachineSetupRequest request = new MachineSetupRequest(); - request.SerialNumber = serialNumber; request.DeviceID = await _windows_manager.GetDeviceId(); request.DeviceName = deviceName; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs index 3e3fbcc27..77646da40 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs @@ -38,9 +38,8 @@ namespace Tango.PPC.Common.MachineUpdate event EventHandler Progress; /// - /// Performs a machine update using the specified serial number and machine service address. + /// Performs a machine update. /// - /// The serial number. /// if set to true updates the embedded device firmware. /// if set to true updates the embedded device FPGA version and other parameters. /// @@ -61,24 +60,22 @@ namespace Tango.PPC.Common.MachineUpdate Task UpdateFromTFP(String fileName); /// - /// Checks if any update are available for the specified machine serial number. + /// Checks if any update are available. /// - /// The serial number. /// - Task CheckForUpdate(String serialNumber); + Task CheckForUpdate(); /// /// Checks whether it is necessary to updates all the "overwrite-able" database tables. /// - /// The serial number. /// - Task UpdateDBCheck(String serialNumber); + Task UpdateDBCheck(); /// /// Updates all the "overwrite-able" database tables. /// /// - Task UpdateDB(DbCompareResult dbCompareResult, String serialNumber); + Task UpdateDB(DbCompareResult dbCompareResult); /// /// Gets the update package file information. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 4f8be0a6e..9b4462a70 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -148,12 +148,12 @@ namespace Tango.PPC.Common.MachineUpdate #region Private Methods - private Task Login(String serialNumber) + private Task Login(String machineGuid) { return _client.Login(new LoginRequest() { Mode = LoginMode.Machine, - SerialNumber = serialNumber, + MachineGuid = machineGuid, }); } @@ -609,9 +609,8 @@ namespace Tango.PPC.Common.MachineUpdate #region Public Methods /// - /// Performs a machine update using the specified serial number and machine service address. + /// Performs a machine update. /// - /// The serial number. /// if set to true updates the embedded device firmware. /// if set to true updates the embedded device FPGA version and other parameters. /// @@ -638,7 +637,7 @@ namespace Tango.PPC.Common.MachineUpdate var _newPackageTempFolder = TemporaryManager.CreateFolder(); _newPackageTempFolder.Persist = true; - String serialNumber = _machineProvider.Machine.SerialNumber; + String machineGuid = _machineProvider.Machine.Guid; try { @@ -646,7 +645,7 @@ namespace Tango.PPC.Common.MachineUpdate var machineServiceAddress = _settings.GetMachineServiceAddress(); - LogManager.Log($"Starting machine update for serial number {serialNumber}..."); + LogManager.Log($"Starting machine update..."); //Connecting to machine... LogManager.Log("Verifying machine connection and state..."); @@ -677,10 +676,9 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - await Login(serialNumber); + await Login(machineGuid); DownloadUpdateRequest request = new DownloadUpdateRequest(); - request.SerialNumber = serialNumber; update_response = await _client.MachineUpdate(request); @@ -804,7 +802,7 @@ namespace Tango.PPC.Common.MachineUpdate Path.Combine(_newPackageTempFolder, "Update Scripts"), update_response.DataSource, localDataSource, - serialNumber); + machineGuid); runner.Log += (x, msg) => { @@ -894,12 +892,11 @@ namespace Tango.PPC.Common.MachineUpdate } /// - /// Checks if any update are available for the specified machine serial number. + /// Checks if any update are available for the specified machine. /// - /// The serial number. /// The machine service address. /// - public Task CheckForUpdate(string serialNumber) + public Task CheckForUpdate() { return Task.Factory.StartNew(() => { @@ -909,12 +906,13 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - Login(serialNumber).GetAwaiter().GetResult(); + String machineGuid = _machineProvider.Machine.Guid; + + Login(machineGuid).GetAwaiter().GetResult(); LogManager.Log($"Checking if updates available..."); CheckForUpdateRequest request = new CheckForUpdateRequest(); - request.SerialNumber = serialNumber; request.Version = _app_manager.Version.ToString(); request.FirmwareVersion = _app_manager.FirmwareVersion?.ToString(); @@ -950,10 +948,9 @@ namespace Tango.PPC.Common.MachineUpdate /// /// Updates all the "overwrite-able" database tables. /// - /// The serial number. /// The machine service address. /// - public Task UpdateDB(DbCompareResult dbCompareResult, String serialNumber) + public Task UpdateDB(DbCompareResult dbCompareResult) { _updateStartDate = DateTime.UtcNow; _logs.Clear(); @@ -1034,7 +1031,7 @@ namespace Tango.PPC.Common.MachineUpdate if (item.RequiresSerialNumber) { - builder.SetMachineSerialNumber(serialNumber); + builder.SetMachineSerialNumber(_machineProvider.Machine.Guid); } builder.Synchronize(); @@ -1081,16 +1078,15 @@ namespace Tango.PPC.Common.MachineUpdate /// /// Checks whether it is necessary to updates all the "overwrite-able" database tables. /// - /// The serial number. /// The machine service address. /// - public Task UpdateDBCheck(string serialNumber) + public Task UpdateDBCheck() { return Task.Factory.StartNew(() => { var machineServiceAddress = _settings.GetMachineServiceAddress(); - LogManager.Log($"Checking if database update is required for serial number {serialNumber}..."); + LogManager.Log($"Checking if database update is required..."); LogManager.Log("Looking for update scripts configuration on application path..."); @@ -1103,10 +1099,9 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - Login(serialNumber).Wait(); + Login(_machineProvider.Machine.Guid).Wait(); UpdateDBRequest request = new UpdateDBRequest(); - request.SerialNumber = serialNumber; request.ApplicationVersion = _app_manager.Version.ToString(); request.FirmwareVersion = _app_manager.FirmwareVersion.ToString(); @@ -1137,7 +1132,7 @@ namespace Tango.PPC.Common.MachineUpdate if (item.RequiresSerialNumber) { - builder.SetMachineSerialNumber(serialNumber); + builder.SetMachineSerialNumber(_machineProvider.Machine.Guid); } var config = builder.Build(); @@ -1227,7 +1222,7 @@ namespace Tango.PPC.Common.MachineUpdate { _isUpdating = true; - LogManager.Log($"Starting machine update for serial number {serialNumber}..."); + LogManager.Log($"Starting machine update (TUP) for serial number {serialNumber}..."); //Connecting to machine... LogManager.Log("Verifying machine connection and state..."); @@ -1368,7 +1363,7 @@ namespace Tango.PPC.Common.MachineUpdate Path.Combine(_newPackageTempFolder, "Update Scripts"), tempDbDataSource, localDataSource, - serialNumber); + _machineProvider.Machine.Guid); runner.Log += (x, msg) => { @@ -1661,7 +1656,7 @@ namespace Tango.PPC.Common.MachineUpdate try { - var response = await CheckForUpdate(_machineProvider.Machine.SerialNumber); + var response = await CheckForUpdate(); if (response.IsUpdateAvailable || response.IsDatabaseUpdateAvailable) { LogManager.Log($"New {(response.IsDatabaseUpdateAvailable ? "database updates" : "application version")} detected ({response.Version}). Raising event..."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs index ab1f8e890..645ddbdf5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs @@ -452,7 +452,7 @@ namespace Tango.PPC.Common.Synchronization await this.client.Login(new LoginRequest() { Mode = LoginMode.Machine, - SerialNumber = _machineProvider.Machine.SerialNumber, + MachineGuid = _machineProvider.Machine.Guid, }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs index a93b30a59..8e13ea7c4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs @@ -9,7 +9,6 @@ namespace Tango.PPC.Common.Web { public class CheckForUpdateRequest : WebRequestMessage { - public String SerialNumber { get; set; } public String Version { get; set; } public String FirmwareVersion { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs index a32d3d497..db4080dff 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs @@ -9,6 +9,6 @@ namespace Tango.PPC.Common.Web { public class DownloadUpdateRequest : WebRequestMessage { - public String SerialNumber { get; set; } + } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs index f8588f6b0..9ae0d65ae 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs @@ -11,6 +11,7 @@ namespace Tango.PPC.Common.Web { public LoginMode Mode { get; set; } public String SerialNumber { get; set; } + public String MachineGuid { get; set; } public String Email { get; set; } public String Password { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs index 821828a48..a9e68df36 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs @@ -9,7 +9,6 @@ namespace Tango.PPC.Common.Web { public class MachineSetupRequest : WebRequestMessage { - public String SerialNumber { get; set; } public String DeviceID { get; set; } public String DeviceName { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs index c78f6199e..4d8433a56 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs @@ -9,7 +9,6 @@ namespace Tango.PPC.Common.Web { public class UpdateDBRequest : WebRequestMessage { - public String SerialNumber { get; set; } public String ApplicationVersion { get; set; } public String FirmwareVersion { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index d4d78dac6..23ec956a0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -167,7 +167,7 @@ namespace Tango.PPC.UI.ViewModels return; } - var response = await MachineUpdateManager.CheckForUpdate(MachineProvider.Machine.SerialNumber); + var response = await MachineUpdateManager.CheckForUpdate(); try { @@ -208,7 +208,7 @@ namespace Tango.PPC.UI.ViewModels } else { - _db_compare_result = await MachineUpdateManager.UpdateDBCheck(MachineProvider.Machine.SerialNumber); + _db_compare_result = await MachineUpdateManager.UpdateDBCheck(); if (_db_compare_result.RequiresUpdate) { @@ -261,7 +261,7 @@ namespace Tango.PPC.UI.ViewModels try { - await MachineUpdateManager.UpdateDB(_db_compare_result, MachineProvider.Machine.SerialNumber); + await MachineUpdateManager.UpdateDB(_db_compare_result); LogManager.Log("Database update completed."); await NavigateTo(MachineUpdateView.UpdateCompletedView); } diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index 8f60372b0..f3b845010 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index 540b4cad9..260448394 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 4215cd175..601438d67 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -390,7 +390,11 @@ namespace Tango.MachineService.Controllers if (hasDatabaseUpdates) { response.IsDatabaseUpdateAvailable = true; - response.UpdateDBResponse = UpdateDB(new UpdateDBRequest() { SerialNumber = request.SerialNumber }); + response.UpdateDBResponse = UpdateDB(new UpdateDBRequest() + { + ApplicationVersion = request.Version, + FirmwareVersion = request.FirmwareVersion + }); } //Compare database @@ -937,11 +941,11 @@ namespace Tango.MachineService.Controllers } else if (request.Mode == LoginMode.Machine) { - var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber); + var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber || x.Guid == request.MachineGuid); if (machine == null) { - throw new AuthenticationException("Invalid serial number."); + throw new AuthenticationException("Invalid machine serial number or id."); } response.AccessToken = WebToken.CreateNew(MachineServiceConfig.JWT_TOKEN_SECRET, new TokenObject() -- cgit v1.3.1 From 74cf0b226d0ed2b8ae425e1843f5152504d98888 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 29 Sep 2020 17:44:50 +0300 Subject: Fixed update manager PPC not allowing db updates when machine is disconnected --- .../PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index 4f8be0a6e..0ad9b411e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -970,9 +970,9 @@ namespace Tango.PPC.Common.MachineUpdate { LogManager.Log("Starting database update..."); - if (!_machineProvider.MachineOperator.CanPrint) + if (_machineProvider.MachineOperator.IsPrinting) { - throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {_machineProvider.MachineOperator.Status} status.")); + throw LogManager.Log(new InvalidOperationException($"Could not perform a database update while the machine is dyeing.")); } UpdateProgress("Updating Database", "Initializing..."); -- cgit v1.3.1