aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs11
1 files changed, 8 insertions, 3 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 636a73d3c..1fd5fdd0a 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
@@ -53,6 +53,11 @@ namespace Tango.PPC.Common.Connection
MachineOperatorChanged?.Invoke(this, new MachineOperatorChangedEventArgs(oldOperator, newOperator));
}
+ public DefaultMachineProvider()
+ {
+ MachineOperator = new MachineOperator();
+ }
+
public void Init()
{
if (!_isInitialized)
@@ -69,9 +74,9 @@ namespace Tango.PPC.Common.Connection
Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600);
var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10));
- var machine = new MachineOperator(response.Adapter);
- await machine.Connect();
- MachineOperator = machine;
+ await MachineOperator.Disconnect();
+ MachineOperator.Adapter = response.Adapter;
+ await MachineOperator.Connect();
}
}
}