DataItem.cs
936 Bytes
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
using HHECS.EquipmentModel;
namespace HHECS.DAQClient.Communications
{
public class DataItem
{
public int Id { get; set; }
public string Code { get; set; }
/// <summary>
/// 地址数据
/// </summary>
/// <remarks>
/// <para>示例:DB100.0.0</para>
/// <para>字符串地址:DB100.0,20表示从DB100.0读取20位</para>
/// </remarks>
public string DataAddress { get; set; }
public EquipmentDataType DataType { get; set; }
public string Value { get; set; }
/// <summary>
/// 数据长度
/// </summary>
/// <remarks>仅<see cref="char"/>类型有效</remarks>
public ushort Length
{
get
{
_ = ushort.TryParse(DataAddress.Split(',').LastOrDefault() ?? "1", out var val);
return val;
}
}
}
}