Esempio n. 1
0
        /// <summary>
        /// 分析GPS数据包
        /// </summary>
        /// <param name="buf"></param>
        /// <param name="aDataStorage"></param>
        /// <param name="blnShouldResponse"></param>
        /// <param name="aResponseList"></param>
        /// <returns></returns>
        private List<GPSDataEntity> Parse(byte[] buf, out List<byte[]> aResponseList, out string fullGpsCode, string sessionID)
        {
            List<GPSDataEntity> ObjectList = new List<GPSDataEntity>();
            object result = null;
            KaiYanData aKaiYanData = new KaiYanData();

            KaiYanDecodeData decodeData = new KaiYanDecodeData();
            byte[] byteGPSCode = null;
            string ReplyInstructionMode = "";

            decodeData.Decode(buf, base.CodePrefix, ref ReplyInstructionMode, ref aKaiYanData, ref byteGPSCode, out aResponseList);

            if (base.TransfersType == TransfersType.IsTcp)
            {
                if (!String.IsNullOrEmpty(aKaiYanData.FullGpsCode))
                {
                    OnAddConnectionEvent(aKaiYanData.FullGpsCode, sessionID);
                }
                //更新上一次数据
                if (TCPConnList.Instance().IsFirstDataOfConn(sessionID))
                {
                    //更改记录状态,标明以后的数据已不是第一点数据
                    TCPConnList.Instance().UpdateFirstDataRela(sessionID, 0);
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(aKaiYanData.FullGpsCode))
                {
                    OnAddConnectionEvent(aKaiYanData.FullGpsCode, sessionID);
                }
                if (UDPConnList.Instance().IsFirstDataOfConn(sessionID))
                {
                    if (string.IsNullOrEmpty(aKaiYanData.FullGpsCode))
                    {
                        Logger.Error("gpsData.FullGpsCode为空:" + aKaiYanData.BaseData.GPSCode, null);
                    }

                    //更改记录状态,标明以后的数据已不是第一点数据
                    UDPConnList.Instance().UpdateFirstDataRela(sessionID, 0);
                }
            }

            fullGpsCode = aKaiYanData.FullGpsCode;
            result = aKaiYanData;           
            ObjectList.Add(aKaiYanData.BaseData);
            //if (aKaiYanData != null)
            //{
            //    if (IsSendRsgsMessage(aKaiYanData, DicIsGPSLocaated, RestartTimeByUnGPSLocaated))
            //    {
            //        if (aResponseList != null)
            //        {
            //            aResponseList.Add(decodeData.GetRestartDeviceInstruction());
            //        }
            //        else
            //        {
            //            aResponseList = new System.Collections.Generic.List<byte[]>();
            //            aResponseList.Add(decodeData.GetRestartDeviceInstruction());
            //        }
            //        Logger.Trace("UnGPSLocaatedRestart--" + aKaiYanData.FullGpsCode + "--" + DateTime.Now.ToString());
            //    }
            //}
            return ObjectList;
        }
Esempio n. 2
0
 /// <summary> 解析页面下发指令
 /// 
 /// </summary>
 /// <param name="takePicture"></param>
 /// <returns></returns>
 public override byte[] ParseUpdateMileageControl(UpdateMileage Upmileage)
 {
     KaiYanDecodeData decodeData = new KaiYanDecodeData();
     return decodeData.GetUpdateMileage(Upmileage.Data.Mileage);
 }