public override Location Parse(MessageInput input) { MeiligaoInputMessage inputMessage = new MeiligaoInputMessage(input.DataMessage); HandleMessage(input, inputMessage); if (inputMessage.MeiligaoDataMessage != null) { Location location = new Location { Device = new Device { IMEI = inputMessage.DeviceIdTrimmed } }; location.PositionStatus = inputMessage.MeiligaoDataMessage.GPRMCArray[1] == "A"; location.Latitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{2})(\d{2}).(\d{4})", inputMessage.MeiligaoDataMessage.GPRMCArray[2], inputMessage.MeiligaoDataMessage.GPRMCArray[3]); location.Longitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{3})(\d{2}).(\d{4})", inputMessage.MeiligaoDataMessage.GPRMCArray[4], inputMessage.MeiligaoDataMessage.GPRMCArray[5]); location.DateTime = GetDateTime(inputMessage.MeiligaoDataMessage.GPRMCArray[0], inputMessage.MeiligaoDataMessage.GPRMCArray[8]); location.Speed = inputMessage.MeiligaoDataMessage.GPRMCArray.Get <double>(6) * 1.852; location.Heading = inputMessage.MeiligaoDataMessage.GPRMCArray.Get <float?>(7); location.HDOP = inputMessage.MeiligaoDataMessage.StringSplit.Get <double>(1); location.Altitude = inputMessage.MeiligaoDataMessage.StringSplit.Get <double>(2); location.Odometer = inputMessage.MeiligaoDataMessage.StringSplit.Get <uint?>(7); return(location); } return(null); }
private static Location ParseLocation_AT09(MessageInput input) { return(new Location { Device = new Device { IMEI = input.DataMessage.Reader.Skip(8).GetUntil('|') }, DateTime = ConvertDate(input.DataMessage.Reader.Skip(8).Get(12)), Satellites = Convert.ToInt16(input.DataMessage.Reader.Skip(36).Get(2)), GsmSignal = GsmUtil.ConvertSignal(Convert.ToInt16(input.DataMessage.Reader.Get(2))), Heading = Convert.ToInt32(input.DataMessage.Reader.Get(3)), Speed = Convert.ToInt32(input.DataMessage.Reader.Get(3)), HDOP = double.Parse(input.DataMessage.Reader.Get(4)), Odometer = uint.Parse(input.DataMessage.Reader.Get(7)), Latitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{2})(\d{2}).(\d{4})", input.DataMessage.Reader.Get(9), input.DataMessage.Reader.Get(1)), Longitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{3})(\d{2}).(\d{4})", input.DataMessage.Reader.Get(10), input.DataMessage.Reader.Get(1)) }); }
private static Location Location(MessageInput input) { Location location = new Location { Device = new Device { IMEI = input.DataMessage.CommaSplit.Get <string>(0).Replace("imei:", Empty) }, DateTime = GetDate(input.DataMessage.CommaSplit.Get <string>(2)), PositionStatus = input.DataMessage.CommaSplit.Get <string>(4) == "F", Latitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{2})(\d{2}).(\d{4})", input.DataMessage.CommaSplit[7], input.DataMessage.CommaSplit[8]), Longitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{3})(\d{2}).(\d{4})", input.DataMessage.CommaSplit[9], input.DataMessage.CommaSplit[10]), Speed = input.DataMessage.CommaSplit.Get <double>(11), Heading = input.DataMessage.CommaSplit.Get <string>(12) != "1" ? input.DataMessage.CommaSplit.Get <float?>(12) : null, Altitude = input.DataMessage.CommaSplit.Get <double?>(13), }; return(location); }
private static Location Parse_V3(MessageInput input) { Location location = new Location { Device = new Device { IMEI = input.DataMessage.CommaSplit[1] }, Latitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{2})(\d{2}).(\d{4})", input.DataMessage.CommaSplit[7], input.DataMessage.CommaSplit[8]), Longitude = GpsUtil.ConvertDegreeAngleToDouble(@"(\d{3})(\d{2}).(\d{4})", input.DataMessage.CommaSplit[9], input.DataMessage.CommaSplit[10]), DateTime = GetDate(input.DataMessage.CommaSplit[4], input.DataMessage.CommaSplit[5]), Satellites = input.DataMessage.CommaSplit.Get <short?>(12), HDOP = input.DataMessage.CommaSplit.Get <double>(14), Speed = input.DataMessage.CommaSplit.Get <double>(15) * 1.852, Heading = input.DataMessage.CommaSplit.Get <float?>(16), Altitude = input.DataMessage.CommaSplit.Get <double?>(17), Odometer = input.DataMessage.CommaSplit.Get <double?>(18) * 1000, GsmSignal = input.DataMessage.CommaSplit.Get <short?>(23) }; return(location); }