diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-12-12 18:47:31 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-12-12 18:47:31 +0200 |
| commit | f901d520c6a62797eae912144d6c33d5881cc272 (patch) | |
| tree | 76ab476634f2b443a41e8b4f1180d2164f8aceed /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs | |
| parent | 33de2cfe94b9fde80f987aab9ad5aa95be6d4371 (diff) | |
| parent | d9a89773f2f283fbf5596799dd4d50d231817203 (diff) | |
| download | Tango-f901d520c6a62797eae912144d6c33d5881cc272.tar.gz Tango-f901d520c6a62797eae912144d6c33d5881cc272.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs | 19 |
1 files changed, 18 insertions, 1 deletions
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 4932d1e72..9ae77df6f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -13,6 +13,7 @@ using Tango.Core; using Tango.Core.DB; using Tango.Core.Helpers; using Tango.Core.IO; +using Tango.Integration.Operation; using Tango.PMR.Synchronization; using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; @@ -83,6 +84,23 @@ namespace Tango.PPC.Common.MachineUpdate { LogManager.Log($"Starting machine update for serial number {serialNumber}..."); + //Connecting to machine... + LogManager.Log("Verifying machine connection and state..."); + + UpdateProgress("Verifying machine state", "Initializing..."); + + await Task.Delay(1000); + + IMachineOperator op = _machineProvider.MachineOperator; + if (op.State != Transport.TransportComponentState.Connected) + { + throw new InvalidOperationException("Could not perform an update while the machine is not connected."); + } + if (op.Status != MachineStatuses.ReadyToDye) + { + throw new InvalidOperationException($"Could not perform an update while the machine is in a {op.Status} status."); + } + //Connect to machine service and get matching packages for this machine. UpdateProgress("Downloading software package", "Connecting to machine service..."); @@ -217,7 +235,6 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log(""); LogManager.Log("-------------------------------------------------------------------------"); LogManager.Log("Updating Firmware..."); - var op = _machineProvider.MachineOperator; UpdateProgress("Updating Firmware", "Loading firmware package..."); var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); |
