From d5a5fd2813a98d97e0198342bbcc53df454c3e01 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 13 Feb 2018 16:35:28 +0200 Subject: Digital out. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/PMR/Messages/Common/ErrorCode.proto | 1 + Software/PMR/Messages/Common/MessageType.proto | 4 +- Software/PMR/Messages/Diagnostics/DigitalPin.proto | 10 ++ .../Diagnostics/PushDiagnosticsResponse.proto | 3 +- .../Diagnostics/SetDigitalOutRequest.proto | 10 ++ .../Diagnostics/SetDigitalOutResponse.proto | 9 + .../Messages/Diagnostics/SetGPIOStateRequest.proto | 10 -- .../Diagnostics/SetGPIOStateResponse.proto | 9 - .../Converters/TechIosToDigitalOutsConverter.cs | 35 ++++ .../Editors/DigitalOutElementEditor.xaml | 103 +++++++++++ .../Editors/DigitalOutElementEditor.xaml.cs | 90 ++++++++++ .../Editors/IOElementEditor.xaml | 106 ------------ .../Editors/IOElementEditor.xaml.cs | 102 ----------- .../Editors/MotorElementEditor.xaml | 2 +- .../PropertiesTemplates/DigitalOutTemplate.xaml | 33 ++++ .../PropertiesTemplates/DigitalOutTemplate.xaml.cs | 28 +++ .../PropertiesTemplates/IOTemplate.xaml | 33 ---- .../PropertiesTemplates/IOTemplate.xaml.cs | 37 ---- .../Tango.MachineStudio.Technician.csproj | 15 +- .../TechItems/DigitalOutItem.cs | 70 ++++++++ .../TechItems/IOItem.cs | 71 -------- .../TechItems/TechItem.cs | 2 +- .../ViewModels/MachineTechViewVM.cs | 33 ++-- .../Views/MachineTechView.xaml | 4 +- .../Tango.MachineStudio.UI/App.xaml.cs | 13 +- .../Tango.Core/Helpers/ThreadsHelper.cs | 37 ++++ .../Tango.DAL.Remote/DB/RemoteADO.Context.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 51 ++++++ .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 69 ++++---- .../Visual_Studio/Tango.DAL.Remote/DB/TECH_IOS.cs | 28 +++ .../Tango.DAL.Remote/DB/TECH_MOTORS.cs | 1 + .../Tango.DAL.Remote/Tango.DAL.Remote.csproj | 3 + .../Visual_Studio/Tango.Editors/EnumExtensions.cs | 5 - .../Tango.Emulations/Emulators/MachineEmulator.cs | 37 ++-- .../Tango.Emulations/Tango.Emulations.csproj | 4 + .../Observables/Entities/TechIo.cs | 162 ++++++++++++++++++ .../Observables/Entities/TechMotor.cs | 20 +++ .../Observables/Enumerations/IOType.cs | 17 ++ .../Observables/Enumerations/TechDispensers.cs | 13 ++ .../Observables/Enumerations/TechIos.cs | 25 +++ .../Observables/Enumerations/TechMonitors.cs | 48 ++++++ .../Observables/Enumerations/TechMotors.cs | 19 +++ .../Observables/ObservableEntity.cs | 2 +- .../Observables/ObservablesContext.cs | 8 + .../Observables/ObservablesEntitiesAdapter.cs | 2 + .../ObservablesEntitiesAdapterExtension.cs | 38 +++++ .../Operators/IMachineOperator.cs | 4 +- .../Tango.Integration/Operators/MachineOperator.cs | 6 +- .../Tango.Integration/Tango.Integration.csproj | 2 + .../Visual_Studio/Tango.PMR/Common/ErrorCode.cs | 11 +- .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 20 +-- .../Tango.PMR/Diagnostics/DigitalPin.cs | 187 ++++++++++++++++++++ .../Diagnostics/PushDiagnosticsResponse.cs | 60 +++---- .../Tango.PMR/Diagnostics/SetDigitalOutRequest.cs | 188 +++++++++++++++++++++ .../Tango.PMR/Diagnostics/SetDigitalOutResponse.cs | 131 ++++++++++++++ .../Tango.PMR/Diagnostics/SetGPIOStateRequest.cs | 188 --------------------- .../Tango.PMR/Diagnostics/SetGPIOStateResponse.cs | 131 -------------- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 5 +- .../Visual_Studio/Tango.Transport/ITransporter.cs | 2 +- .../Tango.Transport/ResponseErrorException.cs | 4 +- .../Tango.Transport/TransporterBase.cs | 11 +- .../ObservablesGenerator.cs | 10 ++ .../Utilities/Tango.MachineEM.UI/App.config | 18 +- .../Utilities/Tango.MachineEM.UI/App.xaml.cs | 11 ++ .../Tango.MachineEM.UI/MainWindow.xaml.cs | 2 + .../Tango.MachineEM.UI/Tango.MachineEM.UI.csproj | 15 ++ .../Utilities/Tango.MachineEM.UI/packages.config | 1 + 69 files changed, 1597 insertions(+), 833 deletions(-) create mode 100644 Software/PMR/Messages/Diagnostics/DigitalPin.proto create mode 100644 Software/PMR/Messages/Diagnostics/SetDigitalOutRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/SetDigitalOutResponse.proto delete mode 100644 Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto delete mode 100644 Software/PMR/Messages/Diagnostics/SetGPIOStateResponse.proto create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs create mode 100644 Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_IOS.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Observables/Entities/TechIo.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechIos.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/DigitalPin.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateResponse.cs (limited to 'Software') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index dee5d4c24..c26134cc3 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 8e9fee248..e935a702e 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Common/ErrorCode.proto b/Software/PMR/Messages/Common/ErrorCode.proto index e0a9f36a8..5164c61a1 100644 --- a/Software/PMR/Messages/Common/ErrorCode.proto +++ b/Software/PMR/Messages/Common/ErrorCode.proto @@ -7,4 +7,5 @@ enum ErrorCode { NONE = 0; BAD_CRC = 1; + INVALID_DIGITAL_PIN_NUMBER = 2; //Can be returned by SetDigitalOutResponse. } diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 4f1593222..7b01bbb13 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -76,8 +76,8 @@ enum MessageType DispenserJoggingResponse = 2015; DispenserAbortJoggingRequest = 2016; DispenserAbortJoggingResponse = 2017; - SetGPIOStateRequest = 2018; - SetGPIOStateResponse = 2019; + SetDigitalOutRequest = 2018; + SetDigitalOutResponse = 2019; ThreadJoggingRequest = 2020; ThreadJoggingResponse = 2021; ThreadAbortJoggingRequest = 2022; diff --git a/Software/PMR/Messages/Diagnostics/DigitalPin.proto b/Software/PMR/Messages/Diagnostics/DigitalPin.proto new file mode 100644 index 000000000..c87f9adda --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/DigitalPin.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message DigitalPin +{ + int32 Port = 1; + bool Value = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto index a79d0cba9..08045c2d9 100644 --- a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto +++ b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto @@ -1,6 +1,7 @@ syntax = "proto3"; import "DoubleArray.proto"; +import "DigitalPin.proto"; package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; @@ -25,5 +26,5 @@ message PushDiagnosticsResponse repeated double Dispenser8MotorFrequency = 12; //GPIO Ports States - repeated bool GPIO = 13; + repeated DigitalPin DigitalPins = 13; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/SetDigitalOutRequest.proto b/Software/PMR/Messages/Diagnostics/SetDigitalOutRequest.proto new file mode 100644 index 000000000..9e5ab22f1 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/SetDigitalOutRequest.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message SetDigitalOutRequest +{ + int32 Port = 1; + bool Value = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/SetDigitalOutResponse.proto b/Software/PMR/Messages/Diagnostics/SetDigitalOutResponse.proto new file mode 100644 index 000000000..fa66bb98d --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/SetDigitalOutResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message SetDigitalOutResponse +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto b/Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto deleted file mode 100644 index 86685ac85..000000000 --- a/Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Diagnostics; -option java_package = "com.twine.tango.pmr.diagnostics"; - -message SetGPIOStateRequest -{ - int32 Port = 1; - bool Value = 2; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/SetGPIOStateResponse.proto b/Software/PMR/Messages/Diagnostics/SetGPIOStateResponse.proto deleted file mode 100644 index 51b8b6c97..000000000 --- a/Software/PMR/Messages/Diagnostics/SetGPIOStateResponse.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Diagnostics; -option java_package = "com.twine.tango.pmr.diagnostics"; - -message SetGPIOStateResponse -{ - -} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs new file mode 100644 index 000000000..734c4bebf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class TechIosToDigitalOutsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ObservableCollection ios = value as ObservableCollection; + + if (ios != null) + { + return ios.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).ToObservableCollection(); + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml new file mode 100644 index 000000000..dcf78ca69 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs new file mode 100644 index 000000000..6428ccf1d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs @@ -0,0 +1,90 @@ +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.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 DigitalOutElementEditor : ElementEditor + { + public DigitalOutElementEditor() + : base() + { + InitializeComponent(); + } + + public DigitalOutElementEditor(DigitalOutItem digitalOutItem) + : this() + { + DigitalOutItem = digitalOutItem; + DataContext = DigitalOutItem; + } + + public DigitalOutElementEditor(DigitalOutItem digitalOutItem, Rect bounds) + : this(digitalOutItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DigitalOutItem _digitalOutItem; + + public DigitalOutItem DigitalOutItem + { + get { return _digitalOutItem; } + set { _digitalOutItem = value; RaisePropertyChanged(nameof(DigitalOutItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DigitalOutItem.Clone() as DigitalOutItem; + DigitalOutElementEditor cloned = new DigitalOutElementEditor(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 DigitalOutItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml deleted file mode 100644 index aa4f8aee6..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GPIO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs deleted file mode 100644 index 95710abd3..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs +++ /dev/null @@ -1,102 +0,0 @@ -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.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 IOElementEditor : ElementEditor - { - /// - /// Initializes a new instance of the class. - /// - public IOElementEditor() - : base() - { - InitializeComponent(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The framework element. - public IOElementEditor(IOItem ioItem) - : this() - { - IOItem = ioItem; - DataContext = IOItem; - } - - /// - /// Initializes a new instance of the class. - /// - /// The framework element. - /// The bounds. - public IOElementEditor(IOItem monitorItem, Rect bounds) - : this(monitorItem) - { - Left = bounds.Left; - Top = bounds.Top; - Width = bounds.Width; - Height = bounds.Height; - } - - private IOItem _monitorItem; - - public IOItem IOItem - { - get { return _monitorItem; } - set { _monitorItem = value; RaisePropertyChanged(nameof(IOItem)); } - } - - - /// - /// Clones this instance. - /// - /// - public override IElementEditor Clone() - { - try - { - var clonedItem = IOItem.Clone() as IOItem; - IOElementEditor cloned = new IOElementEditor(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 IOItem; } - } - } -} 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 860072282..fb0466177 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 @@ -162,7 +162,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml new file mode 100644 index 000000000..9d30e744c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + Selected Pin + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs new file mode 100644 index 000000000..58a3fcb8f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.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 DigitalOutTemplate : UserControl + { + public DigitalOutTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml deleted file mode 100644 index c03b72837..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - Selected Port - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs deleted file mode 100644 index fae3586dc..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -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 IOTemplate : UserControl - { - public IOTemplate() - { - InitializeComponent(); - - List ports = new List(); - - for (int i = 0; i < 120; i++) - { - ports.Add(i); - } - - combo.ItemsSource = ports; - } - } -} 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 e8b14e277..820a7ee57 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 @@ -99,12 +99,13 @@ + DispenserElementEditor.xaml - - IOElementEditor.xaml + + DigitalOutElementEditor.xaml MotorGroupElementEditor.xaml @@ -129,8 +130,8 @@ - - IOTemplate.xaml + + DigitalOutTemplate.xaml MeterTemplate.xaml @@ -156,7 +157,7 @@ SingleGraphTemplate.xaml - + @@ -196,7 +197,7 @@ MSBuild:Compile Designer - + MSBuild:Compile Designer @@ -228,7 +229,7 @@ MSBuild:Compile Designer - + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs new file mode 100644 index 000000000..817cfd9b7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs @@ -0,0 +1,70 @@ +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.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class DigitalOutItem : TechItem + { + public event EventHandler ValueChanged; + + private TechIo _techIo; + [XmlIgnore] + public TechIo TechIo + { + get { return _techIo; } + set { _techIo = value; RaisePropertyChangedAuto(); TechName = _techIo != null ? _techIo.Description : null; ItemGuid = value != null ? value.Guid : null; } + } + + private bool _value; + [XmlIgnore] + public bool Value + { + get { return _value; } + set { _value = value; RaisePropertyChangedAuto(); ValueChanged?.Invoke(this, value); } + } + + private bool _effectiveValue; + [XmlIgnore] + public bool EffectiveValue + { + get { return _effectiveValue; } + set + { + if (_effectiveValue != value) + { + _effectiveValue = value; + RaisePropertyChangedAuto(); + _value = value; + RaisePropertyChanged(nameof(Value)); + } + } + } + + public DigitalOutItem() : base() + { + Name = "Digital Out"; + Description = "Digital Output Pin Controller"; + Image = ResourceHelper.GetImageFromResources("Images/binary.png"); + Color = Colors.White; + } + + public DigitalOutItem(TechIo techIo) : this() + { + TechIo = techIo; + } + + public override TechItem Clone() + { + DigitalOutItem cloned = base.Clone() as DigitalOutItem; + cloned.TechIo = TechIo; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs deleted file mode 100644 index 60d47b1c0..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs +++ /dev/null @@ -1,71 +0,0 @@ -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; -using Tango.SharedUI.Helpers; - -namespace Tango.MachineStudio.Technician.TechItems -{ - public class IOItem : TechItem - { - public event EventHandler ValueChanged; - - private int _port; - - public int Port - { - get { return _port; } - set { _port = value; RaisePropertyChangedAuto(); TechName = "GPIO " + Port; } - } - - private bool _value; - [XmlIgnore] - public bool Value - { - get { return _value; } - set { _value = value; RaisePropertyChangedAuto(); ValueChanged?.Invoke(this, value); } - } - - private bool _effectiveValue; - [XmlIgnore] - public bool EffectiveValue - { - get { return _effectiveValue; } - set - { - if (_effectiveValue != value) - { - _effectiveValue = value; - RaisePropertyChangedAuto(); - _value = value; - RaisePropertyChanged(nameof(Value)); - } - } - } - - - public IOItem() : base() - { - Name = "GPIO Controller"; - Description = "GPIO Controller"; - Image = ResourceHelper.GetImageFromResources("Images/binary.png"); - Color = Colors.White; - } - - public IOItem(int port) : this() - { - Port = port; - } - - public override TechItem Clone() - { - IOItem cloned = base.Clone() as IOItem; - cloned.Port = Port; - return cloned; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index a7b5ae5b9..92ad1c536 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -14,7 +14,7 @@ using Tango.Integration.Observables; namespace Tango.MachineStudio.Technician.TechItems { [XmlInclude(typeof(DispenserItem))] - [XmlInclude(typeof(IOItem))] + [XmlInclude(typeof(DigitalOutItem))] [XmlInclude(typeof(MeterItem))] [XmlInclude(typeof(MonitorItem))] [XmlInclude(typeof(MotorItem))] 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 1b0ee0a56..c886c2345 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 @@ -16,6 +16,7 @@ using System.Windows.Media; using Tango.Core.Helpers; using Tango.Editors; using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; using Tango.Integration.Operators; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; @@ -211,13 +212,15 @@ namespace Tango.MachineStudio.Technician.ViewModels } } } - else if (item.GetType() == typeof(IOItem)) + else if (item.GetType() == typeof(DigitalOutItem)) { - IOItem ioItem = item as IOItem; + DigitalOutItem digitalOutItem = item as DigitalOutItem; - if (ioItem.Port < data.GPIO.Count) + var digitalPin = data.DigitalPins.SingleOrDefault(x => x.Port == digitalOutItem.TechIo.Port); + + if (digitalPin != null) { - ioItem.EffectiveValue = data.GPIO[ioItem.Port]; + digitalOutItem.EffectiveValue = digitalPin.Value; } } else if (item.GetType() == typeof(MeterItem)) @@ -355,10 +358,10 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(bounds, Adapter.TechDispensers.FirstOrDefault()); InitDispenserItem(editor.DispenserItem); } - else if (item is IOItem) + else if (item is DigitalOutItem) { - var editor = CreateElement(bounds, 0); - InitIOItem(editor.IOItem); + var editor = CreateElement(bounds, Adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).FirstOrDefault()); + InitDigitalOutItem(editor.DigitalOutItem); } else if (item is ThreadMotionItem) { @@ -423,10 +426,10 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(item); InitDispenserItem(editor.DispenserItem); } - else if (item is IOItem) + else if (item is DigitalOutItem) { - var editor = CreateElement(item); - InitIOItem(editor.IOItem); + var editor = CreateElement(item); + InitDigitalOutItem(editor.DigitalOutItem); } else if (item is ThreadMotionItem) { @@ -507,10 +510,10 @@ namespace Tango.MachineStudio.Technician.ViewModels var dispenser = element.HostedElement as DispenserItem; InitDispenserItem(dispenser); } - else if (element is IOElementEditor) + else if (element is DigitalOutItem) { - var ioItem = element.HostedElement as IOItem; - InitIOItem(ioItem); + var ioItem = element.HostedElement as DigitalOutItem; + InitDigitalOutItem(ioItem); } else if (element is ThreadMotionItem) { @@ -669,13 +672,13 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } - private void InitIOItem(IOItem item) + private void InitDigitalOutItem(DigitalOutItem item) { item.ValueChanged += async (x, value) => { try { - await MachineOperator.SetGPIOState(new SetGPIOStateRequest() { Port = item.Port, Value = value }); + await MachineOperator.SetDigitalOut(new SetDigitalOutRequest() { Port = item.TechIo.Port, Value = value }); } catch (Exception ex) { 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 1658b97d8..784bd56fb 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 @@ -361,8 +361,8 @@ - - + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index ffc8068a5..c15a87980 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -25,16 +25,17 @@ namespace Tango.MachineStudio.UI base.OnStartup(e); LogManager.Categories.Clear(); - LogManager.Categories.AddRange(SettingsManager.Default.MachineStudio.LoggingCategories); - if (LogManager.Categories.Count == 0) + if (SettingsManager.Default.MachineStudio.LoggingCategories.Count == 0) { - LogManager.Categories.Add(LogCategory.Critical); - LogManager.Categories.Add(LogCategory.Error); - LogManager.Categories.Add(LogCategory.General); - LogManager.Categories.Add(LogCategory.Warning); + SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Critical); + SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Error); + SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.General); + SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Warning); } + LogManager.Categories.AddRange(SettingsManager.Default.MachineStudio.LoggingCategories); + LogManager.RegisterLogger(new VSOutputLogger()); LogManager.RegisterLogger(new FileLogger()); diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs index c18f2cc26..efed8c818 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs @@ -16,6 +16,15 @@ namespace Tango.Core.Helpers public static class ThreadsHelper { private static Dispatcher _dispatcher; //Holds the current dispatcher. + public static event Action DispatcherSet; + private static List _whenAvailableActions; + private static bool _whenAvailableActionsInvoked; + private static bool _hasDispatcher; + + static ThreadsHelper() + { + _whenAvailableActions = new List(); + } /// /// Sets the current dispatcher. @@ -24,6 +33,18 @@ namespace Tango.Core.Helpers public static void SetDisptacher(Dispatcher dispatcher) { _dispatcher = dispatcher; + DispatcherSet?.Invoke(dispatcher); + _hasDispatcher = true; + + if (!_whenAvailableActionsInvoked) + { + foreach (var action in _whenAvailableActions) + { + InvokeUI(action); + } + + _whenAvailableActionsInvoked = true; + } } /// @@ -60,6 +81,22 @@ namespace Tango.Core.Helpers } } + /// + /// Invokes UI thread after a dispatcher has been set by . + /// + /// The action. + public static void InvokeWhenAvailable(Action action) + { + if (_hasDispatcher) + { + InvokeUI(action); + } + else + { + _whenAvailableActions.Add(action); + } + } + /// /// Starts a new STA thread which will be running the specified action. /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs index 886695580..fbe885fea 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -72,6 +72,7 @@ namespace Tango.DAL.Remote.DB public virtual DbSet SEGMENTS { get; set; } public virtual DbSet SYNC_CONFIGURATIONS { get; set; } public virtual DbSet TECH_DISPENSERS { get; set; } + public virtual DbSet TECH_IOS { get; set; } public virtual DbSet TECH_MONITORS { get; set; } public virtual DbSet TECH_MOTORS { get; set; } public virtual DbSet TECH_VALVES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 069333d1d..7ccc175d8 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -596,6 +596,21 @@ + + + + + + + + + + + + + + + @@ -623,6 +638,7 @@ + @@ -1395,6 +1411,7 @@ + @@ -1670,6 +1687,7 @@ + @@ -2584,6 +2602,21 @@ + + + + + + + + + + + + + + + @@ -2611,6 +2644,7 @@ + @@ -3987,6 +4021,22 @@ + + + + + + + + + + + + + + + + @@ -4008,6 +4058,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 17e6744db..8b8441b70 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,59 +5,60 @@ - + - - + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + - - + + - - + + - + - - - + + + + - + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_IOS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_IOS.cs new file mode 100644 index 000000000..7f7fd4045 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_IOS.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.DAL.Remote.DB +{ + using System; + using System.Collections.Generic; + + public partial class TECH_IOS + { + public int ID { get; set; } + public string GUID { get; set; } + public System.DateTime LAST_UPDATED { get; set; } + public int CODE { get; set; } + public string NAME { get; set; } + public string DESCRIPTION { get; set; } + public int PORT { get; set; } + public int TYPE { get; set; } + public double MIN { get; set; } + public double MAX { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_MOTORS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_MOTORS.cs index 16495aa16..e4b77478d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_MOTORS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/TECH_MOTORS.cs @@ -20,5 +20,6 @@ namespace Tango.DAL.Remote.DB public int CODE { get; set; } public string NAME { get; set; } public string DESCRIPTION { get; set; } + public bool SUPPORTS_HOMING { get; set; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj index 5339cf0c8..3b6e2d0a6 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -221,6 +221,9 @@ RemoteADO.tt + + RemoteADO.tt + RemoteADO.tt diff --git a/Software/Visual_Studio/Tango.Editors/EnumExtensions.cs b/Software/Visual_Studio/Tango.Editors/EnumExtensions.cs index 106dd4f44..95783fef7 100644 --- a/Software/Visual_Studio/Tango.Editors/EnumExtensions.cs +++ b/Software/Visual_Studio/Tango.Editors/EnumExtensions.cs @@ -25,9 +25,4 @@ public static class EnumExtensions else return value.ToString(); } - - public static int ToInt32(this Enum value) - { - return (int)((object)value); - } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index baeb148f0..f998fab2e 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -18,6 +18,8 @@ using Tango.PMR.Diagnostics; using System.Windows.Forms; using Google.Protobuf.Collections; using Tango.PMR.Printing; +using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; namespace Tango.Emulations.Emulators { @@ -35,7 +37,7 @@ namespace Tango.Emulations.Emulators private List _dispenserHomingRequestCodes; private double _graphAmplitude; private double _graphFrequency; - private List _ioStates; + private List _digitalPinsStates; #region Constructors @@ -67,12 +69,15 @@ namespace Tango.Emulations.Emulators _motorHomingRequestCodes = new List(); _dispenserJoggingRequestCodes = new List(); _dispenserHomingRequestCodes = new List(); - _ioStates = new List(); + _digitalPinsStates = new List(); - for (int i = 0; i < 120; i++) + var adapter = ObservablesEntitiesAdapter.Instance; + adapter.Initialize(); + + _digitalPinsStates = adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32() || x.Type == IOType.DigitalInput.ToInt32()).Select(x => new DigitalPin() { - _ioStates.Add(false); - } + Port = x.Port, + }).ToList(); ResetGraphFactors(); } @@ -135,8 +140,8 @@ namespace Tango.Emulations.Emulators case MessageType.DispenserAbortHomingRequest: HandleAbortDispenserHomingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; - case MessageType.SetGpiostateRequest: - HandleGPIOStateRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + case MessageType.SetDigitalOutRequest: + HandleSetDigitalOutRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; case MessageType.ThreadJoggingRequest: HandleThreadJoggingRequest(MessageFactory.ParseTangoMessageFromContainer(container)); @@ -235,7 +240,7 @@ namespace Tango.Emulations.Emulators res.Dispenser8MotorFrequency.AddRange(dispenserFrequencies[7].Data); } - res.GPIO.AddRange(_ioStates); + res.DigitalPins.AddRange(_digitalPinsStates); Transporter.SendResponse(res, request.Container.Token); Thread.Sleep(10); @@ -443,11 +448,19 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse(new DispenserAbortHomingResponse(), request.Container.Token); } - private void HandleGPIOStateRequest(TangoMessage request) + private void HandleSetDigitalOutRequest(TangoMessage request) { - LogManager.Log("Abort dispenser homing request received: " + Environment.NewLine + request.Message.ToJsonString()); - _ioStates[request.Message.Port] = request.Message.Value; - Transporter.SendResponse(new SetGPIOStateResponse(), request.Container.Token); + LogManager.Log("Set digital output pin request received: " + Environment.NewLine + request.Message.ToJsonString()); + var pinState = _digitalPinsStates.SingleOrDefault(x => x.Port == request.Message.Port); + if (pinState != null) + { + pinState.Value = request.Message.Value; + Transporter.SendResponse(new SetDigitalOutResponse(), request.Container.Token); + } + else + { + Transporter.SendResponse(new SetDigitalOutResponse(), request.Container.Token, null, ErrorCode.InvalidDigitalPinNumber); + } } private void HandleThreadJoggingRequest(TangoMessage request) diff --git a/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj b/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj index d76a547d0..5a2830b50 100644 --- a/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj +++ b/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj @@ -60,6 +60,10 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechIo.cs b/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechIo.cs new file mode 100644 index 000000000..90ac0de7c --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechIo.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using Tango.DAL.Remote.DB; + +namespace Tango.Integration.Observables +{ + [Table("TECH_IOS")] + public partial class TechIo : ObservableEntity + { + + protected Int32 _code; + /// + /// Gets or sets the techio code. + /// + [Column("CODE")] + + public Int32 Code + { + get + { + return _code; + } + + set + { + _code = value; RaisePropertyChanged(nameof(Code)); + } + + } + + protected String _name; + /// + /// Gets or sets the techio name. + /// + [Column("NAME")] + + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + + protected String _description; + /// + /// Gets or sets the techio description. + /// + [Column("DESCRIPTION")] + + public String Description + { + get + { + return _description; + } + + set + { + _description = value; RaisePropertyChanged(nameof(Description)); + } + + } + + protected Int32 _port; + /// + /// Gets or sets the techio port. + /// + [Column("PORT")] + + public Int32 Port + { + get + { + return _port; + } + + set + { + _port = value; RaisePropertyChanged(nameof(Port)); + } + + } + + protected Int32 _type; + /// + /// Gets or sets the techio type. + /// + [Column("TYPE")] + + public Int32 Type + { + get + { + return _type; + } + + set + { + _type = value; RaisePropertyChanged(nameof(Type)); + } + + } + + protected Double _min; + /// + /// Gets or sets the techio min. + /// + [Column("MIN")] + + public Double Min + { + get + { + return _min; + } + + set + { + _min = value; RaisePropertyChanged(nameof(Min)); + } + + } + + protected Double _max; + /// + /// Gets or sets the techio max. + /// + [Column("MAX")] + + public Double Max + { + get + { + return _max; + } + + set + { + _max = value; RaisePropertyChanged(nameof(Max)); + } + + } + + /// + /// Initializes a new instance of the class. + /// + public TechIo() : base() + { + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechMotor.cs b/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechMotor.cs index 8fb082850..fd872f636 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechMotor.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Entities/TechMotor.cs @@ -72,6 +72,26 @@ namespace Tango.Integration.Observables } + protected Boolean _supportshoming; + /// + /// Gets or sets the techmotor supports homing. + /// + [Column("SUPPORTS_HOMING")] + + public Boolean SupportsHoming + { + get + { + return _supportshoming; + } + + set + { + _supportshoming = value; RaisePropertyChanged(nameof(SupportsHoming)); + } + + } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs new file mode 100644 index 000000000..c13f4cca8 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Integration.Observables.Enumerations +{ + public enum IOType + { + DigitalOutput, + DigitalInput, + AnalogOut, + AnalogInput, + PWM, + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechDispensers.cs b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechDispensers.cs index 677a546d2..e14fbb397 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechDispensers.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechDispensers.cs @@ -8,5 +8,18 @@ namespace Tango.Integration.Observables { public enum TechDispensers { + + /// + /// (Dispenser 1) + /// + [Description("Dispenser 1")] + Dispenser1 = 0, + + /// + /// (Dispenser 2) + /// + [Description("Dispenser 2")] + Dispenser2 = 1, + } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechIos.cs b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechIos.cs new file mode 100644 index 000000000..301448c28 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechIos.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.Integration.Observables +{ + public enum TechIos + { + + /// + /// (Digital Out 1) + /// + [Description("Digital Out 1")] + PIN0 = 0, + + /// + /// (Digital Out 2) + /// + [Description("Digital Out 2")] + PIN1 = 1, + + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMonitors.cs b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMonitors.cs index 1f8817f44..8e3e20f7d 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMonitors.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMonitors.cs @@ -177,5 +177,53 @@ namespace Tango.Integration.Observables [Description("Chiller Temperature")] ChillerTemperature = 27, + /// + /// (Dispenser 1 Motor Frequency) + /// + [Description("Dispenser 1 Motor Frequency")] + Dispenser1MotorFrequency = 28, + + /// + /// (Dispenser 2 Motor Frequency) + /// + [Description("Dispenser 2 Motor Frequency")] + Dispenser2MotorFrequency = 29, + + /// + /// (Dispenser 3 Motor Frequency) + /// + [Description("Dispenser 3 Motor Frequency")] + Dispenser3MotorFrequency = 30, + + /// + /// (Dispenser 4 Motor Frequency) + /// + [Description("Dispenser 4 Motor Frequency")] + Dispenser4MotorFrequency = 31, + + /// + /// (Dispenser 5 Motor Frequency) + /// + [Description("Dispenser 5 Motor Frequency")] + Dispenser5MotorFrequency = 32, + + /// + /// (Dispenser 6 Motor Frequency) + /// + [Description("Dispenser 6 Motor Frequency")] + Dispenser6MotorFrequency = 33, + + /// + /// (Dispenser 7 Motor Frequency) + /// + [Description("Dispenser 7 Motor Frequency")] + Dispenser7MotorFrequency = 34, + + /// + /// (Dispenser 8 Motor Frequency) + /// + [Description("Dispenser 8 Motor Frequency")] + Dispenser8MotorFrequency = 35, + } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMotors.cs b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMotors.cs index bef81b052..e99aacc83 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMotors.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/TechMotors.cs @@ -8,5 +8,24 @@ namespace Tango.Integration.Observables { public enum TechMotors { + + /// + /// (Dispenser 1 Motor) + /// + [Description("Dispenser 1 Motor")] + Dispenser1Motor = 0, + + /// + /// (Dancer 1 Motor) + /// + [Description("Dancer 1 Motor")] + Dancer1Motor = 1, + + /// + /// (Dancer 2 Motor) + /// + [Description("Dancer 2 Motor")] + Dancer2Motor = 2, + } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs index 63f45cd76..1e1874205 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs @@ -95,7 +95,7 @@ namespace Tango.Integration.Observables if (!DesignMode) { - ThreadsHelper.InvokeUI(() => + ThreadsHelper.InvokeWhenAvailable(() => { Parameters = new ReadOnlyObservableCollection(this.CreateParametersCollection(ParameterItemMode.Binding)); }); diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContext.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContext.cs index 39bd02357..a21463c9b 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesContext.cs @@ -423,6 +423,14 @@ namespace Tango.Integration.Observables get; set; } + /// + /// Gets or sets the TechIos. + /// + public DbSet TechIos + { + get; set; + } + /// /// Gets or sets the TechMonitors. /// diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapter.cs index 194ea5669..7151cb188 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapter.cs @@ -267,6 +267,8 @@ namespace Tango.Integration.Observables TechValves = Context.TechValves.ToObservableCollection(); + TechIos = Context.TechIos.ToObservableCollection(); + IdsPackFormulas = Context.IdsPackFormulas.ToObservableCollection(); ColorSpaces = Context.ColorSpaces.ToObservableCollection(); diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapterExtension.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapterExtension.cs index 65d41e05a..67b2d786e 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapterExtension.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservablesEntitiesAdapterExtension.cs @@ -1698,6 +1698,42 @@ namespace Tango.Integration.Observables } + private ObservableCollection _techios; + /// + /// Gets or sets the TechIos. + /// + public ObservableCollection TechIos + { + get + { + return _techios; + } + + set + { + _techios = value; RaisePropertyChanged(nameof(TechIos)); + } + + } + + private ICollectionView _techiosViewSource; + /// + /// Gets or sets the TechIos View Source. + /// + public ICollectionView TechIosViewSource + { + get + { + return _techiosViewSource; + } + + set + { + _techiosViewSource = value; RaisePropertyChanged(nameof(TechIosViewSource)); + } + + } + private ObservableCollection _techmonitors; /// /// Gets or sets the TechMonitors. @@ -2014,6 +2050,8 @@ namespace Tango.Integration.Observables TechDispensersViewSource = CreateCollectionView(TechDispensers); + TechIosViewSource = CreateCollectionView(TechIos); + TechMonitorsViewSource = CreateCollectionView(TechMonitors); TechMotorsViewSource = CreateCollectionView(TechMotors); diff --git a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs index 078375e4f..e067e7a98 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs @@ -95,11 +95,11 @@ namespace Tango.Integration.Operators Task> StopDispenserHoming(DispenserAbortHomingRequest request); /// - /// Turn on/off the specified GPIO port. + /// Turn on/off the specified digital output pin. /// /// The request. /// - Task> SetGPIOState(SetGPIOStateRequest request); + Task> SetDigitalOut(SetDigitalOutRequest request); /// /// Starts jogging the thread motion system. diff --git a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs index b89a8c7ca..4bbd7aa64 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs @@ -265,13 +265,13 @@ namespace Tango.Integration.Operators } /// - /// Turn on/off the specified GPIO port. + /// Turn on/off the specified digital output pin. /// /// The request. /// - public Task> SetGPIOState(SetGPIOStateRequest request) + public Task> SetDigitalOut(SetDigitalOutRequest request) { - return SendRequest(request); + return SendRequest(request); } /// diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 346d91f12..dd6f8b99e 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -110,6 +110,7 @@ + @@ -148,6 +149,7 @@ + diff --git a/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs b/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs index 8c663c246..ec1ed555f 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs @@ -22,9 +22,10 @@ namespace Tango.PMR.Common { static ErrorCodeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cg9FcnJvckNvZGUucHJvdG8SEFRhbmdvLlBNUi5Db21tb24qIgoJRXJyb3JD", - "b2RlEggKBE5PTkUQABILCgdCQURfQ1JDEAFCHAoaY29tLnR3aW5lLnRhbmdv", - "LnBtci5jb21tb25iBnByb3RvMw==")); + "Cg9FcnJvckNvZGUucHJvdG8SEFRhbmdvLlBNUi5Db21tb24qQgoJRXJyb3JD", + "b2RlEggKBE5PTkUQABILCgdCQURfQ1JDEAESHgoaSU5WQUxJRF9ESUdJVEFM", + "X1BJTl9OVU1CRVIQAkIcChpjb20udHdpbmUudGFuZ28ucG1yLmNvbW1vbmIG", + "cHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.ErrorCode), }, null)); @@ -36,6 +37,10 @@ namespace Tango.PMR.Common { public enum ErrorCode { [pbr::OriginalName("NONE")] None = 0, [pbr::OriginalName("BAD_CRC")] BadCrc = 1, + /// + ///Can be returned by SetDigitalOutResponse. + /// + [pbr::OriginalName("INVALID_DIGITAL_PIN_NUMBER")] InvalidDigitalPinNumber = 2, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 54b83906e..4811280d1 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( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqPEAoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqREAoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhQKEENhbGN1bGF0ZVJlcXVlc3QQAxIVChFD", "YWxjdWxhdGVSZXNwb25zZRAEEhMKD1Byb2dyZXNzUmVxdWVzdBAFEhQKEFBy", "b2dyZXNzUmVzcG9uc2UQBhIcChhTdHViQ2FydHJpZGdlUmVhZFJlcXVlc3QQ", @@ -63,13 +63,13 @@ namespace Tango.PMR.Common { "cG9uc2UQ3Q8SHAoXRGlzcGVuc2VySm9nZ2luZ1JlcXVlc3QQ3g8SHQoYRGlz", "cGVuc2VySm9nZ2luZ1Jlc3BvbnNlEN8PEiEKHERpc3BlbnNlckFib3J0Sm9n", "Z2luZ1JlcXVlc3QQ4A8SIgodRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVzcG9u", - "c2UQ4Q8SGAoTU2V0R1BJT1N0YXRlUmVxdWVzdBDiDxIZChRTZXRHUElPU3Rh", - "dGVSZXNwb25zZRDjDxIZChRUaHJlYWRKb2dnaW5nUmVxdWVzdBDkDxIaChVU", - "aHJlYWRKb2dnaW5nUmVzcG9uc2UQ5Q8SHgoZVGhyZWFkQWJvcnRKb2dnaW5n", - "UmVxdWVzdBDmDxIfChpUaHJlYWRBYm9ydEpvZ2dpbmdSZXNwb25zZRDnDxIP", - "CgpKb2JSZXF1ZXN0ELgXEhAKC0pvYlJlc3BvbnNlELkXEhQKD0Fib3J0Sm9i", - "UmVxdWVzdBC6FxIVChBBYm9ydEpvYlJlc3BvbnNlELsXQhwKGmNvbS50d2lu", - "ZS50YW5nby5wbXIuY29tbW9uYgZwcm90bzM=")); + "c2UQ4Q8SGQoUU2V0RGlnaXRhbE91dFJlcXVlc3QQ4g8SGgoVU2V0RGlnaXRh", + "bE91dFJlc3BvbnNlEOMPEhkKFFRocmVhZEpvZ2dpbmdSZXF1ZXN0EOQPEhoK", + "FVRocmVhZEpvZ2dpbmdSZXNwb25zZRDlDxIeChlUaHJlYWRBYm9ydEpvZ2dp", + "bmdSZXF1ZXN0EOYPEh8KGlRocmVhZEFib3J0Sm9nZ2luZ1Jlc3BvbnNlEOcP", + "Eg8KCkpvYlJlcXVlc3QQuBcSEAoLSm9iUmVzcG9uc2UQuRcSFAoPQWJvcnRK", + "b2JSZXF1ZXN0ELoXEhUKEEFib3J0Sm9iUmVzcG9uc2UQuxdCHAoaY29tLnR3", + "aW5lLnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -153,8 +153,8 @@ namespace Tango.PMR.Common { [pbr::OriginalName("DispenserJoggingResponse")] DispenserJoggingResponse = 2015, [pbr::OriginalName("DispenserAbortJoggingRequest")] DispenserAbortJoggingRequest = 2016, [pbr::OriginalName("DispenserAbortJoggingResponse")] DispenserAbortJoggingResponse = 2017, - [pbr::OriginalName("SetGPIOStateRequest")] SetGpiostateRequest = 2018, - [pbr::OriginalName("SetGPIOStateResponse")] SetGpiostateResponse = 2019, + [pbr::OriginalName("SetDigitalOutRequest")] SetDigitalOutRequest = 2018, + [pbr::OriginalName("SetDigitalOutResponse")] SetDigitalOutResponse = 2019, [pbr::OriginalName("ThreadJoggingRequest")] ThreadJoggingRequest = 2020, [pbr::OriginalName("ThreadJoggingResponse")] ThreadJoggingResponse = 2021, [pbr::OriginalName("ThreadAbortJoggingRequest")] ThreadAbortJoggingRequest = 2022, diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DigitalPin.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DigitalPin.cs new file mode 100644 index 000000000..f5bdb949a --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DigitalPin.cs @@ -0,0 +1,187 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DigitalPin.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 DigitalPin.proto + public static partial class DigitalPinReflection { + + #region Descriptor + /// File descriptor for DigitalPin.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DigitalPinReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChBEaWdpdGFsUGluLnByb3RvEhVUYW5nby5QTVIuRGlhZ25vc3RpY3MiKQoK", + "RGlnaXRhbFBpbhIMCgRQb3J0GAEgASgFEg0KBVZhbHVlGAIgASgIQiEKH2Nv", + "bS50d2luZS50YW5nby5wbXIuZGlhZ25vc3RpY3NiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DigitalPin), global::Tango.PMR.Diagnostics.DigitalPin.Parser, new[]{ "Port", "Value" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DigitalPin : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DigitalPin()); + [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.DigitalPinReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DigitalPin() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DigitalPin(DigitalPin other) : this() { + port_ = other.port_; + value_ = other.value_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DigitalPin Clone() { + return new DigitalPin(this); + } + + /// Field number for the "Port" field. + public const int PortFieldNumber = 1; + private int port_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Port { + get { return port_; } + set { + port_ = value; + } + } + + /// Field number for the "Value" field. + public const int ValueFieldNumber = 2; + private bool value_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DigitalPin); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DigitalPin other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Port != other.Port) return false; + if (Value != other.Value) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Port != 0) hash ^= Port.GetHashCode(); + if (Value != false) hash ^= Value.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 (Port != 0) { + output.WriteRawTag(8); + output.WriteInt32(Port); + } + if (Value != false) { + output.WriteRawTag(16); + output.WriteBool(Value); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Port != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); + } + if (Value != false) { + size += 1 + 1; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DigitalPin other) { + if (other == null) { + return; + } + if (other.Port != 0) { + Port = other.Port; + } + if (other.Value != false) { + Value = other.Value; + } + } + + [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: { + Port = input.ReadInt32(); + break; + } + case 16: { + Value = input.ReadBool(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs index 864910381..d86dc8882 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs @@ -23,22 +23,23 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1QdXNoRGlhZ25vc3RpY3NSZXNwb25zZS5wcm90bxIVVGFuZ28uUE1SLkRp", - "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90byLAAwoXUHVzaERpYWdub3N0", - "aWNzUmVzcG9uc2USFAoMRGFuY2VyMUFuZ2xlGAEgAygBEhQKDERhbmNlcjJB", - "bmdsZRgCIAMoARIUCgxEYW5jZXIzQW5nbGUYAyADKAESRQoZRGlzcGVuc2Vy", - "c01vdG9yc0ZyZXF1ZW5jeRgEIAMoCzIiLlRhbmdvLlBNUi5EaWFnbm9zdGlj", - "cy5Eb3VibGVBcnJheRIgChhEaXNwZW5zZXIxTW90b3JGcmVxdWVuY3kYBSAD", - "KAESIAoYRGlzcGVuc2VyMk1vdG9yRnJlcXVlbmN5GAYgAygBEiAKGERpc3Bl", - "bnNlcjNNb3RvckZyZXF1ZW5jeRgHIAMoARIgChhEaXNwZW5zZXI0TW90b3JG", - "cmVxdWVuY3kYCCADKAESIAoYRGlzcGVuc2VyNU1vdG9yRnJlcXVlbmN5GAkg", - "AygBEiAKGERpc3BlbnNlcjZNb3RvckZyZXF1ZW5jeRgKIAMoARIgChhEaXNw", - "ZW5zZXI3TW90b3JGcmVxdWVuY3kYCyADKAESIAoYRGlzcGVuc2VyOE1vdG9y", - "RnJlcXVlbmN5GAwgAygBEgwKBEdQSU8YDSADKAhCIQofY29tLnR3aW5lLnRh", - "bmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90bxoQRGlnaXRhbFBpbi5wcm90", + "byLqAwoXUHVzaERpYWdub3N0aWNzUmVzcG9uc2USFAoMRGFuY2VyMUFuZ2xl", + "GAEgAygBEhQKDERhbmNlcjJBbmdsZRgCIAMoARIUCgxEYW5jZXIzQW5nbGUY", + "AyADKAESRQoZRGlzcGVuc2Vyc01vdG9yc0ZyZXF1ZW5jeRgEIAMoCzIiLlRh", + "bmdvLlBNUi5EaWFnbm9zdGljcy5Eb3VibGVBcnJheRIgChhEaXNwZW5zZXIx", + "TW90b3JGcmVxdWVuY3kYBSADKAESIAoYRGlzcGVuc2VyMk1vdG9yRnJlcXVl", + "bmN5GAYgAygBEiAKGERpc3BlbnNlcjNNb3RvckZyZXF1ZW5jeRgHIAMoARIg", + "ChhEaXNwZW5zZXI0TW90b3JGcmVxdWVuY3kYCCADKAESIAoYRGlzcGVuc2Vy", + "NU1vdG9yRnJlcXVlbmN5GAkgAygBEiAKGERpc3BlbnNlcjZNb3RvckZyZXF1", + "ZW5jeRgKIAMoARIgChhEaXNwZW5zZXI3TW90b3JGcmVxdWVuY3kYCyADKAES", + "IAoYRGlzcGVuc2VyOE1vdG9yRnJlcXVlbmN5GAwgAygBEjYKC0RpZ2l0YWxQ", + "aW5zGA0gAygLMiEuVGFuZ28uUE1SLkRpYWdub3N0aWNzLkRpZ2l0YWxQaW5C", + "IQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.DoubleArrayReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.DoubleArrayReflection.Descriptor, global::Tango.PMR.Diagnostics.DigitalPinReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushDiagnosticsResponse), global::Tango.PMR.Diagnostics.PushDiagnosticsResponse.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "DispensersMotorsFrequency", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency", "GPIO" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushDiagnosticsResponse), global::Tango.PMR.Diagnostics.PushDiagnosticsResponse.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "DispensersMotorsFrequency", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency", "DigitalPins" }, null, null, null) })); } #endregion @@ -81,7 +82,7 @@ namespace Tango.PMR.Diagnostics { dispenser6MotorFrequency_ = other.dispenser6MotorFrequency_.Clone(); dispenser7MotorFrequency_ = other.dispenser7MotorFrequency_.Clone(); dispenser8MotorFrequency_ = other.dispenser8MotorFrequency_.Clone(); - gPIO_ = other.gPIO_.Clone(); + digitalPins_ = other.digitalPins_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -215,17 +216,17 @@ namespace Tango.PMR.Diagnostics { get { return dispenser8MotorFrequency_; } } - /// Field number for the "GPIO" field. - public const int GPIOFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_gPIO_codec - = pb::FieldCodec.ForBool(106); - private readonly pbc::RepeatedField gPIO_ = new pbc::RepeatedField(); + /// Field number for the "DigitalPins" field. + public const int DigitalPinsFieldNumber = 13; + private static readonly pb::FieldCodec _repeated_digitalPins_codec + = pb::FieldCodec.ForMessage(106, global::Tango.PMR.Diagnostics.DigitalPin.Parser); + private readonly pbc::RepeatedField digitalPins_ = new pbc::RepeatedField(); /// ///GPIO Ports States /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField GPIO { - get { return gPIO_; } + public pbc::RepeatedField DigitalPins { + get { return digitalPins_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -253,7 +254,7 @@ namespace Tango.PMR.Diagnostics { if(!dispenser6MotorFrequency_.Equals(other.dispenser6MotorFrequency_)) return false; if(!dispenser7MotorFrequency_.Equals(other.dispenser7MotorFrequency_)) return false; if(!dispenser8MotorFrequency_.Equals(other.dispenser8MotorFrequency_)) return false; - if(!gPIO_.Equals(other.gPIO_)) return false; + if(!digitalPins_.Equals(other.digitalPins_)) return false; return true; } @@ -272,7 +273,7 @@ namespace Tango.PMR.Diagnostics { hash ^= dispenser6MotorFrequency_.GetHashCode(); hash ^= dispenser7MotorFrequency_.GetHashCode(); hash ^= dispenser8MotorFrequency_.GetHashCode(); - hash ^= gPIO_.GetHashCode(); + hash ^= digitalPins_.GetHashCode(); return hash; } @@ -295,7 +296,7 @@ namespace Tango.PMR.Diagnostics { dispenser6MotorFrequency_.WriteTo(output, _repeated_dispenser6MotorFrequency_codec); dispenser7MotorFrequency_.WriteTo(output, _repeated_dispenser7MotorFrequency_codec); dispenser8MotorFrequency_.WriteTo(output, _repeated_dispenser8MotorFrequency_codec); - gPIO_.WriteTo(output, _repeated_gPIO_codec); + digitalPins_.WriteTo(output, _repeated_digitalPins_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -313,7 +314,7 @@ namespace Tango.PMR.Diagnostics { size += dispenser6MotorFrequency_.CalculateSize(_repeated_dispenser6MotorFrequency_codec); size += dispenser7MotorFrequency_.CalculateSize(_repeated_dispenser7MotorFrequency_codec); size += dispenser8MotorFrequency_.CalculateSize(_repeated_dispenser8MotorFrequency_codec); - size += gPIO_.CalculateSize(_repeated_gPIO_codec); + size += digitalPins_.CalculateSize(_repeated_digitalPins_codec); return size; } @@ -334,7 +335,7 @@ namespace Tango.PMR.Diagnostics { dispenser6MotorFrequency_.Add(other.dispenser6MotorFrequency_); dispenser7MotorFrequency_.Add(other.dispenser7MotorFrequency_); dispenser8MotorFrequency_.Add(other.dispenser8MotorFrequency_); - gPIO_.Add(other.gPIO_); + digitalPins_.Add(other.digitalPins_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -404,9 +405,8 @@ namespace Tango.PMR.Diagnostics { dispenser8MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser8MotorFrequency_codec); break; } - case 106: - case 104: { - gPIO_.AddEntriesFrom(input, _repeated_gPIO_codec); + case 106: { + digitalPins_.AddEntriesFrom(input, _repeated_digitalPins_codec); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutRequest.cs new file mode 100644 index 000000000..05e9fd067 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutRequest.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SetDigitalOutRequest.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 SetDigitalOutRequest.proto + public static partial class SetDigitalOutRequestReflection { + + #region Descriptor + /// File descriptor for SetDigitalOutRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static SetDigitalOutRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChpTZXREaWdpdGFsT3V0UmVxdWVzdC5wcm90bxIVVGFuZ28uUE1SLkRpYWdu", + "b3N0aWNzIjMKFFNldERpZ2l0YWxPdXRSZXF1ZXN0EgwKBFBvcnQYASABKAUS", + "DQoFVmFsdWUYAiABKAhCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9z", + "dGljc2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.SetDigitalOutRequest), global::Tango.PMR.Diagnostics.SetDigitalOutRequest.Parser, new[]{ "Port", "Value" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class SetDigitalOutRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SetDigitalOutRequest()); + [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.SetDigitalOutRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetDigitalOutRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetDigitalOutRequest(SetDigitalOutRequest other) : this() { + port_ = other.port_; + value_ = other.value_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetDigitalOutRequest Clone() { + return new SetDigitalOutRequest(this); + } + + /// Field number for the "Port" field. + public const int PortFieldNumber = 1; + private int port_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Port { + get { return port_; } + set { + port_ = value; + } + } + + /// Field number for the "Value" field. + public const int ValueFieldNumber = 2; + private bool value_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SetDigitalOutRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SetDigitalOutRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Port != other.Port) return false; + if (Value != other.Value) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Port != 0) hash ^= Port.GetHashCode(); + if (Value != false) hash ^= Value.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 (Port != 0) { + output.WriteRawTag(8); + output.WriteInt32(Port); + } + if (Value != false) { + output.WriteRawTag(16); + output.WriteBool(Value); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Port != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); + } + if (Value != false) { + size += 1 + 1; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SetDigitalOutRequest other) { + if (other == null) { + return; + } + if (other.Port != 0) { + Port = other.Port; + } + if (other.Value != false) { + Value = other.Value; + } + } + + [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: { + Port = input.ReadInt32(); + break; + } + case 16: { + Value = input.ReadBool(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutResponse.cs new file mode 100644 index 000000000..0d8233b94 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetDigitalOutResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SetDigitalOutResponse.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 SetDigitalOutResponse.proto + public static partial class SetDigitalOutResponseReflection { + + #region Descriptor + /// File descriptor for SetDigitalOutResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static SetDigitalOutResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChtTZXREaWdpdGFsT3V0UmVzcG9uc2UucHJvdG8SFVRhbmdvLlBNUi5EaWFn", + "bm9zdGljcyIXChVTZXREaWdpdGFsT3V0UmVzcG9uc2VCIQofY29tLnR3aW5l", + "LnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.SetDigitalOutResponse), global::Tango.PMR.Diagnostics.SetDigitalOutResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class SetDigitalOutResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SetDigitalOutResponse()); + [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.SetDigitalOutResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetDigitalOutResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetDigitalOutResponse(SetDigitalOutResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetDigitalOutResponse Clone() { + return new SetDigitalOutResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SetDigitalOutResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SetDigitalOutResponse 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(SetDigitalOutResponse 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/SetGPIOStateRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateRequest.cs deleted file mode 100644 index 9a849a08b..000000000 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateRequest.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: SetGPIOStateRequest.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 SetGPIOStateRequest.proto - public static partial class SetGPIOStateRequestReflection { - - #region Descriptor - /// File descriptor for SetGPIOStateRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static SetGPIOStateRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChlTZXRHUElPU3RhdGVSZXF1ZXN0LnByb3RvEhVUYW5nby5QTVIuRGlhZ25v", - "c3RpY3MiMgoTU2V0R1BJT1N0YXRlUmVxdWVzdBIMCgRQb3J0GAEgASgFEg0K", - "BVZhbHVlGAIgASgIQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25vc3Rp", - "Y3NiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.SetGPIOStateRequest), global::Tango.PMR.Diagnostics.SetGPIOStateRequest.Parser, new[]{ "Port", "Value" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class SetGPIOStateRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SetGPIOStateRequest()); - [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.SetGPIOStateRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SetGPIOStateRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SetGPIOStateRequest(SetGPIOStateRequest other) : this() { - port_ = other.port_; - value_ = other.value_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SetGPIOStateRequest Clone() { - return new SetGPIOStateRequest(this); - } - - /// Field number for the "Port" field. - public const int PortFieldNumber = 1; - private int port_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Port { - get { return port_; } - set { - port_ = value; - } - } - - /// Field number for the "Value" field. - public const int ValueFieldNumber = 2; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SetGPIOStateRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SetGPIOStateRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Port != other.Port) return false; - if (Value != other.Value) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Port != 0) hash ^= Port.GetHashCode(); - if (Value != false) hash ^= Value.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 (Port != 0) { - output.WriteRawTag(8); - output.WriteInt32(Port); - } - if (Value != false) { - output.WriteRawTag(16); - output.WriteBool(Value); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Port != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); - } - if (Value != false) { - size += 1 + 1; - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SetGPIOStateRequest other) { - if (other == null) { - return; - } - if (other.Port != 0) { - Port = other.Port; - } - if (other.Value != false) { - Value = other.Value; - } - } - - [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: { - Port = input.ReadInt32(); - break; - } - case 16: { - Value = input.ReadBool(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateResponse.cs deleted file mode 100644 index cf8e4f49a..000000000 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateResponse.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: SetGPIOStateResponse.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 SetGPIOStateResponse.proto - public static partial class SetGPIOStateResponseReflection { - - #region Descriptor - /// File descriptor for SetGPIOStateResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static SetGPIOStateResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChpTZXRHUElPU3RhdGVSZXNwb25zZS5wcm90bxIVVGFuZ28uUE1SLkRpYWdu", - "b3N0aWNzIhYKFFNldEdQSU9TdGF0ZVJlc3BvbnNlQiEKH2NvbS50d2luZS50", - "YW5nby5wbXIuZGlhZ25vc3RpY3NiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.SetGPIOStateResponse), global::Tango.PMR.Diagnostics.SetGPIOStateResponse.Parser, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class SetGPIOStateResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SetGPIOStateResponse()); - [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.SetGPIOStateResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SetGPIOStateResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SetGPIOStateResponse(SetGPIOStateResponse other) : this() { - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SetGPIOStateResponse Clone() { - return new SetGPIOStateResponse(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SetGPIOStateResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SetGPIOStateResponse 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(SetGPIOStateResponse 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/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 04e856594..0d4034767 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -55,6 +55,7 @@ + @@ -75,8 +76,8 @@ - - + + diff --git a/Software/Visual_Studio/Tango.Transport/ITransporter.cs b/Software/Visual_Studio/Tango.Transport/ITransporter.cs index f1dd296e8..1861ae6a3 100644 --- a/Software/Visual_Studio/Tango.Transport/ITransporter.cs +++ b/Software/Visual_Studio/Tango.Transport/ITransporter.cs @@ -63,7 +63,7 @@ namespace Tango.Transport /// The response. /// The token. /// - Task SendResponse(TangoMessage response, String token, bool? completed = null) where Response : IMessage; + Task SendResponse(TangoMessage response, String token, bool? completed = null, ErrorCode? errorCode = null) where Response : IMessage; /// /// Occurs when a new request message has been received. diff --git a/Software/Visual_Studio/Tango.Transport/ResponseErrorException.cs b/Software/Visual_Studio/Tango.Transport/ResponseErrorException.cs index 365a5d432..747a07b4f 100644 --- a/Software/Visual_Studio/Tango.Transport/ResponseErrorException.cs +++ b/Software/Visual_Studio/Tango.Transport/ResponseErrorException.cs @@ -20,11 +20,13 @@ namespace Tango.Transport /// public ErrorCode Error { get; set; } + public MessageType MessageType { get; set; } + /// /// Initializes a new instance of the class. /// /// The error. - public ResponseErrorException(ErrorCode error) : base("Response received with error " + error.ToString()) + public ResponseErrorException(ErrorCode error, MessageType messageType) : base("Response " + messageType.ToString() + " returned with error " + error.ToString()) { Error = error; } diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 0f4193aab..236cc3976 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -327,7 +327,7 @@ namespace Tango.Transport /// The response. /// The token. /// - public Task SendResponse(TangoMessage response, String token, bool? completed = null) where Response : IMessage + public Task SendResponse(TangoMessage response, String token, bool? completed = null, ErrorCode? errorCode = null) where Response : IMessage { response.Container.Token = token; @@ -336,6 +336,11 @@ namespace Tango.Transport response.Container.Completed = completed.Value; } + if (errorCode.HasValue) + { + response.Container.Error = errorCode.Value; + } + LogManager.Log("Queuing response message: " + typeof(Response).Name, LogCategory.Debug); PendingResponse pendingResponse = null; @@ -492,7 +497,7 @@ namespace Tango.Transport else { LogManager.Log("Response has returned with error: " + container.Error.ToString(), LogCategory.Warning); - request.SetException(new ResponseErrorException(container.Error)); + request.SetException(new ResponseErrorException(container.Error, container.Type)); } } catch (Exception ex) @@ -518,7 +523,7 @@ namespace Tango.Transport else { LogManager.Log("Response has returned with error: " + container.Error.ToString(), LogCategory.Warning); - request.SetException(new ResponseErrorException(container.Error)); + request.SetException(new ResponseErrorException(container.Error, container.Type)); } } catch (Exception ex) diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs index 3973e8ad5..130015d42 100644 --- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs @@ -29,6 +29,8 @@ namespace Tango.DBObservablesGenerator.CLI //Generate Entities... foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) { + Console.WriteLine("Generating table '" + table + "'..."); + EntityCodeFile codeFile = new EntityCodeFile(DalNameToStandardName(table.Name).SingularizeMVC()) { EntityName = table.Name.SingularizeMVC(), @@ -105,6 +107,8 @@ namespace Tango.DBObservablesGenerator.CLI EnumerationFile enumFile = new EnumerationFile(); enumFile.Name = DalNameToStandardName(tableProp.Name); + Console.WriteLine("Generating enumeration '" + enumFile.Name + "'..."); + foreach (var row in tableProp.GetValue(db) as IEnumerable) { EnumerationField field = new EnumerationField(); @@ -134,6 +138,9 @@ namespace Tango.DBObservablesGenerator.CLI //Generate Enumerations... //Generate Observables Adapter Extensions... + + Console.WriteLine("Generating Observables Adapter..."); + ObservablesAdapterFile adapterFile = new ObservablesAdapterFile(); adapterFile.Name = "ObservablesEntitiesAdapter"; @@ -151,6 +158,9 @@ namespace Tango.DBObservablesGenerator.CLI //Generate Observables Adapter Extensions... //Generate Observables Context + + Console.WriteLine("Generating Observables DB Context..."); + ObservablesContextCodeFile contextFile = new ObservablesContextCodeFile(); contextFile.Name = "ObservablesContext"; diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.config b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.config index 4f1ff76f3..08560e57b 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.config +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.config @@ -1,8 +1,12 @@  - - - + + +
+ + + + @@ -11,4 +15,10 @@ - + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.xaml.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.xaml.cs index 24222d957..f5a43c972 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/App.xaml.cs @@ -5,6 +5,7 @@ using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; +using Tango.Logging; namespace Tango.MachineEM.UI { @@ -13,5 +14,15 @@ namespace Tango.MachineEM.UI ///
public partial class App : Application { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + LogManager.Categories.Clear(); + LogManager.Categories.Add(LogCategory.Critical); + LogManager.Categories.Add(LogCategory.Error); + LogManager.Categories.Add(LogCategory.General); + LogManager.Categories.Add(LogCategory.Warning); + } } } diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml.cs index 7baded308..0f03d74a9 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml.cs @@ -13,6 +13,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.Helpers; using Tango.Logging; namespace Tango.MachineEM.UI @@ -28,6 +29,7 @@ namespace Tango.MachineEM.UI public MainWindow() { InitializeComponent(); + ThreadsHelper.SetDisptacher(Dispatcher); } } } diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj index e15e75bc5..ff4ab4a62 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj @@ -37,6 +37,12 @@ machine.ico + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + ..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll @@ -47,6 +53,7 @@ ..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + ..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll @@ -130,10 +137,18 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {38197109-8610-4d3f-92b9-16d48df94d7c} + Tango.DAL.Remote + {63561e19-ff5a-414b-a5ef-e30711543e1d} Tango.Emulations + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/packages.config b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/packages.config index 9cbe8b937..e1cb3339d 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/packages.config +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/packages.config @@ -1,5 +1,6 @@  + -- cgit v1.3.1