using HslCommunication; using System.Linq; using System.Security.Cryptography; namespace DataBlockHelper.Entity.DB2103Entity { public class FOR_MOTOREntity { public FOR_MOTOREntity(ushort startSet, byte[] bytes) { // OperateResult read = PlcConnect.Instance.Read("DB2103." + startSet + ".0", 2); byte[] content = bytes.Skip(startSet).Take(2).ToArray(); //var content = read.Content; byte byt = content[0]; ManualMode = byt.GetBit(0); AutoMode = byt.GetBit(1); AlarmReset = byt.GetBit(2); StartManual = byt.GetBit(3); StopManual = byt.GetBit(4); StartAuto = byt.GetBit(5); StopAuto = byt.GetBit(6); Running = byt.GetBit(7); byt = content[1]; Run = byt.GetBit(0); Alarm = byt.GetBit(1); } public bool ManualMode { get; private set; } public bool AutoMode { get; private set; } public bool AlarmReset { 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 Running { get; private set; } public bool Run { get; private set; } public bool Alarm { get; private set; } } }