using System; using System.Collections.Generic; using System.Threading.Tasks; using S7.Net; namespace DMS.Infrastructure.Interfaces.Services { /// /// S7服务接口,定义了与S7 PLC进行通信所需的方法 /// public interface IS7Service { /// /// 获取当前连接状态 /// bool IsConnected { get; } /// /// 异步连接到S7 PLC /// /// 表示异步操作的任务 Task ConnectAsync(string ipAddress, int port, short rack, short slot, S7.Net.CpuType cpuType); /// /// 异步断开与S7 PLC的连接 /// /// 表示异步操作的任务 Task DisconnectAsync(); /// /// 异步读取单个变量的值 /// /// S7地址 /// 表示异步操作的任务,包含读取到的值 Task ReadVariableAsync(string address); /// /// 异步读取多个变量的值 /// /// S7地址列表 /// 表示异步操作的任务,包含读取到的值字典 Task> ReadVariablesAsync(List addresses); /// /// 异步写入单个变量的值 /// /// S7地址 /// 要写入的值 /// 表示异步操作的任务 Task WriteVariableAsync(string address, object value); /// /// 异步写入多个变量的值 /// /// 地址和值的字典 /// 表示异步操作的任务 Task WriteVariablesAsync(Dictionary values); } }