protected override bool CheckReveicedDataBody(byte[] bytes)
 {
     if ((bytes[1] == 221) && (bytes[2].ToInt32() == DeviceNumber) && TLAutoPLCDeviceHelper.IsRightCRC(bytes, ResultByteLength))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
 protected override bool CheckReveicedDataBody(byte[] bytes)
 {
     if ((bytes[1] == 221) && TLAutoPLCDeviceHelper.IsRightCRC(bytes, ResultByteLength))
     {
         return(true);
     }
     return(base.CheckReveicedDataBody(bytes));
 }
Esempio n. 3
0
        public override byte[] GetSendData()
        {
            var commandParamsList = new List <object> {
                DeviceNumber.ToHex()
            };
            var commandParams = GetReplaceCommandParams();

            if (commandParams != null)
            {
                commandParamsList.AddRange(commandParams);
            }
            var commandText = string.Format(SendCommand, commandParamsList.ToArray());

            if (HasSendCRC)
            {
                var crc = TLAutoPLCDeviceHelper.GetCRCFromHexs(commandText);
                commandText = commandText + " " + crc;
            }
            return(TLAutoDeviceHelper.HexStringToByteArray(commandText));
        }