using PlcSiemens.O;
using PlcSiemens.Protocol.Common;

namespace PlcSiemens.Protocol.Header
{
    public class HeaderPacketWithErrorCode : HeaderPacket
    {
        public ResultCode Error { get; set; }    // Error code

        public override void Build(ByteBuffer buffer)
        {
            P = buffer.PopByte();
            PduType = buffer.PopByte();
            AbEx = buffer.PopUshort();
            Sequence = buffer.PopUshort();
            ParLen = buffer.PopUshort();
            DataLen = buffer.PopUshort();
            Error = (ResultCode)buffer.PopUshort();
        }
    }
}
