using HslCommunication;
using System.Linq;

namespace DataBlockHelper.Entity.DB91Entity
{
    public class ForMotorSToTEntity
    {
        public ForMotorSToTEntity(ushort startSet, byte[] bytes)
        {
            //OperateResult<byte[]> read = PlcConnect.Instance.Read("DB91." + startSet + ".0", 8);

            var content = bytes.Skip(startSet).Take(8).ToArray();

            byte byt = content[0];

            ManualMode = byt.GetBit(0);
            AutoMode = byt.GetBit(1);
            StartManual = byt.GetBit(2);
            StopManual = byt.GetBit(3);
            StartAuto = byt.GetBit(4);
            StopAuto = byt.GetBit(5);
            AlarmReset = byt.GetBit(6);
            Running_M = byt.GetBit(7);

            byt = content[1];

            Running_S = byt.GetBit(0);
            Running_T = byt.GetBit(1);
            Run_M = byt.GetBit(2);
            Run_S = byt.GetBit(3);
            Run_T = byt.GetBit(4);
            Alarm = byt.GetBit(5);
            Alarm_M = byt.GetBit(6);
            Alarm_S = byt.GetBit(7);

            byt = content[2];

            Alarm_T = byt.GetBit(0);

            STOTTIME = PlcConnect.Instance.ByteTransform.TransInt32(content, 4);
        }
        public bool ManualMode { get; private set; }
        public bool AutoMode { get; private set; }
        public bool StartManual { get; private set; }
        public bool StopManual { get; private set; }
        public bool StartAuto { get; private set; }
        public bool StopAuto { get; private set; }
        public bool AlarmReset { get; private set; }
        public bool Running_M { get; private set; }
        public bool Running_S { get; private set; }
        public bool Running_T { get; private set; }
        public bool Run_M { get; private set; }
        public bool Run_S { get; private set; }
        public bool Run_T { get; private set; }
        public bool Alarm { get; private set; }
        public bool Alarm_M { get; private set; }
        public bool Alarm_S { get; private set; }
        public bool Alarm_T { get; private set; }
        public int STOTTIME { get; private set; }

    }
}