设备编辑管理界面

This commit is contained in:
hsc
2026-06-12 10:00:13 +08:00
parent ffb22e1f20
commit 02d9923474
23 changed files with 2098 additions and 16 deletions

View File

@@ -0,0 +1,48 @@
using Common.Attributes;
using DeviceCommand.Base;
using NModbus;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceCommand.Device
{
[ADPCommand]
public class IOBoard : ModbusTcp
{
public IOBoard(string Ip地址, int , int , int )
{
ConfigureDevice(Ip地址, , , );
}
public async Task (byte , ushort , bool data)
{
await Modbus.WriteSingleCoilAsync(, , data);
}
public async Task (byte , ushort , bool[] datas)
{
var = await Modbus.ReadCoilsAsync(1, 0, 16);
for (int i = 0; i < datas.Length; i++)
{
if ( + i < .Length)
{
[ + i] = datas[i];
}
}
await Modbus.WriteMultipleCoilsAsync(, 0, );
}
public async Task (byte , ushort )
{
await Modbus.ReadCoilsAsync(, , 1);
}
public async Task<bool[]> (byte , ushort ,ushort )
{
return await Modbus.ReadCoilsAsync(, , );
}
}
}