aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2024-03-10 16:26:32 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2024-03-10 16:26:32 +0200
commit6dbef47fe2ca696fcf11ce4c2d0662c28b36bf35 (patch)
tree4acde5e7e00c919e57c8e09e30179dfb14b2e36c /Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob
parent0e4045af38f59004c537e9bf5e7f2e89f7320f1f (diff)
downloadTango-6dbef47fe2ca696fcf11ce4c2d0662c28b36bf35.tar.gz
Tango-6dbef47fe2ca696fcf11ce4c2d0662c28b36bf35.zip
FSE Remote Job Parameters.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs109
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs22
2 files changed, 127 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs
index 8826a8be3..00b4f5ad1 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs
@@ -8,6 +8,7 @@ using Tango.Core;
using Tango.Core.DI;
using Tango.Integration.ExternalBridge;
using Tango.Integration.Operation;
+using Tango.PPC.Common.Build;
using Tango.PPC.Common.Connection;
using Tango.PPC.Common.ExternalBridge;
using Tango.PPC.Shared.Jobs;
@@ -27,18 +28,23 @@ namespace Tango.PPC.Common.RemoteJob
private List<RunningJobUpdateClient> _clients;
private JobHandler _handler;
private JobDTO _currentJobDTO;
+ private String _rmlName;
private ProcessParametersTableDTO _currentJobProcessParameters;
+ private IRemoteJobInputOutputProvider _inputOutputProvider;
+ private IBuildProvider _buildProvider;
public bool Enabled { get; set; } = true;
private IMachineProvider MachineProvider { get; set; }
- public DefaultRemoteJobService(IPPCExternalBridgeService externalBridge, IMachineProvider machineProvider)
+ public DefaultRemoteJobService(IPPCExternalBridgeService externalBridge, IMachineProvider machineProvider, IBuildProvider buildProvider)
{
externalBridge.RegisterRequestHandler(this);
MachineProvider = machineProvider;
+ _buildProvider = buildProvider;
+
_clients = new List<RunningJobUpdateClient>();
MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
}
@@ -52,6 +58,14 @@ namespace Tango.PPC.Common.RemoteJob
_currentJobDTO = JobDTO.FromObservable(e.Job);
_currentJobProcessParameters = ProcessParametersTableDTO.FromObservable(_handler.ProcessParameters);
+ _rmlName = e.Job.Rml.FinalName;
+
+ RemoteJobInputOutput inputOutput = new RemoteJobInputOutput();
+
+ if (_clients.Count > 0 && _buildProvider.IsEureka)
+ {
+ inputOutput = GetCurrentJobInputOutput();
+ }
foreach (var client in _clients.ToList())
{
@@ -60,12 +74,15 @@ namespace Tango.PPC.Common.RemoteJob
RemoteJobProgress progress = new RemoteJobProgress();
progress.Stage = RemoteJobStage.Started;
progress.JobStatus = _handler.JobStatus;
+ progress.InputOutput = inputOutput;
+
await client.Receiver.SendGenericResponse(new RemoteJobUpdateResponse()
{
Job = _currentJobDTO,
ProcessParameters = _currentJobProcessParameters,
- Progress = progress
+ Progress = progress,
+ RmlName = _rmlName
}, client.Token);
client.JobSent = true;
@@ -76,6 +93,16 @@ namespace Tango.PPC.Common.RemoteJob
private async void JobHandler_StatusChanged(object sender, RunningJobStatus e)
{
+ var currentProgress = GetJobProgress(_handler);
+ RemoteJobInputOutput inputOutput = new RemoteJobInputOutput();
+
+ if (_clients.Count > 0 && _buildProvider.IsEureka)
+ {
+ inputOutput = GetCurrentJobInputOutput();
+ }
+
+ currentProgress.InputOutput = inputOutput;
+
foreach (var client in _clients.ToList())
{
if (client.JobSent)
@@ -84,7 +111,8 @@ namespace Tango.PPC.Common.RemoteJob
{
await client.Receiver.SendGenericResponse(new RemoteJobUpdateResponse()
{
- Progress = GetJobProgress(_handler)
+ Progress = currentProgress,
+ RmlName = _rmlName,
}, client.Token);
}
catch { }
@@ -96,12 +124,14 @@ namespace Tango.PPC.Common.RemoteJob
RemoteJobProgress progress = new RemoteJobProgress();
progress.Stage = RemoteJobStage.Started;
progress.JobStatus = _handler.JobStatus;
+ progress.InputOutput = inputOutput;
await client.Receiver.SendGenericResponse(new RemoteJobUpdateResponse()
{
Job = _currentJobDTO,
ProcessParameters = _currentJobProcessParameters,
- Progress = progress
+ Progress = progress,
+ RmlName = _rmlName
}, client.Token);
client.JobSent = true;
@@ -128,6 +158,77 @@ namespace Tango.PPC.Common.RemoteJob
}
}
+ private RemoteJobInputOutput GetCurrentJobInputOutput()
+ {
+ var inputOutput = new RemoteJobInputOutput();
+
+ if (_inputOutputProvider == null && _buildProvider.IsEureka)
+ {
+ _inputOutputProvider = TangoIOC.Default.GetInstance<IRemoteJobInputOutputProvider>();
+ }
+
+ if (_inputOutputProvider != null)
+ {
+ var i = _inputOutputProvider;
+
+ if (i.CurrentBrushStop != null)
+ {
+ var colorSpace = i.CurrentBrushStop.BrushColorSpace;
+
+ inputOutput.ColorSpace = colorSpace;
+
+ switch (colorSpace)
+ {
+ case BL.Enumerations.ColorSpaces.Volume:
+ inputOutput.Input.Add(new Tuple<string, String>("C", i.CurrentBrushStop.Cyan.ToString("0.00")));
+ inputOutput.Input.Add(new Tuple<string, String>("M", i.CurrentBrushStop.Magenta.ToString("0.00")));
+ inputOutput.Input.Add(new Tuple<string, String>("Y", i.CurrentBrushStop.Yellow.ToString("0.00")));
+ inputOutput.Input.Add(new Tuple<string, String>("K", i.CurrentBrushStop.Black.ToString("0.00")));
+ break;
+ case BL.Enumerations.ColorSpaces.RGB:
+ inputOutput.Input.Add(new Tuple<string, String>("R", i.CurrentBrushStop.Red.ToString()));
+ inputOutput.Input.Add(new Tuple<string, String>("G", i.CurrentBrushStop.Green.ToString()));
+ inputOutput.Input.Add(new Tuple<string, String>("B", i.CurrentBrushStop.Blue.ToString()));
+ break;
+ case BL.Enumerations.ColorSpaces.LAB:
+ inputOutput.Input.Add(new Tuple<string, String>("L", i.CurrentBrushStop.L.ToString("0.00")));
+ inputOutput.Input.Add(new Tuple<string, String>("A", i.CurrentBrushStop.A.ToString("0.00")));
+ inputOutput.Input.Add(new Tuple<string, String>("B", i.CurrentBrushStop.B.ToString("0.00")));
+ break;
+ case BL.Enumerations.ColorSpaces.Catalog:
+ inputOutput.Input.Add(new Tuple<string, String>("Catalog", i.CurrentBrushStop.ColorCatalog.Name));
+ inputOutput.Input.Add(new Tuple<string, String>("Color", i.CurrentBrushStop.ColorCatalogsItem.Name));
+ break;
+ default:
+ break;
+ }
+
+ try
+ {
+ inputOutput.Output.Add(new Tuple<string, string>("C", i.CyanOutput.ToString()));
+ inputOutput.Output.Add(new Tuple<string, string>("LC", i.LightCyanOutput.ToString()));
+ inputOutput.Output.Add(new Tuple<string, string>("M", i.MagentaOutput.ToString()));
+ inputOutput.Output.Add(new Tuple<string, string>("LM", i.LightMagentaOutput.ToString()));
+ inputOutput.Output.Add(new Tuple<string, string>("Y", i.YellowOutput.ToString()));
+ inputOutput.Output.Add(new Tuple<string, string>("LY", i.LightYellowOutput.ToString()));
+ inputOutput.Output.Add(new Tuple<string, string>("K", i.BlackOutput.ToString()));
+ }
+ catch
+ {
+ inputOutput.Output.Add(new Tuple<string, string>("C", "N/A"));
+ inputOutput.Output.Add(new Tuple<string, string>("LC", "N/A"));
+ inputOutput.Output.Add(new Tuple<string, string>("M", "N/A"));
+ inputOutput.Output.Add(new Tuple<string, string>("LM", "N/A"));
+ inputOutput.Output.Add(new Tuple<string, string>("Y", "N/A"));
+ inputOutput.Output.Add(new Tuple<string, string>("LY", "N/A"));
+ inputOutput.Output.Add(new Tuple<string, string>("K", "N/A"));
+ }
+ }
+ }
+
+ return inputOutput;
+ }
+
private RemoteJobProgress GetJobProgress(JobHandler handler)
{
RemoteJobStage stage = RemoteJobStage.Running;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs
new file mode 100644
index 000000000..cc98bd419
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+
+namespace Tango.PPC.Common.RemoteJob
+{
+ public interface IRemoteJobInputOutputProvider
+ {
+ BrushStop CurrentBrushStop { get; }
+
+ double CyanOutput { get; }
+ double MagentaOutput { get; }
+ double YellowOutput { get; }
+ double BlackOutput { get; }
+ double LightCyanOutput { get; }
+ double LightMagentaOutput { get; }
+ double LightYellowOutput { get; }
+ }
+}