using ProjectManagementSystem.Device.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectManagementSystem.Device.CommandCallback
{
    public class InfoBoxRelease : BaseInfo, IDeviceCommandCallback
    {
        public int Mark { get; set; }
        public int Route { get; set; }
        public int AgvId { get; set; }
        public int Function { get; set; }

        public bool BoxReleaseLightOn { get; set; }
        public bool BoxReleaseAgv { get; set; }

        public void Deserialize(byte[] data)
        {
            Function = data[1];

            Route = (data[6] << 8) + data[7] - 0x3030;
            Mark = ((int)data[8] << 8 | data[9]);
            AgvId = data[11];

            BoxReleaseLightOn = Function == 0x36;
            BoxReleaseAgv = Function == 0x37;

            LastUpdateTime = DateTime.Now;
        }
    }
}
