39 lines
935 B
C#
39 lines
935 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace HC_APTBS.Infrastructure.Kwp.Packets
|
|
{
|
|
public class AsciiDataPacket : Packet
|
|
{
|
|
public AsciiDataPacket(List<byte> bytes) : base(bytes)
|
|
{
|
|
// Dump();
|
|
}
|
|
|
|
public bool MoreDataAvailable => Bytes[3] > 0x7F;
|
|
|
|
public override string ToString()
|
|
{
|
|
var sb = new StringBuilder();
|
|
foreach (var b in Body)
|
|
{
|
|
sb.Append((char)(b & 0x7F));
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
|
|
private void Dump()
|
|
{
|
|
System.Diagnostics.Debug.Write($"Received Ascii data packet: \"{ToString()}\"");
|
|
|
|
if (MoreDataAvailable)
|
|
{
|
|
System.Diagnostics.Debug.Write(" (More data available via ReadIdent)");
|
|
}
|
|
|
|
System.Diagnostics.Debug.WriteLine("");
|
|
}
|
|
}
|
|
}
|