/// <summary>
        /// 解析GPS上传的数据----定位信息
        /// </summary>
        /// <param name="position"></param>
        /// <param name="data"></param>
        public static void ParseGPSData_Position_ToEntity(IPositionStatus position, ref YouWeiGPSData data)
        {
            try
            {                            
                string sDate = string.Empty;

                //默认为当前时间
                DateTime aCurrentDateTime = DateTime.Now;
                byte[] byttime = position.szDatetime;
                try
                {
                    string strtime = Encoding.ASCII.GetString(byttime);
                    string stryear = strtime.Substring(0, 4);
                    string strmonth = strtime.Substring(4, 2);
                    string strday = strtime.Substring(6, 2);
                    string strhour = strtime.Substring(8, 2);
                    string strminute = strtime.Substring(10, 2);
                    string strsecond = strtime.Substring(12, 2);
                    //aCurrentDateTime = DateTime.Parse(strtime);
                    sDate = stryear + "-" + strmonth + "-" + strday + " " + strhour + ":" + strminute + ":" + strsecond;

                    try
                    {
                        aCurrentDateTime = Convert.ToDateTime(sDate);

                        //GPS时间比正式时间晚8小时
                        aCurrentDateTime = aCurrentDateTime.AddHours(8);
                    }
                    catch
                    {
                        aCurrentDateTime = DateTime.Now;
                    }

                }
                catch (Exception ex)
                {
                    Logger.Error(ex, null);
                }                

                data.BaseData.Latitude = (decimal)position.dLatitude;
                data.BaseData.Longitude = (decimal)position.dLongitude;
                
                //if (position.dwFlags == 1)
                //{
                //    data.BaseData.IsLocatedData = true;
                //}
                byte[] GpsFlag= BitConverter.GetBytes(position.dwGPSFlags);
                int bitStatus = Transfer.GetByteIndexValue(GpsFlag[0], 7); 
                data.BaseData.IsLocatedData = bitStatus == 0 ? false : true; 

                data.BaseData.Speed = (decimal)position.fSpeed;
                data.BaseData.Direction = (decimal)position.fDirect;
                data.BaseData.ReportTime = aCurrentDateTime;
                data.BaseData.ReceiveTime = DateTime.Now;
                ParseGPSData_StatusEx_ToEntity(position.byStatus, ref data);
                //added by lixun 2010/1/10 目前技术支持对808A油耗的接线不清楚,需要和厂家继续沟通,放入下一个版本 
                //GetOilBearling(position, ref data);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, null);
            }            
        }
        /// <summary>
        /// 获取当前油量(4012协议)
        /// </summary>
        /// <param name="position"></param>
        /// <param name="data"></param>
        private static void GetOilBearling(IPositionStatus position, ref YouWeiGPSData data)
        {
            if (position.Option.Length > 0)
            {
                uint uKind = (uint)position.Option[4];

                if (uKind == YouWeiPublicDefine.POS_OPTION_KIND_OILVALUE)
                {
                    IDevicePosOptionOIL deviceOil = (IDevicePosOptionOIL)Transfer.BytesToStuct(position.Option, typeof(IDevicePosOptionOIL));
                    if (data.BaseData.ACCState == 1)
                    {
                        try
                        {
                            if (deviceOil.dwValue < 500)
                            {
                                deviceOil.dwValue = 500;
                            }

                            data.BaseData.OilBearing = (deviceOil.dwValue - 500) / 10;
                        }
                        catch
                        {
                            data.BaseData.OilBearing = (decimal)0.00;
                        }
                    }
                    else
                    {
                        data.BaseData.OilBearing = (decimal)0.00;
                    }
                }
                //System.Diagnostics.Debug.WriteLine("----------" + data.BaseData.OilBearing.ToString() + "---------"); 

            }
        }