Exemplo n.º 1
0
        /// <summary>
        /// 获取GPSDataEntity
        /// </summary>
        /// <param name="fullGpsCode"></param>
        /// <param name="LR"></param>
        /// <param name="entity"></param>
        private void GetGPSDataEntity(string fullGpsCode, LocationReport LR, ref GPSDataEntity entity)
        {
            entity.GPSCode = fullGpsCode;
            entity.Longitude = Convert.ToDecimal(LR.Longitude / Math.Pow(10, 6));
            entity.Latitude = Convert.ToDecimal(LR.Latitude / Math.Pow(10, 6));
            entity.Speed = LR.Speed / 10;
            entity.Direction = LR.Direction;
            entity.ReportTime = LR.Time;
            entity.OilState = LR.VehicleOilStatus == 0 ? 1 : 0;
            entity.ACCState = LR.ACCStatus;
            entity.IsLocatedData = LR.LocationStatus == 0 ? false : true;
            //高度暂存,部标检测
            entity.Detector2 = LR.Elevation;
            entity.IsOnCar = false;

            if (LR.AdditionMsgList != null && LR.AdditionMsgList.Count > 0)
            {
                //部标使用
                //entity.AdditionalInfo = Encoding.ASCII.GetString(LR.AdditionMsgByte);

                if (LR.AdditionMsgList.Exists(o => o.MsgID == AdditionMsgIDType.Mileage))
                {
                    AdditionMsgItem item = LR.AdditionMsgList.Find(o => o.MsgID == AdditionMsgIDType.Mileage);
                    Mileage aMileage = new Mileage();
                    item.ParseItem(ref aMileage);
                    entity.StarkMileage = aMileage.Value * 100;
                }
                if (LR.AdditionMsgList.Exists(o => o.MsgID == AdditionMsgIDType.OilMass))
                {
                    AdditionMsgItem item = LR.AdditionMsgList.Find(o => o.MsgID == AdditionMsgIDType.OilMass);
                    OilMass aOilMass = new OilMass();
                    item.ParseItem(ref aOilMass);
                    entity.OilBearing = aOilMass.Value / 10;
                }
                if (LR.AdditionMsgList.Exists(o => o.MsgID == AdditionMsgIDType.TachographSpeed))
                {
                    //行驶记录功能获取的速度 部标暂存
                    AdditionMsgItem item = LR.AdditionMsgList.Find(o => o.MsgID == AdditionMsgIDType.TachographSpeed);
                    TachographSpeed aSpeed = new TachographSpeed();
                    item.ParseItem(ref aSpeed);
                    entity.Detector1 = aSpeed.Value / 10;
                }

                if (LR.AdditionMsgList.Exists(o => o.MsgID == AdditionMsgIDType.YWExtensionStatus))
                {
                    //IsOnCar 是否上车(0否,1是)
                    AdditionMsgItem item = LR.AdditionMsgList.Find(o => o.MsgID == AdditionMsgIDType.YWExtensionStatus);
                    YWExtensionStatus aYWStatus = new YWExtensionStatus();
                    item.ParseItem(ref aYWStatus);
                    if (aYWStatus.IsOnCar == 1)
                        entity.IsOnCar = true;


                }

            }
            //所有报警的状态位(部标)            
            //entity.BlackBoxAlarmType = LR.AlarmStatus;
            entity.Mileage = 0;
            entity.PowerState = LR.VehicleEleStatus == 0 ? 1 : 0; ;
            entity.AntennaState = 1;
            entity.DoorStatus = LR.VehicleLockStatus == 0 ? 1 : 0;
            entity.PlunderState = LR.EmergencyAlarm == 1 ? 0 : 1;
            entity.ReceiveTime = DateTime.Now;


            //报警标志;状态;高程;行驶记录议速度
            string strExtensionData = LR.AlarmStatus + ";" + LR.Status + ";" + entity.Detector2 + ";" + entity.Detector1;
            entity.SourceData = Encoding.ASCII.GetBytes(strExtensionData);


            base.OnDebugDataEvent(base.TransfersType.ToString(), fullGpsCode, "[Status]:" + LR.Status + "[AlarmStatus]:" + LR.AlarmStatus + "[OnCar]:" + entity.IsOnCar);

            //base.OnDebugDataEvent(base.TransfersType.ToString(), fullGpsCode, string.Format("[EmergencyAlarm]:{0};[ACCStatus]:{1}", LR.EmergencyAlarm, LR.ACCStatus));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 解析位置附加信息项
 /// </summary>
 public void ParseItem(ref TachographSpeed TAItem)
 {
     TAItem.ValueByte = MsgValue;
     TAItem.Value = BitConverter.ToUInt16(BuBiaoData.LocalByteToNetByteOrder(TAItem.ValueByte), 0);
 }