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