From c873eb1c0324eb50428fc26cdb5f1c3d05c7d3ea Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 1 Dec 2020 20:08:05 +0200 Subject: Improved external bridge events notification to support emulation. --- .../ExternalBridge/ExternalBridgeService.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/Tango.Integration') diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 527320008..4218f9e9a 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -256,6 +256,8 @@ namespace Tango.Integration.ExternalBridge MachineOperator.StatusChanged += MachineOperator_StatusChanged; MachineOperator.PendingResponseReceived -= MachineOperator_PendingResponseReceived; MachineOperator.PendingResponseReceived += MachineOperator_PendingResponseReceived; + MachineOperator.EventsNotification -= MachineOperator_EventsNotification; + MachineOperator.EventsNotification += MachineOperator_EventsNotification; } } @@ -339,6 +341,23 @@ namespace Tango.Integration.ExternalBridge OnOperatorResponseReceived(container); } + private void MachineOperator_EventsNotification(object sender, StartEventsNotificationResponse e) + { + try + { + MessageContainer container = new MessageContainer(); + container.Type = MessageType.StartEventsNotificationResponse; + container.Continuous = true; + container.Data = e.ToByteString(); + + _receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresEventsNotification).ToList().ForEach(x => x.UpdateEvents(container)); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error on external bridge machine events broadcast."); + } + } + #endregion #region Receiver Events Handlers @@ -756,7 +775,7 @@ namespace Tango.Integration.ExternalBridge _receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresDebugLogs).ToList().ForEach(x => x.UpdateDebugLogs(container)); break; case MessageType.StartEventsNotificationResponse: - _receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresEventsNotification).ToList().ForEach(x => x.UpdateEvents(container)); + //_receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresEventsNotification).ToList().ForEach(x => x.UpdateEvents(container)); break; case MessageType.StartMachineStatusUpdateResponse: _receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresMachineStatusUpdate).ToList().ForEach(x => x.UpdateMachineStatus(container)); -- cgit v1.3.1