using System.Linq; using HslCommunication; namespace DataBlockHelper.Entity.DB2102Entity { public class FOR_VALVE_DoubleEntity { public FOR_VALVE_DoubleEntity(ushort startSet,byte [] bytes) { // OperateResult read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2); byte[] content = bytes.Skip(startSet).Take(2).ToArray(); byte byt = content[0]; ManualMode = byt.GetBit(0); AutoMode = byt.GetBit(1); SetLeftManual = byt.GetBit(2); SetRightManual = byt.GetBit(3); SetLeftAuto = byt.GetBit(4); SetRightAuto = byt.GetBit(5); AlarmReset = byt.GetBit(6); LeftPosition = byt.GetBit(7); byt = content[1]; RightPosition = byt.GetBit(0); SetLeft = byt.GetBit(1); SetRight = byt.GetBit(2); AlarmLeftPosition = byt.GetBit(3); AlarmRightPosition = byt.GetBit(4); AlarmPosition = byt.GetBit(5); Alarm = byt.GetBit(6); } public bool ManualMode { get; private set; } public bool AutoMode { get; private set; } public bool SetLeftManual { get; private set; } public bool SetRightManual { get; private set; } public bool SetLeftAuto { get; private set; } public bool SetRightAuto { get; private set; } public bool AlarmReset { get; private set; } public bool LeftPosition { get; private set; } public bool RightPosition { get; private set; } public bool SetLeft { get; private set; } public bool SetRight { get; private set; } public bool AlarmLeftPosition { get; private set; } public bool AlarmRightPosition { get; private set; } public bool AlarmPosition { get; private set; } public bool Alarm { get; private set; } } }