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

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

        public CopyRamToRomRequest()
        {
            Header = new HeaderPacket();
            Params = new CopyRamToRomParamsRequest();
        }

        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;
        }
    }
}
