操控平台后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.8 KiB

// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Bodk.Device.Storage.EventArgs;
namespace Bodk.Device.Storage.Modules;
public class Valves(
Action<object?, AlarmChangedEventArg> alarmEventHandler,
Action<object?, MotionTimeoutAlarmChangedEventArg> motionTimeoutAlarmEventHandler,
Func<ushort, bool[], Task> writeCoilRegisterFunc,
Func<ushort, ushort, Task<bool[]>> readCoilRegisterFunc,
Func<ushort, ushort, Task<ushort[]>> readHoldingRegistersFunc,
Func<ushort, ushort[], Task> writeHoldingRegistersFunc)
: ModuleBase(alarmEventHandler, motionTimeoutAlarmEventHandler, writeCoilRegisterFunc, readCoilRegisterFunc,
readHoldingRegistersFunc, writeHoldingRegistersFunc)
{
public override string Name => "Valves";
public override string Descirption => "阀门控制";
public override int Id => 1001;
private static ushort MainValve => 490;
private static ushort InletValve => 491;
private static ushort ExhaustValve => 492;
/// <summary>
/// 总阀控制
/// </summary>
/// <param name="open"></param>
/// <returns></returns>
public Task MainValveSwitch(bool open)
{
return writeCoilRegisterFunc(MainValve, new[] { open });
}
/// <summary>
/// 进液阀控制
/// </summary>
/// <param name="open"></param>
/// <returns></returns>
public Task InletValveSwitch(bool open)
{
return writeCoilRegisterFunc(InletValve, new[] { open });
}
/// <summary>
/// 排气阀控制
/// </summary>
/// <param name="open"></param>
/// <returns></returns>
public Task ExhaustValveSwitch(bool open)
{
return writeCoilRegisterFunc(ExhaustValve, new[] { open });
}
}