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
using Misc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
namespace FLY.Modbus
{
/// <summary>
/// 加载通讯列表用
/// </summary>
public class PLCGroup
{
public class PLCDevice
{
[JsonConverter(typeof(IPEndPointJsonConverter))]
public IPEndPoint EP;
}
public class PLCVariable
{
/// <summary>
/// 设备序号
/// </summary>
public int DeviceIndex;
/// <summary>
/// 值为 0,1,3,4 ;对应modbus寄存器的区号
/// </summary>
public string Mode;
/// <summary>
/// 区号的地址
/// </summary>
public int Addr;
/// <summary>
/// 类型 只有 bool 才对应 bool, 其它数值类型 都转为 float
/// </summary>
public string Type;
/// <summary>
/// 放大倍数
/// </summary>
public double Scale;
/// <summary>
/// 属性拥有者名称
/// </summary>
public string OwnerName;
/// <summary>
/// 属性名称
/// </summary>
public string PropertyName;
public override string ToString()
{
return OwnerName + "." + PropertyName + " dev" + DeviceIndex + " [" + Mode + "](" + Addr + ")";
}
}
public List<PLCDevice> Devices = new List<PLCDevice>();
public List<PLCVariable> Variables = new List<PLCVariable>();
}
}