private byte[] createStartMessageTEM(byte adr)
 {
     byte[] startMessage = new byte[7];
     startMessage[0] = 0x55;
     startMessage[1] = adr;
     startMessage[2] = (byte)~adr;
     startMessage[3] = 0x00;
     startMessage[4] = 0x00;
     startMessage[5] = 0x00;
     startMessage[6] = CSStuff.calculateCS(startMessage, 6);
     return(startMessage);
 }
 private byte[] create2KMessageTEM(byte adr, byte startH, byte startL, byte len)
 {
     byte[] startMessage = new byte[10];
     startMessage[0] = 0x55;
     startMessage[1] = adr;
     startMessage[2] = (byte)~adr;
     startMessage[3] = 0x0F;
     startMessage[4] = 0x01;
     startMessage[5] = 0x03;
     startMessage[6] = startH;
     startMessage[7] = startL;
     startMessage[8] = len;
     startMessage[9] = CSStuff.calculateCS(startMessage, 9);
     return(startMessage);
 }
Exemple #3
0
 private void WAIT_REQUEST_ID()
 {
     if (readData[3] == 0x00 && readData[4] == 0x00)
     {
         if (readData[6] == CSStuff.calculateCS(readData, 6))
         {
             type_msg[1]  = readData[1];
             type_msg[2]  = readData[2];
             type_msg[13] = CSStuff.calculateCS(type_msg, 13);
             Thread.Sleep(10);
             StreamWriter(type_msg, 0, 14);
         }
     }
     _state = State_Emul.WAIT;
 }
 private byte[] createFlashMessageTEM(byte adr, byte f0, byte f1, byte f2, byte f3, byte len)
 {
     byte[] startMessage = new byte[12];
     startMessage[0]  = 0x55;
     startMessage[1]  = adr;
     startMessage[2]  = (byte)~adr;
     startMessage[3]  = 0x0F;
     startMessage[4]  = 0x03;
     startMessage[5]  = 0x05;
     startMessage[6]  = len;
     startMessage[7]  = f3;
     startMessage[8]  = f2;
     startMessage[9]  = f1;
     startMessage[10] = f0;
     startMessage[11] = CSStuff.calculateCS(startMessage, 11);
     return(startMessage);
 }
Exemple #5
0
 private void WAIT_REQUEST_2K()
 {
     if (readData[3] == 0x0F && readData[4] == 0x01)
     {
         //Console.WriteLine("*");
         if (readData[9] == CSStuff.calculateCS(readData, 9))
         {
             //Console.WriteLine("!");
             int len = 7 + Convert.ToInt32(readData[8]);
             Array.Copy(byteBlock, dataSend, len);
             dataSend[1]       = readData[1];
             dataSend[2]       = readData[2];
             dataSend[5]       = readData[8];
             dataSend[len - 1] = CSStuff.calculateCS(dataSend, len - 1);
             Thread.Sleep(10);
             StreamWriter(dataSend, 0, len);
             //Console.Write("-----");
         }
     }
     _state = State_Emul.WAIT;
     //_port.DiscardInBuffer();
     //_port.DiscardOutBuffer();
 }
 private bool CHEK_SUMM(byte[] msg, int count)
 {
     return((!CSStuff.checkCS(msg, count)) ? false : true);
 }