diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-10 17:10:13 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-10 17:10:13 +0300 |
| commit | 606db1b64a49a154fa1ba597a455ba96b42aad2b (patch) | |
| tree | 2a7c76c50dec3459f8b5c74fadac7026cf8d8814 /Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication | |
| parent | 5d795170b304199383ac967583830acaf313ff05 (diff) | |
| download | Tango-606db1b64a49a154fa1ba597a455ba96b42aad2b.tar.gz Tango-606db1b64a49a154fa1ba597a455ba96b42aad2b.zip | |
Implemented auto usb port scanning.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index c9d0ab35c..4978fa6e0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -17,6 +17,7 @@ using Tango.Core.Helpers; using Tango.PPC.Common.Modules; using System.Windows.Threading; using Tango.Transport.Adapters; +using Tango.PMR.Connection; namespace Tango.PPC.UI.PPCApplication { @@ -192,9 +193,12 @@ namespace Tango.PPC.UI.PPCApplication private async void ConnectToMachine() { - //var machine = new MachineOperator(new UsbTransportAdapter("COM3", UsbSerialBaudRates.BR_9600)); - //await machine.Connect(); - //ConnectedMachine = machine; + 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(60)); + + var machine = new MachineOperator(response.Adapter); + await machine.Connect(); + ConnectedMachine = machine; } } } |
