示例#1
0
 public RequestDataOperation(byte srcNodeId, byte destNodeId, byte[] data, TransmitOptions txOptions, byte[] dataToCompare, int bytesToCompare, int timeoutMs)
     : this(srcNodeId, destNodeId, data, txOptions, timeoutMs)
 {
     _dataToCompare = new ByteIndex[bytesToCompare];
     for (int i = 0; i < bytesToCompare; i++)
     {
         _dataToCompare[i] = new ByteIndex(dataToCompare[i]);
     }
 }
示例#2
0
文件: Location.cs 项目: yazici/gcodes
        public override int GetHashCode()
        {
            var hashCode = 1862217691;

            hashCode = hashCode * -1521134295 + ByteIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + Line.GetHashCode();
            hashCode = hashCode * -1521134295 + Column.GetHashCode();
            return(hashCode);
        }
示例#3
0
 public void SetDataToCompare(ByteIndex[] data)
 {
     if (data != null)
     {
         DataToCompare = new ByteIndex[data.Length];
         for (int i = 0; i < data.Length; i++)
         {
             if (i == 1 && data[0].Value == COMMAND_CLASS_TRANSPORT_SERVICE_V2.ID)
             {
                 DataToCompare[i] = new ByteIndex(data[i].Value, 0xF8);
             }
             else
             {
                 DataToCompare[i] = data[i];
             }
         }
     }
 }
示例#4
0
        public ApiAchOperation(byte destNodeId, byte srcNodeId, byte[] data, int bytesToCompare)
            : base(false, null, false)
        {
            IsFillReceived  = true;
            ReceivedAchData = new AchData();
            DestNodeId      = destNodeId;
            SrcNodeId       = srcNodeId;

            if (data != null)
            {
                bytesToCompare = data.Length < bytesToCompare ? data.Length : bytesToCompare;
                var compareData = new ByteIndex[bytesToCompare];
                for (int i = 0; i < bytesToCompare && i < data.Length; i++)
                {
                    compareData[i] = new ByteIndex(data[i]);
                }
                SetDataToCompare(compareData);
            }
        }
示例#5
0
        public ApiAchOperation(byte destNodeId, byte srcNodeId, byte[] data, int bytesToCompare, ExtensionTypes[] extensionTypes)
            : base(false, null, false)
        {
            _extensionS2Types        = extensionTypes.Select(val => (byte)((byte)val & 0x3F)).ToArray();
            ExtensionS2TypeSpecified = true;
            IsFillReceived           = true;
            ReceivedAchData          = new AchData();
            DestNodeId = destNodeId;
            SrcNodeId  = srcNodeId;
            var compareData = new ByteIndex[bytesToCompare];

            if (data != null)
            {
                for (int i = 0; i < bytesToCompare && i < data.Length; i++)
                {
                    compareData[i] = new ByteIndex(data[i]);
                }
                SetDataToCompare(compareData);
            }
        }
示例#6
0
 public ApiHandler(CommandTypes command)
 {
     Mask = new ByteIndex[] { new ByteIndex((byte)FrameTypes.Response), new ByteIndex((byte)command) };
 }
示例#7
0
 public ApiProgHandler(byte command)
 {
     Mask = new ByteIndex[] { ByteIndex.AnyValue, new ByteIndex((byte)FrameTypes.Response), new ByteIndex(command) };
 }
示例#8
0
 public ApiHandler(FrameTypes frameType, CommandTypes command)
 {
     Mask = new ByteIndex[] { new ByteIndex((byte)frameType), new ByteIndex((byte)command) };
 }