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

namespace PlcSiemens.Protocol.Upload
{
    public class UploadParamsRequest
    {
        public byte FunUpld;  // function upload 0x1E
        public byte[] Uk6;   // Unknown 6 bytes
        public byte UploadID;

        public ushort PacketLength = 0x08;

        public void Build(byte uploadID, PduType pduType = PduType.PduUpload)
        {
            FunUpld = (byte)pduType;
            byte byte00 = 0x00;
            Uk6 = new[] { byte00, byte00, byte00, byte00, byte00, byte00 };
            UploadID = uploadID;
        }

        public void GetByteBuffer(ByteBuffer buffer)
        {
            buffer.Push(FunUpld);
            buffer.Push(Uk6);
            buffer.Push(UploadID);
        }
    }
}
