ReadParamRtnPkg.cs 1.4 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mushiny.Model
{
    /// <summary>
    /// 参数回读数据包:RCS后台发下配置回读请求后立即发送一次
    /// </summary>
    internal class ReadParamRtnPkg:PkgData
    {
        public ReadParamRtnPkg() :base() 
        {
        }
        public byte[] MatchWord { get; set; }
        public byte[] ParamGroup { get; set; }
        public byte[] Data { get; set; }
        public override bool Parse(byte[] bytes)
        {
            bool result = false;
            try
            {
                if (base.Parse(bytes))
                {
                    if (bytes.Length < 15)
                    {
                        return false;
                    }
                    MatchWord = Common.GetSubBytes(bytes, 12, 2);
                    ParamGroup = Common.GetSubBytes(bytes, 14, 1);
                    if(bytes.Length >17)
                    {
                        Data = Common.GetSubBytes(bytes, 15, bytes.Length - 15 - 2);
                    }
                    result = true;
                }
                else
                {
                    result = false;
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return result;
        }
    }
}