aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-05-27 23:47:34 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-05-27 23:47:34 +0300
commit2624be1a24c8581bdc5977bab66c40ef0e667378 (patch)
tree3aa1a8e0544c9655e67bcd76a0b1ac21112f3774 /Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge
parent94c57f750fd544bcffbf4df2a40c09f8a155a547 (diff)
downloadTango-2624be1a24c8581bdc5977bab66c40ef0e667378.tar.gz
Tango-2624be1a24c8581bdc5977bab66c40ef0e667378.zip
Safety level operations from csv.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs
index 4bf9819b8..6eaeb58a0 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs
@@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.Core.DI;
+using Tango.Core.Helpers;
+using Tango.CSV;
using Tango.Integration.ExternalBridge;
using Tango.Integration.Operation;
+using Tango.PMR.Common;
using Tango.PPC.Common.Application;
using Tango.PPC.Common.Connection;
using Tango.PPC.Common.Messages;
@@ -14,6 +18,11 @@ using Tango.Settings;
namespace Tango.PPC.Common.ExternalBridge
{
+ public class CsvEntry
+ {
+ public String MessageType { get; set; }
+ }
+
/// <summary>
/// Represents the PPC external bridge service capable of exposing a remote API for communicating and controlling the machine through the PPC.
/// </summary>
@@ -28,7 +37,20 @@ namespace Tango.PPC.Common.ExternalBridge
/// <param name="machineProvider">The machine provider.</param>
public PPCExternalBridgeService(IPPCApplicationManager applicationManager, IMachineProvider machineProvider)
{
- applicationManager.ApplicationReady += (_, __) =>
+ var csvStream = EmbeddedResourceHelper.GetEmbeddedResourceStream("Tango.PPC.Common.SafetyLevelOperations.csv");
+
+ List<CsvEntry> entries = CsvFile.Read<CsvEntry>(new CsvSource(csvStream)).ToList();
+
+ foreach (var entry in entries)
+ {
+ MessageType type;
+ if (Enum.TryParse<MessageType>(entry.MessageType, out type))
+ {
+ ExternalBridgeService.SafetyLevelOperations.Add(type);
+ }
+ }
+
+ applicationManager.ApplicationReady += (_, __) =>
{
var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
MachineOperator = machineProvider.MachineOperator;