public void Process(Packet p) { if (p.MessageId != (ushort)LogType.BestPos) { return; } p.SeekRead(p.GetHeaderLength(), SeekOrigin.Begin); var solStat = p.ReadUInt32(); var posType = p.ReadUInt32(); var latDegrees = p.ReadDouble(); var lonDegrees = p.ReadDouble(); var hight = p.ReadDouble(); var undulation = p.ReadSingle(); var datumId = p.ReadUInt32(); var latDeviation = p.ReadSingle(); var lonDeviation = p.ReadSingle(); var heightDeviation = p.ReadSingle(); var stationId = p.ReadUInt8Array(4); var diffAge = p.ReadSingle(); var solAge = p.ReadSingle(); var numberOfSatelites = p.ReadUInt8(); var usedSatelites = p.ReadUInt8(); m_current = new BestPosition() { LatitudeDegrees = latDegrees, LongitudeDegrees = lonDegrees, Latidue = latDeviation, Longitude = lonDeviation }; }
static void Callback(BestPosition p) { if (p == null) { return; } Console.WriteLine("-------------------"); Console.WriteLine(p.Longitude); Console.WriteLine(p.Latidue); }
public async Task <Position> GetUserPosition() { if ((BestPosition != null) && BestPosition.IsActive()) { return(BestPosition); } // ios does not send CLLocationManagerDelegate.didUpdateLocation constantly when there is no position update so the PositionExtensions.ValidCoordinateTime // quickly becomes invalid which causes to pause (GetNextPosition([pause time],.....) every time when Find My Location click before acting to position on the map // so the pause time should be 0 var position = await GetNextPosition(TimeSpan.Zero, 70) .Take(1) .DefaultIfEmpty() // Will return null in case of a timeout .ToTask(); if (position != null) { return(position); } // between the first call to BestPosition, we might have received a position if LocationService was started by GetNextPosition() return(BestPosition ?? GetInitialPosition()); }