SGIP协议之Report

   /// <summary>
    /// 功能:消息的状态报告
    /// 时间:2010年12月29日
    /// </summary>
    public class Report
    {
        private readonly int BodyLength = 12 + 1 + 21 + 1 + 1 + 8;

        private MessageHeader msgHeader;

        /// <summary>
        /// 消息头
        /// </summary>
        public MessageHeader MsgHeader
        {
            get { return msgHeader; }
            set { msgHeader = value; }
        }

        private byte[] submitSequenceNumber;

        public byte[] SubmitSequenceNumber
        {
            get { return submitSequenceNumber; }
            set { submitSequenceNumber = value; }
        }
        private uint reportType;

        public uint ReportType
        {
            get { return reportType; }
            set { reportType = value; }
        }
        private string userNumber;

        public string UserNumber
        {
            get { return userNumber; }
            set { userNumber = value; }
        }
        private uint state;

        public uint State
        {
            get { return state; }
            set { state = value; }
        }
        private uint errorCode;

        public uint ErrorCode
        {
            get { return errorCode; }
            set { errorCode = value; }
        }
        private string reserve;

        public string Reserve
        {
            get { return reserve; }
            set { reserve = value; }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="bytes"></param>
        public Report(byte[] bytes)
        {
            int i = 0;
            byte[] buffer = new byte[MessageHeader.HeaderLength];
            Util.ByteCopyToByte(bytes, i, buffer, 0, buffer.Length);
            this.msgHeader = new MessageHeader(buffer);
            i = i + buffer.Length;
            buffer = new byte[12];
            Util.ByteCopyToByte(bytes, i, buffer, 0, buffer.Length);
            this.submitSequenceNumber = buffer;
            i = i + buffer.Length;

            buffer = new byte[1];
            this.reportType = (byte)bytes[i++];
            buffer = new byte[21];
            Util.ByteCopyToByte(bytes, i, buffer, 0, buffer.Length);
            this.userNumber = BIConvert.Byte2String(buffer);
            i = i + buffer.Length;

            this.state = bytes[i++];
            this.errorCode = bytes[i++];

            buffer = new byte[8];
            Util.ByteCopyToByte(bytes, i, buffer, 0, buffer.Length);
            this.reserve = BIConvert.Byte2String(buffer);
            i = i + 8;

        }

    }

你可能感兴趣的:(String,report,Class,buffer,byte,2010)