From 081d332a0494d309c2762f76f9dc5032a673ea0d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 7 Jul 2019 15:05:28 +0300 Subject: Removed Object extension methods from global namespace. --- .../Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs index 80a95d1bf..f1127ebfe 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Core.DI; +using Tango.Core.ExtensionMethods; using Tango.Integration.ExternalBridge; using Tango.PMR.Integration; using Tango.PPC.Common; -- cgit v1.3.1 From c2471c200471e62b80133542183eb14af7c79bc7 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 4 Aug 2019 12:59:34 +0300 Subject: Implemented emergency switch. --- .../Connection/DefaultMachineProvider.cs | 6 + .../Tango.PPC.Common/Navigation/NavigationView.cs | 3 +- .../PPC/Tango.PPC.Common/PPCSettings.cs | 12 ++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 9 ++ .../PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs | 51 ++++++++ .../PPC/Tango.PPC.UI/Views/EmergencyView.xaml | 21 ++++ .../PPC/Tango.PPC.UI/Views/EmergencyView.xaml.cs | 28 +++++ .../PPC/Tango.PPC.UI/Views/MainView.xaml | 1 + .../Tango.Integration/Emergency/EmergencyStatus.cs | 15 +++ .../Emergency/EmergencyStatusChangedEventArgs.cs | 14 +++ .../Emergency/IEmergencyNotificationProvider.cs | 34 +++++ .../Emergency/UsbEmergencyNotificationProvider.cs | 139 +++++++++++++++++++++ .../Operation/IMachineOperator.cs | 6 + .../Tango.Integration/Operation/MachineOperator.cs | 7 ++ .../Tango.Integration/Tango.Integration.csproj | 6 +- 16 files changed, 359 insertions(+), 3 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatus.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatusChangedEventArgs.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Emergency/IEmergencyNotificationProvider.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Emergency/UsbEmergencyNotificationProvider.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 7b3d85b75..46a7eeb62 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -158,6 +158,9 @@ namespace Tango.PPC.Common.Connection await Task.Delay(1000); await MachineOperator.UploadHardwareConfiguration(Machine.Configuration.HardwareVersion, Machine.Configuration); MachineOperator.UseKeepAlive = true; + + MachineOperator.EmergencyNotificationProvider.Address = settings.EmergencyComPort; + MachineOperator.EmergencyNotificationProvider.IsEnabled = settings.EnableEmergencyNotifications; } } else @@ -180,6 +183,9 @@ namespace Tango.PPC.Common.Connection await Task.Delay(1000); await MachineOperator.UploadHardwareConfiguration(Machine.Configuration.HardwareVersion, Machine.Configuration); + + MachineOperator.EmergencyNotificationProvider.Address = settings.EmergencyComPort; + MachineOperator.EmergencyNotificationProvider.IsEnabled = settings.EnableEmergencyNotifications; } } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs index e3129b970..b4562054c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs @@ -21,6 +21,7 @@ namespace Tango.PPC.Common.Navigation ExternalBridgeView, HomeModule, ShutdownView, - RestartingSystemView + RestartingSystemView, + EmergencyView } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index e98a03404..b495ec54d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -122,6 +122,16 @@ namespace Tango.PPC.Common /// public String LockScreenPassword { get; set; } + /// + /// Gets or sets the enable emergency notifications. + /// + public bool EnableEmergencyNotifications { get; set; } + + /// + /// Gets or sets the emergency COM port. + /// + public String EmergencyComPort { get; set; } + /// /// Gets the machine service address. /// @@ -149,6 +159,8 @@ namespace Tango.PPC.Common LockScreenPassword = "1111"; DeploymentSlot = DeploymentSlot.TEST; EnableWatchDog = true; + EnableEmergencyNotifications = true; + EmergencyComPort = "COM1"; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 9b3b58c67..389f5d59b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -143,6 +143,7 @@ + @@ -162,6 +163,9 @@ LayoutView.xaml + + EmergencyView.xaml + LoadingErrorView.xaml @@ -234,6 +238,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -538,7 +546,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 3517abbb2..67b5dc19b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -106,6 +106,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.GetInstance().ContentRendered += (_, __) => @@ -203,5 +204,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance(); } } + + public static EmergencyViewVM EmergencyViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs new file mode 100644 index 000000000..87b3c012b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Emergency; +using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; + +namespace Tango.PPC.UI.ViewModels +{ + public class EmergencyViewVM : PPCViewModel + { + private bool _isActive; + + public override void OnApplicationStarted() + { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + MachineProvider.MachineOperator.EmergencyNotificationProvider.StatusChanged += EmergencyNotificationProvider_StatusChanged; + } + + private void EmergencyNotificationProvider_StatusChanged(object sender, EmergencyStatusChangedEventArgs e) + { + InvokeUI(async () => + { + if (e.Status == EmergencyStatus.On && !_isActive) + { + LogManager.Log("Emergency switch activated..."); + _isActive = true; + await NavigationManager.NavigateTo(NavigationView.EmergencyView); + } + else if (_isActive) + { + LogManager.Log("Emergency switch deactivated..."); + _isActive = false; + await NavigationManager.NavigateTo(NavigationView.LayoutView); + } + + if (e.Status == EmergencyStatus.Error && e.ErrorException != null) + { + LogManager.Log(e.ErrorException, "Error occurred while detecting emergency switch."); + } + }); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml new file mode 100644 index 000000000..dfc70e602 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml @@ -0,0 +1,21 @@ + + + + + + Emergency Switch Activated + Please release the emergency switch to exit this screen. + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml.cs new file mode 100644 index 000000000..6c5020fbe --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/EmergencyView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Views +{ + /// + /// Interaction logic for LoadingErrorView.xaml + /// + public partial class EmergencyView : UserControl + { + public EmergencyView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 005edb182..5accd8ff3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -92,6 +92,7 @@ + diff --git a/Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatus.cs b/Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatus.cs new file mode 100644 index 000000000..85c35056f --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Integration.Emergency +{ + public enum EmergencyStatus + { + Error, + Off, + On, + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatusChangedEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatusChangedEventArgs.cs new file mode 100644 index 000000000..aad8ab4b7 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Emergency/EmergencyStatusChangedEventArgs.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Integration.Emergency +{ + public class EmergencyStatusChangedEventArgs + { + public EmergencyStatus Status { get; set; } + public Exception ErrorException { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Emergency/IEmergencyNotificationProvider.cs b/Software/Visual_Studio/Tango.Integration/Emergency/IEmergencyNotificationProvider.cs new file mode 100644 index 000000000..9d8f0d421 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Emergency/IEmergencyNotificationProvider.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Integration.Emergency +{ + /// + /// Represents a machine emergency notification provider. + /// + public interface IEmergencyNotificationProvider + { + /// + /// Gets or sets a value indicating whether to enable emergency detection and notification. + /// + bool IsEnabled { get; set; } + + /// + /// Gets or sets the address/port of the detection device. + /// + String Address { get; set; } + + /// + /// Gets or sets the current emergency status. + /// + EmergencyStatus Status { get; set; } + + /// + /// Occurs when the emergency status has changed. + /// + event EventHandler StatusChanged; + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Emergency/UsbEmergencyNotificationProvider.cs b/Software/Visual_Studio/Tango.Integration/Emergency/UsbEmergencyNotificationProvider.cs new file mode 100644 index 000000000..ece9d39bb --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Emergency/UsbEmergencyNotificationProvider.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.IO.Ports; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; + +namespace Tango.Integration.Emergency +{ + /// + /// Represents a USB serial port emergency switch notification provider. + /// + /// + public class UsbEmergencyNotificationProvider : IEmergencyNotificationProvider + { + private Timer _timer; + private bool _busy; + + /// + /// Gets or sets a value indicating whether to enable emergency detection and notification. + /// + public bool IsEnabled { get; set; } + + /// + /// Gets or sets the current emergency status. + /// + public EmergencyStatus Status { get; set; } + + /// + /// Gets or sets the address/port of the detection device. + /// + public string Address { get; set; } + + /// + /// Gets or sets the read timeout for the loop-back signal. + /// + public TimeSpan ReadTimeout { get; set; } + + /// + /// Gets or sets the signal output. + /// + public String SignalOutput { get; set; } + + /// + /// Occurs when the emergency status has changed. + /// + public event EventHandler StatusChanged; + + /// + /// Initializes a new instance of the class. + /// + /// The port. + public UsbEmergencyNotificationProvider(String port) + { + SignalOutput = "1"; + Address = port; + ReadTimeout = TimeSpan.FromMilliseconds(500); + _timer = new Timer(2000); + _timer.Elapsed += _timer_Elapsed; + _timer.Start(); + } + + /// + /// Called when the status has been changed. + /// + /// The status. + /// The error exception. + protected virtual void OnStatusChanged(EmergencyStatus status, Exception errorException = null) + { + if (Status != status) + { + Status = status; + StatusChanged?.Invoke(this, new EmergencyStatusChangedEventArgs() + { + Status = status, + ErrorException = errorException, + }); + } + } + + /// + /// Handles the Elapsed event of the _timer. + /// + /// The source of the event. + /// The instance containing the event data. + private void _timer_Elapsed(object sender, ElapsedEventArgs e) + { + if (IsEnabled && !_busy) + { + _busy = true; + + SerialPort serial = new SerialPort(Address); + try + { + serial.ReadTimeout = (int)ReadTimeout.TotalMilliseconds; + serial.Open(); + + serial.Write(SignalOutput + "\n"); + + try + { + string output = serial.ReadLine(); + + if (output == SignalOutput) + { + OnStatusChanged(EmergencyStatus.On); + } + else + { + OnStatusChanged(EmergencyStatus.Off); + } + } + catch (TimeoutException) + { + OnStatusChanged(EmergencyStatus.Off); + } + catch (Exception ex) + { + OnStatusChanged(EmergencyStatus.Error, ex); + } + } + catch (Exception ex) + { + OnStatusChanged(EmergencyStatus.Error, ex); + } + finally + { + try + { + serial.Dispose(); + _busy = false; + } + catch { } + } + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index e110e6189..d5f55c0d8 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -21,6 +21,7 @@ using Tango.Integration.Upgrade; using Tango.PMR.IO; using Tango.PMR.FirmwareUpgrade; using Tango.Integration.JobRuns; +using Tango.Integration.Emergency; namespace Tango.Integration.Operation { @@ -65,6 +66,11 @@ namespace Tango.Integration.Operation /// IGradientGenerationConfiguration GradientGenerationConfiguration { get; set; } + /// + /// Gets or sets the emergency notification provider. + /// + IEmergencyNotificationProvider EmergencyNotificationProvider { get; set; } + /// /// Gets a value indicating whether this instance is printing. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index ba00d21e6..5a8d910be 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -36,6 +36,7 @@ using Tango.FirmwareUpdateLib.WPF; using Tango.FirmwareUpdateLib; using Tango.Core.ExtensionMethods; using Tango.ColorConversion; +using Tango.Integration.Emergency; namespace Tango.Integration.Operation { @@ -92,6 +93,7 @@ namespace Tango.Integration.Operation LogEmbeddedDebuggingToFile = true; FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE; GradientGenerationConfiguration = new DefaultGradientGenerationConfiguration(); + EmergencyNotificationProvider = new UsbEmergencyNotificationProvider("COM1"); } /// @@ -397,6 +399,11 @@ namespace Tango.Integration.Operation set { _gradientGenerationConfiguration = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the emergency notification provider. + /// + public IEmergencyNotificationProvider EmergencyNotificationProvider { get; set; } + #endregion #region Virtual Methods diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 994a0ef2e..bbd9f8c0d 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -88,6 +88,10 @@ + + + + @@ -188,7 +192,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From 0c97dba8c1443ee39029136c52bc3861702888e2 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 22 Aug 2019 11:58:11 +0300 Subject: Added cartridge insertion validation handling. Implemented a better keep alive mechanism. --- .../Diagnostics/CartridgeValidationRequest.proto | 2 - .../Diagnostics/CartridgeValidationResponse.proto | 4 +- .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 2 +- .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 1 + .../Dialogs/CartridgeValidationView.xaml | 67 +++++++++++++++++++++ .../Dialogs/CartridgeValidationView.xaml.cs | 28 +++++++++ .../Dialogs/CartridgeValidationViewVM.cs | 37 ++++++++++++ .../Tango.PPC.UI/Images/cartridge_validation.png | Bin 0 -> 44260 bytes .../Notifications/DefaultNotificationProvider.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 11 +++- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 29 +++++++++ .../Tango.Emulations/Emulators/MachineEmulator.cs | 10 +++ .../ExternalBridge/ExternalBridgeService.cs | 2 + .../ExternalBridge/ExternalBridgeTcpClient.cs | 1 + .../Operation/CartridgeValidationEventArgs.cs | 50 +++++++++++++++ .../Operation/IMachineOperator.cs | 5 ++ .../Tango.Integration/Operation/MachineOperator.cs | 47 +++++++++++++++ .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Diagnostics/CartridgeValidationRequest.cs | 48 ++------------- .../Diagnostics/CartridgeValidationResponse.cs | 53 +++++++--------- .../Tango.Touch/Styles/TouchButton.xaml | 6 ++ .../Visual_Studio/Tango.Transport/ITransporter.cs | 5 ++ .../Tango.Transport/TransporterBase.cs | 21 ++++++- Software/Visual_Studio/Tango.sln | 12 ++-- .../Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 20 ++++++ .../Tango.MachineEM.UI/Views/MainView.xaml | 8 ++- 26 files changed, 383 insertions(+), 91 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png create mode 100644 Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto b/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto index 6ea8ba407..432643e67 100644 --- a/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto +++ b/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto @@ -1,6 +1,5 @@ syntax = "proto3"; -import "Cartridge.proto"; import "CartridgeAction.proto"; package Tango.PMR.Diagnostics; @@ -8,6 +7,5 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message CartridgeValidationRequest { - Cartridge Cartridge = 1; CartridgeAction Action = 2; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto b/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto index f3212faa6..5656c7987 100644 --- a/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto +++ b/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto @@ -1,12 +1,10 @@ syntax = "proto3"; -import "Cartridge.proto"; - package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; message CartridgeValidationResponse { bool IsValid = 1; - Cartridge Cartridge = 2; + int32 Index = 2; } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 8ed2ff80e..26fd06d2d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -472,7 +472,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index b5b9f9b23..04021d6b6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -49,6 +49,7 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs new file mode 100644 index 000000000..dbfb990b6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Dialogs +{ + /// + /// Interaction logic for TechnicianModeLoginView.xaml + /// + public partial class CartridgeValidationView : UserControl + { + public CartridgeValidationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs new file mode 100644 index 000000000..f901723a4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class CartridgeValidationViewVM : DialogViewVM + { + private List _idsPacks; + public List IDSPacks + { + get { return _idsPacks; } + set { _idsPacks = value; RaisePropertyChangedAuto(); } + } + + private IdsPack _selectedIDSPack; + public IdsPack SelectedIDSPack + { + get { return _selectedIDSPack; } + set { _selectedIDSPack = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public CartridgeValidationViewVM() + { + IDSPacks = new List(); + } + + protected override bool CanOK() + { + return base.CanOK() && SelectedIDSPack != null; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png new file mode 100644 index 000000000..373cb78c1 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index 5062df1d6..1c71b080d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -388,7 +388,7 @@ namespace Tango.PPC.UI.Notifications throw new NullReferenceException("The view " + viewType.ToString() + " is not of type framework element."); } - return ShowDialog(datacontext, Activator.CreateInstance(viewType) as FrameworkElement); + return ShowDialog(datacontext, view); } /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 389f5d59b..c2025b733 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -122,9 +122,13 @@ + + CartridgeValidationView.xaml + ScreenLockView.xaml + TechnicianModeLoginView.xaml @@ -194,6 +198,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -311,6 +319,7 @@ + @@ -546,7 +555,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index a4f550a39..01a47539e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Threading; using Tango.Core.DI; using Tango.Integration.ExternalBridge; +using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; @@ -14,6 +15,7 @@ using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; +using Tango.PPC.UI.Dialogs; using Tango.SharedUI; namespace Tango.PPC.UI.ViewModels @@ -49,6 +51,13 @@ namespace Tango.PPC.UI.ViewModels /// public override void OnApplicationStarted() { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; } #region Event Handlers @@ -63,6 +72,26 @@ namespace Tango.PPC.UI.ViewModels CurrentDateTime = DateTime.Now; } + private void MachineOperator_CartridgeValidationRequestReceived(object sender, CartridgeValidationEventArgs e) + { + InvokeUI(async () => + { + var vm = await NotificationProvider.ShowDialog(new CartridgeValidationViewVM() + { + IDSPacks = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.ToList(), + }); + + if (vm.DialogResult) + { + e.Approve(vm.SelectedIDSPack.PackIndex); + } + else + { + e.Decline(); + } + }); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 0a219b824..dea2ddb69 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -1312,6 +1312,16 @@ namespace Tango.Emulations.Emulators #region Public Methods + public async Task ValidateCartridge() + { + var response = await Transporter.SendRequest(new CartridgeValidationRequest() + { + Action = CartridgeAction.Inserted, + + }, TimeSpan.FromSeconds(10)); + + return response.Message.Index; + } #endregion } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 648046bd2..b7921aac3 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -145,6 +145,8 @@ namespace Tango.Integration.ExternalBridge _tcpServer.ClientConnected += _tcpServer_ClientConnected; LogManager.NewLog += LogManager_NewLog; + + KeepAliveTimeout = TimeSpan.FromSeconds(5); } /// diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index ef00133df..9adc1f223 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -251,6 +251,7 @@ namespace Tango.Integration.ExternalBridge SerialNumber = serialNumber; Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == serialNumber); IPAddress = ipAddress; + KeepAliveTimeout = TimeSpan.FromSeconds(5); UseKeepAlive = false; EnableDiagnostics = true; } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs new file mode 100644 index 000000000..6ef6e43c6 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; + +namespace Tango.Integration.Operation +{ + /// + /// Represents a cartridge validation request event arguments. + /// + /// + public class CartridgeValidationEventArgs : EventArgs + { + private Action _approveAction; + private Action _declineAction; + + /// + /// Initializes a new instance of the class. + /// + /// The request. + /// The approve action. + public CartridgeValidationEventArgs(CartridgeValidationRequest request, Action approveAction,Action declineAction) + { + Request = request; + _approveAction = approveAction; + _declineAction = declineAction; + } + + /// + /// Gets the request. + /// + public CartridgeValidationRequest Request { get; private set; } + + /// + /// Sends approved response for the specified cartridge index. + /// + /// The cartridge index. + public void Approve(int cartridgeIndex) + { + _approveAction(cartridgeIndex); + } + + public void Decline() + { + _declineAction(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index 89c947764..ae303563b 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -167,6 +167,11 @@ namespace Tango.Integration.Operation /// event EventHandler MachineStatusChanged; + /// + /// Occurs when a new cartridge validation request has been received. + /// + event EventHandler CartridgeValidationRequestReceived; + /// /// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 3fd24b20b..0c842d0da 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -137,6 +137,11 @@ namespace Tango.Integration.Operation /// public event EventHandler MachineStatusChanged; + /// + /// Occurs when a new cartridge validation request has been received. + /// + public event EventHandler CartridgeValidationRequestReceived; + /// /// Occurs when a request has been sent. /// @@ -776,6 +781,20 @@ namespace Tango.Integration.Operation ResponseReceived?.Invoke(this, response); } + /// + /// Called when a new request has been received. + /// + /// The request. + protected override void OnRequestReceived(MessageContainer container) + { + base.OnRequestReceived(container); + + if (container.Type == MessageType.CartridgeValidationRequest) + { + OnCartridgeValidationRequestReceived(container.Token, MessageFactory.ExtractMessageFromContainer(container)); + } + } + /// /// Called when the response has been sent /// @@ -803,6 +822,34 @@ namespace Tango.Integration.Operation StatusChanged?.Invoke(this, status); } + /// + /// Called when the cartridge validation request has been received. + /// + /// The request. + protected virtual void OnCartridgeValidationRequestReceived(String token, CartridgeValidationRequest request) + { + CartridgeValidationEventArgs e = new CartridgeValidationEventArgs(request, (index) => + { + //Approve + SendResponse(new CartridgeValidationResponse() + { + IsValid = true, + Index = index, + }, token).Wait(); + + }, () => + { + //Decline + SendResponse(new CartridgeValidationResponse() + { + + }, token).Wait(); + + }); + + CartridgeValidationRequestReceived?.Invoke(this, e); + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index bbd9f8c0d..62ff18fb6 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -99,6 +99,7 @@ + @@ -192,7 +193,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs index 149c2b6cb..5dc0fa044 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs @@ -23,16 +23,14 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiBDYXJ0cmlkZ2VWYWxpZGF0aW9uUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1S", - "LkRpYWdub3N0aWNzGg9DYXJ0cmlkZ2UucHJvdG8aFUNhcnRyaWRnZUFjdGlv", - "bi5wcm90byKJAQoaQ2FydHJpZGdlVmFsaWRhdGlvblJlcXVlc3QSMwoJQ2Fy", - "dHJpZGdlGAEgASgLMiAuVGFuZ28uUE1SLkRpYWdub3N0aWNzLkNhcnRyaWRn", - "ZRI2CgZBY3Rpb24YAiABKA4yJi5UYW5nby5QTVIuRGlhZ25vc3RpY3MuQ2Fy", - "dHJpZGdlQWN0aW9uQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25vc3Rp", - "Y3NiBnByb3RvMw==")); + "LkRpYWdub3N0aWNzGhVDYXJ0cmlkZ2VBY3Rpb24ucHJvdG8iVAoaQ2FydHJp", + "ZGdlVmFsaWRhdGlvblJlcXVlc3QSNgoGQWN0aW9uGAIgASgOMiYuVGFuZ28u", + "UE1SLkRpYWdub3N0aWNzLkNhcnRyaWRnZUFjdGlvbkIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.CartridgeReflection.Descriptor, global::Tango.PMR.Diagnostics.CartridgeActionReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.CartridgeActionReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationRequest), global::Tango.PMR.Diagnostics.CartridgeValidationRequest.Parser, new[]{ "Cartridge", "Action" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationRequest), global::Tango.PMR.Diagnostics.CartridgeValidationRequest.Parser, new[]{ "Action" }, null, null, null) })); } #endregion @@ -63,7 +61,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CartridgeValidationRequest(CartridgeValidationRequest other) : this() { - Cartridge = other.cartridge_ != null ? other.Cartridge.Clone() : null; action_ = other.action_; } @@ -72,17 +69,6 @@ namespace Tango.PMR.Diagnostics { return new CartridgeValidationRequest(this); } - /// Field number for the "Cartridge" field. - public const int CartridgeFieldNumber = 1; - private global::Tango.PMR.Diagnostics.Cartridge cartridge_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Tango.PMR.Diagnostics.Cartridge Cartridge { - get { return cartridge_; } - set { - cartridge_ = value; - } - } - /// Field number for the "Action" field. public const int ActionFieldNumber = 2; private global::Tango.PMR.Diagnostics.CartridgeAction action_ = 0; @@ -107,7 +93,6 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Cartridge, other.Cartridge)) return false; if (Action != other.Action) return false; return true; } @@ -115,7 +100,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (cartridge_ != null) hash ^= Cartridge.GetHashCode(); if (Action != 0) hash ^= Action.GetHashCode(); return hash; } @@ -127,10 +111,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (cartridge_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Cartridge); - } if (Action != 0) { output.WriteRawTag(16); output.WriteEnum((int) Action); @@ -140,9 +120,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (cartridge_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cartridge); - } if (Action != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Action); } @@ -154,12 +131,6 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.cartridge_ != null) { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - Cartridge.MergeFrom(other.Cartridge); - } if (other.Action != 0) { Action = other.Action; } @@ -173,13 +144,6 @@ namespace Tango.PMR.Diagnostics { default: input.SkipLastField(); break; - case 10: { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - input.ReadMessage(cartridge_); - break; - } case 16: { action_ = (global::Tango.PMR.Diagnostics.CartridgeAction) input.ReadEnum(); break; diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs index 7463f0270..e128809df 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs @@ -23,14 +23,13 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiFDYXJ0cmlkZ2VWYWxpZGF0aW9uUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBN", - "Ui5EaWFnbm9zdGljcxoPQ2FydHJpZGdlLnByb3RvImMKG0NhcnRyaWRnZVZh", - "bGlkYXRpb25SZXNwb25zZRIPCgdJc1ZhbGlkGAEgASgIEjMKCUNhcnRyaWRn", - "ZRgCIAEoCzIgLlRhbmdvLlBNUi5EaWFnbm9zdGljcy5DYXJ0cmlkZ2VCIQof", - "Y29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + "Ui5EaWFnbm9zdGljcyI9ChtDYXJ0cmlkZ2VWYWxpZGF0aW9uUmVzcG9uc2US", + "DwoHSXNWYWxpZBgBIAEoCBINCgVJbmRleBgCIAEoBUIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.CartridgeReflection.Descriptor, }, + new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationResponse), global::Tango.PMR.Diagnostics.CartridgeValidationResponse.Parser, new[]{ "IsValid", "Cartridge" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationResponse), global::Tango.PMR.Diagnostics.CartridgeValidationResponse.Parser, new[]{ "IsValid", "Index" }, null, null, null) })); } #endregion @@ -62,7 +61,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CartridgeValidationResponse(CartridgeValidationResponse other) : this() { isValid_ = other.isValid_; - Cartridge = other.cartridge_ != null ? other.Cartridge.Clone() : null; + index_ = other.index_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -81,14 +80,14 @@ namespace Tango.PMR.Diagnostics { } } - /// Field number for the "Cartridge" field. - public const int CartridgeFieldNumber = 2; - private global::Tango.PMR.Diagnostics.Cartridge cartridge_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 2; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Tango.PMR.Diagnostics.Cartridge Cartridge { - get { return cartridge_; } + public int Index { + get { return index_; } set { - cartridge_ = value; + index_ = value; } } @@ -106,7 +105,7 @@ namespace Tango.PMR.Diagnostics { return true; } if (IsValid != other.IsValid) return false; - if (!object.Equals(Cartridge, other.Cartridge)) return false; + if (Index != other.Index) return false; return true; } @@ -114,7 +113,7 @@ namespace Tango.PMR.Diagnostics { public override int GetHashCode() { int hash = 1; if (IsValid != false) hash ^= IsValid.GetHashCode(); - if (cartridge_ != null) hash ^= Cartridge.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); return hash; } @@ -129,9 +128,9 @@ namespace Tango.PMR.Diagnostics { output.WriteRawTag(8); output.WriteBool(IsValid); } - if (cartridge_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Cartridge); + if (Index != 0) { + output.WriteRawTag(16); + output.WriteInt32(Index); } } @@ -141,8 +140,8 @@ namespace Tango.PMR.Diagnostics { if (IsValid != false) { size += 1 + 1; } - if (cartridge_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cartridge); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } return size; } @@ -155,11 +154,8 @@ namespace Tango.PMR.Diagnostics { if (other.IsValid != false) { IsValid = other.IsValid; } - if (other.cartridge_ != null) { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - Cartridge.MergeFrom(other.Cartridge); + if (other.Index != 0) { + Index = other.Index; } } @@ -175,11 +171,8 @@ namespace Tango.PMR.Diagnostics { IsValid = input.ReadBool(); break; } - case 18: { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - input.ReadMessage(cartridge_); + case 16: { + Index = input.ReadInt32(); break; } } diff --git a/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml b/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml index d8d843b78..2fd056b6d 100644 --- a/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml +++ b/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml @@ -47,6 +47,12 @@ + + + + + +