Merge lp:~thomas-voss/location-service/enable-dual-landing into lp:location-service/trunk

Proposed by Thomas Voß
Status: Superseded
Proposed branch: lp:~thomas-voss/location-service/enable-dual-landing
Merge into: lp:location-service/trunk
Diff against target: 1627 lines (+1233/-56)
33 files modified
CMakeLists.txt (+14/-4)
_clang-format (+56/-0)
astyle-config (+43/-0)
debian/VERSION (+1/-0)
debian/VERSION.vivid (+1/-0)
debian/changelog (+35/-0)
debian/control (+10/-5)
debian/control.in (+122/-0)
debian/gen-debian-files.sh (+111/-0)
debian/get-versions.sh (+68/-0)
debian/libubuntu-location-service-dev.install (+0/-5)
debian/libubuntu-location-service-dev.install.in (+5/-0)
debian/libubuntu-location-service.install.in (+2/-0)
debian/libubuntu-location-service.install.with-gps.in (+3/-0)
debian/libubuntu-location-service2.install (+0/-2)
debian/libubuntu-location-service2.install.with-gps (+0/-3)
debian/rules (+20/-1)
debian/source/format (+1/-1)
doc/Doxyfile.in (+2/-2)
doc/daemon_and_cli.md (+55/-0)
doc/debugging.md (+92/-0)
doc/hacking.md (+146/-0)
doc/intro.md (+67/-0)
doc/manual_testing.md (+174/-0)
doc/tips_n_tricks.md (+21/-0)
src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp (+3/-5)
src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h (+1/-1)
src/location_service/com/ubuntu/location/service/daemon.cpp (+4/-23)
src/location_service/com/ubuntu/location/service/session/skeleton.cpp (+21/-3)
tests/gps_provider_test.cpp (+83/-0)
tests/position_test.cpp (+1/-1)
tools/CMakeLists.txt (+1/-0)
tools/symbol_diff.in (+70/-0)
To merge this branch: bzr merge lp:~thomas-voss/location-service/enable-dual-landing
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+278142@code.launchpad.net

This proposal has been superseded by a proposal from 2015-11-20.

Commit message

Enable dual landing.

Description of the change

Enable dual landing.

To post a comment you must log in.
222. By Thomas Voß

Add missing build-dep on lsb-release.

223. By Thomas Voß

* libubuntu-location-service3: Replaces libubuntu-location-service2,
  config file /etc/gps.conf in both packages.
* Bump major revision and fix LP:#1478750 to account for toolchain update.

224. By Thomas Voß

Fix s/lsp/lsb/ typo.

225. By Thomas Voß

Add build-dependency on lsb-release to debian/control.in.

226. By Thomas Voß

Lower client count to make test more robust.

227. By Thomas Voß

Provide a sensible version fallback.
Add correct version for Replaces/Conflicts stanzas in generated debian/control.

228. By Thomas Voß

* Ensure that event connections are cleaned up on destruction. (LP:
  #1480877)
[ Alberto Mardegan ]
* Send last known position on session start
[ CI Train Bot ]
* New rebuild forced.
[ Thomas Voß ]
* Factor out service::Runtime from daemon.cpp into its own .h/.cpp
  pair of files. Add test cases around correct operation of
  service::Runtime. added:
  src/location_service/com/ubuntu/location/service/runtime.cpp
  src/location_service/com/ubuntu/location/service/runtime.h
  tests/runtime_test.cpp
[ thomas-voss ]
* Factor out service::Runtime from daemon.cpp into its own .h/.cpp
  pair of files. Add test cases around correct operation of
  service::Runtime. added:
  src/location_service/com/ubuntu/location/service/runtime.cpp
  src/location_service/com/ubuntu/location/service/runtime.h
  tests/runtime_test.cpp

Unmerged revisions

228. By Thomas Voß

* Ensure that event connections are cleaned up on destruction. (LP:
  #1480877)
[ Alberto Mardegan ]
* Send last known position on session start
[ CI Train Bot ]
* New rebuild forced.
[ Thomas Voß ]
* Factor out service::Runtime from daemon.cpp into its own .h/.cpp
  pair of files. Add test cases around correct operation of
  service::Runtime. added:
  src/location_service/com/ubuntu/location/service/runtime.cpp
  src/location_service/com/ubuntu/location/service/runtime.h
  tests/runtime_test.cpp
[ thomas-voss ]
* Factor out service::Runtime from daemon.cpp into its own .h/.cpp
  pair of files. Add test cases around correct operation of
  service::Runtime. added:
  src/location_service/com/ubuntu/location/service/runtime.cpp
  src/location_service/com/ubuntu/location/service/runtime.h
  tests/runtime_test.cpp

227. By Thomas Voß

Provide a sensible version fallback.
Add correct version for Replaces/Conflicts stanzas in generated debian/control.

226. By Thomas Voß

Lower client count to make test more robust.

225. By Thomas Voß

Add build-dependency on lsb-release to debian/control.in.

224. By Thomas Voß

Fix s/lsp/lsb/ typo.

223. By Thomas Voß

* libubuntu-location-service3: Replaces libubuntu-location-service2,
  config file /etc/gps.conf in both packages.
* Bump major revision and fix LP:#1478750 to account for toolchain update.

222. By Thomas Voß

Add missing build-dep on lsb-release.

221. By Thomas Voß

Account for versioned include dir.

220. By Thomas Voß

Alter build setup to query major.minor.patch from debian.VERSION* files.

219. By Thomas Voß

Enable dual landing.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-18 23:06:08 +0000
3+++ CMakeLists.txt 2015-11-20 12:59:02 +0000
4@@ -2,10 +2,6 @@
5
6 project(ubuntu-location-service)
7
8-set(UBUNTU_LOCATION_SERVICE_VERSION_MAJOR 2)
9-set(UBUNTU_LOCATION_SERVICE_VERSION_MINOR 0)
10-set(UBUNTU_LOCATION_SERVICE_VERSION_PATCH 0)
11-
12 set(UBUNTU_LOCATION_SERVICE_TRUST_STORE_SERVICE_NAME "UbuntuLocationService")
13
14 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -fPIC")
15@@ -54,6 +50,20 @@
16 SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs")
17 endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
18
19+#
20+# Code style fixer. We rely on clang-format to adjust the formatting of source code.
21+#
22+find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.6 clang-format-3.5)
23+if (NOT CLANG_FORMAT_COMMAND)
24+ message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available")
25+endif()
26+
27+if (CLANG_FORMAT_COMMAND)
28+ file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES ${CMAKE_SOURCE_DIR}/include/*.h)
29+ file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp)
30+ add_custom_target(formatcode ${CLANG_FORMAT_COMMAND} -i ${UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES} ${UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES} SOURCES _clang-format)
31+endif()
32+
33 include_directories(
34 ${Boost_INCLUDE_DIRS}
35 ${DBUS_INCLUDE_DIRS}
36
37=== added file '_clang-format'
38--- _clang-format 1970-01-01 00:00:00 +0000
39+++ _clang-format 2015-11-20 12:59:02 +0000
40@@ -0,0 +1,56 @@
41+---
42+Language: Cpp
43+AccessModifierOffset: -4
44+ConstructorInitializerIndentWidth: 4
45+AlignEscapedNewlinesLeft: false
46+AlignTrailingComments: true
47+AllowAllParametersOfDeclarationOnNextLine: true
48+AllowShortBlocksOnASingleLine: false
49+AllowShortIfStatementsOnASingleLine: false
50+AllowShortLoopsOnASingleLine: false
51+AllowShortFunctionsOnASingleLine: All
52+AlwaysBreakTemplateDeclarations: false
53+AlwaysBreakBeforeMultilineStrings: false
54+BreakBeforeBinaryOperators: false
55+BreakBeforeTernaryOperators: true
56+BreakConstructorInitializersBeforeComma: false
57+BinPackParameters: true
58+ColumnLimit: 0
59+ConstructorInitializerAllOnOneLineOrOnePerLine: false
60+DerivePointerAlignment: false
61+ExperimentalAutoDetectBinPacking: false
62+IndentCaseLabels: false
63+IndentWrappedFunctionNames: false
64+IndentFunctionDeclarationAfterType: false
65+MaxEmptyLinesToKeep: 1
66+KeepEmptyLinesAtTheStartOfBlocks: true
67+NamespaceIndentation: None
68+ObjCSpaceAfterProperty: false
69+ObjCSpaceBeforeProtocolList: true
70+PenaltyBreakBeforeFirstCallParameter: 19
71+PenaltyBreakComment: 300
72+PenaltyBreakString: 1000
73+PenaltyBreakFirstLessLess: 120
74+PenaltyExcessCharacter: 1000000
75+PenaltyReturnTypeOnItsOwnLine: 60
76+PointerAlignment: Left
77+SpacesBeforeTrailingComments: 1
78+Cpp11BracedListStyle: true
79+Standard: Cpp11
80+IndentWidth: 4
81+TabWidth: 8
82+UseTab: Never
83+BreakBeforeBraces: Allman
84+SpacesInParentheses: false
85+SpacesInAngles: false
86+SpaceInEmptyParentheses: false
87+SpacesInCStyleCastParentheses: false
88+SpacesInContainerLiterals: true
89+SpaceBeforeAssignmentOperators: true
90+ContinuationIndentWidth: 4
91+CommentPragmas: '^ IWYU pragma:'
92+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
93+SpaceBeforeParens: ControlStatements
94+DisableFormat: false
95+...
96+
97
98=== added file 'astyle-config'
99--- astyle-config 1970-01-01 00:00:00 +0000
100+++ astyle-config 2015-11-20 12:59:02 +0000
101@@ -0,0 +1,43 @@
102+# Options for formatting code with astyle.
103+#
104+# This helps to make code match the style guide.
105+#
106+# Use like this:
107+#
108+# astyle --options=astyle-config mfile.h myfile.cpp
109+#
110+# Occasionally, astyle does something silly (particularly with lambdas), so it's
111+# still necessary to scan the changes for things that are wrong.
112+# But, for most files, it does a good job.
113+#
114+# Please consider using this before checking code in for review. Code reviews shouldn't
115+# have to deal with layout issues, they are just a distraction. It's better to be able
116+# to focus on semantics in a code review, with style issues out of the way.
117+
118+--formatted
119+--style=allman
120+--min-conditional-indent=2
121+--indent-switches
122+--max-instatement-indent=120
123+--pad-header
124+--align-pointer=type
125+--align-reference=type
126+--convert-tabs
127+--close-templates
128+--max-code-length=120
129+
130+# --pad-oper
131+#
132+# Commented out for now. It changes
133+#
134+# for (int i=0; i<10; ++i)
135+# to
136+# for (int i = 0; i < 10; ++i)
137+#
138+# Unfortunately, it also messes with rvalue references:
139+#
140+# ResourcePtr& operator=(ResourcePtr&& r);
141+#
142+# becomes:
143+#
144+# ResourcePtr& operator=(ResourcePtr && r);
145
146=== added file 'debian/VERSION'
147--- debian/VERSION 1970-01-01 00:00:00 +0000
148+++ debian/VERSION 2015-11-20 12:59:02 +0000
149@@ -0,0 +1,1 @@
150+3.0.0
151\ No newline at end of file
152
153=== added file 'debian/VERSION.vivid'
154--- debian/VERSION.vivid 1970-01-01 00:00:00 +0000
155+++ debian/VERSION.vivid 2015-11-20 12:59:02 +0000
156@@ -0,0 +1,1 @@
157+2.0.0
158
159=== modified file 'debian/changelog'
160--- debian/changelog 2015-07-27 18:07:37 +0000
161+++ debian/changelog 2015-11-20 12:59:02 +0000
162@@ -36,6 +36,41 @@
163
164 -- CI Train Bot <ci-train-bot@canonical.com> Thu, 28 May 2015 11:40:58 +0000
165
166+location-service (2.1+15.04.20151113-0ubuntu1) vivid; urgency=medium
167+
168+ * Adjust default timeout for downloading GPS XTRA data.
169+
170+ -- Thomas Voß <ci-train-bot@canonical.com> Fri, 13 Nov 2015 10:33:56 +0000
171+
172+location-service (2.1+15.04.20151109.2-0ubuntu1) vivid; urgency=medium
173+
174+ [ Alberto Mardegan ]
175+ * Make sure that injected time is given in milliseconds
176+
177+ [ Thomas Voß ]
178+ * Cherry-pick rev. 196 and 199 from lp:location-service. The changes
179+ got accidentally removed by merging the outstanding documentation
180+ branch.
181+ * Handle responses of clients to updates asynchronously. Rely on
182+ dummy::ConnectivityManager as harvesting is disabled anyway. (LP:
183+ #1462664, #1387643)
184+
185+ -- David Barth <david.barth@canonical.com> Mon, 09 Nov 2015 20:48:48 +0000
186+
187+location-service (2.1+15.04.20151022-0ubuntu1) vivid; urgency=medium
188+
189+ [ Thomas Voß ]
190+ * Add documentation for debugging, hacking and debugging the location
191+ service. Pull manual testing instructions over from the wiki. Add
192+ tools for formatting the source.
193+
194+ [ thomas-voss ]
195+ * Add documentation for debugging, hacking and debugging the location
196+ service. Pull manual testing instructions over from the wiki. Add
197+ tools for formatting the source.
198+
199+ -- Thomas Voß <ci-train-bot@canonical.com> Thu, 22 Oct 2015 07:16:50 +0000
200+
201 location-service (2.1+15.04.20150427.1-0ubuntu1) vivid; urgency=medium
202
203 [ CI Train Bot ]
204
205=== modified file 'debian/control'
206--- debian/control 2015-07-15 19:04:43 +0000
207+++ debian/control 2015-11-20 12:59:02 +0000
208@@ -1,3 +1,8 @@
209+# This file is autogenerated. DO NOT EDIT!
210+#
211+# Modifications should be made to control.in instead.
212+# This file is regenerated automatically in the clean target.
213+#
214 Source: location-service
215 Section: utils
216 Priority: optional
217@@ -35,7 +40,7 @@
218 Vcs-Bzr: https://code.launchpad.net/~phablet-team/location-service/trunk
219 Vcs-Browser: http://bazaar.launchpad.net/~phablet-team/location-service/trunk/files
220
221-Package: libubuntu-location-service2
222+Package: libubuntu-location-service3
223 Section: libs
224 Architecture: any
225 Multi-Arch: same
226@@ -52,7 +57,7 @@
227 Architecture: any
228 Multi-Arch: foreign
229 Recommends: ubuntu-location-service-doc,
230-Depends: libubuntu-location-service2 (= ${binary:Version}),
231+Depends: libubuntu-location-service3 (= ${binary:Version}),
232 libdbus-1-dev,
233 libdbus-cpp-dev,
234 libboost-dev,
235@@ -68,7 +73,7 @@
236 Section: debug
237 Architecture: any
238 Multi-Arch: foreign
239-Depends: libubuntu-location-service2 (= ${binary:Version}),
240+Depends: libubuntu-location-service3 (= ${binary:Version}),
241 ${misc:Depends},
242 Description: location service aggregating position/velocity/heading
243 updates and exporting them over dbus.
244@@ -86,7 +91,7 @@
245
246 Package: ubuntu-location-service-bin
247 Architecture: any
248-Depends: libubuntu-location-service2 (= ${binary:Version}),
249+Depends: libubuntu-location-service3 (= ${binary:Version}),
250 ${misc:Depends},
251 ${shlibs:Depends},
252 trust-store-bin,
253@@ -100,7 +105,7 @@
254 Package: ubuntu-location-service-examples
255 Architecture: any
256 Multi-Arch: same
257-Depends: libubuntu-location-service2 (= ${binary:Version}),
258+Depends: libubuntu-location-service3 (= ${binary:Version}),
259 ${misc:Depends},
260 ${shlibs:Depends},
261 ubuntu-location-service-doc,
262
263=== added file 'debian/control.in'
264--- debian/control.in 1970-01-01 00:00:00 +0000
265+++ debian/control.in 2015-11-20 12:59:02 +0000
266@@ -0,0 +1,122 @@
267+Source: location-service
268+Section: utils
269+Priority: optional
270+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
271+XSBC-Original-Maintainer: Thomas Voß <thomas.voss@canonical.com>
272+Build-Depends: cmake,
273+ curl,
274+ libdbus-cpp-dev (>= 4.1.0),
275+ debhelper (>= 9),
276+ doxygen,
277+ geoclue-ubuntu-geoip,
278+ google-mock (>= 1.6.0+svn437),
279+ graphviz,
280+ libapparmor-dev,
281+ libboost-filesystem-dev,
282+ libboost-program-options-dev,
283+ libboost-system-dev,
284+ libdbus-1-dev,
285+ libdbus-cpp-dev,
286+ libgoogle-glog-dev,
287+ libgtest-dev,
288+ libiw-dev,
289+ libjson-c-dev,
290+ libnet-cpp-dev,
291+ libprocess-cpp-dev,
292+ libtrust-store-dev,
293+ libubuntu-platform-hardware-api-headers [!arm64 !ppc64el !powerpc],
294+ libubuntu-platform-hardware-api-dev [!arm64 !ppc64el !powerpc],
295+ libproperties-cpp-dev,
296+ trust-store-bin,
297+Standards-Version: 3.9.4
298+Homepage: http://launchpad.net/location-service
299+# If you aren't a member of ~phablet-team but need to upload packaging changes,
300+# just go ahead. ~phablet-team will notice and sync up the code again.
301+Vcs-Bzr: https://code.launchpad.net/~phablet-team/location-service/trunk
302+Vcs-Browser: http://bazaar.launchpad.net/~phablet-team/location-service/trunk/files
303+
304+Package: libubuntu-location-service@UBUNTU_LOCATION_SERVICE_SOVERSION@
305+Section: libs
306+Architecture: any
307+Multi-Arch: same
308+Pre-Depends: ${misc:Pre-Depends}
309+Depends: ${misc:Depends},
310+ ${shlibs:Depends},
311+Description: location service aggregating position/velocity/heading
312+ updates and exporting them over dbus.
313+ .
314+ Contains the shared library needed by client applications.
315+
316+Package: libubuntu-location-service-dev
317+Section: libdevel
318+Architecture: any
319+Multi-Arch: foreign
320+Recommends: ubuntu-location-service-doc,
321+Depends: libubuntu-location-service@UBUNTU_LOCATION_SERVICE_SOVERSION@ (= ${binary:Version}),
322+ libdbus-1-dev,
323+ libdbus-cpp-dev,
324+ libboost-dev,
325+ ${misc:Depends},
326+Suggests: ubuntu-location-service-doc,
327+Description: location service aggregating position/velocity/heading
328+ updates and exporting them over dbus.
329+ .
330+ Contains header files required to develop clients talking to the ubuntu
331+ location service.
332+
333+Package: libubuntu-location-service-dbg
334+Section: debug
335+Architecture: any
336+Multi-Arch: foreign
337+Depends: libubuntu-location-service@UBUNTU_LOCATION_SERVICE_SOVERSION@ (= ${binary:Version}),
338+ ${misc:Depends},
339+Description: location service aggregating position/velocity/heading
340+ updates and exporting them over dbus.
341+ .
342+ Contains debug symbols.
343+
344+Package: ubuntu-location-service-tests
345+Architecture: any
346+Depends: ${misc:Depends},
347+ ${shlibs:Depends},
348+Description: location service aggregating position/velocity/heading
349+ updates and exporting them over dbus.
350+ .
351+ Contains all test executables
352+
353+Package: ubuntu-location-service-bin
354+Architecture: any
355+Depends: libubuntu-location-service@UBUNTU_LOCATION_SERVICE_SOVERSION@ (= ${binary:Version}),
356+ ${misc:Depends},
357+ ${shlibs:Depends},
358+ trust-store-bin,
359+Breaks: ubuntu-location-service-examples (<< 0.0.2),
360+Replaces: ubuntu-location-service-examples (<< 0.0.2),
361+Description: location service aggregating position/velocity/heading
362+ updates and exporting them over dbus.
363+ .
364+ Contains the service executable and man pages.
365+
366+Package: ubuntu-location-service-examples
367+Architecture: any
368+Multi-Arch: same
369+Depends: libubuntu-location-service@UBUNTU_LOCATION_SERVICE_SOVERSION@ (= ${binary:Version}),
370+ ${misc:Depends},
371+ ${shlibs:Depends},
372+ ubuntu-location-service-doc,
373+Description: location service aggregating position/velocity/heading
374+ updates and exporting them over dbus.
375+ .
376+ Contains example service and client.
377+
378+Package: ubuntu-location-service-doc
379+Section: doc
380+Architecture: all
381+Multi-Arch: foreign
382+Depends: ${misc:Depends},
383+ ${shlibs:Depends},
384+Recommends: ubuntu-location-service-examples,
385+Description: location service aggregating position/velocity/heading
386+ updates and exporting them over dbus.
387+ .
388+ Contains documentation for service and client.
389
390=== added file 'debian/gen-debian-files.sh'
391--- debian/gen-debian-files.sh 1970-01-01 00:00:00 +0000
392+++ debian/gen-debian-files.sh 2015-11-20 12:59:02 +0000
393@@ -0,0 +1,111 @@
394+#!/bin/sh
395+
396+# Copyright (C) 2015 Canonical Ltd
397+#
398+# This program is free software: you can redistribute it and/or modify
399+# it under the terms of the GNU Lesser General Public License version 3 as
400+# published by the Free Software Foundation.
401+#
402+# This program is distributed in the hope that it will be useful,
403+# but WITHOUT ANY WARRANTY; without even the implied warranty of
404+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
405+# GNU Lesser General Public License for more details.
406+#
407+# You should have received a copy of the GNU Lesser General Public License
408+# along with this program. If not, see <http://www.gnu.org/licenses/>.
409+#
410+# Authored by: Michi Henning <michi.henning@canonical.com>
411+# Thomas Voß <thomas.voss@canonical.com>
412+
413+#
414+# Script to generate debian files for dual landing in Vivid (gcc 4.9 ABI)
415+# and Wily and later (gcc 5 ABI).
416+#
417+# This script is called from debian/rules and generates:
418+#
419+# - control
420+# - libubuntu-location-service${soversion}.install.${target_arch}
421+#
422+# For all but control, this is a straight substition and/or renaming exercise for each file.
423+# For control, if building on Wily or later, we also fix the "Replaces:" and "Conflicts:"
424+# entries, so we don't end up with two packages claiming ownership of the same places
425+# in the file system.
426+#
427+# Because the debian files for the different distributions are generated on the fly,
428+# this allows us to keep a single source tree for both distributions. See ../HACKING
429+# for more explanations.
430+#
431+
432+set -e # Fail if any command fails.
433+
434+progname=$(basename $0)
435+
436+[ $# -ne 1 ] && {
437+ echo "usage: $progname path-to-debian-dir" >&2
438+ exit 1
439+}
440+dir=$1
441+version_dir=$(mktemp -d)
442+
443+# Dump version numbers into files and initialize vars from those files.
444+
445+sh ${dir}/get-versions.sh ${dir} ${version_dir}
446+
447+full_version=$(cat "${version_dir}"/libubuntu-location-service.full-version)
448+major_minor=$(cat "${version_dir}"/libubuntu-location-service.major-minor-version)
449+soversion=$(cat "${version_dir}"/libubuntu-location-service.soversion)
450+vivid_soversion=$(cat "${version_dir}"/libubuntu-location-service.vivid-soversion)
451+
452+warning=$(mktemp -t gen-debian-files-msg.XXX)
453+
454+trap "rm -fr $warning $version_dir" 0 INT TERM QUIT
455+
456+warning_msg()
457+{
458+ cat >$warning <<EOF
459+# This file is autogenerated. DO NOT EDIT!
460+#
461+# Modifications should be made to $(basename "$1") instead.
462+# This file is regenerated automatically in the clean target.
463+#
464+EOF
465+}
466+
467+# Generate debian/control from debian/control.in, substituting the soversion for both libs.
468+# For wily onwards, we also add an entry for the vivid versions to "Conflicts:" and "Replaces:".
469+
470+infile="${dir}"/control.in
471+outfile="${dir}"/control
472+warning_msg $infile
473+cat $warning $infile \
474+ | sed -e "s/@UBUNTU_LOCATION_SERVICE_SOVERSION@/${soversion}/" > "$outfile"
475+
476+[ "$distro" != "vivid" ] && {
477+ sed -i -e "/Replaces: libubuntu-location-service0,/a\
478+\ libubuntu-location-service${vivid_soversion}," \
479+ "$outfile"
480+}
481+
482+# Generate the install files, naming them according to the soversion.
483+
484+# Install file for binary package
485+infile="${dir}"/libubuntu-location-service.install.in
486+outfile="${dir}"/libubuntu-location-service${soversion}.install
487+warning_msg "$infile"
488+cat $warning "$infile" >"$outfile"
489+
490+infile="${dir}"/libubuntu-location-service.install.with-gps.in
491+outfile="${dir}"/libubuntu-location-service${soversion}.install.with-gps
492+warning_msg "$infile"
493+cat $warning "$infile" >"$outfile"
494+
495+infile="${dir}"/libubuntu-location-service-dev.install.in
496+outfile="${dir}"/libubuntu-location-service-dev.install
497+warning_msg "$infile"
498+cat $warning $infile | sed -e "s/@UBUNTU_LOCATION_SERVICE_SOVERSION@/${soversion}/" > "$outfile"
499+
500+ln -s "${dir}"/libubuntu-location-service${soversion}.install.with-gps "${dir}"/libubuntu-location-service${soversion}.install.amd64
501+ln -s "${dir}"/libubuntu-location-service${soversion}.install.with-gps "${dir}"/libubuntu-location-service${soversion}.install.armhf
502+ln -s "${dir}"/libubuntu-location-service${soversion}.install.with-gps "${dir}"/libubuntu-location-service${soversion}.install.i386
503+
504+exit 0
505
506=== added file 'debian/get-versions.sh'
507--- debian/get-versions.sh 1970-01-01 00:00:00 +0000
508+++ debian/get-versions.sh 2015-11-20 12:59:02 +0000
509@@ -0,0 +1,68 @@
510+#!/bin/sh
511+
512+# Copyright (C) 2015 Canonical Ltd
513+#
514+# This program is free software: you can redistribute it and/or modify
515+# it under the terms of the GNU Lesser General Public License version 3 as
516+# published by the Free Software Foundation.
517+#
518+# This program is distributed in the hope that it will be useful,
519+# but WITHOUT ANY WARRANTY; without even the implied warranty of
520+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
521+# GNU Lesser General Public License for more details.
522+#
523+# You should have received a copy of the GNU Lesser General Public License
524+# along with this program. If not, see <http://www.gnu.org/licenses/>.
525+#
526+# Authored by: Michi Henning <michi.henning@canonical.com>
527+
528+#
529+# Script to read the version numbers from VERSION and QT-VERSION
530+# and write the version components and the soversion numbers
531+# into separate files, so we can pick them up from both
532+# gen-debian-files.sh and CMakeLists.txt.
533+#
534+
535+set -e # Fail if any command fails.
536+
537+progname=$(basename $0)
538+
539+[ $# -lt 1 -o $# -gt 2 ] && {
540+ echo "usage: $progname path-to-debian-dir [output-dir]" >&2
541+ exit 1
542+}
543+dir=$1
544+output_dir=`pwd`
545+[ $# -eq 2 ] && output_dir=$2
546+
547+# Write the various version numbers into a bunch of files. This allows
548+# us to easily pick them up from both gen-debian-files.sh and CMakeLists.txt.
549+
550+distro=$(lsb_release -c -s)
551+
552+full_version=$(cat "${dir}"/VERSION)
553+
554+major=$(echo $full_version | cut -d'.' -f1)
555+minor=$(echo $full_version | cut -d'.' -f2)
556+micro=$(echo $full_version | cut -d'.' -f3)
557+major_minor="${major}.${minor}"
558+
559+vivid_full_version=$(cat "${dir}"/VERSION.vivid)
560+vivid_major=$(echo $vivid_full_version | cut -d'.' -f1)
561+vivid_soversion=$vivid_major
562+
563+if [ "$distro" = "vivid" ]
564+then
565+ soversion=${vivid_soversion}
566+else
567+ soversion="${major}"
568+fi
569+[ -n $soversion ]
570+
571+echo ${full_version} >${output_dir}/libubuntu-location-service.full-version
572+echo ${major} >${output_dir}/libubuntu-location-service.major-version
573+echo ${minor} >${output_dir}/libubuntu-location-service.minor-version
574+echo ${micro} >${output_dir}/libubuntu-location-service.micro-version
575+echo ${major_minor} >${output_dir}/libubuntu-location-service.major-minor-version
576+echo ${soversion} >${output_dir}/libubuntu-location-service.soversion
577+echo ${vivid_soversion} >${output_dir}/libubuntu-location-service.vivid-soversion
578
579=== removed file 'debian/libubuntu-location-service-dev.install'
580--- debian/libubuntu-location-service-dev.install 2014-07-18 14:42:10 +0000
581+++ debian/libubuntu-location-service-dev.install 1970-01-01 00:00:00 +0000
582@@ -1,5 +0,0 @@
583-usr/include/ubuntu-location-service-2
584-usr/lib/*/libubuntu-location-service.so
585-usr/lib/*/libubuntu-location-service-connectivity.so
586-usr/lib/*/pkgconfig/ubuntu-location-service.pc
587-usr/lib/*/pkgconfig/ubuntu-location-service-connectivity.pc
588
589=== added file 'debian/libubuntu-location-service-dev.install.in'
590--- debian/libubuntu-location-service-dev.install.in 1970-01-01 00:00:00 +0000
591+++ debian/libubuntu-location-service-dev.install.in 2015-11-20 12:59:02 +0000
592@@ -0,0 +1,5 @@
593+usr/include/ubuntu-location-service-@UBUNTU_LOCATION_SERVICE_SOVERSION@
594+usr/lib/*/libubuntu-location-service.so
595+usr/lib/*/libubuntu-location-service-connectivity.so
596+usr/lib/*/pkgconfig/ubuntu-location-service.pc
597+usr/lib/*/pkgconfig/ubuntu-location-service-connectivity.pc
598
599=== added file 'debian/libubuntu-location-service.install.in'
600--- debian/libubuntu-location-service.install.in 1970-01-01 00:00:00 +0000
601+++ debian/libubuntu-location-service.install.in 2015-11-20 12:59:02 +0000
602@@ -0,0 +1,2 @@
603+usr/lib/*/libubuntu-location-service.so.*
604+usr/lib/*/libubuntu-location-service-connectivity.so.*
605
606=== added file 'debian/libubuntu-location-service.install.with-gps.in'
607--- debian/libubuntu-location-service.install.with-gps.in 1970-01-01 00:00:00 +0000
608+++ debian/libubuntu-location-service.install.with-gps.in 2015-11-20 12:59:02 +0000
609@@ -0,0 +1,3 @@
610+usr/lib/*/libubuntu-location-service.so.*
611+usr/lib/*/libubuntu-location-service-connectivity.so.*
612+/etc/gps.conf
613
614=== removed file 'debian/libubuntu-location-service2.install'
615--- debian/libubuntu-location-service2.install 2014-07-30 13:55:44 +0000
616+++ debian/libubuntu-location-service2.install 1970-01-01 00:00:00 +0000
617@@ -1,2 +0,0 @@
618-usr/lib/*/libubuntu-location-service.so.*
619-usr/lib/*/libubuntu-location-service-connectivity.so.*
620
621=== removed symlink 'debian/libubuntu-location-service2.install.amd64'
622=== target was u'libubuntu-location-service2.install.with-gps'
623=== removed symlink 'debian/libubuntu-location-service2.install.armhf'
624=== target was u'libubuntu-location-service2.install.with-gps'
625=== removed symlink 'debian/libubuntu-location-service2.install.i386'
626=== target was u'libubuntu-location-service2.install.with-gps'
627=== removed file 'debian/libubuntu-location-service2.install.with-gps'
628--- debian/libubuntu-location-service2.install.with-gps 2014-07-30 13:55:44 +0000
629+++ debian/libubuntu-location-service2.install.with-gps 1970-01-01 00:00:00 +0000
630@@ -1,3 +0,0 @@
631-usr/lib/*/libubuntu-location-service.so.*
632-usr/lib/*/libubuntu-location-service-connectivity.so.*
633-/etc/gps.conf
634
635=== modified file 'debian/rules'
636--- debian/rules 2015-07-15 19:04:43 +0000
637+++ debian/rules 2015-11-20 12:59:02 +0000
638@@ -15,6 +15,18 @@
639
640 include /usr/share/dpkg/default.mk
641
642+distro=$(shell lsb_release -c -s)
643+
644+ifeq ($(distro),vivid)
645+ full_version=$(shell cat $(CURDIR)/debian/VERSION.vivid)
646+else
647+ full_version=$(shell cat $(CURDIR)/debian/VERSION)
648+endif
649+
650+major=$(shell echo $(full_version) | cut -d'.' -f1)
651+minor=$(shell echo $(full_version) | cut -d'.' -f2)
652+patch=$(shell echo $(full_version) | cut -d'.' -f3)
653+
654 ifneq (,$(filter $(DEB_HOST_ARCH),ppc64el powerpc arm64))
655 LOCATION_SERVICE_ENABLE_GPS_PROVIDER = OFF
656 else
657@@ -31,4 +43,11 @@
658 dh_strip --dbg-package=libubuntu-location-service-dbg
659
660 override_dh_auto_configure:
661- dh_auto_configure -- -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/ubuntu-location-service -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DLOCATION_SERVICE_ENABLE_GPS_PROVIDER=$(LOCATION_SERVICE_ENABLE_GPS_PROVIDER)
662+ dh_auto_configure -- -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/ubuntu-location-service -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DLOCATION_SERVICE_ENABLE_GPS_PROVIDER=$(LOCATION_SERVICE_ENABLE_GPS_PROVIDER) -DUBUNTU_LOCATION_SERVICE_VERSION_MAJOR=$(major) -DUBUNTU_LOCATION_SERVICE_VERSION_MINOR=$(minor) -DUBUNTU_LOCATION_SERVICE_VERSION_PATCH=$(patch)
663+
664+override_dh_auto_clean:
665+ rm -f $(CURDIR)/debian/libubuntu-location-service$(major).install.amd64
666+ rm -f $(CURDIR)/debian/libubuntu-location-service$(major).install.armhf
667+ rm -f $(CURDIR)/debian/libubuntu-location-service$(major).install.i386
668+ /bin/sh $(CURDIR)/debian/gen-debian-files.sh $(CURDIR)/debian
669+ dh_auto_clean
670
671=== modified file 'debian/source/format'
672--- debian/source/format 2014-07-30 14:15:06 +0000
673+++ debian/source/format 2015-11-20 12:59:02 +0000
674@@ -1,1 +1,1 @@
675-3.0 (quilt)
676+3.0 (native)
677
678=== modified file 'doc/Doxyfile.in'
679--- doc/Doxyfile.in 2014-05-19 09:55:25 +0000
680+++ doc/Doxyfile.in 2015-11-20 12:59:02 +0000
681@@ -748,7 +748,7 @@
682 # directories that contain image that are included in the documentation (see
683 # the \image command).
684
685-IMAGE_PATH =
686+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
687
688 # The INPUT_FILTER tag can be used to specify a program that doxygen should
689 # invoke to filter for each input file. Doxygen will invoke the filter program
690@@ -1463,7 +1463,7 @@
691 # generate an XML file that captures the structure of
692 # the code including all documentation.
693
694-GENERATE_XML = NO
695+GENERATE_XML = YES
696
697 # The XML_OUTPUT tag is used to specify where the XML pages will be put.
698 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
699
700=== added file 'doc/daemon_and_cli.md'
701--- doc/daemon_and_cli.md 1970-01-01 00:00:00 +0000
702+++ doc/daemon_and_cli.md 2015-11-20 12:59:02 +0000
703@@ -0,0 +1,55 @@
704+# Service Daemon and CLI
705+
706+The location service offers a daemon executable and a corresponding
707+command-line interface for interacting with it. The daemon does not
708+necessarily require root privileges, but might so depending on your
709+configuration.
710+
711+Run the following command to receive an overview of the arguments to
712+the daemon:
713+
714+ ubuntu-location-serviced --help
715+
716+An example invocation of the daemon, configuring a GPS provider that
717+relies on the Android HAL to talk to the chipset, exposing the service
718+on the system DBus instance:
719+
720+ ubuntu-location-serviced --bus system --provider gps::Provider
721+
722+The cli allows for querying properties of a running service instance, e.g.:
723+
724+ ubuntu-location-serviced-cli --bus system --get --property is_online
725+
726+## Configuring an Out-Of-Process Provider
727+
728+If you want to run a provider out of process, the daemon executable
729+allows you to do so by instantiating a so-called remote provider. The
730+following invocation of the service tries to connect to the provider
731+instance described by the given unique DBus name and path.
732+
733+ ubuntu-location-serviced \
734+ --bus system \
735+ --provider remote::Provider \
736+ --remote::Provider::bus=system \
737+ --remote::Provider::name=com.ubuntu.location.provider.Gps \
738+ --remote::Provider::path=/
739+
740+Please note that the service allows for decorating provider names to
741+uniquely identify per provider configuration options and to allow for
742+loading more than one provider of a certain kind. The following
743+configuration configures two remote providers, one relying on GPS
744+(decorated with @gps) and another one relying on network-based
745+positioning (decorated with @network):
746+
747+ ubuntu-location-serviced \
748+ --bus system \
749+ --provider remote::Provider@gps \
750+ --remote::Provider@gps::bus=system \
751+ --remote::Provider@gps::name=com.ubuntu.location.provider.Gps \
752+ --remote::Provider@gps::path=/ \
753+ --provider remote::Provider@network \
754+ --remote::Provider@network::bus=system \
755+ --remote::Provider@network::name=com.ubuntu.location.provider.Network \
756+ --remote::Provider@network::path=/
757+
758+
759
760=== added file 'doc/debugging.md'
761--- doc/debugging.md 1970-01-01 00:00:00 +0000
762+++ doc/debugging.md 2015-11-20 12:59:02 +0000
763@@ -0,0 +1,92 @@
764+# Debugging
765+
766+Location not working? Here's how to debug.
767+
768+## Layers
769+
770+Test in OSMTouch (QML app using Qt API) before testing in webapps or
771+webbrowser app. Different results? File a bug where it doesn't
772+work. Same result of no location? Next step.
773+
774+## Check that stack works with dummy provider
775+
776+Edit /etc/init/ubuntu-location-provider.override to start
777+location-serviced with just the dummy provider; this should
778+work. Doesn't work? File a bug against location-service. Works? Reset
779+config to defaults and try the next thing.
780+
781+## Hardware GPS breaking all of location-service
782+
783+GPS provider is built-in into location-service and might break all of
784+it if it goes south (working on splitting it out); try enabling only
785+the HERE provider on the location-serviced command-line and see if
786+that works. Works? File a bug against location-service. Doesn't work?
787+Move on.
788+
789+## HERE test
790+
791+To test whether the low-level HERE stack gets a location, put
792+http://people.canonical.com/~lool/espoo-cli on your phone (will be
793+included along HERE bits in the future) and run with:
794+
795+ chmod a+x espoo-cli
796+ GLOG_logtostderr=1 GLOG_v=100 LD_LIBRARY_PATH=/custom/vendor/here/location-provider/lib/arm-linux-gnueabihf ./espoo-cli 5
797+
798+NB: 5 is the number of location updates after which the tool exits;
799+updates should come in at approx 15s interval. Output looks like:
800+
801+ I1101 21:30:01.285964 4403 cli.cpp:117] Requested number of updates is 2
802+ I1101 21:30:01.299002 4403 cli.cpp:133] Starting location updates
803+ I1101 21:30:01.301888 4403 cli.cpp:141] Starting GLib main loop
804+ I1101 21:30:11.304612 4403 cli.cpp:158] Location: tstamp=1414891811 lat=xyz long=foo hor. acc.=2569 alt=nan vert. acc.=nan tech=cell
805+ I1101 21:30:11.306061 4403 cli.cpp:170] Remaining updates: 1
806+ I1101 21:30:26.736821 4403 cli.cpp:158] Location: tstamp=1414891826 lat=xyz long=foo hor. acc.=2824 alt=nan vert. acc.=nan tech=cell
807+ I1101 21:30:26.738348 4403 cli.cpp:148] Stopping location updates
808+
809+Low-level HERE stack works but location-serviced with just HERE
810+provider doesn't work? File a bug against espoo projet (HERE) and/or
811+location-service. Low-level HERE stack doesn't work? Move on
812+
813+## location-service and espoo-service debug
814+
815+Collect some debug data by editing /etc/init/ubuntu-espoo-service.conf
816+and /etc/init/ubuntu-location-service.override and changing the start
817+sequence to add some env vars:
818+
819+ export GLOG_v=200
820+ export GLOG_logtostderr=1
821+
822+before the exec. Reboot, and start some app. You should have some log
823+files under /var/log/upstart/ubuntu-espoo-service.log and
824+/var/log/upstart/ubuntu-location-service.log to attach to a bug
825+report; e.g. a working espoo log looks like this:
826+
827+ WARNING: Logging before InitGoogleLogging() is written to STDERR
828+ I1105 16:30:10.221474 1620 provider.cpp:568] StartPositionUpdates
829+ I1105 16:30:10.224901 1620 provider.cpp:122] Successfully started position updates.
830+ I1105 16:30:10.228739 1620 provider.cpp:596] StartVelocityUpdates
831+ I1105 16:30:13.046851 1621 provider.cpp:83] Received location: Position(lat: Coordinate(12.34 deg), lon: Coordinate(12.34 deg), alt: Coordinate(nan m), hor.acc.: 1430 m, ver.acc.: nan m)
832+
833+No position there? check connectivity API works by running:
834+
835+ cd /tmp
836+ wget http://people.ubuntu.com/~lool/connectivity
837+ GLOG_v=200 GLOG_logtostderr=1 ./connectivity
838+
839+you should see something like:
840+
841+ I1105 16:47:26.431466 11140 cached_radio_cell.cpp:160] (mcc: 123, mnc: 2, lac: 1234, id: 123456, asu: 1)
842+ I1105 16:47:26.533818 11140 connectivity.cpp:47] Is wifi enabled: true
843+ I1105 16:47:26.533963 11140 connectivity.cpp:48] Is wifi hw enabled: true
844+ I1105 16:47:26.534010 11140 connectivity.cpp:49] Is wwan enabled: true
845+ I1105 16:47:26.534050 11140 connectivity.cpp:50] Is wwan hw enabled: true
846+ I1105 16:47:26.534442 11140 connectivity.cpp:122] umts(mcc: 123, mnc: 2, lac: 1234, id: 123456, asu: 1)
847+ I1105 16:47:26.534633 11140 connectivity.cpp:155] (bssid: 12:12:12:12:12:12, ssid: xyz, last seen: 1415224046, mode: Mode::infrastructure, frequency: 2442, strength: 63)
848+ I1105 16:47:26.534828 11140 connectivity.cpp:155] (bssid: 12:12:12:12:12:12, ssid: boing, last seen: 1415224046, mode: Mode::infrastructure, frequency: 2467, strength: 57)
849+
850+Also, please attach output of /usr/share/ofono/scripts/list-modems > list-modems-output.txt
851+Please note that the command might take ~1 minute to complete.
852+
853+TODO: document dbus-monitor / d-feet capturing of client / system traffic with snooping config.
854+
855+
856
857=== added file 'doc/hacking.md'
858--- doc/hacking.md 1970-01-01 00:00:00 +0000
859+++ doc/hacking.md 2015-11-20 12:59:02 +0000
860@@ -0,0 +1,146 @@
861+# Hacking
862+
863+
864+## Building the code
865+
866+By default, the code is built in release mode. To build a debug version, use
867+
868+ $ mkdir builddebug
869+ $ cd builddebug
870+ $ cmake -DCMAKE_BUILD_TYPE=debug ..
871+ $ make
872+
873+For a release version, use -DCMAKE_BUILD_TYPE=release
874+
875+## Running the tests
876+
877+ $ make
878+ $ make test
879+
880+Note that "make test" alone is dangerous because it does not rebuild
881+any tests if either the library or the test files themselves need
882+rebuilding. It's not possible to fix this with cmake because cmake cannot
883+add build dependencies to built-in targets. To make sure that everything
884+is up-to-date, run "make" before running "make test"!
885+
886+## Coverage
887+
888+To build with the flags for coverage testing enabled and get coverage:
889+
890+ $ mkdir buildcoverage
891+ $ cd buildcoverage
892+ $ cmake -DCMAKE_BUILD_TYPE=coverage
893+ $ make
894+ $ make test
895+ $ make coverage
896+
897+Unfortunately, it is not possible to get 100% coverage for some files,
898+mainly due to gcc's generation of two destructors for dynamic and non-
899+dynamic instances. For abstract base classes and for classes that
900+prevent stack and static allocation, this causes one of the destructors
901+to be reported as uncovered.
902+
903+There are also issues with some functions in header files that are
904+incorrectly reported as uncovered due to inlining, as well as
905+the impossibility of covering defensive assert(false) statements,
906+such as an assert in the default branch of a switch, where the
907+switch is meant to handle all possible cases explicitly.
908+
909+If you run a binary and get lots of warnings about a "merge mismatch for summaries",
910+this is caused by having made changes to the source that add or remove code
911+that was previously run, so the new coverage output cannot sensibly be merged
912+into the old coverage output. You can get rid of this problem by running
913+
914+ $ make clean-coverage
915+
916+This deletes all the .gcda files, allowing the merge to (sometimes) succeed again.
917+If this doesn't work either, the only remedy is to do a clean build.
918+
919+If lcov complains about unrecognized lines involving '=====',
920+you can patch geninfo and gcovr as explained here:
921+
922+https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2
923+
924+## Code style
925+
926+We use a format tool that fixes a whole lot of issues
927+regarding code style. The formatting changes made by
928+the tool are generally sensible (even though they may not be your
929+personal preference in all cases). If there is a case where the formatting
930+really messes things up, consider re-arranging the code to avoid the problem.
931+The convenience of running the entire code base through the pretty-printer
932+far outweighs any minor glitches with pretty printing, and it means that
933+we get consistent code style for free, rather than endlessly having to
934+watch out for formatting issues during code reviews.
935+
936+As of clang-format-3.7, you can use
937+
938+ // clang-format off
939+ void unformatted_code ;
940+ // clang-format on
941+
942+to suppress formatting for a section of code.
943+
944+To format specific files:
945+
946+ ${CMAKE_BINARY_DIR}/tools/formatcode x.cpp x.h
947+
948+If no arguments are provided, formatcode reads stdin and writes
949+stdout, so you can easily pipe code into the tool from within an
950+editor. For example, to reformat the entire file in vi (assuming
951+${CMAKE_BINARY_DIR}/tools is in your PATH):
952+
953+ 1G!Gformatcode
954+
955+To re-format all source and header files in the tree:
956+
957+ $ make formatcode
958+
959+## Thread and address sanitizer
960+
961+Set SANITIZER to "thread" or "address" to build with the
962+corresponding sanitizer enabled.
963+
964+## Updating symbols file
965+
966+To easily spot new/removed/changed symbols in the library, the debian
967+package maintains a .symbols file that lists all exported symbols
968+present in the library .so. If you add new public symbols to the library,
969+it's necessary to refresh the symbols file, otherwise the package will
970+fail to build. The easiest way to do that is using bzr-builddeb:
971+
972+ $ bzr bd -- -us -uc -j8 # Don't sign source package or changes file, 8 compiles in parallel
973+ $ # this will exit with an error if symbols file isn't up-to-date
974+ $ cd ../build-area/location-service-[version]
975+ $ ./obj-[arch]/tools/symbol_diff
976+
977+This creates a diff of the symbols in /tmp/symbols.diff.
978+(The demangled symbols from the debian build are in ./new_symbols.)
979+
980+Review any changes in /tmp/symbols.diff. If they are OK:
981+
982+ $ cd -
983+ $ patch -p0 < /tmp/symbols.diff
984+
985+## ABI compliance test
986+
987+To use this, install abi-compliance-checker package from the archives.
988+
989+You can use abi-compliance-checker to test whether a particular build
990+is ABI compatible with another build. The tool does some source-level
991+analysis in addition to checking library symbols, so it catches things
992+that are potentially dangerous, but won't be picked up by just looking
993+at the symbol table.
994+
995+Assume you have built devel in src/devel, and you have a later build
996+in src/mybranch and want to check that mybranch is still compatible.
997+To run the compliance test:
998+
999+ $ cd src
1000+ $ abi-compliance-checker -lib libunity-scopes.so -old devel/build/test/abi-compliance/abi.xml -new mybranch/build/test/abi-compliance/abi.xml
1001+
1002+The script will take about two minutes to run. Now point your browser at
1003+
1004+ src/compat_reports/libunity-scopes.so/[version]_to_[version]/compat_report.html
1005+
1006+The report provides a nicely layed-out page with all the details.
1007
1008=== added directory 'doc/images'
1009=== added file 'doc/images/LocationServiceHighLevel.png'
1010Binary files doc/images/LocationServiceHighLevel.png 1970-01-01 00:00:00 +0000 and doc/images/LocationServiceHighLevel.png 2015-11-20 12:59:02 +0000 differ
1011=== added file 'doc/intro.md'
1012--- doc/intro.md 1970-01-01 00:00:00 +0000
1013+++ doc/intro.md 2015-11-20 12:59:02 +0000
1014@@ -0,0 +1,67 @@
1015+# Introduction {#mainpage}
1016+
1017+Ubuntu's location service is a central hub for multiplexing access to
1018+positioning subsystems available via hard- and software. It provides a
1019+client API offering positioning capabilities to applications and other
1020+system components, abstracting away the details of individual
1021+positioning solutions.
1022+
1023+## Vocabulary
1024+
1025+To make the remainder of this documentation as easily understandable
1026+as possible, we start over with introducing some vocabulary:
1027+
1028+- Engine:
1029+ Responsible for handling input from multiple positioning
1030+ subsystems and maintaining the state of the overall system. Think
1031+ about it like the heart of the system.
1032+
1033+- Provider:
1034+ A positioning subsystem that feeds into the positioning
1035+ engine. Common examples are a GPS provider or a network-based
1036+ positioning provider.
1037+
1038+- Service:
1039+ The point of entry for applications and services that would
1040+ like to receive position data.
1041+
1042+- Session:
1043+ In order to receive position information, every application
1044+ or service has to create a session with the location Service.
1045+
1046+- Update: An update is a timestamped entity to a certain type of data.
1047+
1048+- [WGS84, http://en.wikipedia.org/wiki/World_Geodetic_System]: The coordinate system that is used throughout the entire location subsystem.
1049+
1050+## Architectural Overview
1051+
1052+The high-level architecture of the service is shown in the following diagram:
1053+
1054+![High-level architectural overview](images/LocationServiceHighLevel.png)
1055+
1056+In this diagram, the configuration of the engine refers to:
1057+
1058+ * The current state of any satellite-based positioning subsystems. Can either be off or on.
1059+ * The current state of reporting facilities responsible for harvesting wifi and cell id measurements together with location information and sending them off to remote services. Can either be off or on.
1060+ * The overall state of the engine. Can either be off, on or active.
1061+
1062+The Service takes this configuration and exposes it to client
1063+applications. In addition, mainly for debugging purposes, the set of
1064+currently visible satellites (if any) is maintained and exposed to
1065+privileged client applications.
1066+
1067+## Privacy & Access Control
1068+
1069+Location information is highly privacy relevant. For this reason, the
1070+location service is deeply integrated with AppArmor and Ubuntu's
1071+overall trust infrastructure. Every incoming session request is
1072+validated and if in doubt, the user is asked to explicitly grant trust
1073+to the application requesting access to positioning
1074+information. Please see [@ref com::ubuntu::location::service::PermissionManager]
1075+for further details.
1076+
1077+In addition, the location service allows for selectively adjusting the
1078+accuracy and reporting setup of the location Engine to provide further
1079+fine-grained control over the exposed data to user. Within this setup,
1080+a user is able to entirely disable all positioning.
1081+
1082
1083=== added file 'doc/manual_testing.md'
1084--- doc/manual_testing.md 1970-01-01 00:00:00 +0000
1085+++ doc/manual_testing.md 2015-11-20 12:59:02 +0000
1086@@ -0,0 +1,174 @@
1087+# Manual Testplan
1088+
1089+[TOC]
1090+
1091+While the automatic test suite of the location service is
1092+comprehensive and covers large parts of the functionality of the
1093+service itself, we still provide an additional level of acceptance
1094+testing covering the entire location stack/experience as a part of
1095+this document.
1096+
1097+## Dependents/Clients
1098+
1099+ - qtubuntu-sensors
1100+ - Qt/QML applications:
1101+ - Browser
1102+ - osmTouch
1103+
1104+## Test Plan
1105+
1106+This test plan is not supposed to be complete; use it to guide your
1107+manual testing so you don't miss big functional areas that are part of
1108+the component; also this should be used as guideline to inspire the
1109+exploratory testing which should be adapted smartly based on the real
1110+content of a MP.
1111+
1112+Please note that if you're testing the GPS provider, the location
1113+service relies on GPS hardware to obtain a location fix. For that, it
1114+might be required that you execute the manual steps listed before
1115+close to a window or ideally outside, with good satellite visibility
1116+conditions.
1117+
1118+__Note: It can take up to 15 minutes for the GPS device to get a lock, due to lack of assisted GPS__
1119+
1120+ - Install latest image on phone
1121+ - Install freshly built MPs that are needed for landing
1122+
1123+Depending on the default configuration of location-service on the
1124+image, you may skip parts of this test plan. E.g. if GPS hardware is
1125+disabled, skip this part. You can see which providers are enabled by
1126+looking at the list of providers on the location-serviced command-line
1127+(`ps fauxw | grep location-service`, then look at the `--provider`
1128+flags).
1129+
1130+### Dummy provider
1131+
1132+This tests forces location-service to use only the dummy provider;
1133+this providers a baseline test for the app to trust-store to
1134+location-service path.
1135+
1136+ - phablet-shell into the phone:
1137+ - `sudo service ubuntu-location-service stop && sudo /usr/bin/ubuntu-location-serviced --bus system --provider dummy::Provider --dummy::Provider::ReferenceLocationLat=48.857503 --dummy::Provider::ReferenceLocationLon=2.295072`
1138+ - As phablet, start the trust store again (it stops when location-service is stopped) with: `start ubuntu-location-service-trust-stored`
1139+ - Ensure that all AP tests for the webbrowser pass as expected
1140+ - Point the browser to maps.google.com (alternatively: here.com, maps.bing.fr).
1141+ - Request centering the map on current position and observe if it works correctly (should show the Eiffel tower)
1142+ - Install osmTouch from the app store
1143+ - Launch osmTouch and check if it centers on the Eiffel tower.
1144+ - Install a maps webapp such as HERE or Google Maps webapp from the app store
1145+ - Launch maps webapp and check if it centers on the Eiffel tower.
1146+
1147+### GPS Test Plan
1148+
1149+This applies only if GPS provider is enabled.
1150+
1151+ - (If applicable: Remember to add the silo you are testing)
1152+ - `sudo apt-get install ubuntu-location-service-tests`
1153+ - If you want to send off crowdsourced information, i.e., information about visible wifis and visible radio cells for the obtained location fixes to Mozilla's location service and our own instance:
1154+ - `sudo GLOG_v=40 GLOG_logtostderr=1 GPS_TEST_ENABLE_HARVESTING_DURING_TESTS=1 /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware`
1155+ - If you '''don't''' want to send off crowdsourced information:
1156+ - `sudo GLOG_v=40 GLOG_logtostderr=1 /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware`
1157+
1158+ - The test will output a lot of diagnostic information to the
1159+ terminal and will take ~30 minutes. If satellite visibility is
1160+ limited, it can take even longer. The test will automatically
1161+ report success or failure.
1162+
1163+### Preliminary AGPS Test Plan
1164+
1165+**Does not apply to Krillin**
1166+
1167+Please note that the Krillin GPS chipset driver and its integration
1168+within Ubuntu does not support vanilla AGPS (i.e., SUPL) right
1169+now. For that, this test case is irrelevant for Krillin and is likely
1170+to fail.
1171+
1172+This applied only if GPS provider and some other provider (giving
1173+_A_ssistance) are enabled.
1174+
1175+ - Add the silo.
1176+ - `sudo apt-get install ubuntu-location-service-tests`
1177+ - Obtain a (rough) location estimate for your current location on Google maps.
1178+ - Make sure to replace INSERT_ESTIMATE_HERE with the respective
1179+ values obtained from Google maps.
1180+ - If you want to send off crowdsourced information, i.e., information
1181+ about visible wifis and visible radio cells for the obtained
1182+ location fixes to Mozilla's location service and our own instance:
1183+ - `sudo GLOG_v=40 GLOG_logtostderr=1 GPS_TEST_ENABLE_HARVESTING_DURING_TESTS=1 GPS_TEST_REF_LAT=INSERT_ESTIMATE_HERE GPS_TEST_REF_LON=INSERT_ESTIMATE_HERE /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware`
1184+ - If you '''don't''' want to send off crowdsourced information:
1185+ - `sudo GLOG_v=40 GLOG_logtostderr=1 GPS_TEST_REF_LAT=INSERT_ESTIMATE_HERE GPS_TEST_REF_LON=INSERT_ESTIMATE_HERE /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware`
1186+
1187+ - The test will output a lot of diagnostic information to the
1188+ terminal and will take ~10 minutes or less. The test will
1189+ automatically report success or failure.
1190+
1191+### Espoo / HERE provider
1192+
1193+This applies only if the Espoo / HERE remote provider is enabled. This
1194+provider should be enabled by default and may either work standalone
1195+as the only provider or as an assistance for the GPS hardware to lock.
1196+
1197+ - Add the silo; special exception for lxc-android-config: see https://wiki.ubuntu.com/Touch/Testing/lxc-android-config
1198+ - If noted, deploy an updated custom tarball:
1199+ - Download the tarball under /tmp ('''NOT''' under /)
1200+ - Unpack there: `cd /tmp; sudo tar xvf custom-vendor-here-*.tar.xz`
1201+ - Remove older bits: `sudo rm -rf /custom/vendor/here/`
1202+ - Update custom bits: `sudo mv /tmp/system/custom/vendor/here /custom/vendor`
1203+ - Reboot
1204+ - After boot, check you have these three processes running on top of location-service:
1205+ - slpgwd
1206+ - posclientd
1207+ - ubuntu-espoo-service
1208+ - Make sure SIM is unlocked and attached to the network (has some reliable signal) and that WiFi is turned on.
1209+ - Install OSMTouch app
1210+ - Run OSMTouch app, hit the position button every other second until you get a blue circle showing your current location;
1211+
1212+# Connectivity API
1213+
1214+For integration of network-based positioning providers, the location
1215+service offers a connectivity API that provides access to wifi and
1216+cell measurements as well as information on the current overall
1217+connectivity status of the device. Please execute the following
1218+commands on a newly flashed device with a writable image:
1219+
1220+ - `sudo apt-get update && sudo apt-get build-dep location-service && sudo apt-get install libubuntu-location-service-dev ubuntu-location-service-examples`
1221+ - `mkdir /tmp/build && cd /tmp/build && cmake /usr/share/ubuntu-location-service/examples/standalone/connectivity/ && make`
1222+ - `GLOG_logtostderr=1 ./connectivity`
1223+
1224+Verify that the output looks similar to:
1225+
1226+ phablet@ubuntu-phablet:/tmp/build$ ./connectivity
1227+ Is wifi enabled: true
1228+ Is wifi hw enabled: true
1229+ Is wwan enabled: false
1230+ Is wwan hw enabled: true
1231+ umts(mcc: 262, mnc: 2, lac: 5313, id: 131948771, asu: 7)
1232+ (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2462, strength: 72)
1233+ (bssid: 00:22:3F:35:43:58, ssid: JustAnotherWLAN, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2412, strength: 24)
1234+ (bssid: 82:C7:A6:40:8C:4E, ssid: EasyBox-44D054, last seen: 1408955206, mode: Mode::infrastructure, frequency: 2417, strength: 17)
1235+ (bssid: 00:24:01:B8:32:8D, ssid: gra, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2412, strength: 12)
1236+ (bssid: C0:25:06:3C:28:22, ssid: FRITZ!Box 6360 Cable, last seen: 1408954966, mode: Mode::infrastructure, frequency: 2412, strength: 17)
1237+ (bssid: 00:1C:4A:A5:B7:59, ssid: FRITZ!Box Fon WLAN 7170, last seen: 1408954966, mode: Mode::infrastructure, frequency: 2437, strength: 10)
1238+ Last seen changed for wifi (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2462, strength: 72)
1239+ Last seen changed for wifi (bssid: 00:22:3F:35:43:58, ssid: JustAnotherWLAN, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2412, strength: 24)
1240+ Signal strength changed for wifi: (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2462, strength: 73)
1241+
1242+# Trust Store Integration
1243+
1244+Please note that we are assuming a freshly wiped system for testing
1245+here. If you cannot fulfill that pre-condition, please run `rm -rf
1246+/home/phablet/.local/share/UbuntuLocationService && sudo shutdown -r` prior to running the
1247+tests:
1248+
1249+## Unconfined
1250+
1251+ - Open the browser, go to maps.google.com
1252+ - Observe the in-browser dialog asking for granting access to location.
1253+
1254+## Confined Web-App
1255+
1256+ - Open the Nokia Here web app, observe the trust dialog appearing.
1257+
1258+## Confined Application
1259+
1260+ - Open osmtouch and observe the osmtouch surface sliding up, presenting you with a trust dialog.
1261
1262=== added file 'doc/tips_n_tricks.md'
1263--- doc/tips_n_tricks.md 1970-01-01 00:00:00 +0000
1264+++ doc/tips_n_tricks.md 2015-11-20 12:59:02 +0000
1265@@ -0,0 +1,21 @@
1266+# Tips'n'Tricks
1267+
1268+## Mark HERE license as accepted from cmdline
1269+
1270+ sudo LC_ALL=C gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Set com.ubuntu.location.providers.here.AccountsService LicenseAccepted '<true>'
1271+
1272+## Force startup after ofono and NM are started
1273+
1274+This is a *workaround* to get connectivity API to collect; mount your
1275+system read-write and edit
1276+/etc/init/ubuntu-location-provider-here-slpgwd.conf:
1277+
1278+ sudo mount -o remount,rw /
1279+ sudo vi /etc/init/ubuntu-location-provider-here-slpgwd.conf
1280+
1281+change: `start on started dbus and (started ofono or started network-manager)`
1282+to: `start on started dbus and started ofono and started network-manager`
1283+
1284+ sudo mount -o remount,ro /
1285+ sync
1286+ sudo reboot
1287
1288=== modified file 'src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp'
1289--- src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp 2014-10-27 21:58:16 +0000
1290+++ src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp 2015-11-20 12:59:02 +0000
1291@@ -66,8 +66,6 @@
1292 if (config.count("XTRA_SERVER_3") > 0)
1293 result.xtra_hosts.push_back(config.get<std::string>("XTRA_SERVER_3"));
1294
1295- result.timeout = std::chrono::milliseconds{1500};
1296-
1297 return result;
1298 }
1299
1300@@ -333,14 +331,14 @@
1301 } else
1302 {
1303 auto now = location::Clock::now().time_since_epoch();
1304- auto thiz = static_cast<android::HardwareAbstractionLayer*>(context);
1305+ auto ms_since_epoch = std::chrono::duration_cast<std::chrono::milliseconds>(now);
1306
1307 static const int zero_uncertainty = 0;
1308
1309 u_hardware_gps_inject_time(
1310 thiz->impl.gps_handle,
1311- now.count(),
1312- now.count(),
1313+ ms_since_epoch.count(),
1314+ ms_since_epoch.count(),
1315 zero_uncertainty);
1316 }
1317 }
1318
1319=== modified file 'src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h'
1320--- src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h 2015-04-22 13:30:04 +0000
1321+++ src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h 2015-11-20 12:59:02 +0000
1322@@ -49,7 +49,7 @@
1323 /** @brief Timeout on gps xtra download operations. */
1324 std::chrono::milliseconds timeout
1325 {
1326- 5000
1327+ 30000
1328 };
1329
1330 /** Set of hosts serving GPS xtra data. */
1331
1332=== modified file 'src/location_service/com/ubuntu/location/service/daemon.cpp'
1333--- src/location_service/com/ubuntu/location/service/daemon.cpp 2015-04-16 10:03:29 +0000
1334+++ src/location_service/com/ubuntu/location/service/daemon.cpp 2015-11-20 12:59:02 +0000
1335@@ -20,6 +20,8 @@
1336 #include <com/ubuntu/location/boost_ptree_settings.h>
1337 #include <com/ubuntu/location/provider_factory.h>
1338
1339+#include <com/ubuntu/location/connectivity/dummy_connectivity_manager.h>
1340+
1341 #include <com/ubuntu/location/service/default_configuration.h>
1342 #include <com/ubuntu/location/service/demultiplexing_reporter.h>
1343 #include <com/ubuntu/location/service/ichnaea_reporter.h>
1344@@ -214,29 +216,8 @@
1345 dc.the_permission_manager(config.outgoing),
1346 location::service::Harvester::Configuration
1347 {
1348- location::connectivity::platform_default_manager(),
1349- // We submit location/wifi/cell measurements to both
1350- // Mozilla's location service and to Ubuntu's own instance.
1351- std::make_shared<service::DemultiplexingReporter>(
1352- std::initializer_list<service::Harvester::Reporter::Ptr>
1353- {
1354- std::make_shared<service::ichnaea::Reporter>(
1355- service::ichnaea::Reporter::Configuration
1356- {
1357- "https://location.services.mozilla.com",
1358- "UbuntuLocationService",
1359- "UbuntuLocationService"
1360- }
1361- ),
1362- std::make_shared<service::ichnaea::Reporter>(
1363- service::ichnaea::Reporter::Configuration
1364- {
1365- "https://162.213.35.107",
1366- "UbuntuLocationService",
1367- "UbuntuLocationService"
1368- }
1369- )
1370- })
1371+ std::make_shared<dummy::ConnectivityManager>(),
1372+ std::make_shared<NullReporter>()
1373 }
1374 };
1375
1376
1377=== modified file 'src/location_service/com/ubuntu/location/service/session/skeleton.cpp'
1378--- src/location_service/com/ubuntu/location/service/session/skeleton.cpp 2014-08-14 20:31:09 +0000
1379+++ src/location_service/com/ubuntu/location/service/session/skeleton.cpp 2015-11-20 12:59:02 +0000
1380@@ -283,7 +283,13 @@
1381 VLOG(10) << __PRETTY_FUNCTION__;
1382 try
1383 {
1384- configuration.remote.object->invoke_method_asynchronously<culs::session::Interface::UpdatePosition, void>(position);
1385+ configuration.remote.object->invoke_method_asynchronously_with_callback<culs::session::Interface::UpdatePosition, void>([](const core::dbus::Result<void>& result)
1386+ {
1387+ if (result.is_error())
1388+ {
1389+ LOG(INFO) << "Failed to communicate position update to client: " << result.error().print();
1390+ }
1391+ }, position);
1392 } catch(const std::exception&)
1393 {
1394 // We consider the session to be dead once we hit an exception here.
1395@@ -300,7 +306,13 @@
1396 VLOG(10) << __PRETTY_FUNCTION__;
1397 try
1398 {
1399- configuration.remote.object->invoke_method_asynchronously<culs::session::Interface::UpdateHeading, void>(heading);
1400+ configuration.remote.object->invoke_method_asynchronously_with_callback<culs::session::Interface::UpdateHeading, void>([](const core::dbus::Result<void>& result)
1401+ {
1402+ if (result.is_error())
1403+ {
1404+ LOG(INFO) << "Failed to communicate position update to client: " << result.error().print();
1405+ }
1406+ }, heading);
1407 } catch(const std::exception&)
1408 {
1409 // We consider the session to be dead once we hit an exception here.
1410@@ -317,7 +329,13 @@
1411 VLOG(10) << __PRETTY_FUNCTION__;
1412 try
1413 {
1414- configuration.remote.object->invoke_method_asynchronously<culs::session::Interface::UpdateVelocity, void>(velocity);
1415+ configuration.remote.object->invoke_method_asynchronously_with_callback<culs::session::Interface::UpdateVelocity, void>([](const core::dbus::Result<void>& result)
1416+ {
1417+ if (result.is_error())
1418+ {
1419+ LOG(INFO) << "Failed to communicate position update to client: " << result.error().print();
1420+ }
1421+ }, velocity);
1422 } catch(const std::exception&)
1423 {
1424 // We consider the session to be dead once we hit an exception here.
1425
1426=== modified file 'tests/gps_provider_test.cpp'
1427--- tests/gps_provider_test.cpp 2015-01-12 08:41:14 +0000
1428+++ tests/gps_provider_test.cpp 2015-11-20 12:59:02 +0000
1429@@ -48,6 +48,31 @@
1430
1431 namespace
1432 {
1433+
1434+struct MockHardwareGps
1435+{
1436+ MockHardwareGps()
1437+ {
1438+ instance_ = this;
1439+ }
1440+ ~MockHardwareGps()
1441+ {
1442+ instance_ = nullptr;
1443+ }
1444+
1445+ MOCK_METHOD5(set_position_mode, bool(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t));
1446+ MOCK_METHOD3(inject_time, void(int64_t, int64_t, int));
1447+
1448+ static MockHardwareGps *mocked(UHardwareGps self) {
1449+ return reinterpret_cast<MockHardwareGps*>(self);
1450+ }
1451+ static MockHardwareGps *instance() { return instance_; }
1452+
1453+ static MockHardwareGps *instance_;
1454+};
1455+
1456+MockHardwareGps *MockHardwareGps::instance_ = nullptr;
1457+
1458 struct UpdateTrap
1459 {
1460 MOCK_METHOD1(on_position_updated, void(const location::Position&));
1461@@ -211,6 +236,42 @@
1462
1463 }
1464
1465+/* Mock the hardware GPS platform API: the methods defined here will be invoked
1466+ * instead of those exported by the system library.
1467+ * We redefine these methods using the MockHardwareGps class above, which is
1468+ * implemented using google-mock. This effectively allows us to test that the
1469+ * right calls to the platform API are made.
1470+ */
1471+UHardwareGps
1472+u_hardware_gps_new(UHardwareGpsParams *)
1473+{
1474+ using namespace ::testing;
1475+
1476+ return reinterpret_cast<UHardwareGps>(MockHardwareGps::instance());
1477+}
1478+
1479+void
1480+u_hardware_gps_delete(UHardwareGps)
1481+{
1482+}
1483+
1484+bool
1485+u_hardware_gps_set_position_mode(UHardwareGps self, uint32_t mode, uint32_t recurrence,
1486+ uint32_t min_interval, uint32_t preferred_accuracy,
1487+ uint32_t preferred_time)
1488+{
1489+ MockHardwareGps *thiz = MockHardwareGps::mocked(self);
1490+ return thiz->set_position_mode(mode, recurrence, min_interval,
1491+ preferred_accuracy, preferred_time);
1492+}
1493+
1494+void
1495+u_hardware_gps_inject_time(UHardwareGps self, int64_t time, int64_t time_reference, int uncertainty)
1496+{
1497+ MockHardwareGps* thiz = MockHardwareGps::mocked(self);
1498+ return thiz->inject_time(time, time_reference, uncertainty);
1499+}
1500+
1501 TEST(AndroidGpsXtraDownloader, reading_configuration_from_valid_conf_file_works)
1502 {
1503 std::stringstream ss{gps_conf};
1504@@ -261,6 +322,28 @@
1505 provider.on_reference_location_updated(pos);
1506 }
1507
1508+TEST(GpsProvider, time_requests_inject_current_time_into_the_hal)
1509+{
1510+ using namespace ::testing;
1511+
1512+ NiceMock<MockHardwareGps> hardwareGps;
1513+
1514+ gps::android::HardwareAbstractionLayer::Configuration configuration;
1515+ gps::android::HardwareAbstractionLayer hal(configuration);
1516+ std::shared_ptr<gps::HardwareAbstractionLayer> hal_ptr(&hal, [](gps::HardwareAbstractionLayer*){});
1517+
1518+ gps::Provider provider(hal_ptr);
1519+ int64_t time = 0;
1520+ EXPECT_CALL(hardwareGps, inject_time(_, _, 0)).Times(1).WillOnce(SaveArg<0>(&time));
1521+
1522+ auto t0 = std::chrono::duration_cast<std::chrono::milliseconds>(location::Clock::now().time_since_epoch());
1523+
1524+ gps::android::HardwareAbstractionLayer::on_request_utc_time(&hal);
1525+
1526+ auto t1 = std::chrono::duration_cast<std::chrono::milliseconds>(location::Clock::now().time_since_epoch());
1527+ EXPECT_THAT(time, AllOf(Ge(t0.count()), Le(t1.count())));
1528+}
1529+
1530 TEST(GpsProvider, updates_from_hal_are_passed_on_by_the_provider)
1531 {
1532 using namespace ::testing;
1533
1534=== modified file 'tests/position_test.cpp'
1535--- tests/position_test.cpp 2014-06-20 07:40:34 +0000
1536+++ tests/position_test.cpp 2015-11-20 12:59:02 +0000
1537@@ -40,7 +40,7 @@
1538 cul::wgs84::Latitude{},
1539 cul::wgs84::Longitude{},
1540 cul::wgs84::Altitude{}};
1541- EXPECT_TRUE(p.altitude);
1542+ EXPECT_TRUE(static_cast<bool>(p.altitude));
1543 }
1544
1545 #include <com/ubuntu/location/codec.h>
1546
1547=== added directory 'tools'
1548=== added file 'tools/CMakeLists.txt'
1549--- tools/CMakeLists.txt 1970-01-01 00:00:00 +0000
1550+++ tools/CMakeLists.txt 2015-11-20 12:59:02 +0000
1551@@ -0,0 +1,1 @@
1552+configure_file(symbol_diff.in symbol_diff)
1553
1554=== added file 'tools/symbol_diff.in'
1555--- tools/symbol_diff.in 1970-01-01 00:00:00 +0000
1556+++ tools/symbol_diff.in 2015-11-20 12:59:02 +0000
1557@@ -0,0 +1,70 @@
1558+#! /usr/bin/env python3
1559+
1560+#
1561+# Copyright (C) 2014 Canonical Ltd
1562+#
1563+# This program is free software: you can redistribute it and/or modify
1564+# it under the terms of the GNU Lesser General Public License version 3 as
1565+# published by the Free Software Foundation.
1566+#
1567+# This program is distributed in the hope that it will be useful,
1568+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1569+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1570+# GNU Lesser General Public License for more details.
1571+#
1572+# You should have received a copy of the GNU Lesser General Public License
1573+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1574+#
1575+# Authored by: Michi Henning <michi.henning@canonical.com>
1576+#
1577+
1578+import re
1579+import subprocess
1580+
1581+OLD_FILE = './debian/libubuntu-location-service@UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@.symbols'
1582+NEW_FILE = './debian/libubuntu-location-service@UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@/DEBIAN/symbols'
1583+
1584+def run():
1585+ old_regex = re.compile(r'^ (\(.*\))"(.*)" (.*)$')
1586+
1587+ old_syms = {} # Dictionary containing symbol -> ( tag, version )
1588+ with open(OLD_FILE, encoding='utf=8') as file:
1589+ file.readline() # Skip first line, which is the library name and version
1590+ for line in file:
1591+ mo = old_regex.match(line)
1592+ if mo:
1593+ old_syms[mo.group(2)] = ( mo.group(1), mo.group(3) )
1594+ else:
1595+ raise Exception('Invalid input line in ' + OLD_FILE + ': ' + line)
1596+
1597+ new_regex = re.compile(r'^ (.*) .+$')
1598+
1599+ # Run the new symbols file through "c++filt | sort | uniq". We need
1600+ # the sort | uniq because, otherwise, we end up with duplicate demangled symbols.
1601+ with open(NEW_FILE) as infile, open('new_symbols', 'w') as outfile:
1602+ p = subprocess.Popen(['c++filt | sort | uniq'], shell=True, stdin=infile, stdout=subprocess.PIPE)
1603+
1604+ # For each symbol, if it is in the old dictionary, output the tags from the original
1605+ # symbol file, followed by the symbol and version. Otherwise, use "(c++)" as the tag
1606+ # and add " 0replaceme", so the new symbol will be accepted.
1607+ line = p.stdout.readline().decode('utf-8')
1608+ outfile.write(line) # Write library name and version
1609+ for line in p.stdout:
1610+ mo = new_regex.match(line.decode('utf-8'))
1611+ if (mo):
1612+ sym = mo.group(1)
1613+ try:
1614+ tag, version = old_syms[sym]
1615+ except KeyError:
1616+ tag = '(c++)'
1617+ version = '0replaceme'
1618+ outfile.write(' {}"{}" {}\n'.format(tag, sym, version))
1619+ else:
1620+ raise Exception('Cannot parse demangled line: ' + line)
1621+
1622+ # Write the diff into /tmp/symbols.diff
1623+ with open('/tmp/symbols.diff', 'w') as outfile:
1624+ subprocess.call(['diff', '-u', OLD_FILE, 'new_symbols'], stdout=outfile)
1625+
1626+if __name__ == '__main__':
1627+ run()

Subscribers

People subscribed via source and target branches