diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-30 13:39:27 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-30 13:39:27 +0300 |
| commit | 1d02b0cf2a0aa550cb87464ab8beea60a6d2e006 (patch) | |
| tree | 17b4db78fa4c4c01907c55459a7d3a46031b16e3 /Software/Visual_Studio | |
| parent | ca615f9192350dadd7be4ab0e096e380816ca2a6 (diff) | |
| download | Tango-1d02b0cf2a0aa550cb87464ab8beea60a6d2e006.tar.gz Tango-1d02b0cf2a0aa550cb87464ab8beea60a6d2e006.zip | |
Implemented better events handling ExternalBridge <=> Machine Studio.
Diffstat (limited to 'Software/Visual_Studio')
7 files changed, 97 insertions, 8 deletions
diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index de4d79c45..b20492b1b 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -15,10 +15,10 @@ <ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/> <ROW Property="ARPNOREPAIR" MultiBuildValue="DefaultBuild:1"/> <ROW Property="Manufacturer" Value="Twine"/> - <ROW Property="ProductCode" Value="1033:{D1B16C8D-42B2-4A1B-89AC-228AB51F3853} " Type="16"/> + <ROW Property="ProductCode" Value="1033:{29FB309A-96A4-4C7B-8F3D-C2EDCC52E9B7} " Type="16"/> <ROW Property="ProductLanguage" Value="1033"/> <ROW Property="ProductName" Value="Machine Studio"/> - <ROW Property="ProductVersion" Value="4.0.15.0" Type="32"/> + <ROW Property="ProductVersion" Value="4.0.16.0" Type="32"/> <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/> <ROW Property="UpgradeCode" Value="{CBEE5CAE-7C5A-4280-98DE-AA98113764E4}"/> <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/> @@ -782,7 +782,7 @@ <ROW Action="AI_DetectSoftware" Sequence="101"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent"> - <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\Machine Studio\Release" PackageFileName="Machine Studio Installer_v4.0.9" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="Machine Studio Installer_v4.0.15"/> + <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\Machine Studio\Release" PackageFileName="Machine Studio Installer_v4.0.9" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="Machine Studio Installer_v4.0.16"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent"> <ROW Path="<AI_DICTS>ui.ail"/> diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk Binary files differindex 8b7c552b7..aeda0b936 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index fb9d1472b..496b7d8f8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.15.0")] +[assembly: AssemblyVersion("4.0.16.0")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index edc6e27d2..a7fcd4ade 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -565,7 +565,20 @@ namespace Tango.Emulations.Emulators _current_job_ticket.Segments.AddRange(segments); } - LogManager.Log("Parsed Job Upload File:\n" + _current_job_ticket.ToJsonString()); + var logedTicket = _current_job_ticket.Clone(); + foreach (var segment in logedTicket.Segments) + { + if (segment.BrushStops.Count > 2) + { + var first = segment.BrushStops.First(); + var last = segment.BrushStops.Last(); + segment.BrushStops.Clear(); + segment.BrushStops.Add(first); + segment.BrushStops.Add(last); + } + } + + LogManager.Log("Parsed Job Upload File (Showing first and last brush stop for segment):\n" + logedTicket.ToJsonString()); } double centimeter_per_second = request.Message.JobTicket.ProcessParameters.DyeingSpeed; diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 376befe06..76c0b9541 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -31,6 +31,7 @@ namespace Tango.Integration.ExternalBridge private Dictionary<MessageType, Action<MessageContainer>> _messageHandlers; private int _discovery_port = 8888; //Will be overridden by settings in constructor.. private int _external_bridge_port = 1984; //Will be overridden by settings in constructor.. + private String _eventsNotificationsToken; #region Events @@ -185,6 +186,8 @@ namespace Tango.Integration.ExternalBridge { MachineOperator.StateChanged -= MachineOperator_StateChanged; MachineOperator.StateChanged += MachineOperator_StateChanged; + MachineOperator.PendingResponseReceived -= MachineOperator_PendingResponseReceived; + MachineOperator.PendingResponseReceived += MachineOperator_PendingResponseReceived; } } @@ -230,6 +233,12 @@ namespace Tango.Integration.ExternalBridge } } + + private void MachineOperator_PendingResponseReceived(object sender, MessageContainer container) + { + OnOperatorResponseReceived(container); + } + #endregion #region Public Methods @@ -391,6 +400,7 @@ namespace Tango.Integration.ExternalBridge protected async virtual void OnClientDisconnected() { + _eventsNotificationsToken = null; IsInSession = false; _send_app_logs = false; @@ -429,6 +439,25 @@ namespace Tango.Integration.ExternalBridge LogManager.Log("External bridge client disconnected."); } + protected virtual void OnOperatorResponseReceived(MessageContainer container) + { + try + { + if (IsInSession) + { + if (container.Type == MessageType.StartEventsNotificationResponse) + { + if (_eventsNotificationsToken != null) + { + container.Token = _eventsNotificationsToken; + SendResponse(container); + } + } + } + } + catch { } + } + #endregion #region Message Handlers @@ -441,6 +470,9 @@ namespace Tango.Integration.ExternalBridge _messageHandlers.Add(MessageType.StopApplicationLogsRequest, OnStopApplicationLogsRequest); _messageHandlers.Add(MessageType.JobRequest, OnJobRequest); + + _messageHandlers.Add(MessageType.StartEventsNotificationRequest, OnStartEventsNotificationRequest); + _messageHandlers.Add(MessageType.StopEventsNotificationRequest, OnStopEventsNotificationRequest); } protected virtual async void OnAnyRequest(MessageContainer container) @@ -600,6 +632,22 @@ namespace Tango.Integration.ExternalBridge } } + protected virtual void OnStartEventsNotificationRequest(MessageContainer container) + { + _eventsNotificationsToken = container.Token; + SendResponse<StartEventsNotificationResponse>(new StartEventsNotificationResponse(), container.Token); + } + + private void OnStopEventsNotificationRequest(MessageContainer container) + { + if (_eventsNotificationsToken != null) + { + SendResponse<StartEventsNotificationResponse>(new StartEventsNotificationResponse(), _eventsNotificationsToken, true); + _eventsNotificationsToken = null; + SendResponse<StopEventsNotificationResponse>(new StopEventsNotificationResponse(), container.Token); + } + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Transport/ITransporter.cs b/Software/Visual_Studio/Tango.Transport/ITransporter.cs index b114b4681..7424a4684 100644 --- a/Software/Visual_Studio/Tango.Transport/ITransporter.cs +++ b/Software/Visual_Studio/Tango.Transport/ITransporter.cs @@ -139,6 +139,11 @@ namespace Tango.Transport event EventHandler<MessageContainer> RequestReceived; /// <summary> + /// Occurs when a new response message has been received. + /// </summary> + event EventHandler<MessageContainer> PendingResponseReceived; + + /// <summary> /// Gets or sets the default request timeout. /// </summary> TimeSpan RequestTimeout { get; set; } diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 534d3d05d..28ac15cd6 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -44,6 +44,11 @@ namespace Tango.Transport public event EventHandler<MessageContainer> RequestReceived; /// <summary> + /// Occurs when a new response message has been received. + /// </summary> + public event EventHandler<MessageContainer> PendingResponseReceived; + + /// <summary> /// Occurs when component state changes. /// </summary> public event EventHandler<TransportComponentState> StateChanged; @@ -214,10 +219,19 @@ namespace Tango.Transport /// <summary> /// Called when a new request has been received. /// </summary> - /// <param name="request">The request.</param> - protected virtual void OnRequestReceived(MessageContainer request) + /// <param name="container">The request.</param> + protected virtual void OnRequestReceived(MessageContainer container) { - RequestReceived?.Invoke(this, request); + RequestReceived?.Invoke(this, container); + } + + /// <summary> + /// Called when a new response has been received. + /// </summary> + /// <param name="container">The request.</param> + protected virtual void OnResponseReceived(MessageContainer container) + { + PendingResponseReceived?.Invoke(this, container); } /// <summary> @@ -1060,6 +1074,15 @@ namespace Tango.Transport LogManager.Log(ex, "Error parsing response message."); } } + + try + { + Task.Factory.StartNew(() => OnResponseReceived(container)); + } + catch + { + //Ignore any exceptions that may raise on the client side.. + } } else { |
