diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs index aec9c0db0..213ad7cb6 100644 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs +++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs @@ -37,6 +37,22 @@ namespace Tango.Integration.Services set { _ipAddress = value; RaisePropertyChangedAuto(); } } + private String _comPort; + + public String ComPort + { + get { return _comPort; } + set { _comPort = value; RaisePropertyChangedAuto(); } + } + + private String _Device; + + public String Device + { + get { return _Device; } + set { _Device = value; RaisePropertyChangedAuto(); } + } + private String _organization; public String Organization @@ -45,10 +61,27 @@ namespace Tango.Integration.Services private set { _organization = value; RaisePropertyChangedAuto(); } } + private ExternalBridgeClientType _type; + + public ExternalBridgeClientType Type + { + get { return _type; } + internal set { _type = value; RaisePropertyChangedAuto(); } + } + + public override async Task Connect() { await Disconnect(); - Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.Integration.ExternalBridgeServicePort); + + if (Type == ExternalBridgeClientType.TCP) + { + Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.Integration.ExternalBridgeServicePort); + } + else if (Type == ExternalBridgeClientType.USB) + { + Adapter = new UsbTransportAdapter(ComPort); + } await base.Connect(); } @@ -58,11 +91,20 @@ namespace Tango.Integration.Services return response.Message.Authenticated; } - public ExternalBridgeClient(String serialNumber,String ipAddress) + public ExternalBridgeClient(String serialNumber, String ipAddress) { SerialNumber = serialNumber; IPAddress = ipAddress; UseKeepAlive = true; + Type = ExternalBridgeClientType.TCP; + } + + public ExternalBridgeClient(String comPort, String device, String putNull) + { + ComPort = comPort; + Device = device; + UseKeepAlive = false; + Type = ExternalBridgeClientType.USB; } } } |
