using System.Collections.Generic; using System.Linq; namespace HC_APTBS.Infrastructure.Kwp.Packets { /// /// KWP1281 packet /// public class Packet { public Packet(List bytes) { Bytes = bytes; } public List Bytes { get; } public byte Title => Bytes[2]; /// /// Returns the body of the packet, excluding the length, counter, command and end bytes. /// public List Body => Bytes.Skip(3).Take(Bytes.Count - 4).ToList(); public bool IsAck => Title == (byte)PacketCommand.ACK; public bool IsNak => Title == (byte)PacketCommand.NAK; public bool IsAckNak => IsAck || IsNak; } }