From 2133dc2a55f2c0254456df7578c8884899d71453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BE=D0=B1=D1=80=D1=8B=D0=B8=CC=86=20=D0=AD=D1=8D?= =?UTF-8?q?=D1=85?= Date: Thu, 20 Oct 2016 10:14:44 +0300 Subject: [PATCH] add required accuracy for gps reporter --- tracking/reporter.cpp | 4 ++++ tracking/tracking_tests/reporter_test.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/tracking/reporter.cpp b/tracking/reporter.cpp index 8e2b9a9991..b161b4e3d6 100644 --- a/tracking/reporter.cpp +++ b/tracking/reporter.cpp @@ -12,6 +12,7 @@ namespace { +double constexpr kRequiredHorizontalAccuracy = 10.0; double constexpr kMinDelaySeconds = 1.0; double constexpr kReconnectDelaySeconds = 60.0; size_t constexpr kRealTimeBufferSize = 60; @@ -56,6 +57,9 @@ void Reporter::AddLocation(location::GpsInfo const & info) { lock_guard lg(m_mutex); + if (info.m_horizontalAccuracy > kRequiredHorizontalAccuracy) + return; + if (info.m_timestamp < m_lastGpsTime + kMinDelaySeconds) return; diff --git a/tracking/tracking_tests/reporter_test.cpp b/tracking/tracking_tests/reporter_test.cpp index 2492f32e9d..685b4f19f7 100644 --- a/tracking/tracking_tests/reporter_test.cpp +++ b/tracking/tracking_tests/reporter_test.cpp @@ -25,6 +25,7 @@ void TransferLocation(Reporter & reporter, TestSocket & testSocket, double times gpsInfo.m_timestamp = timestamp; gpsInfo.m_latitude = latidute; gpsInfo.m_longitude = longtitude; + gpsInfo.m_horizontalAccuracy = 1.0; reporter.AddLocation(gpsInfo); vector buffer;