设备命令修改

This commit is contained in:
“hsc”
2026-08-06 14:04:28 +08:00
parent 5a565f7361
commit deb3544143
143 changed files with 730494 additions and 1287 deletions
+41 -1
View File
@@ -168,8 +168,48 @@ namespace DeviceCommand.Devices
await 目标板卡.写输出开关(_slaveAddress, io信息.Address, 开关状态);
}
// =================================================================================
// 以下为新增的原生命令透传接口,使用台架序号自动路由至对应 IOBoard
// =================================================================================
/// <summary>
/// 内部路由辅助方法:根据板卡索引安全获取当前连接的实例对象
/// 针对指定台架直接写入单个输出开关
/// </summary>
public async Task 写输出开关(int 台架序号, byte 站号, ushort 开始地址, bool data)
{
IOBoard targetBoard = GetBoardInstance(台架序号);
await targetBoard.写输出开关(站号, 开始地址, data);
}
/// <summary>
/// 针对指定台架直接批量写入输出开关
/// </summary>
public async Task 批量写输出开关(int 台架序号, byte 站号, ushort 开始地址, bool[] datas)
{
IOBoard targetBoard = GetBoardInstance(台架序号);
await targetBoard.批量写输出开关(站号, 开始地址, datas);
}
/// <summary>
/// 针对指定台架直接读取单个输出开关状态
/// </summary>
public async Task 读输出开关(int 台架序号, byte 站号, ushort 开始地址)
{
IOBoard targetBoard = GetBoardInstance(台架序号);
await targetBoard.读输出开关(站号, 开始地址);
}
/// <summary>
/// 针对指定台架直接批量读取输出开关状态
/// </summary>
public async Task<bool[]> 批量读输出开关(int 台架序号, byte 站号, ushort 开始地址, ushort 数量)
{
IOBoard targetBoard = GetBoardInstance(台架序号);
return await targetBoard.批量读输出开关(站号, 开始地址, 数量);
}
/// <summary>
/// 内部路由辅助方法:根据板卡/台架索引安全获取当前连接的实例对象
/// </summary>
private IOBoard GetBoardInstance(int moduleIndex)
{