ActionFinishPkg.cs 1.6 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mushiny.Model
{
    /// <summary>
    /// AGV->RCS
    /// 动作完成数据包:
    /// (直行完成、转弯完成、料仓取放货完成、货架取放货完成、路径结束、充电对接完成、充满电)
    /// </summary>
    internal class ActionFinishPkg:PkgData
    {
        public ActionFinishPkg() : base() 
        {
        }
        public byte ActionCode {  get; set; }
        public byte[] AddrCodeID { get; set; }  
        public byte[] Dir {  get; set; }

        public byte[] ShelvesCode { get; set; }
        public byte[] ContainerCode { get; set;}

        public override bool Parse(byte[] bytes)
        {
            bool result = false;
            try
            {
                if (base.Parse(bytes))
                {
                    if (bytes.Length < 53)
                    {
                        return false;
                    }
                    ActionCode = Common.GetSubBytes(bytes, 12, 1)[0];
                    AddrCodeID = Common.GetSubBytes(bytes, 13, 4);
                    Dir = Common.GetSubBytes(bytes, 17, 2);
                    ShelvesCode = Common.GetSubBytes(bytes, 19, 16);
                    ContainerCode = Common.GetSubBytes(bytes, 35, 16);
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return result;
        }
    }
}