private bool CheckReveicedDataHeader(byte[] buffer)
        {
            var header = TLAutoDeviceHelper.HexStringToByteArray(HeaderCommand);

            if (buffer.Length < header.Length)
            {
                return(false);
            }
            for (var i = 0; i < header.Length; i++)
            {
                if (header[i] != buffer[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        public override byte[] GetSendData()
        {
            var deviceNumberHex   = DeviceNumber.ToHex();
            var commandParamsList = new List <object> {
                deviceNumberHex
            };
            var commandParams = GetReplaceCommandParams();

            if (commandParams != null)
            {
                commandParamsList.AddRange(commandParams);
            }
            var commandText = string.Format(SendCommand, commandParamsList.ToArray());
            var crc         = TLAutoBoardDeviceHelper.GetCRCFromHexs(commandText);
            var sendText    = commandText + " " + crc;

            return(TLAutoDeviceHelper.HexStringToByteArray(sendText));
        }
 public override byte[] GetSendData()
 {
     return(TLAutoDeviceHelper.HexStringToByteArray(SendCommand));
 }