From 27671ba7c2a09b201a9fe92b11bad482ab93f93f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 30 Oct 2019 14:05:30 +0200 Subject: Implemented PPC rollback procedures. --- .../Web/Tango.MachineService/Controllers/PPCController.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers') diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index d8dc4a7b8..fe6bfad29 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -224,6 +224,9 @@ namespace Tango.MachineService.Controllers throw new AuthenticationException("The specified serial number could not be found."); } + response.SetupFirmware = machine.SetupFirmware; + response.SetupFPGA = machine.SetupFpga; + if (!machine.SuspendVersionUpdate) { var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); -- cgit v1.3.1 From 2f91af8a799782b821acf4e66c84ea7aefa27048 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 30 Oct 2019 16:31:07 +0200 Subject: Added firmware version to TANGO_VERSIONS. Added total version info to TUP file as 'version.json'. --- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 18 +-- .../PPC/Tango.PPC.Common/Publish/PPCPublisher.cs | 25 +++++ .../PPC/Tango.PPC.Common/Publish/PublishInfo.cs | 32 ++++++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 11 +- .../Tango.PPC.Common/Web/UploadVersionRequest.cs | 2 + .../PPC/Tango.PPC.Common/packages.config | 1 + .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Tango.BL/DTO/TangoVersionDTOBase.cs | 8 ++ .../Tango.BL/Entities/TangoVersionBase.cs | 38 +++++++ .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 124 ++++++++++----------- .../Tango.DAL.Remote/DB/TANGO_VERSIONS.cs | 1 + .../Controllers/PPCController.cs | 2 + .../Models/PPCPendingUpload.cs | 2 + 15 files changed, 197 insertions(+), 72 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers') diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index a603ff06b..6d87e9201 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index 9999d9c0f..f1920c766 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -106,7 +106,6 @@ - @@ -179,12 +178,15 @@ + + + - + @@ -290,7 +292,7 @@ - + @@ -383,6 +385,9 @@ + + + @@ -395,7 +400,7 @@ - + @@ -462,7 +467,6 @@ - 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 5131522e0..526d4465a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Tango.AdvancedInstaller; using Tango.Core; using Tango.Core.Helpers; +using Tango.PMR.FirmwareUpgrade; using Tango.PPC.Common.Web; using Tango.SQLExaminer; using Tango.Transport.Web; @@ -181,6 +182,7 @@ namespace Tango.PPC.Common.Publish Version = local_version, MachineVersionGuid = Options.MachineVersionGuid, WithInstaller = !String.IsNullOrWhiteSpace(Options.InstallerProject), + FirmwareVersion = GetVersionInfoFromTFP(Options.TfpPath).FileDescriptors.SingleOrDefault(x => x.Destination == VersionFileDestination.Mcu).Version, }).Result; @@ -289,6 +291,15 @@ namespace Tango.PPC.Common.Publish { zip.AddFile(Options.TfpPath, "/").FileName = "firmware_package.tfp"; + PublishInfo versionInfo = new PublishInfo(); + versionInfo.ApplicationVersion = GetLocalVersion(); + versionInfo.Comments = Options.Comments; + versionInfo.Firmware = GetVersionInfoFromTFP(Options.TfpPath); + + var versionInfoFile = TemporaryManager.CreateImaginaryFile(); + File.WriteAllText(versionInfoFile, versionInfo.ToJson()); + zip.AddFile(versionInfoFile, "/").FileName = "version.json"; + String provision_dir = "Provision Scripts"; zip.AddDirectoryByName(provision_dir); @@ -378,6 +389,20 @@ namespace Tango.PPC.Common.Publish }); } + /// + /// Gets the version information from a TFP file. + /// + /// The TFP file. + /// + private VersionPackageDescriptor GetVersionInfoFromTFP(String tfpFile) + { + using (ZipFile zip = ZipFile.Read(tfpFile)) + { + var reader = zip.Entries.SingleOrDefault(x => x.FileName == "package.cfg").OpenReader(); + return VersionPackageDescriptor.Parser.ParseFrom(reader); + } + } + /// /// Raises the publish progress event. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs new file mode 100644 index 000000000..77717254e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs @@ -0,0 +1,32 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.FirmwareUpgrade; + +namespace Tango.PPC.Common.Publish +{ + public class PublishInfo + { + public String ApplicationVersion { get; set; } + public VersionPackageDescriptor Firmware { get; set; } + public String Comments { get; set; } + + public PublishInfo() + { + Firmware = new VersionPackageDescriptor(); + } + + public String ToJson() + { + return JsonConvert.SerializeObject(this); + } + + public PublishInfo FromJson(String json) + { + return JsonConvert.DeserializeObject(json); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 37885628d..21aad41f4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -73,6 +73,9 @@ + + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + @@ -117,6 +120,7 @@ GlobalVersionInfo.cs + @@ -144,6 +148,7 @@ + @@ -279,7 +284,9 @@ ResXFileCodeGenerator Resources.Designer.cs - + + Designer + SettingsSingleFileGenerator @@ -377,7 +384,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs index 29d533043..eaf2c2002 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs @@ -12,6 +12,8 @@ namespace Tango.PPC.Common.Web { public String Version { get; set; } + public String FirmwareVersion { get; set; } + public String MachineVersionGuid { get; set; } public String Comments { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config b/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config index d13fa64fc..50785f217 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config @@ -6,6 +6,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 92deb6bca..02099e659 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.49.0")] +[assembly: AssemblyVersion("1.0.50.0")] diff --git a/Software/Visual_Studio/Tango.BL/DTO/TangoVersionDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/TangoVersionDTOBase.cs index 7e744706a..3b77ba537 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/TangoVersionDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/TangoVersionDTOBase.cs @@ -29,6 +29,14 @@ namespace Tango.BL.DTO get; set; } + /// + /// firmware version + /// + public String FirmwareVersion + { + get; set; + } + /// /// blob name /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs index a7bb72137..ddf7561af 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs @@ -28,6 +28,8 @@ namespace Tango.BL.Entities public event EventHandler VersionChanged; + public event EventHandler FirmwareVersionChanged; + public event EventHandler BlobNameChanged; public event EventHandler InstallerBlobNameChanged; @@ -65,6 +67,33 @@ namespace Tango.BL.Entities } } + protected String _firmwareversion; + + /// + /// Gets or sets the tangoversionbase firmware version. + /// + + [Column("FIRMWARE_VERSION")] + + public String FirmwareVersion + { + get + { + return _firmwareversion; + } + + set + { + if (_firmwareversion != value) + { + _firmwareversion = value; + + OnFirmwareVersionChanged(value); + + } + } + } + protected String _blobname; /// @@ -271,6 +300,15 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(Version)); } + /// + /// Called when the FirmwareVersion has changed. + /// + protected virtual void OnFirmwareVersionChanged(String firmwareversion) + { + FirmwareVersionChanged?.Invoke(this, firmwareversion); + RaisePropertyChanged(nameof(FirmwareVersion)); + } + /// /// Called when the BlobName has changed. /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 59eaba8d0..19fb2c9fc 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -971,6 +971,7 @@ + @@ -4086,6 +4087,7 @@ + @@ -6321,6 +6323,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 842c5b9a6..79b65efb0 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,79 +5,79 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - + + + + + - + - - - - - - - + + + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_VERSIONS.cs index 6c24d1eee..4c46e8170 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/TANGO_VERSIONS.cs @@ -18,6 +18,7 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public string VERSION { get; set; } + public string FIRMWARE_VERSION { get; set; } public string BLOB_NAME { get; set; } public string INSTALLER_BLOB_NAME { get; set; } public string COMMENTS { get; set; } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index fe6bfad29..a77212787 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -378,6 +378,7 @@ namespace Tango.MachineService.Controllers Version = request.Version, BlobName = blob.Name, MachineVersionGuid = request.MachineVersionGuid, + FirmwareVersion = request.FirmwareVersion, }; if (request.WithInstaller) @@ -424,6 +425,7 @@ namespace Tango.MachineService.Controllers UserGuid = upload.UserGuid, Version = upload.Version, MachineVersionGuid = upload.MachineVersionGuid, + FirmwareVersion = upload.FirmwareVersion, }); db.SaveChanges(); diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs b/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs index b97d8b6c8..408fd74dc 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpload.cs @@ -11,6 +11,8 @@ namespace Tango.MachineService.Models public String Version { get; set; } + public String FirmwareVersion { get; set; } + public String UserGuid { get; set; } public String Comments { get; set; } -- cgit v1.3.1