using HslCommunication;
using System.Linq;

namespace DataBlockHelper.Entity.DB90Entity
{
	public class ForValveSingleEntity
	{
		public ForValveSingleEntity(ushort startSet, byte[] bytes)
		{
			//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB90." + startSet + ".0", 2);

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

            byte byt = content[0];

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

			byt = content[1];

			Set = byt.GetBit(0);
			AlarmSetPos = byt.GetBit(1);
			AlarmUnSetPos = byt.GetBit(2);
			AlarmPosition = byt.GetBit(3);
			Alarm = byt.GetBit(4);
		}
		public bool ManualMode { get; private set; }
		public bool AutoMode { get; private set; }
		public bool SetManual { get; private set; }
		public bool SetAuto { get; private set; }
		public bool AlarmReset { 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; }
	}
}