public void LogPosition(ref GPSData p_gpsData) { bool blnLogPosition = false; if ((m_dbTrack != null) && m_blnLoggingStarted) { //T N54.85655 W1.56742 09-OCT-00 12:01:01 DateTime dtTimeOfEvent = p_gpsData.TimeOfLastFix; TimeSpan tsDifference = dtTimeOfEvent.Subtract(m_dtTimeOfLastWrite); if (tsDifference.Ticks >= m_lTrackWriterLogFrequency ) { if ((m_cdLastLoggedPosition.Latitude == 0) || (m_cdLastLoggedPosition.Longitude == 0)) { blnLogPosition = true; } else { // if 2d lock then accuracy -> 10m // else 2.5m? // get distance between two points... if (p_gpsData.FixType == "3D" ) { m_dbGPSPositionalAccuracy = 0.0025d; //2.5 m } else { m_dbGPSPositionalAccuracy = 0.01d; //10 m } double dbDistanceBetweenPoints = Coordinate.DistanceBetweenPoints(m_cdLastLoggedPosition,p_gpsData.LatestFixPosition, UnitOfMeasure.Kilometer); if (dbDistanceBetweenPoints > m_dbGPSPositionalAccuracy) { blnLogPosition = true; } } if (blnLogPosition) { GPSTrackInfo newPosition = new GPSTrackInfo(m_trTrackId.GetTrackID(),p_gpsData.LatestFixPosition,dtTimeOfEvent); newPosition.SpeedKPH = p_gpsData.CurrentSpeedKPH; try { m_dbTrack.Set(newPosition); m_dbTrack.Commit(); m_dtTimeOfLastWrite = dtTimeOfEvent; m_cdLastLoggedPosition = p_gpsData.LatestFixPosition; } catch (Exception ex) { RaiseExceptionEvent("Error Occured In GPSTrackDBWriter.GPSCoordUpdateEventHandler(...)",ex); } } } } // Console.WriteLine("{0}" , test.GetLatitude(GPSData.GPSCoordFormat.DegreesMinutesSeconds)); // Console.WriteLine("{0}" , test.GetLongitude(GPSData.GPSCoordFormat.DegreesMinutesSeconds)); // Console.WriteLine("{0}" , test.TimeOfLastGPSFix); }