using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PlcCom { public interface IPlcComProtocol { /// /// 通讯是否连通过 /// bool IsConnected { get; set; } /// /// 连接PLC /// /// 返回代码rt, 0:成功,其它:失败;errReason:原因 (uint rt, string errReason) ConnectPLC(); /// /// 关闭连接 /// /// 返回代码,0:成功,其它:失败 uint Close(); /// /// 读取指定地址和指定类型的值 /// /// PLC地址字符串 /// 返回的读取结果 /// 返回代码,0:成功,其它:失败 uint ReadValue(string address,out object result); /// /// 批量读取数据 /// /// 要读取的地址列表 /// 返回读取结果列表 /// 返回代码,0:成功,其它:失败 uint ReadValue(List addresses, out List results); /// /// 写入值到指定地址 /// /// 要写入的地址 /// 要写入的值 /// 写入的结果 /// 返回代码,0:成功,其它:失败 uint WriteValue(string address, object value, ref uint result); /// /// 批量写入数据 /// /// 要读取的地址列表 /// 要写入的值列表 /// 返回代码,0:成功,其它:失败 uint WriteValue(List addresses, List values,ref List resultList); } }