using HslCommunication;


namespace DataBlockHelper.Entity.DB2102Entity
{
    public class FOR_VALVE_SingleEntity
    {
        public FOR_VALVE_SingleEntity(ushort startSet)
        {
            OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);

            var content = read.Content;

            byte byt = content[0];

            ManualMode = byt.GetBit(0);
            AutoMode = byt.GetBit(1);
            AlarmReset = byt.GetBit(2);
            SetManual = byt.GetBit(3);
            SetAuto = byt.GetBit(4);
            SetPosition = byt.GetBit(5);
            UnSetPosition = byt.GetBit(6);
            Set = byt.GetBit(7);

            byt = content[1];

            AlarmSetPos = byt.GetBit(0);
            AlarmUnSetPos = byt.GetBit(1);
            AlarmPosition = byt.GetBit(2);
            Alarm = byt.GetBit(3);
            P = byt.GetBit(4);

        }

        public bool ManualMode { get; private set; }
        public bool AutoMode { get; private set; }
        public bool AlarmReset { get; private set; }
        public bool SetManual { get; private set; }
        public bool SetAuto { get; private set; }
        public bool SetPosition { get; private set; }
        public bool UnSetPosition { get; private set; }
        public bool Set { get; private set; }
        public bool AlarmSetPos { get; private set; }
        public bool AlarmUnSetPos { get; private set; }
        public bool AlarmPosition { get; private set; }
        public bool Alarm { get; private set; }
        public bool P { get; private set; }

    }
}