using System; using System.Threading; using System.Threading.Tasks; namespace DeviceCommand.Base { /// /// VISA SCPI 通信接口:与 暴露一致的异步收发能力, /// 使 SCPI 设备类可在 Tcp 与 VISA 传输之间平滑切换。 /// public interface IVisa : IBaseInterface, IDisposable { /// 发送原始二进制数据。 Task SendAsync(byte[] buffer, CancellationToken ct = default); /// 发送字符串命令(SCPI 命令自带结束符)。 Task SendAsync(string str, CancellationToken ct = default); /// 读取指定长度的原始字节。 Task ReadAsync(int length, CancellationToken ct = default); /// 读取一行字符串,直到遇到结束符。 Task ReadAsync(string delimiter = "\n", CancellationToken ct = default); /// 发送命令并读取一行响应。 Task WriteReadAsync(string command, string delimiter = "\n", CancellationToken ct = default); /// 发送查询命令并读取 IEEE 488.2 定长二进制块,自动剥离块头(#N<长度>)后只返回纯数据字节(用于截图/波形等大块数据)。 Task ReadAllBytesAsync(string queryCommand, CancellationToken ct = default); } }