using HC_APTBS.Infrastructure.Kwp.Packets;
using System;
using System.Collections.Generic;
using System.Text;
namespace HC_APTBS.Infrastructure.Kwp
{
///
/// The info returned by the controller to a ReadIdent packet.
///
public class ControllerIdent
{
public ControllerIdent(IEnumerable 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;
}
}
}