diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-06-17 07:26:14 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-06-17 07:26:14 +0300 |
| commit | dd13554edc2816b026b00fbad26d17f82d8d16c3 (patch) | |
| tree | 4e02ccb755f0e9350d72c3cba902caf50f2e45e9 /Software/Visual_Studio | |
| parent | b7db8dc62f437093bcdc7784d7aa6b1fb6a08793 (diff) | |
| download | Tango-dd13554edc2816b026b00fbad26d17f82d8d16c3.tar.gz Tango-dd13554edc2816b026b00fbad26d17f82d8d16c3.zip | |
Merge
Diffstat (limited to 'Software/Visual_Studio')
13 files changed, 100 insertions, 11 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index ee96a77a5..4e00474f4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -155,7 +155,18 @@ namespace Tango.PPC.Common.EventLogging /// <param name="e">The <see cref="PrintingFailedEventArgs"/> instance containing the event data.</param> private void MachineOperator_PrintingFailed(object sender, PrintingFailedEventArgs e) { - Log(EventTypes.JOB_FAILED, e.Exception.Message); + String eventInfo = String.Empty; + + if (e.Exception is Transport.ResponseErrorException responseError) + { + if (responseError.Container.EventCode > 0) + { + EventTypes evType = (EventTypes)responseError.Container.EventCode; + eventInfo = "\n#" + responseError.Container.EventCode + " " + evType.ToDescription(); + } + } + + Log(EventTypes.JOB_FAILED, e.Exception.Message + eventInfo); } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs index 6a29511a9..963496508 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs @@ -32,6 +32,11 @@ namespace Tango.PPC.Common.Notifications Priority = NotificationPriority.Normal; } + /// <summary> + /// Gets or sets the notification date and time. + /// </summary> + public DateTime Time { get; set; } + private bool _canClose; /// <summary> /// Gets or sets a value indicating whether this instance can close. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index cc8f7b4ab..7b26d8425 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -299,6 +299,7 @@ namespace Tango.PPC.UI.Notifications /// <returns></returns> public NotificationItem PushNotification(NotificationItem item) { + item.Time = DateTime.Now; LogManager.Log($"Pushing NotificationItem '{item.GetType().Name}'."); item.RemoveAction = () => { PopNotification(item); }; NotificationItems.Insert(0, item); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs index 07b58e55f..64c56e5e9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -14,6 +14,7 @@ using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Logging; using Tango.PPC.UI.Views; +using System.Diagnostics; namespace Tango.PPC.UI.ViewModels { @@ -97,7 +98,7 @@ namespace Tango.PPC.UI.ViewModels { LogManager.Log("Application is ready! Navigating to home module..."); - if (BuildProvider.IsEureka) + if (BuildProvider.IsEureka && !Debugger.IsAttached) { var secondsPassed = (DateTime.Now - LoadingView.VideoStartTime).TotalSeconds; var secondsToHold = Math.Max(10 - secondsPassed, 0); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 2f1a54e64..0acd1d7e5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -1509,9 +1509,10 @@ </Grid> <touch:TouchButton Opacity="0" Background="Transparent" Style="{StaticResource TangoFlatButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" Foreground="{StaticResource TangoPrimaryBackgroundBrush}" Padding="5" /> </Grid> - </Grid> </Border> + + <TextBlock Text="{Binding Time,StringFormat='hh:mm:ss'}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 5 7 0" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index c0eea704d..1bf2d3cb7 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -90,6 +90,7 @@ namespace Tango.Emulations.Emulators private String _machineStatusRequestToken; private MachineType _machineType; private ProcessParameters _processParameters; + private bool _failJob; #region Properties @@ -838,6 +839,8 @@ namespace Tango.Emulations.Emulators private void HandleJobRequest(TangoMessage<JobRequest> request) { + _failJob = false; + MachineStatus.State = MachineState.PreparingJob; JobTicket job = request.Message.JobTicket; @@ -992,6 +995,19 @@ namespace Tango.Emulations.Emulators int delay = (100 - (int)watch.ElapsedMilliseconds) > 0 ? (100 - (int)watch.ElapsedMilliseconds) : 5; Thread.Sleep(delay); + if (_failJob) + { + Transporter.SendResponse<JobResponse>(new JobResponse() + { + + }, request.Container.Token, new TransportResponseConfig() { + ErrorCode = ErrorCode.JobThreadBreak, + ErrorMessage = "This is a message about a thread break from the emulator", + EventType = PMR.Diagnostics.EventType.ThreadBreak, + }); + break; + } + if (_cancelJob) { break; @@ -2469,6 +2485,11 @@ namespace Tango.Emulations.Emulators } } + public void FailJobWithEvent() + { + _failJob = true; + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageContainer.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageContainer.cs index 701423add..96594ada4 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageContainer.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageContainer.cs @@ -23,18 +23,18 @@ namespace Tango.PMR.Common { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChZNZXNzYWdlQ29udGFpbmVyLnByb3RvEhBUYW5nby5QTVIuQ29tbW9uGhFN", - "ZXNzYWdlVHlwZS5wcm90bxoPRXJyb3JDb2RlLnByb3RvIv4BChBNZXNzYWdl", + "ZXNzYWdlVHlwZS5wcm90bxoPRXJyb3JDb2RlLnByb3RvIpECChBNZXNzYWdl", "Q29udGFpbmVyEisKBFR5cGUYASABKA4yHS5UYW5nby5QTVIuQ29tbW9uLk1l", "c3NhZ2VUeXBlEg0KBVRva2VuGAIgASgJEg8KB1RpbWVvdXQYAyABKA0SEgoK", "Q29udGludW91cxgEIAEoCBIZChFDb250aW51b3VzVGltZW91dBgFIAEoDRIR", "CglDb21wbGV0ZWQYBiABKAgSDAoERGF0YRgHIAEoDBILCgNDUkMYCCABKA0S", "KgoFRXJyb3IYCSABKA4yGy5UYW5nby5QTVIuQ29tbW9uLkVycm9yQ29kZRIU", - "CgxFcnJvck1lc3NhZ2UYCiABKAlCHAoaY29tLnR3aW5lLnRhbmdvLnBtci5j", - "b21tb25iBnByb3RvMw==")); + "CgxFcnJvck1lc3NhZ2UYCiABKAkSEQoJRXZlbnRDb2RlGAsgASgFQhwKGmNv", + "bS50d2luZS50YW5nby5wbXIuY29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Common.MessageTypeReflection.Descriptor, global::Tango.PMR.Common.ErrorCodeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Common.MessageContainer), global::Tango.PMR.Common.MessageContainer.Parser, new[]{ "Type", "Token", "Timeout", "Continuous", "ContinuousTimeout", "Completed", "Data", "CRC", "Error", "ErrorMessage" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Common.MessageContainer), global::Tango.PMR.Common.MessageContainer.Parser, new[]{ "Type", "Token", "Timeout", "Continuous", "ContinuousTimeout", "Completed", "Data", "CRC", "Error", "ErrorMessage", "EventCode" }, null, null, null) })); } #endregion @@ -75,6 +75,7 @@ namespace Tango.PMR.Common { cRC_ = other.cRC_; error_ = other.error_; errorMessage_ = other.errorMessage_; + eventCode_ = other.eventCode_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -192,6 +193,17 @@ namespace Tango.PMR.Common { } } + /// <summary>Field number for the "EventCode" field.</summary> + public const int EventCodeFieldNumber = 11; + private int eventCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int EventCode { + get { return eventCode_; } + set { + eventCode_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MessageContainer); @@ -215,6 +227,7 @@ namespace Tango.PMR.Common { if (CRC != other.CRC) return false; if (Error != other.Error) return false; if (ErrorMessage != other.ErrorMessage) return false; + if (EventCode != other.EventCode) return false; return true; } @@ -231,6 +244,7 @@ namespace Tango.PMR.Common { if (CRC != 0) hash ^= CRC.GetHashCode(); if (Error != 0) hash ^= Error.GetHashCode(); if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + if (EventCode != 0) hash ^= EventCode.GetHashCode(); return hash; } @@ -281,6 +295,10 @@ namespace Tango.PMR.Common { output.WriteRawTag(82); output.WriteString(ErrorMessage); } + if (EventCode != 0) { + output.WriteRawTag(88); + output.WriteInt32(EventCode); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -316,6 +334,9 @@ namespace Tango.PMR.Common { if (ErrorMessage.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); } + if (EventCode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(EventCode); + } return size; } @@ -354,6 +375,9 @@ namespace Tango.PMR.Common { if (other.ErrorMessage.Length != 0) { ErrorMessage = other.ErrorMessage; } + if (other.EventCode != 0) { + EventCode = other.EventCode; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -404,6 +428,10 @@ namespace Tango.PMR.Common { ErrorMessage = input.ReadString(); break; } + case 88: { + EventCode = input.ReadInt32(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.Transport/TransportResponseConfig.cs b/Software/Visual_Studio/Tango.Transport/TransportResponseConfig.cs index 79940757d..2aa40d6ef 100644 --- a/Software/Visual_Studio/Tango.Transport/TransportResponseConfig.cs +++ b/Software/Visual_Studio/Tango.Transport/TransportResponseConfig.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.PMR.Common; +using Tango.PMR.Diagnostics; namespace Tango.Transport { @@ -12,6 +13,7 @@ namespace Tango.Transport { public bool Completed { get; set; } public ErrorCode? ErrorCode { get; set; } + public EventType EventType { get; set; } public String ErrorMessage { get; set; } public bool ShouldLog { get; set; } public bool Immediate { get; set; } diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 5a56754b9..017f75158 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -977,6 +977,8 @@ namespace Tango.Transport container.ErrorMessage = config.ErrorMessage; } + container.EventCode = (int)config.EventType; + container.Completed = config.Completed; return SendResponse(container); @@ -1075,6 +1077,8 @@ namespace Tango.Transport response.Container.ErrorMessage = config.ErrorMessage; } + response.Container.EventCode = (int)config.EventType; + LogManager.Log($"{GetExtendedComponentName()}: Queuing response message: " + typeof(Response).Name, LogCategory.Debug); if (State != TransportComponentState.Connected) diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml index 875072faa..41ecbb552 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml @@ -9,7 +9,7 @@ xmlns:local="clr-namespace:Tango.MachineEM.UI" xmlns:views="clr-namespace:Tango.MachineEM.UI.Views" mc:Ignorable="d" - Title="Firmware Emulator" Height="820" Width="1300" TitleCaps="False" BorderBrush="Gray" BorderThickness="1" WindowStartupLocation="CenterScreen" Background="#202020" Foreground="Gainsboro" DataContext="{Binding RelativeSource={RelativeSource Self}}"> + Title="Firmware Emulator" Height="950" Width="1400" TitleCaps="False" BorderBrush="Gray" BorderThickness="1" WindowStartupLocation="CenterScreen" Background="#202020" Foreground="Gainsboro" DataContext="{Binding RelativeSource={RelativeSource Self}}"> <Grid> <views:MainView DataContext="{StaticResource MainViewVM}"></views:MainView> </Grid> diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj index c6f382afe..07e03cfd4 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj @@ -204,11 +204,12 @@ </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> - <PostBuildEvent>$(TargetDir)linkgen.exe -s "$(TargetPath)" -d "$(SolutionDir)Build\Shortcuts\Machine Emulator.lnk"</PostBuildEvent> + <PostBuildEvent> + </PostBuildEvent> </PropertyGroup> <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/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs index 6b97bae31..7d74b5d04 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -148,6 +148,7 @@ namespace Tango.MachineEM.UI.ViewModels public RelayCommand RequestWasteReplaceCommand { get; set; } + public RelayCommand FailJobCommand { get; set; } #endregion #region Constructors @@ -182,6 +183,7 @@ namespace Tango.MachineEM.UI.ViewModels FinalizeThreadLoadingCommand = new RelayCommand(FinalizeThreadLoading, (x) => Emulator.IsStarted && _isThreadLoading); AbortJobCommand = new RelayCommand(() => Emulator?.AbortJob(), (x) => Emulator.IsStarted); RequestWasteReplaceCommand = new RelayCommand(RequestWasteReplace, (x) => Emulator.IsStarted); + FailJobCommand = new RelayCommand(FailJob, () => Emulator.IsStarted); Ports = new List<string>() { @@ -376,6 +378,11 @@ namespace Tango.MachineEM.UI.ViewModels catch { } } + private void FailJob() + { + Emulator.FailJobWithEvent(); + } + #endregion #region Private Methods diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml index 98e70d6a5..cc49b0ccd 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml @@ -14,7 +14,7 @@ xmlns:localConverters="clr-namespace:Tango.MachineEM.UI.Converters" xmlns:local="clr-namespace:Tango.MachineEM.UI.Views" mc:Ignorable="d" - d:DesignHeight="780" d:DesignWidth="1300" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" > + d:DesignHeight="900" d:DesignWidth="1400" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" > <UserControl.Resources> <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter> @@ -182,6 +182,13 @@ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">PUT DATA STORE ITEM</TextBlock> </DockPanel> </Button> + + <Button HorizontalContentAlignment="Left" Padding="10 0 0 0" Margin="5" Height="45" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding FailJobCommand}"> + <DockPanel> + <fa:ImageAwesome Icon="HandStopOutline" Width="16"></fa:ImageAwesome> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">FAIL JOB</TextBlock> + </DockPanel> + </Button> <!--BUTTONS HERE--> <DockPanel Margin="5 20 5 0"> |
