Пример #1
0
 private static byte[] AttachCRC(byte[] command)
 {
     byte[] array = new byte[] {
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0
     };
     byte[] cRCAsByteFromByte = CRC.GetCRCAsByteFromByte(command);
     CommandByteArrays.nullCmd_136_length.CopyTo(array, 0);
     command.CopyTo(array, 0);
     array[0x85] = cRCAsByteFromByte[0];
     array[0x86] = cRCAsByteFromByte[1];
     array[0x87] = 0x7e;
     return(array);
 }
Пример #2
0
        public Command ReadNVItem(int item)
        {
            string strConsoleOut = "DIAG_NV_WRITE - Item: " + item.ToString();

            byte[]      buffer3 = new byte[3];
            byte[]      buffer2 = ConversionUtils.HexStringToBytes("26" + this.ProcessNVItem(item, 6));
            List <byte> list    = new List <byte>();

            foreach (byte num in buffer2)
            {
                list.Add(num);
            }
            while (list.Count < 0x85)
            {
                list.Add(0);
            }
            byte[] cRCAsByteFromByte = CRC.GetCRCAsByteFromByte(list.ToArray());
            list.Add(cRCAsByteFromByte[0]);
            list.Add(cRCAsByteFromByte[1]);
            list.Add(0x7e);
            return(new Command(list.ToArray(), strConsoleOut));
        }