static public void OnPrintEncodedMessage(object sender, MessageEncodedArgs e) { ResetConsoleCursorAndConsoleColor(); msgFunctionMSB = e.Msg[0]; msgFunctionLSB = e.Msg[1]; msgPayloadLenghtMSB = e.Msg[2]; msgPayloadLenghtLSB = e.Msg[3]; Console.Write("[Encoded : " + hex_sender_index++ + "] : "); Console.BackgroundColor = ConsoleColor.Yellow; Console.Write("0x" + msgFunctionMSB.ToString("2X") + " " + "0x" + msgFunctionLSB.ToString("2X") + " "); Console.BackgroundColor = ConsoleColor.Blue; Console.Write("0x" + msgPayloadLenghtMSB.ToString("2X") + " 0x" + msgPayloadLenghtLSB.ToString("2X") + " "); Console.BackgroundColor = ConsoleColor.White; for (int pos = 4, max = e.Msg.Length - 1; pos < max; pos++) { Console.Write("0x" + e.Msg[pos].ToString("2x") + " "); } Console.BackgroundColor = ConsoleColor.Green; Console.Write("0x" + e.Msg[e.Msg.Length].ToString("2x")); }
public void SendMessageToRobot(object sender, MessageEncodedArgs e) { serialPort.SendMessage(this, e); }