Merge lp:~mandel/location-service/better-position-selection into lp:location-service/trunk

Proposed by Manuel de la Peña
Status: Merged
Approved by: Jim Hodapp
Approved revision: 202
Merged at revision: 187
Proposed branch: lp:~mandel/location-service/better-position-selection
Merge into: lp:location-service/trunk
Prerequisite: lp:~mandel/location-service/remove-pimpl
Diff against target: 494 lines (+407/-2)
8 files modified
src/location_service/com/ubuntu/location/CMakeLists.txt (+1/-0)
src/location_service/com/ubuntu/location/engine.cpp (+5/-2)
src/location_service/com/ubuntu/location/engine.h (+3/-0)
src/location_service/com/ubuntu/location/time_based_update_policy.cpp (+121/-0)
src/location_service/com/ubuntu/location/time_based_update_policy.h (+70/-0)
src/location_service/com/ubuntu/location/update_policy.h (+75/-0)
tests/CMakeLists.txt (+1/-0)
tests/time_based_update_policy_test.cpp (+131/-0)
To merge this branch: bzr merge lp:~mandel/location-service/better-position-selection
Reviewer Review Type Date Requested Status
Jim Hodapp (community) code Approve
PS Jenkins bot continuous-integration Approve
Thomas Voß (community) Needs Fixing
Review via email: mp+257037@code.launchpad.net

Commit message

Improve the selection of the bag of providers to ensure that the locations used are within a reasonable time margin.

Description of the change

Improve the selection of the bag of providers to ensure that the locations used are within a reasonable time margin.

To post a comment you must log in.
Revision history for this message
Thomas Voß (thomas-voss) wrote :

Thanks for the changes, a high-level remark first: The ProviderSelectionStrategy implementation is not the right place to add this functionality. Instead, the functionality should be added here:

  http://bazaar.launchpad.net/~phablet-team/location-service/trunk/view/head:/src/location_service/com/ubuntu/location/engine.cpp#L205

location::Engine is the central hub receiving and dispatching updates and it is meant to carry out such tasks as proposed in this MP.

Also make sure that an automated test case is added in http://bazaar.launchpad.net/~phablet-team/location-service/trunk/view/head:/tests/engine_test.cpp. I would think that introducing a location::PositionUpdateFilter interface together with a default implementation should help a lot here. You can pass the location::PositionUpdateFilter to the location::Engine constructor as a functional dependency and subsequently test if the Engine calls into that object for position updates.

Rest of my comments inline.

review: Needs Fixing
Revision history for this message
Thomas Voß (thomas-voss) wrote :

One other bit: The predominant style in the codebase is snake_style. Please change the camelCase instances accordingly.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
194. By Manuel de la Peña

Merged remove-pimpl into better-position-selection.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
195. By Manuel de la Peña

Move the heuristics to its own class to make it easier to have diff options. Move the position selection to the engine.

196. By Manuel de la Peña

Add missing files.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

Looks better, but some comments inline.

review: Needs Fixing
197. By Manuel de la Peña

Made changes following the comments from the reviews.

198. By Manuel de la Peña

Add missing space.

199. By Manuel de la Peña

Merged remove-pimpl into better-position-selection.

200. By Manuel de la Peña

Remove unused var.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Some suggestions inline below.

review: Needs Fixing
201. By Manuel de la Peña

Made changes following the code reviews.

202. By Manuel de la Peña

Set var to const.

Revision history for this message
Jim Hodapp (jhodapp) wrote :

Looks good

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/location_service/com/ubuntu/location/CMakeLists.txt'
2--- src/location_service/com/ubuntu/location/CMakeLists.txt 2015-01-25 12:45:30 +0000
3+++ src/location_service/com/ubuntu/location/CMakeLists.txt 2015-04-23 21:30:38 +0000
4@@ -27,6 +27,7 @@
5 proxy_provider.cpp
6 satellite_based_positioning_state.cpp
7 settings.cpp
8+ time_based_update_policy.cpp
9 set_name_for_thread.cpp
10 wifi_and_cell_reporting_state.cpp
11
12
13=== modified file 'src/location_service/com/ubuntu/location/engine.cpp'
14--- src/location_service/com/ubuntu/location/engine.cpp 2015-01-25 12:44:20 +0000
15+++ src/location_service/com/ubuntu/location/engine.cpp 2015-04-23 21:30:38 +0000
16@@ -24,6 +24,8 @@
17 #include <stdexcept>
18 #include <unordered_map>
19
20+#include "time_based_update_policy.h"
21+
22 namespace cul = com::ubuntu::location;
23
24 const cul::SatelliteBasedPositioningState cul::Engine::Configuration::Defaults::satellite_based_positioning_state;
25@@ -33,7 +35,8 @@
26 cul::Engine::Engine(const cul::ProviderSelectionPolicy::Ptr& provider_selection_policy,
27 const cul::Settings::Ptr& settings)
28 : provider_selection_policy(provider_selection_policy),
29- settings(settings)
30+ settings(settings),
31+ update_policy(std::make_shared<cul::TimeBasedUpdatePolicy>())
32 {
33 if (!provider_selection_policy) throw std::runtime_error
34 {
35@@ -204,7 +207,7 @@
36 // We should come up with a better heuristic here.
37 auto cpr = provider->updates().position.connect([this](const cul::Update<cul::Position>& src)
38 {
39- updates.reference_location = src;
40+ updates.reference_location = update_policy->verify_update(src);
41 });
42
43 std::lock_guard<std::mutex> lg(guard);
44
45=== modified file 'src/location_service/com/ubuntu/location/engine.h'
46--- src/location_service/com/ubuntu/location/engine.h 2015-01-14 13:41:54 +0000
47+++ src/location_service/com/ubuntu/location/engine.h 2015-04-23 21:30:38 +0000
48@@ -33,6 +33,8 @@
49 #include <mutex>
50 #include <set>
51
52+#include "update_policy.h"
53+
54 namespace com
55 {
56 namespace ubuntu
57@@ -193,6 +195,7 @@
58 std::map<Provider::Ptr, ProviderConnections> providers;
59 ProviderSelectionPolicy::Ptr provider_selection_policy;
60 Settings::Ptr settings;
61+ UpdatePolicy::Ptr update_policy;
62 };
63
64 /** @brief Pretty prints the given status to the given stream. */
65
66=== added file 'src/location_service/com/ubuntu/location/time_based_update_policy.cpp'
67--- src/location_service/com/ubuntu/location/time_based_update_policy.cpp 1970-01-01 00:00:00 +0000
68+++ src/location_service/com/ubuntu/location/time_based_update_policy.cpp 2015-04-23 21:30:38 +0000
69@@ -0,0 +1,121 @@
70+/*
71+ * Copyright © 2015 Canonical Ltd.
72+ *
73+ * This program is free software: you can redistribute it and/or modify it
74+ * under the terms of the GNU Lesser General Public License version 3,
75+ * as published by the Free Software Foundation.
76+ *
77+ * This program is distributed in the hope that it will be useful,
78+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
79+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80+ * GNU Lesser General Public License for more details.
81+ *
82+ * You should have received a copy of the GNU Lesser General Public License
83+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
84+ *
85+ * Authored by: Manuel de la Pena <manuel.delapena@canonical.com>
86+ */
87+
88+#include "time_based_update_policy.h"
89+
90+namespace com
91+{
92+namespace ubuntu
93+{
94+namespace location
95+{
96+
97+std::chrono::minutes TimeBasedUpdatePolicy::default_timeout()
98+{
99+ static const std::chrono::minutes default_limit(2);
100+ return default_limit;
101+}
102+
103+TimeBasedUpdatePolicy::TimeBasedUpdatePolicy(std::chrono::minutes mins)
104+ : limit(mins)
105+{
106+
107+}
108+
109+const location::Update<location::Position>& TimeBasedUpdatePolicy::verify_update(const location::Update<location::Position>& update)
110+{
111+ std::lock_guard<std::mutex> guard(position_update_mutex);
112+ bool use_new_update;
113+ if (is_significantly_newer(last_position_update, update, limit))
114+ {
115+ use_new_update = true;
116+ }
117+ else if (is_significantly_older(last_position_update, update, limit))
118+ {
119+ use_new_update = false;
120+ }
121+ else
122+ {
123+ // if the update has happened within a reasonable amount of time we will just use it if it is more accurate
124+ // that the previous one.
125+ use_new_update = last_position_update.value.accuracy.horizontal && update.value.accuracy.horizontal
126+ && *last_position_update.value.accuracy.horizontal >= *update.value.accuracy.horizontal;
127+ }
128+
129+ if (use_new_update)
130+ {
131+ last_position_update = update;
132+ return update;
133+ }
134+ else
135+ {
136+ return last_position_update;
137+ }
138+}
139+
140+
141+const location::Update<location::Heading>& TimeBasedUpdatePolicy::verify_update(const location::Update<location::Heading>& update)
142+{
143+ std::lock_guard<std::mutex> guard(heading_update_mutex);
144+ bool use_new_update;
145+ if (is_significantly_newer(last_heading_update, update, limit))
146+ {
147+ use_new_update = true;
148+ }
149+ else if (is_significantly_older(last_heading_update, update, limit))
150+ {
151+ use_new_update = false;
152+ }
153+ if (use_new_update)
154+ {
155+ last_heading_update = update;
156+ return update;
157+ }
158+ else
159+ {
160+ return last_heading_update;
161+ }
162+}
163+
164+const location::Update<location::Velocity>& TimeBasedUpdatePolicy::verify_update(const location::Update<location::Velocity>& update)
165+{
166+ std::lock_guard<std::mutex> guard(velocity_update_mutex);
167+ bool use_new_update;
168+ if (is_significantly_newer(last_velocity_update, update, limit))
169+ {
170+ use_new_update = true;
171+ }
172+ else if (is_significantly_older(last_velocity_update, update, limit))
173+ {
174+ use_new_update = false;
175+ }
176+
177+ if (use_new_update)
178+ {
179+ last_velocity_update = update;
180+ return update;
181+ }
182+ else
183+ {
184+ return last_velocity_update;
185+ }
186+}
187+
188+}
189+}
190+}
191\ No newline at end of file
192
193=== added file 'src/location_service/com/ubuntu/location/time_based_update_policy.h'
194--- src/location_service/com/ubuntu/location/time_based_update_policy.h 1970-01-01 00:00:00 +0000
195+++ src/location_service/com/ubuntu/location/time_based_update_policy.h 2015-04-23 21:30:38 +0000
196@@ -0,0 +1,70 @@
197+/*
198+ * Copyright © 2015 Canonical Ltd.
199+ *
200+ * This program is free software: you can redistribute it and/or modify it
201+ * under the terms of the GNU Lesser General Public License version 3,
202+ * as published by the Free Software Foundation.
203+ *
204+ * This program is distributed in the hope that it will be useful,
205+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
206+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
207+ * GNU Lesser General Public License for more details.
208+ *
209+ * You should have received a copy of the GNU Lesser General Public License
210+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
211+ *
212+ * Authored by: Manuel de la Pena <manuel.delapena@canonical.com>
213+ */
214+#ifndef LOCATION_SERVICE_UBUNTU_LOCATION_SERVICE_TIMES_BASED_UPDATE_POLICY_H_
215+#define LOCATION_SERVICE_UBUNTU_LOCATION_SERVICE_TIMES_BASED_UPDATE_POLICY_H_
216+
217+#include <chrono>
218+#include <mutex>
219+
220+#include "update_policy.h"
221+
222+namespace com
223+{
224+namespace ubuntu
225+{
226+namespace location
227+{
228+
229+// An interface that can be implemented to add heuristics on how heading, position or velocity updates will be chosen.
230+// This class ensures that the best update possible is chosen within a reasonable time bracket.
231+class TimeBasedUpdatePolicy : public UpdatePolicy {
232+
233+ public:
234+ TimeBasedUpdatePolicy(std::chrono::minutes mins=default_timeout());
235+ TimeBasedUpdatePolicy(const TimeBasedUpdatePolicy&) = delete;
236+ ~TimeBasedUpdatePolicy() = default;
237+
238+ // Return if the given position update will be verified as the new position in the engine.
239+ const location::Update<location::Position>& verify_update(const location::Update<location::Position>& update) override;
240+ // Return if the given heading update will be verified as the new heading in the engine.
241+ const location::Update<location::Heading>& verify_update(const location::Update<location::Heading>& update) override;
242+ // Return if the given velocity update will be verified as the new velocity in the engine.
243+ const location::Update<location::Velocity>& verify_update(const location::Update<location::Velocity>& update) override;
244+
245+ static std::chrono::minutes default_timeout();
246+
247+ protected:
248+ // not private to simplify the testing but should be private
249+ location::Update<location::Position> last_position_update;
250+ location::Update<location::Heading> last_heading_update;
251+ location::Update<location::Velocity> last_velocity_update;
252+
253+ private:
254+ // callbacks can happen in diff threads, make sure multi-threading will work in this class
255+ std::mutex position_update_mutex;
256+ std::mutex heading_update_mutex;
257+ std::mutex velocity_update_mutex;
258+ // used to calculate the time accepted bracket
259+ std::chrono::minutes limit;
260+};
261+
262+}
263+}
264+}
265+
266+#endif //LOCATION_SERVICE_UBUNTU_LOCATION_SERVICE_TIMES_BASED_UPDATE_POLICY_H_
267
268=== added file 'src/location_service/com/ubuntu/location/update_policy.h'
269--- src/location_service/com/ubuntu/location/update_policy.h 1970-01-01 00:00:00 +0000
270+++ src/location_service/com/ubuntu/location/update_policy.h 2015-04-23 21:30:38 +0000
271@@ -0,0 +1,75 @@
272+/*
273+ * Copyright © 2015 Canonical Ltd.
274+ *
275+ * This program is free software: you can redistribute it and/or modify it
276+ * under the terms of the GNU Lesser General Public License version 3,
277+ * as published by the Free Software Foundation.
278+ *
279+ * This program is distributed in the hope that it will be useful,
280+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
281+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
282+ * GNU Lesser General Public License for more details.
283+ *
284+ * You should have received a copy of the GNU Lesser General Public License
285+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
286+ *
287+ * Authored by: Manuel de la Pena <manuel.delapena@canonical.com>
288+ */
289+#ifndef LOCATION_SERVICE_UBUNTU_LOCATION_SERVICE_UPDATE_POLICY_H_
290+#define LOCATION_SERVICE_UBUNTU_LOCATION_SERVICE_UPDATE_POLICY_H_
291+
292+#include <memory>
293+
294+#include <com/ubuntu/location/heading.h>
295+#include <com/ubuntu/location/position.h>
296+#include <com/ubuntu/location/update.h>
297+#include <com/ubuntu/location/velocity.h>
298+
299+namespace com
300+{
301+namespace ubuntu
302+{
303+namespace location
304+{
305+
306+// An interface that can be implemented to add heuristics on how heading, position or velocity updateswill be chosen.
307+// This class allows developers to inject different heuristics in the engine to perform the update selection
308+// so that the app developers can take advantage of it.
309+class UpdatePolicy {
310+ public:
311+ typedef std::shared_ptr<UpdatePolicy> Ptr;
312+
313+ UpdatePolicy(const UpdatePolicy&) = delete;
314+ UpdatePolicy(UpdatePolicy&&) = delete;
315+ UpdatePolicy& operator=(const UpdatePolicy&) = delete;
316+ virtual ~UpdatePolicy() = default;
317+
318+ // Return if the given position update will be verified as the new position in the engine.
319+ virtual const location::Update<location::Position>& verify_update(const location::Update<location::Position>& update) = 0;
320+ // Return if the given heading update will be verified as the new heading in the engine.
321+ virtual const location::Update<location::Heading>& verify_update(const location::Update<location::Heading>& update) = 0;
322+ // Return if the given velocity update will be verified as the new velocity in the engine.
323+ virtual const location::Update<location::Velocity>& verify_update(const location::Update<location::Velocity>& update) = 0;
324+ protected:
325+ UpdatePolicy() = default;
326+
327+ template <class T> bool is_significantly_newer(const location::Update<T> last_update, const location::Update<T> update, std::chrono::minutes limit) const
328+ {
329+ auto delta = update.when - last_update.when;
330+ return delta > limit;
331+ }
332+
333+ template <class T> bool is_significantly_older(const location::Update<T> last_update, const location::Update<T> update, std::chrono::minutes limit) const
334+ {
335+ auto delta = update.when - last_update.when;
336+ return delta < (-1 * limit);
337+ }
338+
339+
340+};
341+}
342+}
343+}
344+
345+#endif // LOCATION_SERVICE_UBUNTU_LOCATION_SERVICE_UPDATE_POLICY_H_
346+
347
348=== modified file 'tests/CMakeLists.txt'
349--- tests/CMakeLists.txt 2014-11-14 11:26:45 +0000
350+++ tests/CMakeLists.txt 2015-04-23 21:30:38 +0000
351@@ -80,6 +80,7 @@
352 LOCATION_SERVICE_ADD_TEST(engine_test engine_test.cpp)
353 LOCATION_SERVICE_ADD_TEST(harvester_test harvester_test.cpp)
354 LOCATION_SERVICE_ADD_TEST(demultiplexing_reporter_test demultiplexing_reporter_test.cpp)
355+LOCATION_SERVICE_ADD_TEST(time_based_update_policy_test time_based_update_policy_test.cpp)
356
357 if (NET_CPP_FOUND)
358 LOCATION_SERVICE_ADD_TEST(ichnaea_reporter_test ichnaea_reporter_test.cpp)
359
360=== added file 'tests/time_based_update_policy_test.cpp'
361--- tests/time_based_update_policy_test.cpp 1970-01-01 00:00:00 +0000
362+++ tests/time_based_update_policy_test.cpp 2015-04-23 21:30:38 +0000
363@@ -0,0 +1,131 @@
364+/*
365+ * Copyright © 2015 Canonical Ltd.
366+ *
367+ * This program is free software: you can redistribute it and/or modify it
368+ * under the terms of the GNU Lesser General Public License version 3,
369+ * as published by the Free Software Foundation.
370+ *
371+ * This program is distributed in the hope that it will be useful,
372+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
373+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
374+ * GNU Lesser General Public License for more details.
375+ *
376+ * You should have received a copy of the GNU Lesser General Public License
377+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
378+ *
379+ * Authored by: Manuel de la Pena <manuel.delapena@canonical.com>
380+ */
381+#include <com/ubuntu/location/time_based_update_policy.h>
382+
383+#include <gtest/gtest.h>
384+
385+using namespace ::testing;
386+namespace cul = com::ubuntu::location;
387+
388+namespace
389+{
390+ auto timestamp = com::ubuntu::location::Clock::now();
391+
392+ com::ubuntu::location::Update<com::ubuntu::location::Position> reference_position_update
393+ {
394+ {
395+ com::ubuntu::location::wgs84::Latitude{9. * com::ubuntu::location::units::Degrees},
396+ com::ubuntu::location::wgs84::Longitude{53. * com::ubuntu::location::units::Degrees},
397+ com::ubuntu::location::wgs84::Altitude{-2. * com::ubuntu::location::units::Meters},
398+ },
399+ timestamp
400+ };
401+}
402+
403+// make certain internal details public so that we can set the last update
404+class PublicTimeBasedUpdatePolicy : public cul::TimeBasedUpdatePolicy {
405+ public:
406+ PublicTimeBasedUpdatePolicy(std::chrono::minutes mins) : cul::TimeBasedUpdatePolicy(mins) {}
407+ using cul::TimeBasedUpdatePolicy::last_position_update;
408+ using cul::TimeBasedUpdatePolicy::last_heading_update;
409+ using cul::TimeBasedUpdatePolicy::last_velocity_update;
410+};
411+
412+TEST(TimeBasedUpdatePolicy, policy_ignores_updates_that_are_too_old)
413+{
414+ auto policy = std::make_shared<PublicTimeBasedUpdatePolicy>(std::chrono::minutes(2));
415+ policy->last_position_update = reference_position_update;
416+
417+ com::ubuntu::location::Update<com::ubuntu::location::Position> old_update
418+ {
419+ {
420+ com::ubuntu::location::wgs84::Latitude{10. * com::ubuntu::location::units::Degrees},
421+ com::ubuntu::location::wgs84::Longitude{60. * com::ubuntu::location::units::Degrees},
422+ com::ubuntu::location::wgs84::Altitude{10. * com::ubuntu::location::units::Meters}
423+ },
424+ timestamp - std::chrono::minutes(5)
425+ };
426+ policy->verify_update(old_update);
427+
428+ ASSERT_NE(policy->last_position_update.value.latitude, old_update.value.latitude);
429+ ASSERT_EQ(policy->last_position_update.value.latitude, reference_position_update.value.latitude);
430+
431+ ASSERT_NE(policy->last_position_update.value.longitude, old_update.value.longitude);
432+ ASSERT_EQ(policy->last_position_update.value.longitude, reference_position_update.value.longitude);
433+
434+ ASSERT_NE(policy->last_position_update.value.altitude, old_update.value.altitude);
435+ ASSERT_EQ(policy->last_position_update.value.altitude, reference_position_update.value.altitude);
436+}
437+
438+TEST(TimeBasedUpdatePolicy, policy_uses_very_recent_updates)
439+{
440+ auto policy = std::make_shared<PublicTimeBasedUpdatePolicy>(std::chrono::minutes(2));
441+
442+ policy->last_position_update = reference_position_update;
443+
444+ com::ubuntu::location::Update<com::ubuntu::location::Position> new_update
445+ {
446+ {
447+ com::ubuntu::location::wgs84::Latitude{10. * com::ubuntu::location::units::Degrees},
448+ com::ubuntu::location::wgs84::Longitude{60. * com::ubuntu::location::units::Degrees},
449+ com::ubuntu::location::wgs84::Altitude{10. * com::ubuntu::location::units::Meters}
450+ },
451+ timestamp + std::chrono::minutes(3)
452+ };
453+
454+ policy->verify_update(new_update);
455+
456+ ASSERT_EQ(policy->last_position_update.value.latitude, new_update.value.latitude);
457+ ASSERT_NE(policy->last_position_update.value.latitude, reference_position_update.value.latitude);
458+
459+ ASSERT_EQ(policy->last_position_update.value.longitude, new_update.value.longitude);
460+ ASSERT_NE(policy->last_position_update.value.longitude, reference_position_update.value.longitude);
461+
462+ ASSERT_EQ(policy->last_position_update.value.altitude, new_update.value.altitude);
463+ ASSERT_NE(policy->last_position_update.value.altitude, reference_position_update.value.altitude);
464+}
465+
466+TEST(TimeBasedUpdatePolicy, policy_ignores_inaccurate_updates)
467+{
468+ auto policy = std::make_shared<PublicTimeBasedUpdatePolicy>(std::chrono::minutes(2));
469+ reference_position_update.value.accuracy.horizontal = 1. * com::ubuntu::location::units::Meters;
470+ policy->last_position_update = reference_position_update;
471+
472+ com::ubuntu::location::Update<com::ubuntu::location::Position> new_update
473+ {
474+ {
475+ com::ubuntu::location::wgs84::Latitude{10. * com::ubuntu::location::units::Degrees},
476+ com::ubuntu::location::wgs84::Longitude{60. * com::ubuntu::location::units::Degrees},
477+ com::ubuntu::location::wgs84::Altitude{10. * com::ubuntu::location::units::Meters},
478+ },
479+ timestamp + std::chrono::minutes(1)
480+ };
481+ new_update.value.accuracy.horizontal = 8. * com::ubuntu::location::units::Meters;
482+
483+ policy->verify_update(new_update);
484+ ASSERT_TRUE(*new_update.value.accuracy.horizontal > *reference_position_update.value.accuracy.horizontal);
485+
486+ ASSERT_NE(policy->last_position_update.value.latitude, new_update.value.latitude);
487+ ASSERT_EQ(policy->last_position_update.value.latitude, reference_position_update.value.latitude);
488+
489+ ASSERT_NE(policy->last_position_update.value.longitude, new_update.value.longitude);
490+ ASSERT_EQ(policy->last_position_update.value.longitude, reference_position_update.value.longitude);
491+
492+ ASSERT_NE(policy->last_position_update.value.altitude, new_update.value.altitude);
493+ ASSERT_EQ(policy->last_position_update.value.altitude, reference_position_update.value.altitude);
494+}

Subscribers

People subscribed via source and target branches