initial commit
This commit is contained in:
42
Infrastructure/Kwp/ControllerIdent.cs
Normal file
42
Infrastructure/Kwp/ControllerIdent.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user