diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-30 19:31:46 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-30 19:31:46 +0300 |
| commit | dcfafe05ed0276274c30f40595decb19b05c284d (patch) | |
| tree | 0cb718b6795da5c3d8a291826990f878ab9c5b82 /Software/Visual_Studio | |
| parent | 19683a5a6047e822395f56412d263dc765df82fa (diff) | |
| download | Tango-dcfafe05ed0276274c30f40595decb19b05c284d.tar.gz Tango-dcfafe05ed0276274c30f40595decb19b05c284d.zip | |
Implemented PPC head cleaning.
Diffstat (limited to 'Software/Visual_Studio')
19 files changed, 916 insertions, 91 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml new file mode 100644 index 000000000..f640d5cec --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml @@ -0,0 +1,56 @@ +<UserControl x:Class="Tango.PPC.Maintenance.Dialogs.HeadCleaningView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="600" Height="800" d:DataContext="{d:DesignInstance Type=local:HeadCleaningViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <StackPanel Margin="0 50 0 0" HorizontalAlignment="Center"> + <Image Source="../Images/head_cleaning.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Margin="0 30 0 0">Head Cleaning</TextBlock> + + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Press 'START' to start the head cleaning sequence"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsStarted}" Value="True"> + <Setter Property="Text" Value="Head cleaning in progress"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsAborting}" Value="True"> + <Setter Property="Text" Value="Aborting head cleaning"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsCompleted}" Value="True"> + <Setter Property="Text" Value="Head cleaning completed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + + <Grid> + <touch:TouchButton Visibility="{Binding IsStarted,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Command="{Binding StartCommand}" Margin="0 100 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="80 15" CornerRadius="25">START</touch:TouchButton> + <touch:TouchButton Visibility="{Binding IsStarted,Converter={StaticResource BooleanToVisibilityConverter}}" IsEnabled="{Binding IsAborting,Converter={StaticResource BooleanInverseConverter}}" Command="{Binding AbortCommand}" Margin="0 100 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="80 15" CornerRadius="25">ABORT</touch:TouchButton> + </Grid> + + <StackPanel Margin="40"> + <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Status.Status}"></TextBlock> + <touch:TouchProgressBar Margin="0 20 0 0" VerticalAlignment="Bottom" Width="500" Height="10" Minimum="0" Maximum="{Binding Status.Total}" Value="{Binding Status.Progress}"> + <touch:TouchProgressBar.Style> + <Style TargetType="touch:TouchProgressBar" BasedOn="{StaticResource {x:Type touch:TouchProgressBar}}"> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Status.Progress}" Value="0"> + <Setter Property="IsIndeterminate" Value="True"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchProgressBar.Style> + </touch:TouchProgressBar> + </StackPanel> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml.cs new file mode 100644 index 000000000..c715bf5cf --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.Maintenance.Dialogs +{ + /// <summary> + /// Interaction logic for PowerUpView.xaml + /// </summary> + public partial class HeadCleaningView : UserControl + { + public HeadCleaningView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningViewVM.cs new file mode 100644 index 000000000..59d119f21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningViewVM.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PMR.Printing; +using Tango.PPC.Common; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Maintenance.Dialogs +{ + public class HeadCleaningViewVM : DialogViewVM + { + private HeadCleaningHandler _handler; + + [TangoInject] + private IMachineProvider MachineProvider { get; set; } + + [TangoInject] + private INotificationProvider NotificationProvider { get; set; } + + private bool _isStarted; + public bool IsStarted + { + get { return _isStarted; } + set { _isStarted = value; RaisePropertyChangedAuto(); } + } + + private bool _isCompleted; + public bool IsCompleted + { + get { return _isCompleted; } + set { _isCompleted = value; RaisePropertyChangedAuto(); } + } + + private bool _isAborting; + public bool IsAborting + { + get { return _isAborting; } + set { _isAborting = value; RaisePropertyChangedAuto(); } + } + + private bool _isFailed; + public bool IsFailed + { + get { return _isFailed; } + set { _isFailed = value; RaisePropertyChangedAuto(); } + } + + private StartHeadCleaningResponse _status; + public StartHeadCleaningResponse Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand StartCommand { get; set; } + public RelayCommand AbortCommand { get; set; } + + public HeadCleaningViewVM() + { + CanClose = true; + TangoIOC.Default.Inject(this); + StartCommand = new RelayCommand(Start); + AbortCommand = new RelayCommand(Abort); + } + + private async void Start() + { + try + { + CanClose = false; + IsStarted = true; + _handler = await MachineProvider.MachineOperator.PerformHeadCleaning(); + _handler.Completed += _handler_Completed; + _handler.Failed += _handler_Failed; + _handler.StatusChanged += _handler_StatusChanged; + } + catch (Exception ex) + { + _handler_Failed(this, ex); + } + } + + private void _handler_StatusChanged(object sender, HeadCleaningStatusChangedEventArgs e) + { + Status = e.Status; + } + + private void _handler_Failed(object sender, Exception e) + { + IsStarted = false; + IsFailed = true; + InvokeUI(() => + { + CanClose = true; + Cancel(); + NotificationProvider.ShowError($"Error occurred while trying to perform the head cleaning.\n{e.FlattenMessage()}"); + }); + } + + private void _handler_Completed(object sender, EventArgs e) + { + IsStarted = false; + IsCompleted = true; + InvokeUI(() => + { + Accept(); + NotificationProvider.ShowSuccess("Head cleaning completed successfully."); + }); + } + + protected override void Cancel() + { + if (CanClose) + { + base.Cancel(); + } + } + + private async void Abort() + { + IsAborting = true; + try + { + await _handler.Abort(); + CanClose = true; + Cancel(); + await NotificationProvider.ShowInfo("Head cleaning aborted."); + } + catch (Exception ex) + { + if (!IsCompleted) + { + CanClose = true; + IsAborting = false; + await NotificationProvider.ShowError($"Error occurred while trying to abort the head cleaning.\n{ex.FlattenMessage()}"); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/head_cleaning.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/head_cleaning.png Binary files differnew file mode 100644 index 000000000..373cb78c1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/head_cleaning.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj index 42d4a396e..94dcf8247 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj @@ -81,6 +81,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Dialogs\HeadCleaningView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Resources\Guides.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -116,6 +120,10 @@ <Compile Include="Converters\LiquidTypeToBrushConverter.cs" /> <Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" /> <Compile Include="Converters\StringToFirstLetterConverter.cs" /> + <Compile Include="Dialogs\HeadCleaningView.xaml.cs"> + <DependentUpon>HeadCleaningView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\HeadCleaningViewVM.cs" /> <Compile Include="GuideBase.cs" /> <Compile Include="GuideStep.cs" /> <Compile Include="Guides\LoadInkCartridgeGuide.cs" /> @@ -277,11 +285,13 @@ <Resource Include="Images\cone-full.png" /> <Resource Include="Images\l-full.png" /> </ItemGroup> - <ItemGroup /> + <ItemGroup> + <Resource Include="Images\head_cleaning.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index 759d43415..4bd63e9a6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -14,6 +14,7 @@ using Tango.Logging; using Tango.PMR.MachineStatus; using Tango.PPC.Common; using Tango.PPC.Maintenance.Commands; +using Tango.PPC.Maintenance.Dialogs; using Tango.PPC.Maintenance.Helpers; using Tango.PPC.Maintenance.Models; using Tango.PPC.Maintenance.Views; @@ -65,6 +66,8 @@ namespace Tango.PPC.Maintenance.ViewModels public ResetThreadLoadingCommand ResetThreadLoadingCommand { get; set; } + public RelayCommand HeadCleaningCommand { get; set; } + public MaintenanceViewVM() { Guides = new ObservableCollection<GuideBase>(GuideHelper.CreateAllGuides()); @@ -77,6 +80,7 @@ namespace Tango.PPC.Maintenance.ViewModels OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand(); OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand(); ResetThreadLoadingCommand = new ResetThreadLoadingCommand(); + HeadCleaningCommand = new RelayCommand(PerformHeadCleaning,() => MachineProvider.MachineOperator.CanPrint); } public override void OnApplicationStarted() @@ -101,6 +105,7 @@ namespace Tango.PPC.Maintenance.ViewModels { UpdateMidTankLevels(status); OverallTemperature.Temperature = status.OverallTemperature; + InvalidateRelayCommands(); } public async void OpenGuide(GuideBase guide) @@ -207,5 +212,10 @@ namespace Tango.PPC.Maintenance.ViewModels TotalDyeMeters = "error!"; } } + + private async void PerformHeadCleaning() + { + await NotificationProvider.ShowDialog<HeadCleaningViewVM>(); + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml index 11e2dc663..cf8511ee3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml @@ -192,6 +192,8 @@ <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ResetThreadLoadingCommand.Command}">RESET THREAD LOADING</touch:TouchButton> + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding HeadCleaningCommand}">RUN HEAD CLEANING</touch:TouchButton> + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ExportLogsCommand}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}">EXPORT SYSTEM LOGS</touch:TouchButton> </UniformGrid> </StackPanel> diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 17a7fbe58..42a1902e4 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -83,6 +83,7 @@ namespace Tango.Emulations.Emulators private String _threadLoadingToken; private DateTime _connectionTime; private int _jobAbortCounter; + private bool _abortHeadCleaning; #region Properties @@ -418,6 +419,12 @@ namespace Tango.Emulations.Emulators case MessageType.ContinueThreadLoadingRequest: HandleContinueThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer<ContinueThreadLoadingRequest>(container)); break; + case MessageType.StartHeadCleaningRequest: + HandleStartHeadCleaningRequest(MessageFactory.ParseTangoMessageFromContainer<StartHeadCleaningRequest>(container)); + break; + case MessageType.AbortHeadCleaningRequest: + HandleAbortHeadCleaningRequest(MessageFactory.ParseTangoMessageFromContainer<AbortHeadCleaningRequest>(container)); + break; } } @@ -1526,6 +1533,55 @@ namespace Tango.Emulations.Emulators } } + private async void HandleStartHeadCleaningRequest(TangoMessage<StartHeadCleaningRequest> request) + { + _abortHeadCleaning = false; + + for (int i = 0; i < 100; i++) + { + if (_abortHeadCleaning) + { + await Transporter.SendResponse<StartHeadCleaningResponse>(new StartHeadCleaningResponse() + { + + }, request.Container.Token, new TransportResponseConfig() + { + Completed = true, + ErrorCode = ErrorCode.ContinuousResponseAborted + }); + + return; + } + + await Task.Delay(200); + await Transporter.SendResponse<StartHeadCleaningResponse>(new StartHeadCleaningResponse() + { + Progress = i++, + Total = 100, + Status = $"Performing head cleaning..." + }, request.Container.Token); + } + + await Task.Delay(500); + + await Transporter.SendResponse<StartHeadCleaningResponse>(new StartHeadCleaningResponse() + { + Progress = 100, + Total = 100, + Status = "Completed", + }, request.Container.Token, new TransportResponseConfig() { Completed = true }); + } + + private async void HandleAbortHeadCleaningRequest(TangoMessage<AbortHeadCleaningRequest> request) + { + if (_rnd.Next(0, 100) > 60) + { + _abortHeadCleaning = true; + await Task.Delay(1000); + await Transporter.SendResponse<AbortHeadCleaningResponse>(new AbortHeadCleaningResponse(), request.Container.Token); + } + } + #endregion #region Public Methods diff --git a/Software/Visual_Studio/Tango.Integration/Operation/HeadCleaningHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/HeadCleaningHandler.cs new file mode 100644 index 000000000..d82666a60 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/HeadCleaningHandler.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PMR.Printing; + +namespace Tango.Integration.Operation +{ + public class HeadCleaningHandler : ExtendedObject + { + private Action _abortAction; + + public event EventHandler<HeadCleaningStatusChangedEventArgs> StatusChanged; + public event EventHandler<Exception> Failed; + public event EventHandler Completed; + + private StartHeadCleaningResponse _status; + public StartHeadCleaningResponse Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + + public HeadCleaningHandler(Action abortAction) + { + _abortAction = abortAction; + + Status = new StartHeadCleaningResponse() + { + Total = 100, + Progress = 0, + Status = "Initializing..." + }; + } + + internal void RaiseStatusChanged(StartHeadCleaningResponse status) + { + OnStatusChanged(status); + } + + internal void RaiseFailed(Exception ex) + { + OnFailed(ex); + } + + internal void RaiseCompleted() + { + OnCompleted(); + } + + private void OnStatusChanged(StartHeadCleaningResponse status) + { + Status = status; + StatusChanged?.Invoke(this, new HeadCleaningStatusChangedEventArgs() + { + Status = status + }); + } + + private void OnCompleted() + { + Completed?.Invoke(this, new EventArgs()); + } + + private void OnFailed(Exception ex) + { + Failed?.Invoke(this, ex); + } + + public Task Abort() + { + return Task.Factory.StartNew(() => + { + _abortAction.Invoke(); + }); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/HeadCleaningStatusChangedEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/HeadCleaningStatusChangedEventArgs.cs new file mode 100644 index 000000000..6ec55ce21 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/HeadCleaningStatusChangedEventArgs.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Printing; + +namespace Tango.Integration.Operation +{ + public class HeadCleaningStatusChangedEventArgs : EventArgs + { + public StartHeadCleaningResponse Status { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index b6698a208..25b602104 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -461,5 +461,11 @@ namespace Tango.Integration.Operation /// </summary> /// <returns></returns> Task<PowerDownHandler> PowerDown(); + + /// <summary> + /// Starts a manual head cleaning process. + /// </summary> + /// <returns></returns> + Task<HeadCleaningHandler> PerformHeadCleaning(); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index cad9f80c7..055b130b1 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -72,6 +72,7 @@ namespace Tango.Integration.Operation private bool _threadLoadingSent; private static RunningJobStatus _last_job_status; private bool _isPowerDownRequestInProgress; + private bool _isHeadCleaningInProgress; private List<BL.ValueObjects.JobRunLiquidQuantity> _currentJobLiquidQuantities; private DateTime _diagnosticsTime; private MachineStatus _machineStatusBeforeJobStart; @@ -3564,6 +3565,63 @@ namespace Tango.Integration.Operation return Task.FromResult(handler); } + /// <summary> + /// Turns off the machine. + /// </summary> + /// <returns></returns> + public Task<HeadCleaningHandler> PerformHeadCleaning() + { + if (_isHeadCleaningInProgress) + { + throw new InvalidOperationException("Head cleaning is already in progress."); + } + + if (!CanPrint) + { + throw new InvalidOperationException($"Cannot perform head cleaning while machine status is '{Status}'."); + } + + _isHeadCleaningInProgress = true; + + HeadCleaningHandler handler = new HeadCleaningHandler(() => + { + _isHeadCleaningInProgress = false; + Thread.Sleep(1000); + var r = SendRequest<AbortHeadCleaningRequest, AbortHeadCleaningResponse>(new AbortHeadCleaningRequest(), new TransportRequestConfig() { ShouldLog = true }).Result; + }); + + Task.Factory.StartNew(() => + { + Thread.Sleep(100); + + bool firstResponse = true; + + SendContinuousRequest<StartHeadCleaningRequest, StartHeadCleaningResponse>(new StartHeadCleaningRequest(), new TransportContinuousRequestConfig() { ContinuousTimeout = TimeSpan.FromSeconds(5), ShouldLog = true }).ObserveOn(new NewThreadScheduler()).Subscribe((response) => + { + if (firstResponse) + { + firstResponse = false; + } + + handler.RaiseStatusChanged(response); + }, (ex) => + { + if (!(ex is ContinuousResponseAbortedException)) + { + _isHeadCleaningInProgress = false; + LogManager.Log(ex, "Head cleaning error."); + handler.RaiseFailed(ex); + } + }, () => + { + _isHeadCleaningInProgress = false; + handler.RaiseCompleted(); + }); + }); + + return Task.FromResult(handler); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 8ecbd3d09..d4b36e1ba 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -115,6 +115,8 @@ <Compile Include="Operation\DefaultMachineEventsStateProvider.cs" /> <Compile Include="Logging\EmbeddedLogItem.cs" /> <Compile Include="Operation\DefaultGradientGenerationConfiguration.cs" /> + <Compile Include="Operation\HeadCleaningHandler.cs" /> + <Compile Include="Operation\HeadCleaningStatusChangedEventArgs.cs" /> <Compile Include="Operation\IGradientGenerationConfiguration.cs" /> <Compile Include="Operation\InsufficientLiquidQuantityException.cs" /> <Compile Include="Operation\JobDescriptionFile.cs" /> @@ -215,7 +217,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index d872ef5c9..c84880d31 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( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirPNwoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqYOAoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -139,49 +139,51 @@ namespace Tango.PMR.Common { "c1BhcmFtZXRlcnNSZXF1ZXN0ELwXEiQKH1VwbG9hZFByb2Nlc3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FBv", + "d2VyRG93blJlcXVlc3QQkE4SGwoWU3RhcnRQb3dlckRvd25SZXNwb25zZRCR", + "ThIaChVBYm9ydFBvd2VyRG93blJlcXVlc3QQkk4SGwoWQWJvcnRQb3dlckRv", + "d25SZXNwb25zZRCTThIeChlTdGFydFRocmVhZExvYWRpbmdSZXF1ZXN0EPhV", + "Eh8KGlN0YXJ0VGhyZWFkTG9hZGluZ1Jlc3BvbnNlEPlVEiEKHENvbnRpbnVl", + "VGhyZWFkTG9hZGluZ1JlcXVlc3QQ+lUSIgodQ29udGludWVUaHJlYWRMb2Fk", + "aW5nUmVzcG9uc2UQ+1USHQoYU3RvcFRocmVhZExvYWRpbmdSZXF1ZXN0EPxV", + "Eh4KGVN0b3BUaHJlYWRMb2FkaW5nUmVzcG9uc2UQ/VVCHAoaY29tLnR3aW5l", + "LnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -391,8 +393,10 @@ namespace Tango.PMR.Common { [pbr::OriginalName("CurrentJobResponse")] CurrentJobResponse = 3007, [pbr::OriginalName("ResumeCurrentJobRequest")] ResumeCurrentJobRequest = 3008, [pbr::OriginalName("ResumeCurrentJobResponse")] ResumeCurrentJobResponse = 3009, - [pbr::OriginalName("HeadCleaningRequest")] HeadCleaningRequest = 3010, - [pbr::OriginalName("HeadCleaningResponse")] HeadCleaningResponse = 3011, + [pbr::OriginalName("StartHeadCleaningRequest")] StartHeadCleaningRequest = 3010, + [pbr::OriginalName("StartHeadCleaningResponse")] StartHeadCleaningResponse = 3011, + [pbr::OriginalName("AbortHeadCleaningRequest")] AbortHeadCleaningRequest = 3012, + [pbr::OriginalName("AbortHeadCleaningResponse")] AbortHeadCleaningResponse = 3013, /// <summary> ///Debugging /// </summary> diff --git a/Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningRequest.cs b/Software/Visual_Studio/Tango.PMR/Printing/AbortHeadCleaningRequest.cs index c2e6156ff..291d960aa 100644 --- a/Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Printing/AbortHeadCleaningRequest.cs @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: HeadCleaningRequest.proto +// source: AbortHeadCleaningRequest.proto #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,40 +9,40 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Tango.PMR.Printing { - /// <summary>Holder for reflection information generated from HeadCleaningRequest.proto</summary> - public static partial class HeadCleaningRequestReflection { + /// <summary>Holder for reflection information generated from AbortHeadCleaningRequest.proto</summary> + public static partial class AbortHeadCleaningRequestReflection { #region Descriptor - /// <summary>File descriptor for HeadCleaningRequest.proto</summary> + /// <summary>File descriptor for AbortHeadCleaningRequest.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static HeadCleaningRequestReflection() { + static AbortHeadCleaningRequestReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChlIZWFkQ2xlYW5pbmdSZXF1ZXN0LnByb3RvEhJUYW5nby5QTVIuUHJpbnRp", - "bmciFQoTSGVhZENsZWFuaW5nUmVxdWVzdEIeChxjb20udHdpbmUudGFuZ28u", - "cG1yLnByaW50aW5nYgZwcm90bzM=")); + "Ch5BYm9ydEhlYWRDbGVhbmluZ1JlcXVlc3QucHJvdG8SElRhbmdvLlBNUi5Q", + "cmludGluZyIaChhBYm9ydEhlYWRDbGVhbmluZ1JlcXVlc3RCHgocY29tLnR3", + "aW5lLnRhbmdvLnBtci5wcmludGluZ2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.HeadCleaningRequest), global::Tango.PMR.Printing.HeadCleaningRequest.Parser, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.AbortHeadCleaningRequest), global::Tango.PMR.Printing.AbortHeadCleaningRequest.Parser, null, null, null, null) })); } #endregion } #region Messages - public sealed partial class HeadCleaningRequest : pb::IMessage<HeadCleaningRequest> { - private static readonly pb::MessageParser<HeadCleaningRequest> _parser = new pb::MessageParser<HeadCleaningRequest>(() => new HeadCleaningRequest()); + public sealed partial class AbortHeadCleaningRequest : pb::IMessage<AbortHeadCleaningRequest> { + private static readonly pb::MessageParser<AbortHeadCleaningRequest> _parser = new pb::MessageParser<AbortHeadCleaningRequest>(() => new AbortHeadCleaningRequest()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<HeadCleaningRequest> Parser { get { return _parser; } } + public static pb::MessageParser<AbortHeadCleaningRequest> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Printing.HeadCleaningRequestReflection.Descriptor.MessageTypes[0]; } + get { return global::Tango.PMR.Printing.AbortHeadCleaningRequestReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -51,28 +51,28 @@ namespace Tango.PMR.Printing { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeadCleaningRequest() { + public AbortHeadCleaningRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeadCleaningRequest(HeadCleaningRequest other) : this() { + public AbortHeadCleaningRequest(AbortHeadCleaningRequest other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeadCleaningRequest Clone() { - return new HeadCleaningRequest(this); + public AbortHeadCleaningRequest Clone() { + return new AbortHeadCleaningRequest(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as HeadCleaningRequest); + return Equals(other as AbortHeadCleaningRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HeadCleaningRequest other) { + public bool Equals(AbortHeadCleaningRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -104,7 +104,7 @@ namespace Tango.PMR.Printing { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HeadCleaningRequest other) { + public void MergeFrom(AbortHeadCleaningRequest other) { if (other == null) { return; } diff --git a/Software/Visual_Studio/Tango.PMR/Printing/AbortHeadCleaningResponse.cs b/Software/Visual_Studio/Tango.PMR/Printing/AbortHeadCleaningResponse.cs new file mode 100644 index 000000000..d65675011 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/AbortHeadCleaningResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: AbortHeadCleaningResponse.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.Printing { + + /// <summary>Holder for reflection information generated from AbortHeadCleaningResponse.proto</summary> + public static partial class AbortHeadCleaningResponseReflection { + + #region Descriptor + /// <summary>File descriptor for AbortHeadCleaningResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static AbortHeadCleaningResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch9BYm9ydEhlYWRDbGVhbmluZ1Jlc3BvbnNlLnByb3RvEhJUYW5nby5QTVIu", + "UHJpbnRpbmciGwoZQWJvcnRIZWFkQ2xlYW5pbmdSZXNwb25zZUIeChxjb20u", + "dHdpbmUudGFuZ28ucG1yLnByaW50aW5nYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.AbortHeadCleaningResponse), global::Tango.PMR.Printing.AbortHeadCleaningResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class AbortHeadCleaningResponse : pb::IMessage<AbortHeadCleaningResponse> { + private static readonly pb::MessageParser<AbortHeadCleaningResponse> _parser = new pb::MessageParser<AbortHeadCleaningResponse>(() => new AbortHeadCleaningResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<AbortHeadCleaningResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.AbortHeadCleaningResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AbortHeadCleaningResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AbortHeadCleaningResponse(AbortHeadCleaningResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AbortHeadCleaningResponse Clone() { + return new AbortHeadCleaningResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AbortHeadCleaningResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AbortHeadCleaningResponse 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(AbortHeadCleaningResponse 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/Printing/HeadCleaningResponse.cs b/Software/Visual_Studio/Tango.PMR/Printing/StartHeadCleaningRequest.cs index 928b1ead4..d04dd4e66 100644 --- a/Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Printing/StartHeadCleaningRequest.cs @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: HeadCleaningResponse.proto +// source: StartHeadCleaningRequest.proto #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,40 +9,40 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Tango.PMR.Printing { - /// <summary>Holder for reflection information generated from HeadCleaningResponse.proto</summary> - public static partial class HeadCleaningResponseReflection { + /// <summary>Holder for reflection information generated from StartHeadCleaningRequest.proto</summary> + public static partial class StartHeadCleaningRequestReflection { #region Descriptor - /// <summary>File descriptor for HeadCleaningResponse.proto</summary> + /// <summary>File descriptor for StartHeadCleaningRequest.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static HeadCleaningResponseReflection() { + static StartHeadCleaningRequestReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChpIZWFkQ2xlYW5pbmdSZXNwb25zZS5wcm90bxISVGFuZ28uUE1SLlByaW50", - "aW5nIhYKFEhlYWRDbGVhbmluZ1Jlc3BvbnNlQh4KHGNvbS50d2luZS50YW5n", - "by5wbXIucHJpbnRpbmdiBnByb3RvMw==")); + "Ch5TdGFydEhlYWRDbGVhbmluZ1JlcXVlc3QucHJvdG8SElRhbmdvLlBNUi5Q", + "cmludGluZyIaChhTdGFydEhlYWRDbGVhbmluZ1JlcXVlc3RCHgocY29tLnR3", + "aW5lLnRhbmdvLnBtci5wcmludGluZ2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.HeadCleaningResponse), global::Tango.PMR.Printing.HeadCleaningResponse.Parser, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.StartHeadCleaningRequest), global::Tango.PMR.Printing.StartHeadCleaningRequest.Parser, null, null, null, null) })); } #endregion } #region Messages - public sealed partial class HeadCleaningResponse : pb::IMessage<HeadCleaningResponse> { - private static readonly pb::MessageParser<HeadCleaningResponse> _parser = new pb::MessageParser<HeadCleaningResponse>(() => new HeadCleaningResponse()); + public sealed partial class StartHeadCleaningRequest : pb::IMessage<StartHeadCleaningRequest> { + private static readonly pb::MessageParser<StartHeadCleaningRequest> _parser = new pb::MessageParser<StartHeadCleaningRequest>(() => new StartHeadCleaningRequest()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser<HeadCleaningResponse> Parser { get { return _parser; } } + public static pb::MessageParser<StartHeadCleaningRequest> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Printing.HeadCleaningResponseReflection.Descriptor.MessageTypes[0]; } + get { return global::Tango.PMR.Printing.StartHeadCleaningRequestReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -51,28 +51,28 @@ namespace Tango.PMR.Printing { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeadCleaningResponse() { + public StartHeadCleaningRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeadCleaningResponse(HeadCleaningResponse other) : this() { + public StartHeadCleaningRequest(StartHeadCleaningRequest other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HeadCleaningResponse Clone() { - return new HeadCleaningResponse(this); + public StartHeadCleaningRequest Clone() { + return new StartHeadCleaningRequest(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as HeadCleaningResponse); + return Equals(other as StartHeadCleaningRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HeadCleaningResponse other) { + public bool Equals(StartHeadCleaningRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -104,7 +104,7 @@ namespace Tango.PMR.Printing { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HeadCleaningResponse other) { + public void MergeFrom(StartHeadCleaningRequest other) { if (other == null) { return; } diff --git a/Software/Visual_Studio/Tango.PMR/Printing/StartHeadCleaningResponse.cs b/Software/Visual_Studio/Tango.PMR/Printing/StartHeadCleaningResponse.cs new file mode 100644 index 000000000..4d16341d0 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/StartHeadCleaningResponse.cs @@ -0,0 +1,216 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: StartHeadCleaningResponse.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.Printing { + + /// <summary>Holder for reflection information generated from StartHeadCleaningResponse.proto</summary> + public static partial class StartHeadCleaningResponseReflection { + + #region Descriptor + /// <summary>File descriptor for StartHeadCleaningResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static StartHeadCleaningResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch9TdGFydEhlYWRDbGVhbmluZ1Jlc3BvbnNlLnByb3RvEhJUYW5nby5QTVIu", + "UHJpbnRpbmciTAoZU3RhcnRIZWFkQ2xlYW5pbmdSZXNwb25zZRIQCghQcm9n", + "cmVzcxgBIAEoARINCgVUb3RhbBgCIAEoARIOCgZTdGF0dXMYAyABKAlCHgoc", + "Y29tLnR3aW5lLnRhbmdvLnBtci5wcmludGluZ2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.StartHeadCleaningResponse), global::Tango.PMR.Printing.StartHeadCleaningResponse.Parser, new[]{ "Progress", "Total", "Status" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class StartHeadCleaningResponse : pb::IMessage<StartHeadCleaningResponse> { + private static readonly pb::MessageParser<StartHeadCleaningResponse> _parser = new pb::MessageParser<StartHeadCleaningResponse>(() => new StartHeadCleaningResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<StartHeadCleaningResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.StartHeadCleaningResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartHeadCleaningResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartHeadCleaningResponse(StartHeadCleaningResponse other) : this() { + progress_ = other.progress_; + total_ = other.total_; + status_ = other.status_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public StartHeadCleaningResponse Clone() { + return new StartHeadCleaningResponse(this); + } + + /// <summary>Field number for the "Progress" field.</summary> + public const int ProgressFieldNumber = 1; + private double progress_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Progress { + get { return progress_; } + set { + progress_ = value; + } + } + + /// <summary>Field number for the "Total" field.</summary> + public const int TotalFieldNumber = 2; + private double total_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Total { + get { return total_; } + set { + total_ = value; + } + } + + /// <summary>Field number for the "Status" field.</summary> + public const int StatusFieldNumber = 3; + private string status_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Status { + get { return status_; } + set { + status_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as StartHeadCleaningResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(StartHeadCleaningResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Progress != other.Progress) return false; + if (Total != other.Total) return false; + if (Status != other.Status) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Progress != 0D) hash ^= Progress.GetHashCode(); + if (Total != 0D) hash ^= Total.GetHashCode(); + if (Status.Length != 0) hash ^= Status.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Progress != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Progress); + } + if (Total != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Total); + } + if (Status.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Status); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Progress != 0D) { + size += 1 + 8; + } + if (Total != 0D) { + size += 1 + 8; + } + if (Status.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Status); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(StartHeadCleaningResponse other) { + if (other == null) { + return; + } + if (other.Progress != 0D) { + Progress = other.Progress; + } + if (other.Total != 0D) { + Total = other.Total; + } + if (other.Status.Length != 0) { + Status = other.Status; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 9: { + Progress = input.ReadDouble(); + break; + } + case 17: { + Total = input.ReadDouble(); + break; + } + case 26: { + Status = input.ReadString(); + 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 7065b2212..ce5e8f1e1 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -263,6 +263,8 @@ <Compile Include="Power\PowerDownState.cs" /> <Compile Include="Power\StartPowerDownRequest.cs" /> <Compile Include="Power\StartPowerDownResponse.cs" /> + <Compile Include="Printing\AbortHeadCleaningRequest.cs" /> + <Compile Include="Printing\AbortHeadCleaningResponse.cs" /> <Compile Include="Printing\AbortJobRequest.cs" /> <Compile Include="Printing\AbortJobResponse.cs" /> <Compile Include="Printing\CurrentJobRequest.cs" /> @@ -270,8 +272,6 @@ <Compile Include="Printing\DispenserLiquidType.cs" /> <Compile Include="Printing\DispenserStepDivision.cs" /> <Compile Include="Printing\HeadCleaningParameters.cs" /> - <Compile Include="Printing\HeadCleaningRequest.cs" /> - <Compile Include="Printing\HeadCleaningResponse.cs" /> <Compile Include="Printing\JobBrushStop.cs" /> <Compile Include="Printing\JobDescriptionFileBrushStop.cs" /> <Compile Include="Printing\JobDescriptionFileSegment.cs" /> @@ -288,6 +288,8 @@ <Compile Include="Printing\ProcessParameters.cs" /> <Compile Include="Printing\ResumeCurrentJobRequest.cs" /> <Compile Include="Printing\ResumeCurrentJobResponse.cs" /> + <Compile Include="Printing\StartHeadCleaningRequest.cs" /> + <Compile Include="Printing\StartHeadCleaningResponse.cs" /> <Compile Include="Printing\ThreadParameters.cs" /> <Compile Include="Printing\UploadProcessParametersRequest.cs" /> <Compile Include="Printing\UploadProcessParametersResponse.cs" /> |
