diff options
| author | Roy <Roy.mail.net@gmail.com> | 2022-11-23 23:12:46 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-02-16 23:46:46 +0200 |
| commit | 5ed883227020212c8c9faac1f43bc22b9be7dd30 (patch) | |
| tree | cc5de64c20d1f3a3c20d96cb408e0f8e5a4e08ce /Software/Visual_Studio/Tango.Integration | |
| parent | b8dd2f3dac6aefe2d14992085a131d961938ee1f (diff) | |
| download | Tango-5ed883227020212c8c9faac1f43bc22b9be7dd30.tar.gz Tango-5ed883227020212c8c9faac1f43bc22b9be7dd30.zip | |
Working on ExternalBridge TCP Firmware.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration')
3 files changed, 92 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpFirmwareClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpFirmwareClient.cs new file mode 100644 index 000000000..e5ae14d0f --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpFirmwareClient.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.Settings; +using Tango.Transport.Adapters; + +namespace Tango.Integration.ExternalBridge +{ + public class ExternalBridgeTcpFirmwareClient : MachineOperator, IExternalBridgeClient + { + public bool RequiresAuthentication { get; } = false; + + private String _serialNumber; + /// <summary> + /// Gets the machine serial number. + /// </summary> + public String SerialNumber + { + get { return _serialNumber; } + set + { + _serialNumber = value; + RaisePropertyChangedAuto(); + } + } + + private String _ipAddress; + /// <summary> + /// Gets or sets the machine IP address. + /// </summary> + public String IPAddress + { + get { return _ipAddress; } + private set { _ipAddress = value; RaisePropertyChangedAuto(); } + } + + private int _port; + /// <summary> + /// Gets or sets the machine port. + /// </summary> + public int Port + { + get { return _port; } + private set { _port = value; RaisePropertyChangedAuto(); } + } + + public Machine Machine { get; private set; } + + public ExternalBridgeTcpFirmwareClient() + { + ComponentName = $"External Bridge TCP Firmware Client {_component_counter++}"; + + var settings = SettingsManager.Default.GetOrCreate<IntegrationSettings>(); + + IPAddress = settings.FirmwareIPAddress; + Port = settings.FirmwarePort; + UseKeepAlive = false; + EnableDiagnostics = true; + + Adapter = new TcpTransportAdapter(IPAddress, Port); + } + + public ExternalBridgeTcpFirmwareClient(Machine machine) : this() + { + SetMachine(machine); + } + + public void SetMachine(Machine machine) + { + Machine = machine; + SerialNumber = Machine.SerialNumber; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs b/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs index 20d0b76e4..64158651f 100644 --- a/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs +++ b/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs @@ -47,6 +47,16 @@ namespace Tango.Integration public UsbSerialBaudRates EmbeddedSerialBaudRate { get; set; } /// <summary> + /// Gets or sets the firmware TCP IP address when using TCP/IP as the communication method with the embedded device. + /// </summary> + public String FirmwareIPAddress { get; set; } + + /// <summary> + /// Gets or sets the firmware TCP IP port when using TCP/IP as the communication method with the embedded device. + /// </summary> + public int FirmwarePort { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="IntegrationSettings"/> class. /// </summary> public IntegrationSettings() @@ -58,6 +68,8 @@ namespace Tango.Integration EmbeddedDeviceName = "Tango USB Serial Port"; FilterExternalBridgeUsbMachines = false; EmbeddedSerialBaudRate = UsbSerialBaudRates.BR_115200; + FirmwareIPAddress = "10.0.0.3"; + FirmwarePort = 30000; } } } diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 79baefff0..dfddc1b81 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -103,6 +103,7 @@ <Compile Include="ExternalBridge\ExternalBridgeReceiverLoginRequestEventArgs.cs" /> <Compile Include="ExternalBridge\ExternalBridgeReceiverRequestReceivedEventArgs.cs" /> <Compile Include="ExternalBridge\ExternalBridgeRequestHandlerMethodAttribute.cs" /> + <Compile Include="ExternalBridge\ExternalBridgeTcpFirmwareClient.cs" /> <Compile Include="ExternalBridge\IExternalBridgeRequestHandler.cs" /> <Compile Include="ExternalBridge\ExternalBridgeSignalRConfiguration.cs" /> <Compile Include="ExternalBridge\ExternalBridgeSignalRClient.cs" /> |
