blob: e5ae14d0f8e4c81d5a5f770811937d7a7e893a6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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;
}
}
}
|