using PlcSiemens.O;
using PlcSiemens.Protocol.Common;
using PlcSiemens.Protocol.Control;
using PlcSiemens.Protocol.DateTime;

namespace PlcSiemens.ProtocolHandle
{
    public class CopyRamToRomHandle : IPacketHandle
    {
        public CopyRamToRomRequest Request { get; set; }

        public ControlResponse Response { get; set; }

        public ResultCode ResultCode { get; set; }

        public CopyRamToRomHandle()
        {
            ResultCode = ResultCode.Unknown;
            Request = new CopyRamToRomRequest();
        }

        public void Handle(IIsoSender sender)
        {
            Response = sender.IsoSend<CopyRamToRomRequest, ControlResponse>(Request);
            if (Response == null) return;

            ResultCode = Response.Header.Error;
        }
    }
}
