Revert "[tracks] Safe GpsTrackCollection requests during recording."

This reverts commit b7b87f5530.
This commit is contained in:
Konstantin Pastbin
2025-08-31 15:58:40 +07:00
parent f3c30cbf85
commit de305e1a87
4 changed files with 8 additions and 13 deletions

View File

@@ -50,20 +50,15 @@ void GpsTrack::AddPoints(vector<location::GpsInfo> const & points)
ScheduleTask(); ScheduleTask();
} }
/// @note These functions are called during recording, so should be synchronized with Collection writer thread. TrackStatistics GpsTrack::GetTrackStatistics() const
/// @{
TrackStatistics GpsTrack::GetTrackStatistics()
{ {
lock_guard<mutex> lg(m_threadGuard);
return m_collection ? m_collection->GetTrackStatistics() : TrackStatistics(); return m_collection ? m_collection->GetTrackStatistics() : TrackStatistics();
} }
ElevationInfo const & GpsTrack::GetElevationInfo() ElevationInfo const & GpsTrack::GetElevationInfo() const
{ {
lock_guard<mutex> lg(m_threadGuard);
return m_collection->UpdateAndGetElevationInfo(); return m_collection->UpdateAndGetElevationInfo();
} }
/// @}
void GpsTrack::Clear() void GpsTrack::Clear()
{ {

View File

@@ -31,8 +31,8 @@ public:
void AddPoints(std::vector<location::GpsInfo> const & points); void AddPoints(std::vector<location::GpsInfo> const & points);
/// Returns track statistics /// Returns track statistics
TrackStatistics GetTrackStatistics(); TrackStatistics GetTrackStatistics() const;
ElevationInfo const & GetElevationInfo(); ElevationInfo const & GetElevationInfo() const;
/// Clears any previous tracking info /// Clears any previous tracking info
/// @note Callback is called with 'toRemove' points, if some points were removed. /// @note Callback is called with 'toRemove' points, if some points were removed.

View File

@@ -68,12 +68,12 @@ bool GpsTracker::IsEmpty() const
return m_track.IsEmpty(); return m_track.IsEmpty();
} }
TrackStatistics GpsTracker::GetTrackStatistics() TrackStatistics GpsTracker::GetTrackStatistics() const
{ {
return m_track.GetTrackStatistics(); return m_track.GetTrackStatistics();
} }
ElevationInfo const & GpsTracker::GetElevationInfo() ElevationInfo const & GpsTracker::GetElevationInfo() const
{ {
return m_track.GetElevationInfo(); return m_track.GetElevationInfo();
} }

View File

@@ -17,8 +17,8 @@ public:
bool IsEmpty() const; bool IsEmpty() const;
TrackStatistics GetTrackStatistics(); TrackStatistics GetTrackStatistics() const;
ElevationInfo const & GetElevationInfo(); ElevationInfo const & GetElevationInfo() const;
using TGpsTrackDiffCallback = using TGpsTrackDiffCallback =
std::function<void(std::vector<std::pair<size_t, location::GpsInfo>> && toAdd, std::function<void(std::vector<std::pair<size_t, location::GpsInfo>> && toAdd,