using Common.Attributes; using DeviceCommand.Base; using System; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace DeviceCommand.Device { [BOBCommand] public class E36233A : Tcp { public E36233A(string ipAddress, int port, int sendTimeout, int receiveTimeout) { ConfigureDevice(ipAddress, port, sendTimeout, receiveTimeout); } public E36233A() { } #region 设置命令 public async Task 清除输出保护(CancellationToken ct = default) { await SendAsync($"PROTection:CLEar\r\n", ct); } public async Task 设置电源输出(bool 开关, CancellationToken ct = default) { await SendAsync($"OUTPut {(开关 ? 1 : 0)}\r\n", ct); } public async Task 设置为远程模式(CancellationToken ct = default) { await SendAsync($"SYSTem:REMote\r\n", ct); } public async Task 蜂鸣器测试(CancellationToken ct = default) { await SendAsync($"SYSTem:BEEPer\r\n", ct); } public async Task 设置电流(double 电流, CancellationToken ct = default) { await SendAsync($"CURRent {电流}\r\n", ct); } public async Task 设置电流保护OCP电流(double 电流, CancellationToken ct = default) { await SendAsync($"CURRent:PROTection {电流}\r\n", ct); } public async Task 设置OCP开关(bool 开关, CancellationToken ct = default) { await SendAsync($"CURRent:PROTection:STATe {(开关 ? 1 : 0)}\r\n", ct); } public async Task 设置电压(double 电压, CancellationToken ct = default) { await SendAsync($"VOLTage {电压}\r\n", ct); } public async Task 设置电压保护OVP电压(double 电压, CancellationToken ct = default) { await SendAsync($"VOLT:PROTection {电压}\r\n", ct); } public async Task 设置OVP开关(bool 开关, CancellationToken ct = default) { await SendAsync($"VOLT:PROTection:STATe {(开关 ? 1 : 0)}\r\n", ct); } public async Task 设置功率保护功率(double 电压, CancellationToken ct = default) { await SendAsync($"POWer:PROTection {电压}\r\n", ct); } public async Task 设置功率保护开关(bool 开关, CancellationToken ct = default) { await SendAsync($"POWer:PROTection:STATe {(开关 ? 1 : 0)}\r\n", ct); } public async Task 设置电流斜率(double 上升斜率, double 下降斜率, CancellationToken ct = default) { await SendAsync($"CURRent:SLEW {上升斜率},{下降斜率}\r\n", ct); } public async Task 设置电压斜率(double 上升斜率, double 下降斜率, CancellationToken ct = default) { await SendAsync($"VOLTage:SLEW {上升斜率},{下降斜率}\r\n", ct); } public async Task 发送自定义命令(string 指令, CancellationToken ct = default) { await SendAsync($"{指令}\r\n", ct); } #endregion } }