aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2023-06-27 13:15:28 +0300
committerRoy <Roy.mail.net@gmail.com>2023-06-27 13:15:28 +0300
commit0f150c98978332377ee6aad3eac8c8a08553a8e7 (patch)
treedcfd17fb1c3495e74273cb618c03cd7538a9873d /Software/Visual_Studio/PPC/Tango.PPC.Common
parent304735006580cb2f6728bedeb3393dbefc2e14f5 (diff)
downloadTango-0f150c98978332377ee6aad3eac8c8a08553a8e7.tar.gz
Tango-0f150c98978332377ee6aad3eac8c8a08553a8e7.zip
Added support for external emulator on PPC/Eureka over TCP.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs23
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs12
2 files changed, 28 insertions, 7 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
index 93fde75a5..9e15abbe0 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
@@ -265,16 +265,25 @@ namespace Tango.PPC.Common.Connection
{
LogManager.Log("Application in demo mode!");
- var emulator_channel_name = "emulator-" + Guid.NewGuid().ToString();
+ if (settings.EmulatorMode == EmulatorMode.InMemory)
+ {
+ var emulator_channel_name = "emulator-" + Guid.NewGuid().ToString();
+ LogManager.Log("Starting embedded emulator...");
+ MachineEmulator emulator = new MachineEmulator(new BasicTransporter(new MemoryTransportAdapter(emulator_channel_name)));
+ await emulator.Start();
- LogManager.Log("Starting embedded emulator...");
- MachineEmulator emulator = new MachineEmulator(new BasicTransporter(new MemoryTransportAdapter(emulator_channel_name)));
- await emulator.Start();
+ LogManager.Log("Emulator started. Connecting to emulator...");
- LogManager.Log("Emulator started. Connecting to emulator...");
+ MemoryTransportAdapter adapter = new MemoryTransportAdapter(emulator_channel_name);
+ MachineOperator.Adapter = adapter;
+ }
+ else
+ {
+ LogManager.Log("Connecting to external emulator over TCP...");
+ TcpTransportAdapter adapter = new TcpTransportAdapter("127.0.0.1", 30000);
+ MachineOperator.Adapter = adapter;
+ }
- MemoryTransportAdapter adapter = new MemoryTransportAdapter(emulator_channel_name);
- MachineOperator.Adapter = adapter;
MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp;
LogManager.Log("Connecting machine operator...");
await MachineOperator.Connect();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index 41e103ca0..ae6e4bc47 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -16,6 +16,12 @@ using Tango.Web;
namespace Tango.PPC.Common
{
+ public enum EmulatorMode
+ {
+ InMemory,
+ ExternalTCP,
+ }
+
/// <summary>
/// Represents the main PPC settings.
/// </summary>
@@ -365,6 +371,11 @@ namespace Tango.PPC.Common
public bool ForceTouchMode { get; set; }
/// <summary>
+ /// Gets or sets the emulator mode.
+ /// </summary>
+ public EmulatorMode EmulatorMode { get; set; }
+
+ /// <summary>
/// Gets the machine service address.
/// </summary>
/// <returns></returns>
@@ -378,6 +389,7 @@ namespace Tango.PPC.Common
/// </summary>
public PPCSettings()
{
+ EmulatorMode = EmulatorMode.InMemory;
LubricationLevels = new List<RmlLubricationLevel>();
JobUploadStrategy = JobUploadStrategy.JobDescriptionFile;
FineTuningTrialLengthMeters = 200;