using Misc; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; namespace FLY.Modbus { /// /// 加载通讯列表用 /// public class PLCGroup { public class PLCDevice { /// /// PLC 名称 用于报警时,能有提示 /// public string PlcName; [JsonConverter(typeof(IPEndPointJsonConverter))] public IPEndPoint EP; } public class PLCVariable { /// /// 设备序号 /// public int DeviceIndex; /// /// 值为 0,1,3,4 ;对应modbus寄存器的区号 /// public string Mode; /// /// 区号的地址 /// public int Addr; /// /// 类型 只有 bool 才对应 bool, 其它数值类型 都转为 float /// public string Type; /// /// 放大倍数 /// public double Scale; /// /// 属性拥有者名称 /// public string OwnerName; /// /// 属性名称 /// public string PropertyName; /// /// 原始寄存器地址 /// public string RegAddr; public override string ToString() { return $"{OwnerName}.{PropertyName} ({RegAddr})=dev{DeviceIndex}[{Mode}]({Addr})"; } } /// /// 版本 /// public string Version; /// /// 设备列表 /// public List Devices = new List(); /// /// 寄存器列表 /// public List Variables = new List(); } }