/// <summary> /// Writes basic information for the ASH Layer of the protocol /// </summary> /// <param name="direction">The direction of the frame</param> /// <param name="frame">The frame to write</param> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 08/09/11 RCG 2.52.00 Created public void WriteASHFrameInfo(EZSPLogDirection direction, ASHFrame frame) { string Output = ""; if (direction == EZSPLogDirection.Send) { Output += "S: "; } else { Output += "R: "; } Output += "- ASH Frame: " + frame.ASHFrameType.ToString() + " - "; switch (frame.ASHFrameType) { case ASHFrame.FrameType.Data: { Output += "Frame Number: " + frame.FrameNumber.ToString() + " Ack Number: " + frame.AckNumber.ToString() + " Retransmit: " + frame.IsRetransmitted.ToString() + " Data: "; for (int Index = 0; Index < frame.Data.Length; Index++) { Output += frame.Data[Index].ToString("X2") + " "; } break; } case ASHFrame.FrameType.Ack: case ASHFrame.FrameType.Nak: { Output += "Ack Number: " + frame.AckNumber.ToString() + " Not Ready: " + frame.NotReady.ToString(); break; } case ASHFrame.FrameType.Error: { Output += "Error Code: "; for (int Index = 0; Index < frame.Data.Length; Index++) { Output += frame.Data[Index].ToString("X2") + " "; } break; } } Output += " CRC Valid: " + frame.IsCRCValid.ToString(); WriteLine(EZSPLogLevels.ASHProtocol, Output); }
/// <summary> /// Writes the Serial Port Data to the log /// </summary> /// <param name="direction">The direction of the data</param> /// <param name="data">The data to write</param> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 08/09/11 RCG 2.52.00 Created public void WriteSerialData(EZSPLogDirection direction, byte[] data) { string Output = ""; if (direction == EZSPLogDirection.Send) { Output += "S: "; } else { Output += "R: "; } foreach (byte CurrentByte in data) { Output += CurrentByte.ToString("X2", CultureInfo.InvariantCulture) + " "; } WriteLine(EZSPLogLevels.SerialPort, Output); }