aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/ExternalBridge
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-14 07:53:36 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-14 07:53:36 +0300
commit3cf9e06b11f80d7253a876f03860c6b600b4c563 (patch)
tree4d97a04e8d9ccf4589b9738e1c8f61f39be62f69 /Software/Visual_Studio/Tango.Integration/ExternalBridge
parenteed7de9b180f1c4094c1e62c61a672971bb4ab03 (diff)
downloadTango-3cf9e06b11f80d7253a876f03860c6b600b4c563.tar.gz
Tango-3cf9e06b11f80d7253a876f03860c6b600b4c563.zip
Integrated ink filling status to external bridge secure clients.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/ExternalBridge')
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeReceiver.cs43
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs4
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeSignalRClient.cs8
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs20
4 files changed, 58 insertions, 17 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeReceiver.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeReceiver.cs
index b583b738b..143f21f42 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeReceiver.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeReceiver.cs
@@ -1,4 +1,5 @@
-using System;
+using Google.Protobuf;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@@ -14,6 +15,7 @@ using Tango.PMR;
using Tango.PMR.Common;
using Tango.PMR.Debugging;
using Tango.PMR.Diagnostics;
+using Tango.PMR.IFS;
using Tango.PMR.Integration;
using Tango.PMR.MachineStatus;
using Tango.PMR.Power;
@@ -59,6 +61,7 @@ namespace Tango.Integration.ExternalBridge
private String _diagnosticsToken;
private String _debugLogsToken;
private String _applicationLogsToken;
+ private String _inkFillingToken;
private IMachineOperator _machineOperator;
private Dictionary<MessageType, MessageHandler> _messageHandlers;
@@ -80,7 +83,8 @@ namespace Tango.Integration.ExternalBridge
public bool RequiresDebugLogs { get; private set; }
public bool RequiresEventsNotification { get; private set; }
public bool RequiresMachineStatusUpdate { get; private set; }
- public bool RequiresApplicationLogs { get; set; }
+ public bool RequiresApplicationLogs { get; private set; }
+ public bool RequiresInkFillingStatus { get; private set; }
public bool IsLoggedIn { get; private set; }
public ExternalBridgeLoginIntent LoginIntent { get; private set; }
@@ -144,6 +148,8 @@ namespace Tango.Integration.ExternalBridge
_messageHandlers.Add(MessageType.JobRequest, new MessageHandler(OnJobRequest, ExternalBridgeLoginIntent.Diagnostics));
_messageHandlers.Add(MessageType.StartPowerDownRequest, new MessageHandler(OnStartPowerDownRequest, ExternalBridgeLoginIntent.Diagnostics));
+
+ _messageHandlers.Add(MessageType.StartInkFillingStatusRequest, new MessageHandler(OnStartInkFillingStatusRequest, ExternalBridgeLoginIntent.Diagnostics));
}
public ExternalBridgeReceiver(TcpClient tcpClient, IMachineOperator machineOperator) : this(machineOperator)
@@ -554,6 +560,13 @@ namespace Tango.Integration.ExternalBridge
SendResponse(new StartPowerDownResponse() { }, container.Token, new TransportResponseConfig() { ErrorCode = ErrorCode.ContinuousResponseAborted, ErrorMessage = "Power down request is not supported via external bridge." });
}
+ protected virtual void OnStartInkFillingStatusRequest(MessageContainer container)
+ {
+ _inkFillingToken = container.Token;
+ UpdateInkFillingStatus(null);
+ RequiresInkFillingStatus = true;
+ }
+
#endregion
#region Continuous Updates
@@ -666,6 +679,32 @@ namespace Tango.Integration.ExternalBridge
}
}
+ public void UpdateInkFillingStatus(MessageContainer container)
+ {
+ try
+ {
+ if (_inkFillingToken != null)
+ {
+ if (container == null)
+ {
+ container = new MessageContainer()
+ {
+ Continuous = true,
+ Type = MessageType.StartInkFillingStatusResponse,
+ Data = ByteString.CopyFrom((new StartInkFillingStatusResponse() { Status = _machineOperator.InkFillingStatus }).ToBytes())
+ };
+ }
+ var cloned = container.Clone();
+ cloned.Token = _inkFillingToken;
+ SendResponse(cloned, new TransportResponseConfig());
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex);
+ }
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs
index 5ec806126..527320008 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs
@@ -761,8 +761,10 @@ namespace Tango.Integration.ExternalBridge
case MessageType.StartMachineStatusUpdateResponse:
_receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresMachineStatusUpdate).ToList().ForEach(x => x.UpdateMachineStatus(container));
break;
+ case MessageType.StartInkFillingStatusResponse:
+ _receivers.ToList().Where(x => x.IsLoggedInAndRequiresDiagnostics && x.RequiresInkFillingStatus).ToList().ForEach(x => x.UpdateInkFillingStatus(container));
+ break;
}
-
}
catch { }
}
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeSignalRClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeSignalRClient.cs
index 4d0559aa4..a8f01437c 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeSignalRClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeSignalRClient.cs
@@ -117,13 +117,7 @@ namespace Tango.Integration.ExternalBridge
throw ex;
}
- OnEnableDiagnosticsChanged(EnableDiagnostics);
- OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging);
- OnEnableEventsNotification(EnableEventsNotification);
- OnEnableApplicationLogsChanged(EnableApplicationLogs);
- OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates);
- //TODO: Uncomment this only when Machine Studio enables automatic thread loading (ExternalBridgeTCPClient).
- //OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading);
+ ApplyContinuousChannelsConfiguration();
}
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs
index 0d7bd83d9..0b2a0c608 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs
@@ -190,16 +190,22 @@ namespace Tango.Integration.ExternalBridge
throw ex;
}
- OnEnableDiagnosticsChanged(EnableDiagnostics);
- OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging);
- OnEnableEventsNotification(EnableEventsNotification);
- OnEnableApplicationLogsChanged(EnableApplicationLogs);
- OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates);
- //TODO: Uncomment this only when Machine Studio enables automatic thread loading (ExternalBridgeTCPClient).
- //OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading);
+ ApplyContinuousChannelsConfiguration();
}
}
+ protected virtual void ApplyContinuousChannelsConfiguration()
+ {
+ OnEnableDiagnosticsChanged(EnableDiagnostics);
+ OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging);
+ OnEnableEventsNotification(EnableEventsNotification);
+ OnEnableApplicationLogsChanged(EnableApplicationLogs);
+ OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates);
+ OnEnableInkFillingStatus(EnableInkFillingStatus);
+ //TODO: Uncomment this only when Machine Studio enables automatic thread loading (ExternalBridgeTCPClient).
+ //OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading);
+ }
+
protected async void OnEnableApplicationLogsChanged(bool value)
{
if (value && State == TransportComponentState.Connected && !_logs_sent)