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

namespace PlcSiemens.Protocol.Control
{
    public class PlcStopRequest : IBuildRequest
    {
        public HeaderPacket Header { get; set; }
        public PlcStopParamsRequest Params { get; set; }

        public PlcStopRequest()
        {
            Header = new HeaderPacket();
            Params = new PlcStopParamsRequest();
        }

        public void Build()
        {
            Header.Build(PduType.Request, Params.PacketLength, 0x0000);
            Params.Build();
        }

        public ByteBuffer GetBuffer()
        {
            ByteBuffer buffer = ByteBuffer.Allocate();
            Header.GetByteBuffer(buffer);
            Params.GetByteBuffer(buffer);
            return buffer;
        }
    }
}
