diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-05 22:18:14 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-05 22:18:14 +0300 |
| commit | 03bc9bd370929884f98ee9488146646d44911efd (patch) | |
| tree | b4c694fa99ab2f351f4097ae0467a320cc5d9a59 /Software/Visual_Studio | |
| parent | 568ffe0a9c0141c4530d962f134b4c5960d6ff9b (diff) | |
| download | Tango-03bc9bd370929884f98ee9488146646d44911efd.tar.gz Tango-03bc9bd370929884f98ee9488146646d44911efd.zip | |
Improved PPC Publisher for Firmware version display and validation.
Diffstat (limited to 'Software/Visual_Studio')
7 files changed, 63 insertions, 16 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs index 2fc2ca507..a28cc747a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs @@ -59,14 +59,11 @@ namespace Tango.PPC.Common.Publish /// Gets the latest version. /// </summary> /// <returns></returns> - public async Task<String> GetRemoteVersion(String machineVersionGuid) + public async Task<LatestVersionResponse> GetRemoteVersion(String machineVersionGuid) { _client.Environment = Options.Environment; - var response = await _client.GetLatestVersion(new LatestVersionRequest() - { - MachineVersionGuid = machineVersionGuid, - }); - return response.Version; + var response = await _client.GetLatestVersion(new LatestVersionRequest() { MachineVersionGuid = machineVersionGuid } ); + return response; } /// <summary> @@ -163,8 +160,12 @@ namespace Tango.PPC.Common.Publish OnPublishProgress(0, 100, $"Fetching remote version from {Options.Environment.ToAddress()}..."); - String remote_version = GetRemoteVersion(Options.MachineVersionGuid).Result; + var r = GetRemoteVersion(Options.MachineVersionGuid).Result; + String remote_version = r.Version; + String remote_firmware_version = r.FirmwareVersion; + String local_version = GetLocalVersion(); + String local_firmware_version = GetLocalFirmwareVersion(Options.TfpPath); OnPublishProgress(0, 100, $"Remote version: {remote_version}"); OnPublishProgress(0, 100, $"Local version: {local_version}"); @@ -174,6 +175,11 @@ namespace Tango.PPC.Common.Publish throw new InvalidOperationException($"The local version '{local_version}' is not greater than the remote version '{remote_version}'."); } + if (Version.Parse(local_firmware_version) <= Version.Parse(remote_firmware_version)) + { + throw new InvalidOperationException($"The local firmware version '{local_firmware_version}' is not greater than the remote version '{remote_firmware_version}'."); + } + OnPublishProgress(0, 100, $"Requesting version upload..."); var response = _client.UploadVersion(new UploadVersionRequest() @@ -233,7 +239,7 @@ namespace Tango.PPC.Common.Publish Token = response.Token, }).Wait(); - remote_version = GetRemoteVersion(Options.MachineVersionGuid).Result; + remote_version = GetRemoteVersion(Options.MachineVersionGuid).Result.Version; local_version = GetLocalVersion(); OnPublishProgress(0, 0, $"Remote version: {remote_version}"); @@ -413,6 +419,16 @@ namespace Tango.PPC.Common.Publish } /// <summary> + /// Gets the MCU version from the specified TFP file. + /// </summary> + /// <param name="tfpFile">The TFP file.</param> + /// <returns></returns> + public String GetLocalFirmwareVersion(String tfpFile) + { + return GetVersionInfoFromTFP(tfpFile).GetMcuVersion().ToString(); + } + + /// <summary> /// Raises the publish progress event. /// </summary> /// <param name="progress">The progress.</param> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs index 4c40acb44..9b8613cfb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs @@ -17,6 +17,7 @@ namespace Tango.PPC.Common.Publish public event EventHandler BuidConfigChanged; public event EventHandler BasicInfoChanged; public event EventHandler MachineVersionGuidChanged; + public event EventHandler TfpPathChanged; private String basePath; [Option("path", HelpText = "Specifies the application base path.", Required = false)] @@ -79,7 +80,7 @@ namespace Tango.PPC.Common.Publish public String TfpPath { get { return _tfpPath; } - set { _tfpPath = value; RaisePropertyChangedAuto(); } + set { _tfpPath = value; RaisePropertyChangedAuto(); TfpPathChanged?.Invoke(this, new EventArgs()); } } private String _installerProject; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LatestVersionResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LatestVersionResponse.cs index d2ed08f7d..eb5ef7f5a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LatestVersionResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LatestVersionResponse.cs @@ -11,5 +11,6 @@ namespace Tango.PPC.Common.Web public class LatestVersionResponse : WebResponseMessage { public String Version { get; set; } + public String FirmwareVersion { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml index f74194222..1d60a70be 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml @@ -67,15 +67,17 @@ <TextBlock Margin="0 20 0 0"> <TextBlock> - <Run>Remote Version:</Run> - <Run Text="{Binding RemoteVersion}"></Run> + <Run>Remote Versions:</Run> + <Run Text="{Binding RemoteVersion}"></Run>, + <Run Text="{Binding RemoteFirmwareVersion}"></Run> </TextBlock> </TextBlock> <TextBlock Margin="0 20 0 0"> <TextBlock> - <Run>Local Version:</Run> - <Run Text="{Binding LocalVersion}"></Run> + <Run>Local Versions:</Run> + <Run Text="{Binding LocalVersion}"></Run>, + <Run Text="{Binding LocalFirmwareVersion}"></Run> </TextBlock> </TextBlock> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindowVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindowVM.cs index 98b35ed3f..d935c44d2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindowVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindowVM.cs @@ -67,6 +67,13 @@ namespace Tango.PPC.Publisher.UI set { _localVersion = value; RaisePropertyChangedAuto(); } } + private String _localFirmwareVersion; + public String LocalFirmwareVersion + { + get { return _localFirmwareVersion; } + set { _localFirmwareVersion = value; RaisePropertyChangedAuto(); } + } + private String _remoteVersion; public String RemoteVersion { @@ -74,6 +81,13 @@ namespace Tango.PPC.Publisher.UI set { _remoteVersion = value; RaisePropertyChangedAuto(); } } + private String _remoteFirmwareVersion; + public String RemoteFirmwareVersion + { + get { return _remoteFirmwareVersion; } + set { _remoteFirmwareVersion = value; RaisePropertyChangedAuto(); } + } + private ICollectionView _provisionSequenceItemsView; public ICollectionView ProvisionSequenceItemsView { @@ -127,6 +141,7 @@ namespace Tango.PPC.Publisher.UI Options.BasicInfoChanged += (_, __) => InvalidateRelayCommands(); Options.EnvironmentChanged += async (_, __) => await OnEnvironmentChanged(); Options.BuidConfigChanged += async (_, __) => await UpdateVersions(); + Options.TfpPathChanged += async (_, __) => await UpdateVersions(); Init(); } @@ -165,9 +180,18 @@ namespace Tango.PPC.Publisher.UI { IsFree = false; LocalVersion = _publisher.GetLocalVersion(); + + try + { + LocalFirmwareVersion = _publisher.GetLocalFirmwareVersion(Options.TfpPath); + } + catch {} + if (SelectedMachineVersion != null) { - RemoteVersion = await _publisher.GetRemoteVersion(SelectedMachineVersion.Guid); + var latestVersion = await _publisher.GetRemoteVersion(SelectedMachineVersion.Guid); + RemoteVersion = latestVersion.Version; + RemoteFirmwareVersion = latestVersion.FirmwareVersion; } InvalidateRelayCommands(); IsFree = true; diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 10af2f725..22feb29c1 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -788,10 +788,13 @@ namespace Tango.MachineService.Controllers return new LatestVersionResponse() { Version = "0.0.0.0", + FirmwareVersion = "0.0.0.0" }; } - response.Version = versions.OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault().Version; + var latestTangoVersion = versions.OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); + response.Version = latestTangoVersion.Version; + response.FirmwareVersion = latestTangoVersion.FirmwareVersion; } return response; diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs index 386a7c4b8..a6aa93dee 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs @@ -24,4 +24,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.0.1.0")] |
