Example #1
0
        /// <summary>
        /// 定位数据批量上传解析
        /// </summary>
        /// <param name="msgBody"></param>
        /// <returns></returns>
        public PB0704 Decode(byte[] msgBody)
        {
            REP_PB_0200 body0200    = new REP_PB_0200();
            int         indexOffset = 3;
            UInt16      dlen        = 0;
            UInt16      itemCount   = msgBody.ToUInt16(0);

            PB0704 item = new PB0704()
            {
                LocationDataTypes = msgBody[2]
            };

            item.PositionInformationItems = new List <PB0200>(itemCount);

            for (int i = 0; i < itemCount; ++i)
            {
                //位置汇报数据长度
                dlen = msgBody.ToUInt16(indexOffset);
                //解析位置汇报数据
                item.PositionInformationItems.Add(body0200.Decode(msgBody.Copy(indexOffset += 2, dlen)));

                indexOffset += dlen;
            }

            return(item);
        }
Example #2
0
        public PB0201 Decode(byte[] msgBody)
        {
            PB0201 item = new PB0201()
            {
                SerialNumber = msgBody.ToUInt16(0)
            };

            REP_PB_0200 body0200 = new REP_PB_0200();

            item.PositionInformation = body0200.Decode(msgBody.Copy(2, msgBody.Length - 2));

            return(item);
        }
Example #3
0
        /// <summary>
        /// 多媒体数据上传
        /// </summary>
        /// <param name="msgBody"></param>
        /// <returns></returns>
        public PB0801 Decode(byte[] msgBody)
        {
            int         indexOffset = 0;
            REP_PB_0200 body0200    = new REP_PB_0200();

            PB0801 item = new PB0801()
            {
                MultimediaDataId = msgBody.ToUInt32(0),
                MultmediaType    = msgBody[indexOffset += 4],
                MultimediaFormat = msgBody[indexOffset += 1],
                EventItemCoding  = msgBody[indexOffset += 1],
                ChannelId        = msgBody[indexOffset += 1]
            };

            item.PositionInformation = body0200.Decode(msgBody.Copy(indexOffset += 1, 28));

            item.MultimediaPackage = msgBody.Copy(indexOffset += 28, msgBody.Length - indexOffset);

            return(item);
        }
Example #4
0
        /// <summary>
        /// 多媒体检索数据体解析
        /// </summary>
        /// <param name="msgBody"></param>
        /// <returns></returns>
        public PB0802 Decode(byte[] msgBody)
        {
            PB0802 item = new PB0802()
            {
                SerialNumber = msgBody.ToUInt16(0)
            };

            int    indexOffset = 2;
            UInt16 itemCount   = msgBody.ToUInt16(indexOffset);

            REP_PB_0200 body0200 = new REP_PB_0200();

            item.MultimediaIndexItems = new List <IndexItem>(itemCount);

            for (int i = 0; i < itemCount; ++i)
            {
                if (indexOffset >= msgBody.Length)
                {
                    break;
                }

                IndexItem indexItem = new IndexItem();
                //多媒体ID
                indexItem.MultimediaDataId = msgBody.ToUInt32(indexOffset += 2);
                //多媒体类型
                indexItem.MultmediaType = msgBody[indexOffset += 4];
                //通道ID
                indexItem.ChannelId = msgBody[indexOffset += 1];
                //事件项编码
                indexItem.EventItemCoding = msgBody[indexOffset += 1];
                //位置信息汇报
                indexItem.PositionInformation = body0200.Decode(msgBody.Copy(indexOffset += 1, 28));

                item.MultimediaIndexItems.Add(indexItem);

                indexOffset += 28;
            }
            return(item);
        }