From f8e1ff79cc2fa09b52093c6e029392b3456ad8bb Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 10 Feb 2018 17:27:37 +0200 Subject: Added dispensers support on technician module. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/Graphics/cogwheel.svg | 52 ++++ Software/Graphics/cogwheel.xaml | 36 +++ Software/Graphics/dispenser-big.png | Bin 0 -> 1580 bytes Software/Graphics/dispenser-line.png | Bin 0 -> 36326 bytes Software/Graphics/ico-ac.svg | 16 ++ Software/Graphics/miscellaneous.svg | 78 ++++++ Software/Graphics/propeller.svg | 47 ++++ Software/Graphics/propeller.xaml | 17 ++ Software/Graphics/propeller2.xaml | 47 ++++ Software/Graphics/propeller3.svg | 5 + Software/Graphics/transportation.svg | 143 ++++++++++ Software/Graphics/volume.png | Bin 0 -> 1929 bytes Software/PMR/Messages/Common/MessageType.proto | 9 + .../Diagnostics/DispenserAbortHomingRequest.proto | 9 + .../Diagnostics/DispenserAbortHomingResponse.proto | 9 + .../Diagnostics/DispenserAbortJoggingRequest.proto | 9 + .../DispenserAbortJoggingResponse.proto | 9 + .../Diagnostics/DispenserHomingRequest.proto | 10 + .../Diagnostics/DispenserHomingResponse.proto | 10 + .../Diagnostics/DispenserJoggingRequest.proto | 13 + .../Diagnostics/DispenserJoggingResponse.proto | 9 + .../Messages/Diagnostics/MotorHomingResponse.proto | 4 +- .../Editors/DispenserElementEditor.xaml | 288 +++++++++++++++++++++ .../Editors/DispenserElementEditor.xaml.cs | 181 +++++++++++++ .../Editors/MeterElementEditor.xaml | 6 +- .../Editors/MonitorElementEditor.xaml | 4 +- .../Editors/MotorElementEditor.xaml | 50 ++-- .../Editors/MultiGraphElementEditor.xaml | 4 +- .../Editors/SingleGraphElementEditor.xaml | 4 +- .../Images/dispenser-big.png | Bin 0 -> 1580 bytes .../Images/dispenser-line.png | Bin 0 -> 36326 bytes .../Images/volume.png | Bin 0 -> 1929 bytes .../PropertiesTemplates/DispenserTemplate.xaml | 44 ++++ .../PropertiesTemplates/DispenserTemplate.xaml.cs | 28 ++ .../PropertiesTemplates/MotorTemplate.xaml | 44 ++++ .../PropertiesTemplates/MotorTemplate.xaml.cs | 28 ++ .../Tango.MachineStudio.Technician.csproj | 47 ++++ .../TechItems/DispenserItem.cs | 127 +++++++++ .../TechItems/MeterItem.cs | 2 +- .../TechItems/MotorItem.cs | 10 + .../ViewModels/MachineTechViewVM.cs | 122 +++++++-- .../Views/MachineTechView.xaml | 33 ++- .../Tango.MachineStudio.Technician/packages.config | 6 + .../Controls/RealTimeGraphControl.xaml | 2 +- .../Controls/RealTimeGraphMultiControl.xaml | 2 +- .../ExtensionMethods/ObjectExtensions.cs | 13 +- .../Visual_Studio/Tango.Core/Tango.Core.csproj | 3 + Software/Visual_Studio/Tango.Core/packages.config | 1 + .../Tango.Emulations/Emulators/MachineEmulator.cs | 163 +++++++++++- .../Operators/IMachineOperator.cs | 43 +++ .../Tango.Integration/Operators/MachineOperator.cs | 60 +++++ Software/Visual_Studio/Tango.Logging/LogManager.cs | 25 +- .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 22 +- .../Diagnostics/DispenserAbortHomingRequest.cs | 160 ++++++++++++ .../Diagnostics/DispenserAbortHomingResponse.cs | 131 ++++++++++ .../Diagnostics/DispenserAbortJoggingRequest.cs | 160 ++++++++++++ .../Diagnostics/DispenserAbortJoggingResponse.cs | 160 ++++++++++++ .../Diagnostics/DispenserHomingRequest.cs | 188 ++++++++++++++ .../Diagnostics/DispenserHomingResponse.cs | 188 ++++++++++++++ .../Diagnostics/DispenserJoggingRequest.cs | 218 ++++++++++++++++ .../Diagnostics/DispenserJoggingResponse.cs | 131 ++++++++++ .../Tango.PMR/Diagnostics/MotorHomingResponse.cs | 46 ++-- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 8 + .../Visual_Studio/Tango.UnitTesting/App.config | 8 + .../Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml | 12 + .../AnalogSwitch/AnalogSwitch.xaml.cs | 66 +++++ .../Visual_Studio/Tango.Visuals/Images/off.png | Bin 0 -> 14366 bytes Software/Visual_Studio/Tango.Visuals/Images/on.png | Bin 0 -> 19420 bytes Software/Visual_Studio/Tango.Visuals/Led/Led.xaml | 117 +++++++++ .../Visual_Studio/Tango.Visuals/Led/Led.xaml.cs | 179 +++++++++++++ .../Tango.Visuals/Tango.Visuals.csproj | 25 ++ .../Utilities/Tango.UITests/App.config | 10 +- .../Utilities/Tango.UITests/MainWindow.xaml | 3 +- 75 files changed, 3603 insertions(+), 101 deletions(-) create mode 100644 Software/Graphics/cogwheel.svg create mode 100644 Software/Graphics/cogwheel.xaml create mode 100644 Software/Graphics/dispenser-big.png create mode 100644 Software/Graphics/dispenser-line.png create mode 100644 Software/Graphics/ico-ac.svg create mode 100644 Software/Graphics/miscellaneous.svg create mode 100644 Software/Graphics/propeller.svg create mode 100644 Software/Graphics/propeller.xaml create mode 100644 Software/Graphics/propeller2.xaml create mode 100644 Software/Graphics/propeller3.svg create mode 100644 Software/Graphics/transportation.svg create mode 100644 Software/Graphics/volume.png create mode 100644 Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserAbortHomingResponse.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserHomingResponse.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/DispenserJoggingResponse.proto create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-big.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-line.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/volume.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingResponse.cs create mode 100644 Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml create mode 100644 Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml.cs create mode 100644 Software/Visual_Studio/Tango.Visuals/Images/off.png create mode 100644 Software/Visual_Studio/Tango.Visuals/Images/on.png create mode 100644 Software/Visual_Studio/Tango.Visuals/Led/Led.xaml create mode 100644 Software/Visual_Studio/Tango.Visuals/Led/Led.xaml.cs (limited to 'Software') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 576b52c73..2352d6907 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 ebd2921bf..1a3991eae 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/cogwheel.svg b/Software/Graphics/cogwheel.svg new file mode 100644 index 000000000..c6e68a60d --- /dev/null +++ b/Software/Graphics/cogwheel.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/cogwheel.xaml b/Software/Graphics/cogwheel.xaml new file mode 100644 index 000000000..140885be7 --- /dev/null +++ b/Software/Graphics/cogwheel.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/dispenser-big.png b/Software/Graphics/dispenser-big.png new file mode 100644 index 000000000..284b1da0e Binary files /dev/null and b/Software/Graphics/dispenser-big.png differ diff --git a/Software/Graphics/dispenser-line.png b/Software/Graphics/dispenser-line.png new file mode 100644 index 000000000..9e2e344c0 Binary files /dev/null and b/Software/Graphics/dispenser-line.png differ diff --git a/Software/Graphics/ico-ac.svg b/Software/Graphics/ico-ac.svg new file mode 100644 index 000000000..c72933a0b --- /dev/null +++ b/Software/Graphics/ico-ac.svg @@ -0,0 +1,16 @@ + + + + + + diff --git a/Software/Graphics/miscellaneous.svg b/Software/Graphics/miscellaneous.svg new file mode 100644 index 000000000..e04c7ce3c --- /dev/null +++ b/Software/Graphics/miscellaneous.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/propeller.svg b/Software/Graphics/propeller.svg new file mode 100644 index 000000000..9299250a9 --- /dev/null +++ b/Software/Graphics/propeller.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/propeller.xaml b/Software/Graphics/propeller.xaml new file mode 100644 index 000000000..bc688df26 --- /dev/null +++ b/Software/Graphics/propeller.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/propeller2.xaml b/Software/Graphics/propeller2.xaml new file mode 100644 index 000000000..d083f9aef --- /dev/null +++ b/Software/Graphics/propeller2.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/propeller3.svg b/Software/Graphics/propeller3.svg new file mode 100644 index 000000000..110115909 --- /dev/null +++ b/Software/Graphics/propeller3.svg @@ -0,0 +1,5 @@ + + ed244817-8d6e-440e-a6f5-07dd506aa9a9 + + + diff --git a/Software/Graphics/transportation.svg b/Software/Graphics/transportation.svg new file mode 100644 index 000000000..a77a1e017 --- /dev/null +++ b/Software/Graphics/transportation.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Graphics/volume.png b/Software/Graphics/volume.png new file mode 100644 index 000000000..4f48f7528 Binary files /dev/null and b/Software/Graphics/volume.png differ diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 24a398e01..0c43f2b2d 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -69,6 +69,15 @@ enum MessageType MotorAbortJoggingRequest = 2008; MotorAbortJoggingResponse = 2009; + DispenserAbortHomingRequest = 2010; + DispenserAbortHomingResponse = 2011; + DispenserHomingRequest = 2012; + DispenserHomingResponse = 2013; + DispenserJoggingRequest = 2014; + DispenserJoggingResponse = 2015; + DispenserAbortJoggingRequest = 2016; + DispenserAbortJoggingResponse = 2017; + //Printing JobRequest = 3000; diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto new file mode 100644 index 000000000..a50c64c76 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserAbortHomingRequest +{ + int32 Code = 1; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortHomingResponse.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortHomingResponse.proto new file mode 100644 index 000000000..04c242ddd --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortHomingResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserAbortHomingResponse +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto new file mode 100644 index 000000000..7767ea60f --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserAbortJoggingRequest +{ + int32 Code = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto new file mode 100644 index 000000000..df0fa3fad --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserAbortJoggingResponse +{ + int32 Code = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto new file mode 100644 index 000000000..6263b228c --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserHomingRequest +{ + int32 Code = 1; + double Speed = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserHomingResponse.proto b/Software/PMR/Messages/Diagnostics/DispenserHomingResponse.proto new file mode 100644 index 000000000..c7e249ad3 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserHomingResponse.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserHomingResponse +{ + double Progress = 1; + double MaxProgress = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto new file mode 100644 index 000000000..2eba7cd1b --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +import "MotorDirection.proto"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserJoggingRequest +{ + MotorDirection Direction = 1; + int32 Code = 2; + double Speed = 3; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserJoggingResponse.proto b/Software/PMR/Messages/Diagnostics/DispenserJoggingResponse.proto new file mode 100644 index 000000000..7b6ccea8d --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DispenserJoggingResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DispenserJoggingResponse +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/MotorHomingResponse.proto b/Software/PMR/Messages/Diagnostics/MotorHomingResponse.proto index f79b85955..1ee59cd3b 100644 --- a/Software/PMR/Messages/Diagnostics/MotorHomingResponse.proto +++ b/Software/PMR/Messages/Diagnostics/MotorHomingResponse.proto @@ -5,6 +5,6 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message MotorHomingResponse { - int32 Progress = 1; - int32 MaxProgress = 2; + double Progress = 1; + double MaxProgress = 2; } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml new file mode 100644 index 000000000..b84da3b42 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs new file mode 100644 index 000000000..ef6e4c47c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.Integration.Observables; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class DispenserElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public DispenserElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public DispenserElementEditor(DispenserItem dispenserItem) + : this() + { + DispenserItem = dispenserItem; + DataContext = DispenserItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public DispenserElementEditor(DispenserItem monitorItem, Rect bounds) + : this(monitorItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DispenserItem _monitorItem; + + public DispenserItem DispenserItem + { + get { return _monitorItem; } + set + { + _monitorItem = value; RaisePropertyChanged(nameof(DispenserItem)); + + if (_monitorItem != null) + { + _monitorItem.HomingCompleted -= _monitorItem_HomingCompleted; + _monitorItem.HomingCompleted += _monitorItem_HomingCompleted; + } + } + } + + private void _monitorItem_HomingCompleted(object sender, EventArgs e) + { + StopAnimation(); + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DispenserItem.Clone() as DispenserItem; + DispenserElementEditor cloned = new DispenserElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return DispenserItem; } + } + + private void OnForwardPressed(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.ForwardPressed); + AnimateRight(); + } + + private void OnForwardReleased(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.ForwardReleased); + StopAnimation(); + } + + private void OnBackwardPressed(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.BackwardPressed); + AnimateLeft(); + } + + private void OnBackwardReleased(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.BackwardReleased); + StopAnimation(); + } + + private void OnHomingStarted(object sender, RoutedEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.HomingStarted); + AnimateLeft(); + } + + private void OnHomingStopped(object sender, RoutedEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.HomingStopped); + StopAnimation(); + } + + private void AnimateRight() + { + DoubleAnimation ani = new DoubleAnimation(); + ani.Duration = TimeSpan.FromSeconds(1); + ani.RepeatBehavior = RepeatBehavior.Forever; + ani.FillBehavior = FillBehavior.HoldEnd; + ani.To = 360; + propRotate.BeginAnimation(RotateTransform.AngleProperty, ani); + } + + private void AnimateLeft() + { + DoubleAnimation ani = new DoubleAnimation(); + ani.Duration = TimeSpan.FromSeconds(1); + ani.RepeatBehavior = RepeatBehavior.Forever; + ani.FillBehavior = FillBehavior.HoldEnd; + ani.To = -360; + propRotate.BeginAnimation(RotateTransform.AngleProperty, ani); + } + + public void StopAnimation() + { + this.Dispatcher.Invoke(() => + { + propRotate.BeginAnimation(RotateTransform.AngleProperty, null); + }); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml index 8a9345fa9..98ace7816 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" @@ -12,6 +13,7 @@ + @@ -26,13 +28,13 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml index 8e4520cc5..081a853bb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml @@ -5,12 +5,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" mc:Ignorable="d" d:DesignHeight="250" d:DesignWidth="300" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:MonitorItem, IsDesignTimeCreatable=False}"> + @@ -25,7 +27,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml index bf7aaeff4..a69f81538 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" @@ -13,6 +14,7 @@ + @@ -20,10 +22,12 @@ - - + + + @@ -42,7 +46,7 @@ - + @@ -55,27 +59,35 @@ - + - - - - - + + + + + + + + + + + + + - + - + - + - + @@ -158,13 +170,13 @@ - + + + + + + + + Selected Motor + + + Speed + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml.cs new file mode 100644 index 000000000..dd3a21b07 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.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.MachineStudio.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class DispenserTemplate : UserControl + { + public DispenserTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml new file mode 100644 index 000000000..0d92230ad --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + Selected Motor + + + Speed + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml.cs new file mode 100644 index 000000000..3ac58ce5d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.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.MachineStudio.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class MotorTemplate : UserControl + { + public MotorTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 0f92b6275..34208aded 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -60,6 +60,22 @@ + + ..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll + + + ..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll + + + ..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll + + + ..\..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll + + + ..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll @@ -81,6 +97,9 @@ + + DispenserElementEditor.xaml + MotorElementEditor.xaml @@ -100,6 +119,12 @@ MeterTemplate.xaml + + DispenserTemplate.xaml + + + MotorTemplate.xaml + MonitorTemplate.xaml @@ -111,6 +136,7 @@ + @@ -141,6 +167,10 @@ GlobalVersionInfo.cs + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -165,6 +195,14 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -311,5 +349,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs new file mode 100644 index 000000000..3cea8d127 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.Core.Commands; +using Tango.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class DispenserItem : TechItem + { + public event EventHandler ActionExecuted; + public event EventHandler HomingCompleted; + + private TechDispenser _techDispenser; + [XmlIgnore] + public TechDispenser TechDispenser + { + get { return _techDispenser; } + set { _techDispenser = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); } + } + + private bool _isHoming; + [XmlIgnore] + public bool IsHoming + { + get { return _isHoming; } + set + { + _isHoming = value; + RaisePropertyChangedAuto(); + } + } + + private bool _isHomingCompleted; + + public bool IsHomingCompleted + { + get { return _isHomingCompleted; } + set + { + _isHomingCompleted = value; + RaisePropertyChangedAuto(); + + if (value) + { + HomingCompleted?.Invoke(this, new EventArgs()); + } + } + } + + private double _homingProgress; + [XmlIgnore] + public double HomingProgress + { + get { return _homingProgress; } + set + { + _homingProgress = value; + RaisePropertyChangedAuto(); + } + } + + private double _homingMaximumProgress; + [XmlIgnore] + public double HomingMaximumProgress + { + get { return _homingMaximumProgress; } + set { _homingMaximumProgress = value; RaisePropertyChangedAuto(); } + } + + private bool _isForwardPressed; + [XmlIgnore] + public bool IsForwardPressed + { + get { return _isForwardPressed; } + set { _isForwardPressed = value; RaisePropertyChangedAuto(); } + } + + private bool _isBackwardPressed; + [XmlIgnore] + public bool IsBackwardPressed + { + get { return _isBackwardPressed; } + set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } + } + + private double _speed; + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + + public override object Data => TechDispenser; + + public DispenserItem() : base() + { + Name = "Dispenser"; + Description = "Dispenser Controller"; + Image = ResourceHelper.GetImageFromResources("Images/dispenser-big.png"); + Color = Colors.White; + } + + public DispenserItem(TechDispenser techDispenser) : this() + { + TechDispenser = techDispenser; + } + + public override TechItem Clone() + { + DispenserItem cloned = base.Clone() as DispenserItem; + cloned.TechDispenser = TechDispenser; + return cloned; + } + + public void RaiseAction(MotorActionType action) + { + ActionExecuted?.Invoke(this, action); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs index 9d4fd9d60..7cc2913eb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs @@ -67,7 +67,7 @@ namespace Tango.MachineStudio.Technician.TechItems { Name = "VU Monitor"; Description = "VU Meter monitor"; - Image = ResourceHelper.GetImageFromResources("Images/analog.png"); + Image = ResourceHelper.GetImageFromResources("Images/volume.png"); LastUpdateTime = DateTime.Now; UpdateInterval = 10; LedCount = 14; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs index a7088ac3f..272aedf44 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using System.Xml.Serialization; using Tango.Core.Commands; using Tango.Integration.Observables; @@ -88,6 +89,14 @@ namespace Tango.MachineStudio.Technician.TechItems set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } } + private double _speed; + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + public override object Data => TechMotor; public MotorItem() : base() @@ -95,6 +104,7 @@ namespace Tango.MachineStudio.Technician.TechItems Name = "Motor"; Description = "Motor Controller"; Image = ResourceHelper.GetImageFromResources("Images/engine.png"); + Color = Colors.White; } public MotorItem(TechMotor techMotor) : this() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 7bed3f441..8ed8a4a80 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -253,6 +253,13 @@ namespace Tango.MachineStudio.Technician.ViewModels Elements.Add(editor); InitMotorItem(motorItem); } + else if (SelectedTechItem is DispenserItem) + { + var dispenserItem = new DispenserItem(Adapter.TechDispensers.FirstOrDefault()); + DispenserElementEditor editor = new DispenserElementEditor(dispenserItem, bounds); + Elements.Add(editor); + InitDispenserItem(dispenserItem); + } } public void OnElementsRemoved(List elements) @@ -319,56 +326,139 @@ namespace Tango.MachineStudio.Technician.ViewModels { item.ActionExecuted += async (x, action) => { - if (action == MotorActionType.HomingStarted) + if (action == MotorActionType.ForwardPressed) + { + await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + { + Code = item.TechMotor.Code, + Direction = MotorDirection.Forward, + }); + } + else if (action == MotorActionType.ForwardReleased) + { + await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + { + Code = item.TechMotor.Code, + }); + } + else if (action == MotorActionType.BackwardPressed) + { + await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + { + Code = item.TechMotor.Code, + Direction = MotorDirection.Backward, + }); + } + else if (action == MotorActionType.BackwardReleased) + { + await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + { + Code = item.TechMotor.Code, + }); + } + else if (action == MotorActionType.HomingStarted) { item.HomingProgress = 0; item.IsHoming = true; item.IsHomingCompleted = false; - await Task.Factory.StartNew(() => + MachineOperator.StartMotorHoming(new MotorHomingRequest() + { + Code = item.TechMotor.Code + }) + .Subscribe((response) => { - for (int i = 0; i < 101; i++) - { - item.HomingMaximumProgress = 100; - item.HomingProgress++; - Thread.Sleep(60); - } + item.HomingMaximumProgress = response.Message.MaxProgress; + item.HomingProgress = response.Message.Progress; + + }, () => + { item.IsHoming = false; item.IsHomingCompleted = true; + }); } - else if (action == MotorActionType.ForwardPressed) + else if (action == MotorActionType.HomingStopped) { - await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + await MachineOperator.StopMotorHoming(new MotorAbortHomingRequest() { Code = item.TechMotor.Code, + }); + + item.IsHoming = false; + } + }; + } + + private void InitDispenserItem(DispenserItem item) + { + item.ActionExecuted += async (x, action) => + { + if (action == MotorActionType.ForwardPressed) + { + await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest() + { + Code = item.TechDispenser.Code, Direction = MotorDirection.Forward, }); } else if (action == MotorActionType.ForwardReleased) { - await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest() { - Code = item.TechMotor.Code, + Code = item.TechDispenser.Code, }); } else if (action == MotorActionType.BackwardPressed) { - await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest() { - Code = item.TechMotor.Code, + Code = item.TechDispenser.Code, Direction = MotorDirection.Backward, }); } else if (action == MotorActionType.BackwardReleased) { - await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest() { - Code = item.TechMotor.Code, + Code = item.TechDispenser.Code, + }); + } + else if (action == MotorActionType.HomingStarted) + { + item.HomingProgress = 0; + item.IsHoming = true; + item.IsHomingCompleted = false; + + MachineOperator.StartDispenserHoming(new DispenserHomingRequest() + { + Code = item.TechDispenser.Code + }) + .Subscribe((response) => + { + + item.HomingMaximumProgress = response.Message.MaxProgress; + item.HomingProgress = response.Message.Progress; + + }, () => + { + + item.IsHoming = false; + item.IsHomingCompleted = true; + }); } + else if (action == MotorActionType.HomingStopped) + { + await MachineOperator.StopDispenserHoming(new DispenserAbortHomingRequest() + { + Code = item.TechDispenser.Code, + }); + + item.IsHoming = false; + } }; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 7cdd92e06..9e3970719 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -50,15 +50,38 @@ - + @@ -177,6 +200,12 @@ + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config index 1d449350a..61695a8c5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config @@ -7,4 +7,10 @@ + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 8c364dde9..2f43869d5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -53,7 +53,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml index 2055e282c..5548c452e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml @@ -53,7 +53,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs index 88403f8a6..82bcaa9d4 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -49,4 +50,14 @@ public static class ObjectExtensions } } } + + /// + /// Serializes the specified object to indented json string. + /// + /// The object. + /// + public static String ToJsonString(this Object obj) + { + return JsonConvert.SerializeObject(obj, Formatting.Indented); + } } diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index da33c3f0a..e9d96417b 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -46,6 +46,9 @@ ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + diff --git a/Software/Visual_Studio/Tango.Core/packages.config b/Software/Visual_Studio/Tango.Core/packages.config index 114eefdba..bb569f026 100644 --- a/Software/Visual_Studio/Tango.Core/packages.config +++ b/Software/Visual_Studio/Tango.Core/packages.config @@ -3,5 +3,6 @@ + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index cbda54d56..5e76c2d1b 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -30,6 +30,9 @@ namespace Tango.Emulations.Emulators private PushDiagnosticsRequest _diagnosticsRequest; private bool _cancelJob; private List _motorJoggingRequestCodes; + private List _motorHomingRequestCodes; + private List _dispenserJoggingRequestCodes; + private List _dispenserHomingRequestCodes; private double _graphAmplitude; private double _graphFrequency; @@ -53,9 +56,16 @@ namespace Tango.Emulations.Emulators Init(); } + #endregion + + #region Private Methods + private void Init() { _motorJoggingRequestCodes = new List(); + _motorHomingRequestCodes = new List(); + _dispenserJoggingRequestCodes = new List(); + _dispenserHomingRequestCodes = new List(); ResetGraphFactors(); } @@ -99,6 +109,24 @@ namespace Tango.Emulations.Emulators case MessageType.MotorAbortJoggingRequest: HandleAbortMotorJoggingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; + case MessageType.MotorHomingRequest: + HandleMotorHomingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; + case MessageType.MotorAbortHomingRequest: + HandleAbortMotorHomingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; + case MessageType.DispenserJoggingRequest: + HandleDispenserJoggingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; + case MessageType.DispenserAbortJoggingRequest: + HandleAbortDispenserJoggingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; + case MessageType.DispenserHomingRequest: + HandleDispenserHomingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; + case MessageType.DispenserAbortHomingRequest: + HandleAbortDispenserHomingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; } } @@ -135,6 +163,8 @@ namespace Tango.Emulations.Emulators private void HandlePushDiagnosticsRequest(TangoMessage request) { + LogManager.Log("Push diagnostics request received " + Environment.NewLine + request.Message.ToJsonString()); + _diagnosticsRequest = request.Message; int value = 0; @@ -199,7 +229,7 @@ namespace Tango.Emulations.Emulators { JobTicket job = request.Message.JobTicket; - LogManager.Log("Job request received: " + Environment.NewLine + job.ToString()); + LogManager.Log("Job request received: " + Environment.NewLine + job.ToJsonString()); double progress = 0; _cancelJob = false; @@ -246,24 +276,25 @@ namespace Tango.Emulations.Emulators _motorJoggingRequestCodes.Add(jogRequest.Code); - LogManager.Log("Motor jogging request received: " + Environment.NewLine + jogRequest.ToString()); + LogManager.Log("Motor jogging request received: " + Environment.NewLine + jogRequest.ToJsonString()); - Task.Factory.StartNew(() => + Task.Factory.StartNew(() => { while (_motorJoggingRequestCodes.Contains(jogRequest.Code)) { - if (jogRequest.Direction == MotorDirection.Forward) { - _graphFrequency += 0.1; + _graphFrequency = 10; } else { - _graphFrequency -= 0.1; + _graphFrequency = 18; } Thread.Sleep(30); } + + ResetGraphFactors(); }); Transporter.SendResponse(new MotorJoggingResponse(), request.Container.Token); @@ -271,12 +302,128 @@ namespace Tango.Emulations.Emulators private void HandleAbortMotorJoggingRequest(TangoMessage request) { - LogManager.Log("Abort motor jogging request received: " + Environment.NewLine + request.Message.ToString()); - _motorJoggingRequestCodes.Remove(request.Message.Code); + LogManager.Log("Abort motor jogging request received: " + Environment.NewLine + request.Message.ToJsonString()); + _motorJoggingRequestCodes.RemoveAll(x => x == request.Message.Code); ResetGraphFactors(); Transporter.SendResponse(new MotorAbortJoggingResponse(), request.Container.Token); } + private void HandleMotorHomingRequest(TangoMessage request) + { + var homeRequest = request.Message; + + LogManager.Log("Motor homing request received: " + Environment.NewLine + homeRequest.ToJsonString()); + + _motorHomingRequestCodes.Add(homeRequest.Code); + + Task.Factory.StartNew(() => + { + _graphFrequency = 10; + + for (int i = 0; i < 100; i++) + { + Transporter.SendResponse(new MotorHomingResponse() { MaxProgress = 100, Progress = i }, request.Container.Token); + + if (!_motorHomingRequestCodes.Contains(homeRequest.Code)) + { + ResetGraphFactors(); + return; + } + + Thread.Sleep(30); + } + + Transporter.SendResponse(new MotorHomingResponse() { MaxProgress = 100, Progress = 100 }, request.Container.Token, true); + _motorHomingRequestCodes.Remove(homeRequest.Code); + ResetGraphFactors(); + }); + } + + private void HandleAbortMotorHomingRequest(TangoMessage request) + { + LogManager.Log("Abort motor homing request received: " + Environment.NewLine + request.Message.ToJsonString()); + _motorHomingRequestCodes.RemoveAll(x => x == request.Message.Code); + ResetGraphFactors(); + Transporter.SendResponse(new MotorAbortHomingResponse(), request.Container.Token); + } + + private void HandleDispenserJoggingRequest(TangoMessage request) + { + var jogRequest = request.Message; + + _dispenserJoggingRequestCodes.Add(jogRequest.Code); + + LogManager.Log("Dispenser jogging request received: " + Environment.NewLine + jogRequest.ToJsonString()); + + Task.Factory.StartNew(() => + { + while (_dispenserJoggingRequestCodes.Contains(jogRequest.Code)) + { + if (jogRequest.Direction == MotorDirection.Forward) + { + _graphFrequency = 10; + } + else + { + _graphFrequency = 18; + } + + Thread.Sleep(30); + } + + ResetGraphFactors(); + }); + + Transporter.SendResponse(new DispenserJoggingResponse(), request.Container.Token); + } + + private void HandleAbortDispenserJoggingRequest(TangoMessage request) + { + LogManager.Log("Abort dispenser jogging request received: " + Environment.NewLine + request.Message.ToJsonString()); + _dispenserJoggingRequestCodes.RemoveAll(x => x == request.Message.Code); + ResetGraphFactors(); + Transporter.SendResponse(new DispenserAbortJoggingResponse(), request.Container.Token); + } + + private void HandleDispenserHomingRequest(TangoMessage request) + { + var homeRequest = request.Message; + + LogManager.Log("Dispenser homing request received: " + Environment.NewLine + homeRequest.ToJsonString()); + + _dispenserHomingRequestCodes.Add(homeRequest.Code); + + Task.Factory.StartNew(() => + { + _graphFrequency = 10; + + for (int i = 0; i < 100; i++) + { + Transporter.SendResponse(new DispenserHomingResponse() { MaxProgress = 100, Progress = i }, request.Container.Token); + + if (!_dispenserHomingRequestCodes.Contains(homeRequest.Code)) + { + ResetGraphFactors(); + return; + } + + Thread.Sleep(30); + } + + Transporter.SendResponse(new DispenserHomingResponse() { MaxProgress = 100, Progress = 100 }, request.Container.Token, true); + _dispenserHomingRequestCodes.Remove(homeRequest.Code); + ResetGraphFactors(); + }); + } + + private void HandleAbortDispenserHomingRequest(TangoMessage request) + { + LogManager.Log("Abort dispenser homing request received: " + Environment.NewLine + request.Message.ToJsonString()); + _dispenserHomingRequestCodes.RemoveAll(x => x == request.Message.Code); + ResetGraphFactors(); + Transporter.SendResponse(new DispenserAbortHomingResponse(), request.Container.Token); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs index 6b64575de..14c5114f3 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs @@ -10,6 +10,7 @@ using Tango.Transport; using System.Reactive; using Tango.Integration.Printing; using Tango.PMR; +using System.Reactive.Linq; namespace Tango.Integration.Operators { @@ -50,5 +51,47 @@ namespace Tango.Integration.Operators /// The request. /// Task> StopMotorJogging(MotorAbortJoggingRequest request); + + /// + /// Starts homing the specified motor. + /// + /// The request. + /// + IObservable> StartMotorHoming(MotorHomingRequest request); + + /// + /// Stops homing the specified motor. + /// + /// The request. + /// + Task> StopMotorHoming(MotorAbortHomingRequest request); + + /// + /// Starts jogging the specified dispenser. + /// + /// The request. + /// + Task> StartDispenserJogging(DispenserJoggingRequest request); + + /// + /// Stops jogging the specified dispenser. + /// + /// The request. + /// + Task> StopDispenserJogging(DispenserAbortJoggingRequest request); + + /// + /// Starts homing the specified dispenser. + /// + /// The request. + /// + IObservable> StartDispenserHoming(DispenserHomingRequest request); + + /// + /// Stops homing the specified dispenser. + /// + /// The request. + /// + Task> StopDispenserHoming(DispenserAbortHomingRequest request); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs index 56b7ec971..f0d780191 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs @@ -204,6 +204,66 @@ namespace Tango.Integration.Operators return SendRequest(request); } + /// + /// Starts homing the specified motor. + /// + /// The request. + /// + public IObservable> StartMotorHoming(MotorHomingRequest request) + { + return SendContinuousRequest(request); + } + + /// + /// Stops homing the specified motor. + /// + /// The request. + /// + public Task> StopMotorHoming(MotorAbortHomingRequest request) + { + return SendRequest(request); + } + + /// + /// Starts jogging the specified dispenser. + /// + /// The request. + /// + public Task> StartDispenserJogging(DispenserJoggingRequest request) + { + return SendRequest(request); + } + + /// + /// Stops jogging the specified dispenser. + /// + /// The request. + /// + public Task> StopDispenserJogging(DispenserAbortJoggingRequest request) + { + return SendRequest(request); + } + + /// + /// Starts homing the specified dispenser. + /// + /// The request. + /// + public IObservable> StartDispenserHoming(DispenserHomingRequest request) + { + return SendContinuousRequest(request); + } + + /// + /// Stops homing the specified dispenser. + /// + /// The request. + /// + public Task> StopDispenserHoming(DispenserAbortHomingRequest request) + { + return SendRequest(request); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Logging/LogManager.cs b/Software/Visual_Studio/Tango.Logging/LogManager.cs index 43f40fcbe..b97058bfe 100644 --- a/Software/Visual_Studio/Tango.Logging/LogManager.cs +++ b/Software/Visual_Studio/Tango.Logging/LogManager.cs @@ -184,30 +184,23 @@ namespace Tango.Logging //[DebuggerHidden] private static void LoggingThreadMethod() { - while (_logs.Count > 0) + while (_isStarted) { - LogItemBase log; - - if (_logs.TryDequeue(out log)) + while (_logs.Count > 0) { - if (log != null) + LogItemBase log; + + if (_logs.TryDequeue(out log)) { - _loggers.Where(x => x.Enabled && !x.Immediate).ToList().ForEach(x => x.OnLog(log)); + if (log != null) + { + _loggers.Where(x => x.Enabled && !x.Immediate).ToList().ForEach(x => x.OnLog(log)); + } } } Thread.Sleep(10); } - - Thread.Sleep(400); - - if (_logs.Count > 0) - { - LoggingThreadMethod(); - return; - } - - _isStarted = false; } /// diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index ec378556b..86dfe19ad 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbireDAoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiriDgoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhQKEENhbGN1bGF0ZVJlcXVlc3QQAxIVChFD", "YWxjdWxhdGVSZXNwb25zZRAEEhMKD1Byb2dyZXNzUmVxdWVzdBAFEhQKEFBy", "b2dyZXNzUmVzcG9uc2UQBhIcChhTdHViQ2FydHJpZGdlUmVhZFJlcXVlc3QQ", @@ -57,9 +57,15 @@ namespace Tango.PMR.Common { "cXVlc3QQ1A8SGAoTTW90b3JIb21pbmdSZXNwb25zZRDVDxIYChNNb3Rvckpv", "Z2dpbmdSZXF1ZXN0ENYPEhkKFE1vdG9ySm9nZ2luZ1Jlc3BvbnNlENcPEh0K", "GE1vdG9yQWJvcnRKb2dnaW5nUmVxdWVzdBDYDxIeChlNb3RvckFib3J0Sm9n", - "Z2luZ1Jlc3BvbnNlENkPEg8KCkpvYlJlcXVlc3QQuBcSEAoLSm9iUmVzcG9u", - "c2UQuRcSFAoPQWJvcnRKb2JSZXF1ZXN0ELoXEhUKEEFib3J0Sm9iUmVzcG9u", - "c2UQuxdCHAoaY29tLnR3aW5lLnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); + "Z2luZ1Jlc3BvbnNlENkPEiAKG0Rpc3BlbnNlckFib3J0SG9taW5nUmVxdWVz", + "dBDaDxIhChxEaXNwZW5zZXJBYm9ydEhvbWluZ1Jlc3BvbnNlENsPEhsKFkRp", + "c3BlbnNlckhvbWluZ1JlcXVlc3QQ3A8SHAoXRGlzcGVuc2VySG9taW5nUmVz", + "cG9uc2UQ3Q8SHAoXRGlzcGVuc2VySm9nZ2luZ1JlcXVlc3QQ3g8SHQoYRGlz", + "cGVuc2VySm9nZ2luZ1Jlc3BvbnNlEN8PEiEKHERpc3BlbnNlckFib3J0Sm9n", + "Z2luZ1JlcXVlc3QQ4A8SIgodRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVzcG9u", + "c2UQ4Q8SDwoKSm9iUmVxdWVzdBC4FxIQCgtKb2JSZXNwb25zZRC5FxIUCg9B", + "Ym9ydEpvYlJlcXVlc3QQuhcSFQoQQWJvcnRKb2JSZXNwb25zZRC7F0IcChpj", + "b20udHdpbmUudGFuZ28ucG1yLmNvbW1vbmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -135,6 +141,14 @@ namespace Tango.PMR.Common { [pbr::OriginalName("MotorJoggingResponse")] MotorJoggingResponse = 2007, [pbr::OriginalName("MotorAbortJoggingRequest")] MotorAbortJoggingRequest = 2008, [pbr::OriginalName("MotorAbortJoggingResponse")] MotorAbortJoggingResponse = 2009, + [pbr::OriginalName("DispenserAbortHomingRequest")] DispenserAbortHomingRequest = 2010, + [pbr::OriginalName("DispenserAbortHomingResponse")] DispenserAbortHomingResponse = 2011, + [pbr::OriginalName("DispenserHomingRequest")] DispenserHomingRequest = 2012, + [pbr::OriginalName("DispenserHomingResponse")] DispenserHomingResponse = 2013, + [pbr::OriginalName("DispenserJoggingRequest")] DispenserJoggingRequest = 2014, + [pbr::OriginalName("DispenserJoggingResponse")] DispenserJoggingResponse = 2015, + [pbr::OriginalName("DispenserAbortJoggingRequest")] DispenserAbortJoggingRequest = 2016, + [pbr::OriginalName("DispenserAbortJoggingResponse")] DispenserAbortJoggingResponse = 2017, /// ///Printing /// diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs new file mode 100644 index 000000000..492f9bdaf --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserAbortHomingRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserAbortHomingRequest.proto + public static partial class DispenserAbortHomingRequestReflection { + + #region Descriptor + /// File descriptor for DispenserAbortHomingRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserAbortHomingRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFEaXNwZW5zZXJBYm9ydEhvbWluZ1JlcXVlc3QucHJvdG8SFVRhbmdvLlBN", + "Ui5EaWFnbm9zdGljcyIrChtEaXNwZW5zZXJBYm9ydEhvbWluZ1JlcXVlc3QS", + "DAoEQ29kZRgBIAEoBUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0", + "aWNzYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortHomingRequest), global::Tango.PMR.Diagnostics.DispenserAbortHomingRequest.Parser, new[]{ "Code" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserAbortHomingRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserAbortHomingRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserAbortHomingRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortHomingRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortHomingRequest(DispenserAbortHomingRequest other) : this() { + code_ = other.code_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortHomingRequest Clone() { + return new DispenserAbortHomingRequest(this); + } + + /// Field number for the "Code" field. + public const int CodeFieldNumber = 1; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserAbortHomingRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserAbortHomingRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Code != 0) { + output.WriteRawTag(8); + output.WriteInt32(Code); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserAbortHomingRequest other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Code = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingResponse.cs new file mode 100644 index 000000000..94e32eb29 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserAbortHomingResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserAbortHomingResponse.proto + public static partial class DispenserAbortHomingResponseReflection { + + #region Descriptor + /// File descriptor for DispenserAbortHomingResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserAbortHomingResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiJEaXNwZW5zZXJBYm9ydEhvbWluZ1Jlc3BvbnNlLnByb3RvEhVUYW5nby5Q", + "TVIuRGlhZ25vc3RpY3MiHgocRGlzcGVuc2VyQWJvcnRIb21pbmdSZXNwb25z", + "ZUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortHomingResponse), global::Tango.PMR.Diagnostics.DispenserAbortHomingResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserAbortHomingResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserAbortHomingResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserAbortHomingResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortHomingResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortHomingResponse(DispenserAbortHomingResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortHomingResponse Clone() { + return new DispenserAbortHomingResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserAbortHomingResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserAbortHomingResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserAbortHomingResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs new file mode 100644 index 000000000..4f879102b --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserAbortJoggingRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserAbortJoggingRequest.proto + public static partial class DispenserAbortJoggingRequestReflection { + + #region Descriptor + /// File descriptor for DispenserAbortJoggingRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserAbortJoggingRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiJEaXNwZW5zZXJBYm9ydEpvZ2dpbmdSZXF1ZXN0LnByb3RvEhVUYW5nby5Q", + "TVIuRGlhZ25vc3RpY3MiLAocRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVxdWVz", + "dBIMCgRDb2RlGAIgASgFQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25v", + "c3RpY3NiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequest), global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequest.Parser, new[]{ "Code" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserAbortJoggingRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserAbortJoggingRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortJoggingRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortJoggingRequest(DispenserAbortJoggingRequest other) : this() { + code_ = other.code_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortJoggingRequest Clone() { + return new DispenserAbortJoggingRequest(this); + } + + /// Field number for the "Code" field. + public const int CodeFieldNumber = 2; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserAbortJoggingRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserAbortJoggingRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Code != 0) { + output.WriteRawTag(16); + output.WriteInt32(Code); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserAbortJoggingRequest other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 16: { + Code = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs new file mode 100644 index 000000000..e8e2c8efe --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserAbortJoggingResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserAbortJoggingResponse.proto + public static partial class DispenserAbortJoggingResponseReflection { + + #region Descriptor + /// File descriptor for DispenserAbortJoggingResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserAbortJoggingResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiNEaXNwZW5zZXJBYm9ydEpvZ2dpbmdSZXNwb25zZS5wcm90bxIVVGFuZ28u", + "UE1SLkRpYWdub3N0aWNzIi0KHURpc3BlbnNlckFib3J0Sm9nZ2luZ1Jlc3Bv", + "bnNlEgwKBENvZGUYAiABKAVCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFn", + "bm9zdGljc2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponse), global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponse.Parser, new[]{ "Code" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserAbortJoggingResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserAbortJoggingResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortJoggingResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortJoggingResponse(DispenserAbortJoggingResponse other) : this() { + code_ = other.code_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserAbortJoggingResponse Clone() { + return new DispenserAbortJoggingResponse(this); + } + + /// Field number for the "Code" field. + public const int CodeFieldNumber = 2; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserAbortJoggingResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserAbortJoggingResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Code != 0) { + output.WriteRawTag(16); + output.WriteInt32(Code); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserAbortJoggingResponse other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 16: { + Code = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs new file mode 100644 index 000000000..f5b45c802 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserHomingRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserHomingRequest.proto + public static partial class DispenserHomingRequestReflection { + + #region Descriptor + /// File descriptor for DispenserHomingRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserHomingRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxEaXNwZW5zZXJIb21pbmdSZXF1ZXN0LnByb3RvEhVUYW5nby5QTVIuRGlh", + "Z25vc3RpY3MiNQoWRGlzcGVuc2VySG9taW5nUmVxdWVzdBIMCgRDb2RlGAEg", + "ASgFEg0KBVNwZWVkGAIgASgBQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlh", + "Z25vc3RpY3NiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserHomingRequest), global::Tango.PMR.Diagnostics.DispenserHomingRequest.Parser, new[]{ "Code", "Speed" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserHomingRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserHomingRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserHomingRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserHomingRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserHomingRequest(DispenserHomingRequest other) : this() { + code_ = other.code_; + speed_ = other.speed_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserHomingRequest Clone() { + return new DispenserHomingRequest(this); + } + + /// Field number for the "Code" field. + public const int CodeFieldNumber = 1; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + /// Field number for the "Speed" field. + public const int SpeedFieldNumber = 2; + private double speed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Speed { + get { return speed_; } + set { + speed_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserHomingRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserHomingRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + if (Speed != other.Speed) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + if (Speed != 0D) hash ^= Speed.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Code != 0) { + output.WriteRawTag(8); + output.WriteInt32(Code); + } + if (Speed != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Speed); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + if (Speed != 0D) { + size += 1 + 8; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserHomingRequest other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + if (other.Speed != 0D) { + Speed = other.Speed; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Code = input.ReadInt32(); + break; + } + case 17: { + Speed = input.ReadDouble(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingResponse.cs new file mode 100644 index 000000000..dce4f5777 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingResponse.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserHomingResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserHomingResponse.proto + public static partial class DispenserHomingResponseReflection { + + #region Descriptor + /// File descriptor for DispenserHomingResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserHomingResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1EaXNwZW5zZXJIb21pbmdSZXNwb25zZS5wcm90bxIVVGFuZ28uUE1SLkRp", + "YWdub3N0aWNzIkAKF0Rpc3BlbnNlckhvbWluZ1Jlc3BvbnNlEhAKCFByb2dy", + "ZXNzGAEgASgBEhMKC01heFByb2dyZXNzGAIgASgBQiEKH2NvbS50d2luZS50", + "YW5nby5wbXIuZGlhZ25vc3RpY3NiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserHomingResponse), global::Tango.PMR.Diagnostics.DispenserHomingResponse.Parser, new[]{ "Progress", "MaxProgress" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserHomingResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserHomingResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserHomingResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserHomingResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserHomingResponse(DispenserHomingResponse other) : this() { + progress_ = other.progress_; + maxProgress_ = other.maxProgress_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserHomingResponse Clone() { + return new DispenserHomingResponse(this); + } + + /// Field number for the "Progress" field. + public const int ProgressFieldNumber = 1; + private double progress_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Progress { + get { return progress_; } + set { + progress_ = value; + } + } + + /// Field number for the "MaxProgress" field. + public const int MaxProgressFieldNumber = 2; + private double maxProgress_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double MaxProgress { + get { return maxProgress_; } + set { + maxProgress_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserHomingResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserHomingResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Progress != other.Progress) return false; + if (MaxProgress != other.MaxProgress) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Progress != 0D) hash ^= Progress.GetHashCode(); + if (MaxProgress != 0D) hash ^= MaxProgress.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Progress != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Progress); + } + if (MaxProgress != 0D) { + output.WriteRawTag(17); + output.WriteDouble(MaxProgress); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Progress != 0D) { + size += 1 + 8; + } + if (MaxProgress != 0D) { + size += 1 + 8; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserHomingResponse other) { + if (other == null) { + return; + } + if (other.Progress != 0D) { + Progress = other.Progress; + } + if (other.MaxProgress != 0D) { + MaxProgress = other.MaxProgress; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 9: { + Progress = input.ReadDouble(); + break; + } + case 17: { + MaxProgress = input.ReadDouble(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs new file mode 100644 index 000000000..48894af8d --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs @@ -0,0 +1,218 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserJoggingRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserJoggingRequest.proto + public static partial class DispenserJoggingRequestReflection { + + #region Descriptor + /// File descriptor for DispenserJoggingRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserJoggingRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1EaXNwZW5zZXJKb2dnaW5nUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1SLkRp", + "YWdub3N0aWNzGhRNb3RvckRpcmVjdGlvbi5wcm90byJwChdEaXNwZW5zZXJK", + "b2dnaW5nUmVxdWVzdBI4CglEaXJlY3Rpb24YASABKA4yJS5UYW5nby5QTVIu", + "RGlhZ25vc3RpY3MuTW90b3JEaXJlY3Rpb24SDAoEQ29kZRgCIAEoBRINCgVT", + "cGVlZBgDIAEoAUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNz", + "YgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.MotorDirectionReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserJoggingRequest), global::Tango.PMR.Diagnostics.DispenserJoggingRequest.Parser, new[]{ "Direction", "Code", "Speed" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserJoggingRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserJoggingRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserJoggingRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserJoggingRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserJoggingRequest(DispenserJoggingRequest other) : this() { + direction_ = other.direction_; + code_ = other.code_; + speed_ = other.speed_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserJoggingRequest Clone() { + return new DispenserJoggingRequest(this); + } + + /// Field number for the "Direction" field. + public const int DirectionFieldNumber = 1; + private global::Tango.PMR.Diagnostics.MotorDirection direction_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Diagnostics.MotorDirection Direction { + get { return direction_; } + set { + direction_ = value; + } + } + + /// Field number for the "Code" field. + public const int CodeFieldNumber = 2; + private int code_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + /// Field number for the "Speed" field. + public const int SpeedFieldNumber = 3; + private double speed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Speed { + get { return speed_; } + set { + speed_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserJoggingRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserJoggingRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Direction != other.Direction) return false; + if (Code != other.Code) return false; + if (Speed != other.Speed) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Direction != 0) hash ^= Direction.GetHashCode(); + if (Code != 0) hash ^= Code.GetHashCode(); + if (Speed != 0D) hash ^= Speed.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Direction != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) Direction); + } + if (Code != 0) { + output.WriteRawTag(16); + output.WriteInt32(Code); + } + if (Speed != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Speed); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Direction != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Direction); + } + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + if (Speed != 0D) { + size += 1 + 8; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserJoggingRequest other) { + if (other == null) { + return; + } + if (other.Direction != 0) { + Direction = other.Direction; + } + if (other.Code != 0) { + Code = other.Code; + } + if (other.Speed != 0D) { + Speed = other.Speed; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + direction_ = (global::Tango.PMR.Diagnostics.MotorDirection) input.ReadEnum(); + break; + } + case 16: { + Code = input.ReadInt32(); + break; + } + case 25: { + Speed = input.ReadDouble(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingResponse.cs new file mode 100644 index 000000000..ab32d6f98 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DispenserJoggingResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from DispenserJoggingResponse.proto + public static partial class DispenserJoggingResponseReflection { + + #region Descriptor + /// File descriptor for DispenserJoggingResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DispenserJoggingResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5EaXNwZW5zZXJKb2dnaW5nUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBNUi5E", + "aWFnbm9zdGljcyIaChhEaXNwZW5zZXJKb2dnaW5nUmVzcG9uc2VCIQofY29t", + "LnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserJoggingResponse), global::Tango.PMR.Diagnostics.DispenserJoggingResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DispenserJoggingResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispenserJoggingResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.DispenserJoggingResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserJoggingResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserJoggingResponse(DispenserJoggingResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DispenserJoggingResponse Clone() { + return new DispenserJoggingResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DispenserJoggingResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DispenserJoggingResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DispenserJoggingResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingResponse.cs index 7dd9f982b..487eb32a6 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingResponse.cs @@ -24,7 +24,7 @@ namespace Tango.PMR.Diagnostics { string.Concat( "ChlNb3RvckhvbWluZ1Jlc3BvbnNlLnByb3RvEhVUYW5nby5QTVIuRGlhZ25v", "c3RpY3MiPAoTTW90b3JIb21pbmdSZXNwb25zZRIQCghQcm9ncmVzcxgBIAEo", - "BRITCgtNYXhQcm9ncmVzcxgCIAEoBUIhCh9jb20udHdpbmUudGFuZ28ucG1y", + "ARITCgtNYXhQcm9ncmVzcxgCIAEoAUIhCh9jb20udHdpbmUudGFuZ28ucG1y", "LmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, @@ -71,9 +71,9 @@ namespace Tango.PMR.Diagnostics { /// Field number for the "Progress" field. public const int ProgressFieldNumber = 1; - private int progress_; + private double progress_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Progress { + public double Progress { get { return progress_; } set { progress_ = value; @@ -82,9 +82,9 @@ namespace Tango.PMR.Diagnostics { /// Field number for the "MaxProgress" field. public const int MaxProgressFieldNumber = 2; - private int maxProgress_; + private double maxProgress_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MaxProgress { + public double MaxProgress { get { return maxProgress_; } set { maxProgress_ = value; @@ -112,8 +112,8 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Progress != 0) hash ^= Progress.GetHashCode(); - if (MaxProgress != 0) hash ^= MaxProgress.GetHashCode(); + if (Progress != 0D) hash ^= Progress.GetHashCode(); + if (MaxProgress != 0D) hash ^= MaxProgress.GetHashCode(); return hash; } @@ -124,24 +124,24 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Progress != 0) { - output.WriteRawTag(8); - output.WriteInt32(Progress); + if (Progress != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Progress); } - if (MaxProgress != 0) { - output.WriteRawTag(16); - output.WriteInt32(MaxProgress); + if (MaxProgress != 0D) { + output.WriteRawTag(17); + output.WriteDouble(MaxProgress); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Progress != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Progress); + if (Progress != 0D) { + size += 1 + 8; } - if (MaxProgress != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MaxProgress); + if (MaxProgress != 0D) { + size += 1 + 8; } return size; } @@ -151,10 +151,10 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Progress != 0) { + if (other.Progress != 0D) { Progress = other.Progress; } - if (other.MaxProgress != 0) { + if (other.MaxProgress != 0D) { MaxProgress = other.MaxProgress; } } @@ -167,12 +167,12 @@ namespace Tango.PMR.Diagnostics { default: input.SkipLastField(); break; - case 8: { - Progress = input.ReadInt32(); + case 9: { + Progress = input.ReadDouble(); break; } - case 16: { - MaxProgress = input.ReadInt32(); + case 17: { + MaxProgress = input.ReadDouble(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index e6f671ca7..c50ce853f 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -55,6 +55,14 @@ + + + + + + + + diff --git a/Software/Visual_Studio/Tango.UnitTesting/App.config b/Software/Visual_Studio/Tango.UnitTesting/App.config index 901eeb586..80fd5e3fa 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/App.config +++ b/Software/Visual_Studio/Tango.UnitTesting/App.config @@ -17,4 +17,12 @@ + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml b/Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml new file mode 100644 index 000000000..c7ae4fe57 --- /dev/null +++ b/Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml @@ -0,0 +1,12 @@ + + + + + + diff --git a/Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml.cs b/Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml.cs new file mode 100644 index 000000000..2149409a1 --- /dev/null +++ b/Software/Visual_Studio/Tango.Visuals/AnalogSwitch/AnalogSwitch.xaml.cs @@ -0,0 +1,66 @@ +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.Effects; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Visuals +{ + /// + /// Interaction logic for AnalogSwitch.xaml + /// + public partial class AnalogSwitch : UserControl + { + public event Action CheckedChanged; + + public AnalogSwitch() + { + InitializeComponent(); + this.PreviewMouseUp += AnalogSwitch_PreviewMouseUp; + } + + void AnalogSwitch_PreviewMouseUp(object sender, MouseButtonEventArgs e) + { + IsChecked = !IsChecked; + } + + public bool IsChecked + { + get { return (bool)GetValue(IsCheckedProperty); } + set { SetValue(IsCheckedProperty, value); } + } + + // Using a DependencyProperty as the backing store for IsChecked. This enables animation, styling, binding, etc... + public static readonly DependencyProperty IsCheckedProperty = + DependencyProperty.Register("IsChecked", typeof(bool), typeof(AnalogSwitch), new PropertyMetadata(false,new PropertyChangedCallback(CheckChanged))); + + private static void CheckChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + AnalogSwitch s = d as AnalogSwitch; + if ((bool)e.NewValue) + { + s.imgON.Visibility = Visibility.Visible; + s.imgOFF.Visibility = Visibility.Hidden; + } + else + { + s.imgOFF.Visibility = Visibility.Visible; + s.imgON.Visibility = Visibility.Hidden; + } + + if (s.CheckedChanged != null) s.CheckedChanged(s); + } + + + } +} diff --git a/Software/Visual_Studio/Tango.Visuals/Images/off.png b/Software/Visual_Studio/Tango.Visuals/Images/off.png new file mode 100644 index 000000000..67f2f4a6f Binary files /dev/null and b/Software/Visual_Studio/Tango.Visuals/Images/off.png differ diff --git a/Software/Visual_Studio/Tango.Visuals/Images/on.png b/Software/Visual_Studio/Tango.Visuals/Images/on.png new file mode 100644 index 000000000..9922b1901 Binary files /dev/null and b/Software/Visual_Studio/Tango.Visuals/Images/on.png differ diff --git a/Software/Visual_Studio/Tango.Visuals/Led/Led.xaml b/Software/Visual_Studio/Tango.Visuals/Led/Led.xaml new file mode 100644 index 000000000..b59ed5d15 --- /dev/null +++ b/Software/Visual_Studio/Tango.Visuals/Led/Led.xaml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Visuals/Led/Led.xaml.cs b/Software/Visual_Studio/Tango.Visuals/Led/Led.xaml.cs new file mode 100644 index 000000000..5a1e67913 --- /dev/null +++ b/Software/Visual_Studio/Tango.Visuals/Led/Led.xaml.cs @@ -0,0 +1,179 @@ +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; +using Tango.Core.Commands; + +namespace Tango.Visuals +{ + /// + /// Represents an LED like button that acts like a check box. + /// + public partial class Led : UserControl + { + #region Constructors + + public Led() + { + InitializeComponent(); + this.PreviewMouseUp += LedControl_PreviewMouseUp; + } + + #endregion + + #region Event Handlers + + void LedControl_PreviewMouseUp(object sender, MouseButtonEventArgs e) + { + if (IsPassive) return; + + IsChecked = !IsChecked; + + if (Command != null) + { + Command.Execute(null); + } + } + + #endregion + + #region Properties + + /// + /// Gets or sets whether the LED is on or off. + /// + public bool IsChecked + { + get { return (bool)GetValue(IsCheckedProperty); } + set { SetValue(IsCheckedProperty, value); } + } + public static readonly DependencyProperty IsCheckedProperty = + DependencyProperty.Register("IsChecked", typeof(bool), typeof(Led), new PropertyMetadata(false)); + + + /// + /// Gets or sets whether the control is enabled. + /// + public bool Enabled + { + get { return (bool)GetValue(EnabledProperty); } + set { SetValue(EnabledProperty, value); } + } + public static readonly DependencyProperty EnabledProperty = + DependencyProperty.Register("Enabled", typeof(bool), typeof(Led), new PropertyMetadata(true, new PropertyChangedCallback(EnabledChanged))); + private static void EnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + Led l = d as Led; + if ((bool)e.NewValue) + { + l.gridMask.Visibility = Visibility.Hidden; + l.grid.Visibility = Visibility.Visible; + } + else + { + l.gridMask.Visibility = Visibility.Visible; + l.grid.Visibility = Visibility.Hidden; + } + } + + + public Brush FillBrush + { + get { return (Brush)GetValue(FillBrushProperty); } + set { SetValue(FillBrushProperty, value); } + } + public static readonly DependencyProperty FillBrushProperty = + DependencyProperty.Register("FillBrush", typeof(Brush), typeof(Led), new PropertyMetadata(null)); + + + public double InnerOpacity + { + get { return (double)GetValue(InnerOpacityProperty); } + set { SetValue(InnerOpacityProperty, value); } + } + public static readonly DependencyProperty InnerOpacityProperty = + DependencyProperty.Register("InnerOpacity", typeof(double), typeof(Led), new PropertyMetadata(1.0)); + + + public bool IsPassive + { + get { return (bool)GetValue(IsPassiveProperty); } + set { SetValue(IsPassiveProperty, value); } + } + public static readonly DependencyProperty IsPassiveProperty = + DependencyProperty.Register("IsPassive", typeof(bool), typeof(Led), new PropertyMetadata(false)); + + + + public Brush CheckedBrush + { + get { return (Brush)GetValue(CheckedBrushProperty); } + set { SetValue(CheckedBrushProperty, value); } + } + public static readonly DependencyProperty CheckedBrushProperty = + DependencyProperty.Register("CheckedBrush", typeof(Brush), typeof(Led), new PropertyMetadata(null,CheckBrushChanged)); + + private static void CheckBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var control = d as Led; + control.Resources["inner"] = control.CheckedBrush; + } + + + + public Brush UnCheckedBrush + { + get { return (Brush)GetValue(UnCheckedBrushProperty); } + set { SetValue(UnCheckedBrushProperty, value); } + } + public static readonly DependencyProperty UnCheckedBrushProperty = + DependencyProperty.Register("UnCheckedBrush", typeof(Brush), typeof(Led), new PropertyMetadata(null,UnCheckedBrushChanged)); + + private static void UnCheckedBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var control = d as Led; + control.Resources["innerOff"] = control.UnCheckedBrush; + } + + + + #endregion + + #region Commands + + /// + /// Represents the command to bind for CanExecute event. + /// + public RelayCommand Command + { + get { return (RelayCommand)GetValue(CommandProperty); } + set { SetValue(CommandProperty, value); } + } + public static readonly DependencyProperty CommandProperty = + DependencyProperty.Register("Command", typeof(RelayCommand), typeof(Led), new PropertyMetadata(null, new PropertyChangedCallback(CommandChanged))); + private static void CommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + Led l = d as Led; + + if (l.Command != null) + { + l.Command.CanExecuteChanged += (x, y) => + { + l.IsEnabled = l.Command.CanExecute(null); + }; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Visuals/Tango.Visuals.csproj b/Software/Visual_Studio/Tango.Visuals/Tango.Visuals.csproj index 4eaa3376e..53c87d0f5 100644 --- a/Software/Visual_Studio/Tango.Visuals/Tango.Visuals.csproj +++ b/Software/Visual_Studio/Tango.Visuals/Tango.Visuals.csproj @@ -52,6 +52,9 @@ GlobalVersionInfo.cs + + AnalogSwitch.xaml + PieAxisTicks.xaml @@ -73,6 +76,9 @@ Knob.xaml + + Led.xaml + YAxisDoubles.xaml @@ -90,6 +96,10 @@ VUMeter.xaml + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -110,6 +120,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -188,6 +202,17 @@ + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + + + + +