diff options
26 files changed, 823 insertions, 13 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 2352d6907..6bb71208a 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 1a3991eae..085c8a4a6 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/binary.png b/Software/Graphics/binary.png Binary files differnew file mode 100644 index 000000000..24b399f96 --- /dev/null +++ b/Software/Graphics/binary.png diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 0c43f2b2d..1b6295975 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -68,7 +68,6 @@ enum MessageType MotorJoggingResponse = 2007; MotorAbortJoggingRequest = 2008; MotorAbortJoggingResponse = 2009; - DispenserAbortHomingRequest = 2010; DispenserAbortHomingResponse = 2011; DispenserHomingRequest = 2012; @@ -77,6 +76,8 @@ enum MessageType DispenserJoggingResponse = 2015; DispenserAbortJoggingRequest = 2016; DispenserAbortJoggingResponse = 2017; + SetGPIOStateRequest = 2018; + SetGPIOStateResponse = 2019; //Printing diff --git a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto index e45cb3040..a79d0cba9 100644 --- a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto +++ b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto @@ -14,7 +14,7 @@ message PushDiagnosticsResponse //Dispensers Motors Frequency Multi repeated DoubleArray DispensersMotorsFrequency = 4; - //Dispensers Motors Frequency Singles + //Dispensers Motors Frequency Singles repeated double Dispenser1MotorFrequency = 5; repeated double Dispenser2MotorFrequency = 6; repeated double Dispenser3MotorFrequency = 7; @@ -23,4 +23,7 @@ message PushDiagnosticsResponse repeated double Dispenser6MotorFrequency = 10; repeated double Dispenser7MotorFrequency = 11; repeated double Dispenser8MotorFrequency = 12; + + //GPIO Ports States + repeated bool GPIO = 13; }
\ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto b/Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto new file mode 100644 index 000000000..86685ac85 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/SetGPIOStateRequest.proto @@ -0,0 +1,10 @@ +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 new file mode 100644 index 000000000..51b8b6c97 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/SetGPIOStateResponse.proto @@ -0,0 +1,9 @@ +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/Editors/IOElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml new file mode 100644 index 000000000..aa4f8aee6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml @@ -0,0 +1,106 @@ +<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.IOElementEditor" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" + xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" + mc:Ignorable="d" + d:DesignHeight="88.852" d:DesignWidth="142.323" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:IOItem, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + + <!--Theme--> + <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> + <SolidColorBrush x:Key="CornersBrush" Color="Red"></SolidColorBrush> + </UserControl.Resources> + + <UserControl.RenderTransform> + <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform> + </UserControl.RenderTransform> + + <Grid> + + + <!--Content--> + <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}"> + <Grid.RowDefinitions> + <RowDefinition Height="221*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + + <Border BorderBrush="Gray" BorderThickness="1" CornerRadius="5" Padding="5"> + <Border.Background> + <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> + </Border.Background> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="55*"/> + <ColumnDefinition Width="55*"/> + </Grid.ColumnDefinitions> + + <Viewbox Margin="5"> + <visuals:Led Width="100" Height="100" IsChecked="{Binding EffectiveValue}" IsHitTestVisible="False" /> + </Viewbox> + <visuals:AnalogSwitch Cursor="Hand" RenderTransformOrigin="0.5,0.5" Grid.Column="1" IsChecked="{Binding Value,Mode=TwoWay}"> + <!--<visuals:AnalogSwitch.LayoutTransform> + <RotateTransform Angle="90" /> + </visuals:AnalogSwitch.LayoutTransform>--> + </visuals:AnalogSwitch> + </Grid> + </Border> + + <Border VerticalAlignment="Bottom" Grid.Row="1" Margin="0 0 0 0"> + <TextBlock TextWrapping="Wrap" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"> + <Run>GPIO</Run> + <Run Text="{Binding Port}"></Run> + </TextBlock> + </Border> + </Grid> + <!--Content--> + + + <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}"> + <Grid> + <ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter> + + <Thumb Opacity="0" DragDelta="MoveDrag" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" DragDelta="DragLeft" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" DragDelta="DragRight" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb VerticalAlignment="Top" Cursor="SizeNS" Opacity="0" DragDelta="DragTop" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb VerticalAlignment="Bottom" Cursor="SizeNS" Opacity="0" DragDelta="DragBottom" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + + <Grid ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 -20 0 0" Width="10" Height="10"> + <Ellipse Stroke="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" StrokeThickness="2"></Ellipse> + <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0 10 0 -8" StrokeThickness="1" Stroke="Red"></Rectangle> + <Thumb Opacity="0" DragDelta="DragAngle" DragStarted="DragStarted" Cursor="Arrow" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-8 -8 0 0"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 2 0 0"></Border> + <Thumb Opacity="0" DragDelta="DragTopLeft" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -8 -8 0"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 2 2 0"></Border> + <Thumb Opacity="0" DragDelta="DragTopRight" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -8 -8"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 0 2 2"></Border> + <Thumb Opacity="0" DragDelta="DragBottomRight" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-8 0 0 -8"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 0 0 2"></Border> + <Thumb Opacity="0" DragDelta="DragBottomLeft" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb> + </Grid> + </Grid> + </Border> + </Grid> +</local:ElementEditor> 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 new file mode 100644 index 000000000..95710abd3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs @@ -0,0 +1,102 @@ +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 + { + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + public IOElementEditor() + : base() + { + InitializeComponent(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + public IOElementEditor(IOItem ioItem) + : this() + { + IOItem = ioItem; + DataContext = IOItem; + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + /// <param name="bounds">The bounds.</param> + 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)); } + } + + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + 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); + } + } + + /// <summary> + /// Gets the hosted element. + /// </summary> + [ParameterIgnore] + public override Object HostedElement + { + get { return IOItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/binary.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/binary.png Binary files differnew file mode 100644 index 000000000..24b399f96 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/binary.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml index 0eca72dcd..a732e2924 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml @@ -22,7 +22,7 @@ <Grid> <StackPanel> - <GroupBox Header="MOTOR"> + <GroupBox Header="DISPENSER"> <StackPanel> <TextBlock FontSize="10">Selected Motor</TextBlock> <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechDispensers}" SelectedItem="{Binding TechDispenser,Mode=TwoWay}" DisplayMemberPath="Description" /> 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 new file mode 100644 index 000000000..c03b72837 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml @@ -0,0 +1,33 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.IOTemplate" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:IOItem, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" /> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <StackPanel> + <GroupBox Header="GPIO PORT"> + <StackPanel> + <TextBlock FontSize="10">Selected Port</TextBlock> + <ComboBox x:Name="combo" Margin="0 5 0 0" SelectedItem="{Binding Port,Mode=TwoWay}" /> + </StackPanel> + </GroupBox> + </StackPanel> + </Grid> +</UserControl> 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 new file mode 100644 index 000000000..fae3586dc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs @@ -0,0 +1,37 @@ +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 +{ + /// <summary> + /// Interaction logic for MonitorTemplate.xaml + /// </summary> + public partial class IOTemplate : UserControl + { + public IOTemplate() + { + InitializeComponent(); + + List<int> ports = new List<int>(); + + 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 34208aded..9af2c8ef8 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 @@ -100,6 +100,9 @@ <Compile Include="Editors\DispenserElementEditor.xaml.cs"> <DependentUpon>DispenserElementEditor.xaml</DependentUpon> </Compile> + <Compile Include="Editors\IOElementEditor.xaml.cs"> + <DependentUpon>IOElementEditor.xaml</DependentUpon> + </Compile> <Compile Include="Editors\MotorElementEditor.xaml.cs"> <DependentUpon>MotorElementEditor.xaml</DependentUpon> </Compile> @@ -116,6 +119,9 @@ <DependentUpon>MonitorElementEditor.xaml</DependentUpon> </Compile> <Compile Include="Helpers\GraphsHelper.cs" /> + <Compile Include="PropertiesTemplates\IOTemplate.xaml.cs"> + <DependentUpon>IOTemplate.xaml</DependentUpon> + </Compile> <Compile Include="PropertiesTemplates\MeterTemplate.xaml.cs"> <DependentUpon>MeterTemplate.xaml</DependentUpon> </Compile> @@ -134,6 +140,7 @@ <Compile Include="PropertiesTemplates\SingleGraphTemplate.xaml.cs"> <DependentUpon>SingleGraphTemplate.xaml</DependentUpon> </Compile> + <Compile Include="TechItems\IOItem.cs" /> <Compile Include="TechItems\MeterItem.cs" /> <Compile Include="TechItems\MotorActionType.cs" /> <Compile Include="TechItems\DispenserItem.cs" /> @@ -171,6 +178,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Editors\IOElementEditor.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Editors\MotorElementEditor.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -191,6 +202,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="PropertiesTemplates\IOTemplate.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="PropertiesTemplates\MeterTemplate.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -358,5 +373,8 @@ <ItemGroup> <Resource Include="Images\volume.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\binary.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file 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 new file mode 100644 index 000000000..c0a87842a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs @@ -0,0 +1,72 @@ +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.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class IOItem : TechItem + { + public event EventHandler<bool> ValueChanged; + + public override object Data => new object(); + + private int _port; + + public int Port + { + get { return _port; } + set { _port = value; RaisePropertyChangedAuto(); } + } + + 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/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 8ed8a4a80..21d2c50c2 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 @@ -116,6 +116,15 @@ namespace Tango.MachineStudio.Technician.ViewModels } } } + else if (item.GetType() == typeof(IOItem)) + { + IOItem ioItem = item as IOItem; + + if (ioItem.Port < data.GPIO.Count) + { + ioItem.EffectiveValue = data.GPIO[ioItem.Port]; + } + } else if (item.GetType() == typeof(MeterItem)) { MeterItem meterItem = item as MeterItem; @@ -260,6 +269,13 @@ namespace Tango.MachineStudio.Technician.ViewModels Elements.Add(editor); InitDispenserItem(dispenserItem); } + else if (SelectedTechItem is IOItem) + { + var ioItem = new IOItem(0); + IOElementEditor editor = new IOElementEditor(ioItem, bounds); + Elements.Add(editor); + InitIOItem(ioItem); + } } public void OnElementsRemoved(List<IElementEditor> elements) @@ -366,13 +382,13 @@ namespace Tango.MachineStudio.Technician.ViewModels { Code = item.TechMotor.Code }) - .Subscribe((response) => + .Subscribe((response) => { item.HomingMaximumProgress = response.Message.MaxProgress; item.HomingProgress = response.Message.Progress; - }, () => + }, () => { item.IsHoming = false; @@ -461,5 +477,20 @@ namespace Tango.MachineStudio.Technician.ViewModels } }; } + + private void InitIOItem(IOItem item) + { + item.ValueChanged += async (x, value) => + { + try + { + await MachineOperator.SetGPIOState(new SetGPIOStateRequest() { Port = item.Port, Value = value }); + } + catch (Exception ex) + { + //TODO: Show Exception. + } + }; + } } } 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 9e3970719..494f0892f 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 @@ -200,6 +200,9 @@ <DataTemplate DataType="{x:Type items:MonitorItem}"> <templates:MonitorTemplate/> </DataTemplate> + <DataTemplate DataType="{x:Type items:IOItem}"> + <templates:IOTemplate/> + </DataTemplate> <DataTemplate DataType="{x:Type items:DispenserItem}"> <templates:DispenserTemplate/> </DataTemplate> diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 5e76c2d1b..7645cf493 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -35,6 +35,7 @@ namespace Tango.Emulations.Emulators private List<int> _dispenserHomingRequestCodes; private double _graphAmplitude; private double _graphFrequency; + private List<bool> _ioStates; #region Constructors @@ -66,6 +67,13 @@ namespace Tango.Emulations.Emulators _motorHomingRequestCodes = new List<int>(); _dispenserJoggingRequestCodes = new List<int>(); _dispenserHomingRequestCodes = new List<int>(); + _ioStates = new List<bool>(); + + for (int i = 0; i < 120; i++) + { + _ioStates.Add(false); + } + ResetGraphFactors(); } @@ -127,6 +135,9 @@ namespace Tango.Emulations.Emulators case MessageType.DispenserAbortHomingRequest: HandleAbortDispenserHomingRequest(MessageFactory.ParseTangoMessageFromContainer<DispenserAbortHomingRequest>(container)); break; + case MessageType.SetGpiostateRequest: + HandleGPIOStateRequest(MessageFactory.ParseTangoMessageFromContainer<SetGPIOStateRequest>(container)); + break; } } @@ -218,6 +229,8 @@ namespace Tango.Emulations.Emulators res.Dispenser8MotorFrequency.AddRange(dispenserFrequencies[7].Data); } + res.GPIO.AddRange(_ioStates); + Transporter.SendResponse<PushDiagnosticsResponse>(res, request.Container.Token); Thread.Sleep(10); } @@ -424,6 +437,13 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse<DispenserAbortHomingResponse>(new DispenserAbortHomingResponse(), request.Container.Token); } + private void HandleGPIOStateRequest(TangoMessage<SetGPIOStateRequest> request) + { + LogManager.Log("Abort dispenser homing request received: " + Environment.NewLine + request.Message.ToJsonString()); + _ioStates[request.Message.Port] = request.Message.Value; + Transporter.SendResponse<SetGPIOStateResponse>(new SetGPIOStateResponse(), request.Container.Token); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs index 14c5114f3..6b88cad65 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs @@ -93,5 +93,12 @@ namespace Tango.Integration.Operators /// <param name="request">The request.</param> /// <returns></returns> Task<TangoMessage<DispenserAbortHomingResponse>> StopDispenserHoming(DispenserAbortHomingRequest request); + + /// <summary> + /// Turn on/off the specified GPIO port. + /// </summary> + /// <param name="request">The request.</param> + /// <returns></returns> + Task<TangoMessage<SetGPIOStateRequest>> SetGPIOState(SetGPIOStateRequest request); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs index f0d780191..426b3b865 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs @@ -264,6 +264,16 @@ namespace Tango.Integration.Operators return SendRequest<DispenserAbortHomingRequest, DispenserAbortHomingResponse>(request); } + /// <summary> + /// Turn on/off the specified GPIO port. + /// </summary> + /// <param name="request">The request.</param> + /// <returns></returns> + public Task<TangoMessage<SetGPIOStateRequest>> SetGPIOState(SetGPIOStateRequest request) + { + return SendRequest<SetGPIOStateRequest, SetGPIOStateRequest>(request); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 86dfe19ad..33067e82d 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( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiriDgoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqXDwoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhQKEENhbGN1bGF0ZVJlcXVlc3QQAxIVChFD", "YWxjdWxhdGVSZXNwb25zZRAEEhMKD1Byb2dyZXNzUmVxdWVzdBAFEhQKEFBy", "b2dyZXNzUmVzcG9uc2UQBhIcChhTdHViQ2FydHJpZGdlUmVhZFJlcXVlc3QQ", @@ -63,9 +63,10 @@ namespace Tango.PMR.Common { "cG9uc2UQ3Q8SHAoXRGlzcGVuc2VySm9nZ2luZ1JlcXVlc3QQ3g8SHQoYRGlz", "cGVuc2VySm9nZ2luZ1Jlc3BvbnNlEN8PEiEKHERpc3BlbnNlckFib3J0Sm9n", "Z2luZ1JlcXVlc3QQ4A8SIgodRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVzcG9u", - "c2UQ4Q8SDwoKSm9iUmVxdWVzdBC4FxIQCgtKb2JSZXNwb25zZRC5FxIUCg9B", - "Ym9ydEpvYlJlcXVlc3QQuhcSFQoQQWJvcnRKb2JSZXNwb25zZRC7F0IcChpj", - "b20udHdpbmUudGFuZ28ucG1yLmNvbW1vbmIGcHJvdG8z")); + "c2UQ4Q8SGAoTU2V0R1BJT1N0YXRlUmVxdWVzdBDiDxIZChRTZXRHUElPU3Rh", + "dGVSZXNwb25zZRDjDxIPCgpKb2JSZXF1ZXN0ELgXEhAKC0pvYlJlc3BvbnNl", + "ELkXEhQKD0Fib3J0Sm9iUmVxdWVzdBC6FxIVChBBYm9ydEpvYlJlc3BvbnNl", + "ELsXQhwKGmNvbS50d2luZS50YW5nby5wbXIuY29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -149,6 +150,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, /// <summary> ///Printing /// </summary> diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs index d654f77a1..864910381 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1QdXNoRGlhZ25vc3RpY3NSZXNwb25zZS5wcm90bxIVVGFuZ28uUE1SLkRp", - "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90byKyAwoXUHVzaERpYWdub3N0", + "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90byLAAwoXUHVzaERpYWdub3N0", "aWNzUmVzcG9uc2USFAoMRGFuY2VyMUFuZ2xlGAEgAygBEhQKDERhbmNlcjJB", "bmdsZRgCIAMoARIUCgxEYW5jZXIzQW5nbGUYAyADKAESRQoZRGlzcGVuc2Vy", "c01vdG9yc0ZyZXF1ZW5jeRgEIAMoCzIiLlRhbmdvLlBNUi5EaWFnbm9zdGlj", @@ -33,12 +33,12 @@ namespace Tango.PMR.Diagnostics { "cmVxdWVuY3kYCCADKAESIAoYRGlzcGVuc2VyNU1vdG9yRnJlcXVlbmN5GAkg", "AygBEiAKGERpc3BlbnNlcjZNb3RvckZyZXF1ZW5jeRgKIAMoARIgChhEaXNw", "ZW5zZXI3TW90b3JGcmVxdWVuY3kYCyADKAESIAoYRGlzcGVuc2VyOE1vdG9y", - "RnJlcXVlbmN5GAwgAygBQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25v", - "c3RpY3NiBnByb3RvMw==")); + "RnJlcXVlbmN5GAwgAygBEgwKBEdQSU8YDSADKAhCIQofY29tLnR3aW5lLnRh", + "bmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.DoubleArrayReflection.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" }, 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", "GPIO" }, null, null, null) })); } #endregion @@ -81,6 +81,7 @@ namespace Tango.PMR.Diagnostics { dispenser6MotorFrequency_ = other.dispenser6MotorFrequency_.Clone(); dispenser7MotorFrequency_ = other.dispenser7MotorFrequency_.Clone(); dispenser8MotorFrequency_ = other.dispenser8MotorFrequency_.Clone(); + gPIO_ = other.gPIO_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -214,6 +215,19 @@ namespace Tango.PMR.Diagnostics { get { return dispenser8MotorFrequency_; } } + /// <summary>Field number for the "GPIO" field.</summary> + public const int GPIOFieldNumber = 13; + private static readonly pb::FieldCodec<bool> _repeated_gPIO_codec + = pb::FieldCodec.ForBool(106); + private readonly pbc::RepeatedField<bool> gPIO_ = new pbc::RepeatedField<bool>(); + /// <summary> + ///GPIO Ports States + /// </summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<bool> GPIO { + get { return gPIO_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as PushDiagnosticsResponse); @@ -239,6 +253,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; return true; } @@ -257,6 +272,7 @@ namespace Tango.PMR.Diagnostics { hash ^= dispenser6MotorFrequency_.GetHashCode(); hash ^= dispenser7MotorFrequency_.GetHashCode(); hash ^= dispenser8MotorFrequency_.GetHashCode(); + hash ^= gPIO_.GetHashCode(); return hash; } @@ -279,6 +295,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); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -296,6 +313,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); return size; } @@ -316,6 +334,7 @@ namespace Tango.PMR.Diagnostics { dispenser6MotorFrequency_.Add(other.dispenser6MotorFrequency_); dispenser7MotorFrequency_.Add(other.dispenser7MotorFrequency_); dispenser8MotorFrequency_.Add(other.dispenser8MotorFrequency_); + gPIO_.Add(other.gPIO_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -385,6 +404,11 @@ namespace Tango.PMR.Diagnostics { dispenser8MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser8MotorFrequency_codec); break; } + case 106: + case 104: { + gPIO_.AddEntriesFrom(input, _repeated_gPIO_codec); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateRequest.cs new file mode 100644 index 000000000..9a849a08b --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateRequest.cs @@ -0,0 +1,188 @@ +// 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 { + + /// <summary>Holder for reflection information generated from SetGPIOStateRequest.proto</summary> + public static partial class SetGPIOStateRequestReflection { + + #region Descriptor + /// <summary>File descriptor for SetGPIOStateRequest.proto</summary> + 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<SetGPIOStateRequest> { + private static readonly pb::MessageParser<SetGPIOStateRequest> _parser = new pb::MessageParser<SetGPIOStateRequest>(() => new SetGPIOStateRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<SetGPIOStateRequest> 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); + } + + /// <summary>Field number for the "Port" field.</summary> + public const int PortFieldNumber = 1; + private int port_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Port { + get { return port_; } + set { + port_ = value; + } + } + + /// <summary>Field number for the "Value" field.</summary> + 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 new file mode 100644 index 000000000..cf8e4f49a --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetGPIOStateResponse.cs @@ -0,0 +1,131 @@ +// 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 { + + /// <summary>Holder for reflection information generated from SetGPIOStateResponse.proto</summary> + public static partial class SetGPIOStateResponseReflection { + + #region Descriptor + /// <summary>File descriptor for SetGPIOStateResponse.proto</summary> + 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<SetGPIOStateResponse> { + private static readonly pb::MessageParser<SetGPIOStateResponse> _parser = new pb::MessageParser<SetGPIOStateResponse>(() => new SetGPIOStateResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<SetGPIOStateResponse> 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 c50ce853f..86b43ee04 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -75,6 +75,8 @@ <Compile Include="Diagnostics\MotorJoggingResponse.cs" /> <Compile Include="Diagnostics\PushDiagnosticsRequest.cs" /> <Compile Include="Diagnostics\PushDiagnosticsResponse.cs" /> + <Compile Include="Diagnostics\SetGPIOStateRequest.cs" /> + <Compile Include="Diagnostics\SetGPIOStateResponse.cs" /> <Compile Include="ExtensionMethods.cs" /> <Compile Include="Integration\DirectSynchronizationRequest.cs" /> <Compile Include="Integration\DirectSynchronizationResponse.cs" /> diff --git a/Software/Visual_Studio/Tango.Visuals/Images/on.png b/Software/Visual_Studio/Tango.Visuals/Images/on.png Binary files differindex 9922b1901..fc057a658 100644 --- a/Software/Visual_Studio/Tango.Visuals/Images/on.png +++ b/Software/Visual_Studio/Tango.Visuals/Images/on.png |
