42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using HC_APTBS.Infrastructure.Kwp.Packets;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace HC_APTBS.Infrastructure.Kwp
|
|
{
|
|
/// <summary>
|
|
/// The info returned by the controller to a ReadIdent packet.
|
|
/// </summary>
|
|
public class ControllerIdent
|
|
{
|
|
public ControllerIdent(IEnumerable<Packet> packets)
|
|
{
|
|
var sb = new StringBuilder();
|
|
foreach (var packet in packets)
|
|
{
|
|
if (packet is AsciiDataPacket asciiPacket)
|
|
{
|
|
sb.Append(asciiPacket);
|
|
}
|
|
else if (packet is CodingWscPacket codingWscPacket)
|
|
{
|
|
sb.AppendLine();
|
|
sb.Append(codingWscPacket);
|
|
}
|
|
else
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"ReadIdent returned packet of type {packet.GetType()}");
|
|
}
|
|
}
|
|
Text = sb.ToString();
|
|
}
|
|
|
|
public string Text { get; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return Text;
|
|
}
|
|
}
|
|
} |