Merge lp:~thomas-voss/location-service/add_controller_and_service_configuration into lp:location-service/trunk

Proposed by Thomas Voß
Status: Superseded
Proposed branch: lp:~thomas-voss/location-service/add_controller_and_service_configuration
Merge into: lp:location-service/trunk
Diff against target: 13375 lines (+7432/-3163)
119 files modified
CMakeLists.txt (+6/-3)
debian/changelog (+6/-0)
debian/control (+13/-1)
debian/rules (+2/-2)
debian/ubuntu-location-service-bin.install (+1/-1)
debian/ubuntu-location-service-tests.install (+1/-0)
doc/Doxyfile.in (+20/-20)
examples/CMakeLists.txt (+0/-6)
examples/service/CMakeLists.txt (+5/-3)
examples/service/client.cpp (+21/-22)
examples/service/service.cpp (+9/-11)
include/CMakeLists.txt (+3/-3)
include/location_service/com/ubuntu/location/channel.h (+0/-41)
include/location_service/com/ubuntu/location/clock.h (+26/-0)
include/location_service/com/ubuntu/location/codec.h (+278/-319)
include/location_service/com/ubuntu/location/connectivity/bounded_integer.h (+184/-0)
include/location_service/com/ubuntu/location/connectivity/manager.h (+93/-0)
include/location_service/com/ubuntu/location/connectivity/radio_cell.h (+400/-0)
include/location_service/com/ubuntu/location/connectivity/wireless_network.h (+71/-0)
include/location_service/com/ubuntu/location/criteria.h (+33/-23)
include/location_service/com/ubuntu/location/default_provider_selection_policy.h (+6/-6)
include/location_service/com/ubuntu/location/engine.h (+105/-9)
include/location_service/com/ubuntu/location/heading.h (+3/-74)
include/location_service/com/ubuntu/location/optional.h (+35/-0)
include/location_service/com/ubuntu/location/position.h (+23/-45)
include/location_service/com/ubuntu/location/provider.h (+185/-82)
include/location_service/com/ubuntu/location/provider_enumerator.h (+49/-0)
include/location_service/com/ubuntu/location/provider_factory.h (+3/-3)
include/location_service/com/ubuntu/location/provider_selection.h (+62/-0)
include/location_service/com/ubuntu/location/provider_selection_policy.h (+9/-37)
include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h (+28/-31)
include/location_service/com/ubuntu/location/providers/geoclue/provider.h (+4/-7)
include/location_service/com/ubuntu/location/providers/skyhook/provider.h (+2/-2)
include/location_service/com/ubuntu/location/proxy_provider.h (+2/-6)
include/location_service/com/ubuntu/location/satellite_based_positioning_state.h (+40/-0)
include/location_service/com/ubuntu/location/service/configuration.h (+4/-4)
include/location_service/com/ubuntu/location/service/default_configuration.h (+1/-1)
include/location_service/com/ubuntu/location/service/default_permission_manager.h (+1/-1)
include/location_service/com/ubuntu/location/service/implementation.h (+5/-5)
include/location_service/com/ubuntu/location/service/interface.h (+140/-16)
include/location_service/com/ubuntu/location/service/permission_manager.h (+22/-6)
include/location_service/com/ubuntu/location/service/session/implementation.h (+4/-7)
include/location_service/com/ubuntu/location/service/session/interface.h (+78/-223)
include/location_service/com/ubuntu/location/service/session/skeleton.h (+21/-19)
include/location_service/com/ubuntu/location/service/session/stub.h (+13/-14)
include/location_service/com/ubuntu/location/service/skeleton.h (+10/-5)
include/location_service/com/ubuntu/location/service/stub.h (+8/-4)
include/location_service/com/ubuntu/location/space_vehicle.h (+121/-0)
include/location_service/com/ubuntu/location/units/units.h (+6/-0)
include/location_service/com/ubuntu/location/update.h (+34/-5)
include/location_service/com/ubuntu/location/velocity.h (+3/-74)
include/location_service/com/ubuntu/location/wgs84/altitude.h (+2/-2)
include/location_service/com/ubuntu/location/wgs84/coordinate.h (+5/-3)
include/location_service/com/ubuntu/location/wgs84/latitude.h (+2/-2)
include/location_service/com/ubuntu/location/wgs84/longitude.h (+2/-2)
include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h (+36/-0)
src/location_service/com/ubuntu/location/CMakeLists.txt (+50/-7)
src/location_service/com/ubuntu/location/connectivity/nm.h (+255/-0)
src/location_service/com/ubuntu/location/connectivity/ofono.h (+338/-0)
src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp (+338/-0)
src/location_service/com/ubuntu/location/criteria.cpp (+99/-0)
src/location_service/com/ubuntu/location/default_permission_manager.cpp (+1/-1)
src/location_service/com/ubuntu/location/default_provider_selection_policy.cpp (+15/-19)
src/location_service/com/ubuntu/location/engine.cpp (+77/-8)
src/location_service/com/ubuntu/location/init_and_shutdown.cpp (+6/-6)
src/location_service/com/ubuntu/location/position.cpp (+43/-76)
src/location_service/com/ubuntu/location/provider.cpp (+66/-103)
src/location_service/com/ubuntu/location/provider_factory.cpp (+2/-2)
src/location_service/com/ubuntu/location/providers/config.cpp (+5/-5)
src/location_service/com/ubuntu/location/providers/geoclue/CMakeLists.txt (+1/-1)
src/location_service/com/ubuntu/location/providers/geoclue/provider.cpp (+37/-39)
src/location_service/com/ubuntu/location/providers/gps/CMakeLists.txt (+9/-2)
src/location_service/com/ubuntu/location/providers/gps/hardware_abstraction_layer.cpp (+604/-0)
src/location_service/com/ubuntu/location/providers/gps/hardware_abstraction_layer.h (+322/-0)
src/location_service/com/ubuntu/location/providers/gps/provider.cpp (+52/-173)
src/location_service/com/ubuntu/location/providers/gps/provider.h (+19/-16)
src/location_service/com/ubuntu/location/providers/skyhook/provider.cpp (+3/-3)
src/location_service/com/ubuntu/location/proxy_provider.cpp (+28/-22)
src/location_service/com/ubuntu/location/service/daemon.cpp (+390/-0)
src/location_service/com/ubuntu/location/service/daemon.h (+79/-0)
src/location_service/com/ubuntu/location/service/daemon_cli_main.cpp (+24/-0)
src/location_service/com/ubuntu/location/service/daemon_main.cpp (+24/-0)
src/location_service/com/ubuntu/location/service/default_configuration.cpp (+8/-4)
src/location_service/com/ubuntu/location/service/default_permission_manager.cpp (+1/-1)
src/location_service/com/ubuntu/location/service/implementation.cpp (+88/-27)
src/location_service/com/ubuntu/location/service/main.cpp (+0/-150)
src/location_service/com/ubuntu/location/service/program_options.h (+27/-1)
src/location_service/com/ubuntu/location/service/session/implementation.cpp (+68/-39)
src/location_service/com/ubuntu/location/service/session/interface.cpp (+10/-37)
src/location_service/com/ubuntu/location/service/session/interface_p.h (+228/-0)
src/location_service/com/ubuntu/location/service/session/skeleton.cpp (+125/-106)
src/location_service/com/ubuntu/location/service/session/stub.cpp (+87/-31)
src/location_service/com/ubuntu/location/service/skeleton.cpp (+106/-178)
src/location_service/com/ubuntu/location/service/stub.cpp (+48/-11)
src/location_service/com/ubuntu/location/set_name_for_thread.cpp (+24/-0)
src/location_service/com/ubuntu/location/set_name_for_thread.h (+34/-0)
tests/CMakeLists.txt (+59/-254)
tests/acceptance_tests.cpp (+318/-78)
tests/accuracy_test.cpp (+0/-35)
tests/accuracy_tests.cpp (+0/-52)
tests/connectivity_manager_test.cpp (+42/-0)
tests/controller_test.cpp (+85/-143)
tests/criteria_test.cpp (+50/-0)
tests/cross_process_sync.h (+0/-63)
tests/daemon_and_cli_tests.cpp (+174/-0)
tests/default_permission_manager_test.cpp (+3/-1)
tests/engine_test.cpp (+96/-29)
tests/fork_and_run.h (+0/-61)
tests/geoclue_provider_test.cpp (+1/-1)
tests/gps_provider_test.cpp (+420/-4)
tests/heading_test.cpp (+1/-1)
tests/position_test.cpp (+39/-67)
tests/provider_factory_test.cpp (+1/-1)
tests/provider_selection_policy_test.cpp (+51/-22)
tests/provider_test.cpp (+93/-64)
tests/session_test.cpp (+2/-2)
tests/test_main.cpp (+5/-8)
tests/velocity_test.cpp (+0/-54)
tests/wgs84_test.cpp (+5/-5)
To merge this branch: bzr merge lp:~thomas-voss/location-service/add_controller_and_service_configuration
Reviewer Review Type Date Requested Status
Francis Ginther Approve
PS Jenkins bot continuous-integration Needs Fixing
Timo Jyrinki Approve
Review via email: mp+199105@code.launchpad.net

This proposal has been superseded by a proposal from 2014-02-03.

Commit message

* Added tests for daemon and cli.
* Unified daemon and cli header and implementation files.
* Add a command-line interface to the service.
* Split up provider selection policy to rely on an interface ProviderEnumerator to ease in testing.
* Trimmed down on types.
* Removed connectivity API draft to prepare for simpler approach.
* Refactored includes.
* Added a configuration option to handle cell and wifi ID reporting.
* Add a mock for a connectivity API exposed to providers and reporters.
* Add units for connectivity api.
* Refactor cell class into namespace radio.

Description of the change

* Added tests for daemon and cli.
* Unified daemon and cli header and implementation files.
* Add a command-line interface to the service.
* Split up provider selection policy to rely on an interface ProviderEnumerator to ease in testing.
* Trimmed down on types.
* Removed connectivity API draft to prepare for simpler approach.
* Refactored includes.
* Added a configuration option to handle cell and wifi ID reporting.
* Add a mock for a connectivity API exposed to providers and reporters.
* Add units for connectivity api.
* Refactor cell class into namespace radio.

To post a comment you must log in.
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: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Ok after properties-cpp gets approved from trusty NEW queue: https://launchpad.net/ubuntu/trusty/+queue?queue_state=0&queue_text=

review: Approve
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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: Needs Fixing (continuous-integration)
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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Job configuration regressed, reapproving now that it is fixed.

review: Approve
88. By Thomas Voß

Merge prerequisite branch.

89. By Thomas Voß

Rename visible_radio_cells to connected_radio_cells.
Add function to trigger a scan for visible wifis.
Add missing attributes in WirelessNetwork.

90. By Thomas Voß

Split out connectivity API for provider-integration purposes.
Make sure that the invalid value for a bounded integer range is available.

91. By Thomas Voß

[ Thomas Voß ]
* Patch version bump reflecting the toolchain switch.
* No change rebuild against boost1.55.
[ thomas-voss ]
* Re-enable onSessionDied().
[ Łukasz 'sil2100' Zemczak ]
* Bump the build-dependency on dbus-cpp due to the ABI change
[ thomas-voss ]
* Backport dummy provider and accompanying tests.
[ thomas-voss ]
* Force compilation against gcc 4.7.
[ thomas-voss ]
* * Fix a race when a session is created while another one ends. *
  Ensure a sensible minimum interval between consecutive location
  updates in the GPS provider. (LP: #1240878)
* Adjust to changes in new dbus-cpp version.

92. By Thomas Voß

Add pkgconfig setup for connectivity API.
Adjust acceptance tests to rely on private bus connection without dbus-test-runner.

93. By Thomas Voß

Add missing pkgconfig file.

94. By Thomas Voß

Adjust radio cell information to reflect information and values available from Android.
Add missing build dependency on process-cpp.

95. By Thomas Voß

Add documentation for BoundedInteger::from_percent.

96. By Thomas Voß

Add more documentation to RadioCell.h.

97. By Thomas Voß

Adjust debian installation setup to account for pkgconfig files now correctly being installed to arch-specific subdirs.

98. By Thomas Voß

Fix installation of pkgconfig-file for connectivity API.

99. By Thomas Voß

Extract ssid and mode from NetworkManager.
Make sure that a missing ofono instance is handled gracefully.

100. By Thomas Voß

Remove dbus-test runner setups as dbus-cpp provides its own fixture now.
Add documentation for space vehicle.
Adjust LTE radio cell to carry an attribute TAC instead of LAC.
Add test-cases for location::connectivity::RadioCell.

101. By Thomas Voß

Add standalone example for using the connectivity API.

102. By Thomas Voß

Add standalone examples to debian package.

103. By Thomas Voß

Remove primary scrambling code from UMTS details.
Make wireless network properties observable.

104. By Thomas Voß

Fix test-case.

105. By Thomas Voß

Add a reporter sending off harvested location data to the mozilla location service.
Add test-cases for the reporter.
Adjust debian/copyright to include mongoose.

106. By Thomas Voß

Add build-dep on jsoncpp.
Make elements based on net-cpp optional for now.
Default to a NullReporter for harvesting.

107. By Thomas Voß

Requesting network scans is now async.

108. By Thomas Voß

Remove obsolete header from service implementation.

109. By Thomas Voß

Conditionally include sources for ichnaea reporter.

110. By Thomas Voß

Fix missing link directive for boost program-options.

111. By Thomas Voß

Add diagnostic message for boost libraries.

112. By Thomas Voß

Fix diagnostic message.

113. By Thomas Voß

Remove obsolete dependency on boost threads.

114. By Thomas Voß

Add test case for repeatedly querying visible cells.

115. By Thomas Voß

Refactor property handling for ofono NetworkRegistration interface.

116. By Thomas Voß

Ensure that NetworkRegistration properties are always up to date.

117. By Thomas Voß

Add test cases for GPS provider construction.

118. By Thomas Voß

Replace std::cout with proper logging.

119. By Thomas Voß

Replace std::cerr with LOG(ERROR) in connectivity manager implementation.
Wire up to properties changed signal for Ofono's NetworkRegistration interface.

120. By Thomas Voß

Rename signal to account for ofono conventions.

121. By Thomas Voß

Adjust argument type for signal PropertyChanged.

122. By Thomas Voß

Log property changes on network registration.

123. By Thomas Voß

Add signals for wifi's being added and removed to connectivity::Manager.

124. By Thomas Voß

Refactor connectivity API for visible wireless networks.

125. By Thomas Voß

Adjust standalone connectivity example.

126. By Thomas Voß

Refactor location::connectivity::RadioCell to prepare for fine-grained update propagation.

127. By Thomas Voß

Refactor implementation and consolidate ofono -> connectivity translation in one place.

128. By Thomas Voß

First cut at exposing modem properties for tracking network registrations.

129. By Thomas Voß

Wire up to a modem's PropertyChanged signal.

130. By Thomas Voß

Further glue for wiring up interface changes on a modem.

131. By Thomas Voß

Wire up to property changes on network registrations.

132. By Thomas Voß

Add threading stress-tests to standalone example.

133. By Thomas Voß

Add missing include <thread> in standalone example.
Keep threads running until cancelled in standalone example.

134. By Thomas Voß

Remove noisy std::cout's in query threads.

135. By Thomas Voß

Wire up cell added/removed signals.

136. By Thomas Voß

Factor out WirelessNetwork and RadioCell implementations into their own header files.

137. By Thomas Voß

Clean up Ofono/NM-based connectivity::Manager implementation.

138. By Thomas Voß

Factor out Ofono/NetworkManager-based implementation into header and impl. file.

139. By Thomas Voß

Split out property updates for wifi's.

140. By Thomas Voß

Wire up network registration property updates.

141. By Thomas Voß

Make the gps provider more verbose when reporting satellite visibility.

142. By Thomas Voß

Replace unguarded .at access to maps with guarded .find().
Add verbose logging line to gps hal for tracking satellite visibility updates.

143. By Thomas Voß

Add missing typename.

144. By Thomas Voß

Add more debugging output to the gps provider.

145. By Thomas Voß

More logging output.

146. By Thomas Voß

Add a missing include for logging in the location engine.

147. By Thomas Voß

Temporarily disable space vehicle reporting.

148. By Thomas Voß

Comment out test case.<

149. By Thomas Voß

Disable test cases instead of commenting them out.

150. By Thomas Voß

Remove overly-verbose logs for satellite visibility reporting.

151. By Thomas Voß

Enable AGPS support in the GPS HAL.

152. By Thomas Voß

Make sure to switch assistance mode on in the chipset driver.

153. By Thomas Voß

Notify network connectivity to GPS chipset.

154. By Thomas Voß

Make sure to announce open data connection on agps status update.

155. By Thomas Voß

Add pretty printing for SuplAssistant::Status.

156. By Thomas Voß

Add logging for agps status updates in the hardware abstraction layer.

157. By Thomas Voß

Add missing include <iosfwd>.

158. By Thomas Voß

Make operator<< inline friend to circumvent icl for gcc on arm.

159. By Thomas Voß

Entirely remove stream out operator to fix ice for gcc.

160. By Thomas Voß

Switch to mobile station based positioning.

161. By Thomas Voß

Format IP triplet as ints.

162. By Thomas Voß

Add first cut at handling agps status updates.

163. By Thomas Voß

Switch to "internet" apn for access to supl servers.

164. By Thomas Voß

Remove unneccessary apn reporting.

165. By Thomas Voß

Reenable reference location injection.

166. By Thomas Voß

Set apn for gps chipset.

167. By Thomas Voß

mobile_station_based is the default for assisted GPS.
Relax requirements on time to first fix.

168. By Thomas Voß

Make sure to reinitialize all agps flags after dropping adding data in trial setup.

169. By Thomas Voß

Ensure to set supl server when data connection is requested.

170. By Thomas Voß

Inject reference location.

171. By Thomas Voß

Make sure to report APN to gps chipset.

172. By Thomas Voß

Add accuracy for reference location.

173. By Thomas Voß

Clean up supl test case.

174. By Thomas Voß

Correct apn name.

175. By Thomas Voß

Allow for reference position injection into gps hal test cases.

176. By Thomas Voß

Make sure that we always set a supl server and port.

177. By Thomas Voß

Just a test.

178. By Thomas Voß

Adding last_seen property to WirelessNetwork.
Adding signal indicating end of wifi scan.

179. By Thomas Voß

Print last seen timestamp.

180. By Thomas Voß

Make sure that technology changes are wired up correctly.

181. By Thomas Voß

Print more verbose cell information on changes.

182. By Thomas Voß

Adjust APN for testing purposes.

183. By Thomas Voß

Inject ref position on nmea update.

184. By Thomas Voß

First cut at support for GPS XTRA data.

185. By Thomas Voß

Make sure that the xtra downloader is initialized.

186. By Thomas Voß

Make the supl benchmark inject reference position on a thread while positioning is active.

187. By Thomas Voß

Put the injector thread to sleep for a second.

188. By Thomas Voß

Fix reporting of agps status enum.
Correctly extract last seen timestamp for property updates.

189. By Thomas Voß

Report last seen as raw timestamps.

190. By Thomas Voß

Subscribe to last seen updates in standalone connectivity example.
Adjust formatting of enumerated wifis in standalone connectivity example.

191. By Thomas Voß

network-manager models last seen updates as strength updates, account for that.

192. By Thomas Voß

Refactor the android-specific implementation of the HardwareAbstractionLayer interface.

193. By Thomas Voß

Remove unneeded implementation file.

194. By Thomas Voß

Refactor the harvester to make it usable for reporting in test cases.

195. By Thomas Voß

Make the harvester more chatty in logs if verbose logging is enabled.

196. By Thomas Voß

Make reporting to ichnaea from gps provider test cases opt-in.

197. By Thomas Voß

Make sure that missing last_seen property is not fatal.

198. By Thomas Voß

Shrink the directory name for installed tests.

199. By Thomas Voß

[ Ubuntu daily release ]
* New rebuild forced
[ Ricardo Mendoza ]
* Platform API V2 rebuild

200. By Thomas Voß

Make reference position more readable.

201. By Thomas Voß

Refactor setup to make daemon and cli testable.
Add nickname property to ichnaea reporter.

202. By Thomas Voß

Address build warning for ichnaea reporter test.
Add net-cpp as build-dependency.

203. By Thomas Voß

Fix type in debian/control.

204. By Thomas Voß

Adjust install directories.

205. By Thomas Voß

Refactor and clean up gps provider test case.

206. By Thomas Voß

Refactored command line parsing to take a factory functor for creating connections to the bus (used in testing).

207. By Thomas Voß

Add an end-to-end acceptance test exercising the service with hundreds of clients randomly dying away.
Adjust implementation to correctly disconnect from core::Signal's by levering RAII as provided by core::ScopedConnection.

208. By Thomas Voß

Factor out GPS Xtra Downloader implementations and add tests around them.

209. By Thomas Voß

Disable gps xtra downloader test against external URL as the test fails in CI.

210. By Thomas Voß

Refactor skeletons for service and session, getting rid of the pimpl-pattern.
Introduce a dedicated outgoing dbus connection for integrating with other services.
Factor out testing webserver into its own class and adjust test cases.

211. By Thomas Voß

Factor out wap-headers for GPS Xtra Data Downloader.
Add checks for header in GpsXtraDownloader test cases.

212. By Thomas Voß

Remove UNRELEASED changelog artifact.

213. By Thomas Voß

Make sure that the testing web server is up before executing client requests.

214. By Thomas Voß

Send reply via the same dbus connection.

215. By Thomas Voß

Factor out resolution of client credentials and object path creation into interfaces.

216. By Thomas Voß

Make sure that session counter is incremented on access.

217. By Thomas Voß

Bump so name to account for api change.

218. By Thomas Voß

Make sure to install the versioned include directory.

219. By Thomas Voß

Bump major version.

220. By Thomas Voß

Add dependency on library package.

221. By Thomas Voß

Make sure that the dummy provider thread is correctly joined when stopped.

222. By Thomas Voß

Make sure that the daemon logs to /var/log/ubuntu-location-service.
Make sure that the CLI logs to stderr.
Make sure that the client library logs to stderr.

223. By Thomas Voß

Remove build dependency on json-cpp and net-cpp.

224. By Thomas Voß

Adjust expected type for LastSeen timestamps on wifis.

225. By Thomas Voß

Comment out header for GpsXtraDownloader.

Unmerged revisions

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 2013-10-14 06:11:15 +0000
3+++ CMakeLists.txt 2014-02-03 13:52:45 +0000
4@@ -25,7 +25,8 @@
5 find_package(GFlags)
6 pkg_check_modules(DBUS dbus-1 REQUIRED)
7 pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
8-
9+pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
10+pkg_check_modules(PROPERTIES_CPP properties-cpp REQUIRED)
11 #####################################################################
12 # Enable code coverage calculation with gcov/gcovr/lcov
13 # Usage:
14@@ -43,13 +44,15 @@
15
16 option (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS "Disable errors when local typedefs are unused" ON)
17 if (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
18- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs")
19+ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs")
20 endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
21
22 include_directories(
23 ${Boost_INCLUDE_DIRS}
24 ${DBUS_INCLUDE_DIRS}
25- ${DBUS_CPP_INCLUDE_DIRS}/dbus
26+ ${DBUS_CPP_INCLUDE_DIRS}
27+ ${PROPERTIES_CPP_INCLUDE_DIRS}
28+ ${PROCESS_CPP_INCLUDE_DIRS}
29 ${GLog_INCLUDE_DIR}
30 ${GFlags_INCLUDE_DIR}
31 include/location_service
32
33=== modified file 'debian/changelog'
34--- debian/changelog 2013-10-22 17:24:31 +0000
35+++ debian/changelog 2014-02-03 13:52:45 +0000
36@@ -1,3 +1,9 @@
37+location-service (0.0.2+13.10.20131016.1-0ubuntu3) UNRELEASED; urgency=medium
38+
39+ * Version bump
40+
41+ -- Thomas Voß <thomas.voss@canonical.com> Mon, 13 Jan 2014 16:18:15 +0100
42+
43 location-service (0.0.2+13.10.20131016.1-0ubuntu2) trusty; urgency=low
44
45 * No change rebuild for Boost 1.54 transition.
46
47=== modified file 'debian/control'
48--- debian/control 2013-10-22 17:24:31 +0000
49+++ debian/control 2014-02-03 13:52:45 +0000
50@@ -7,7 +7,7 @@
51 XSBC-Original-Maintainer: Thomas Voß <thomas.voss@canonical.com>
52 Build-Depends: cmake,
53 curl,
54- dbus-cpp-dev,
55+ libdbus-cpp-dev,
56 dbus-test-runner,
57 debhelper (>= 9),
58 doxygen,
59@@ -19,11 +19,14 @@
60 libboost-program-options-dev,
61 libboost-system-dev,
62 libdbus-1-dev,
63+ libdbus-cpp-dev,
64 libgoogle-glog-dev,
65 libgtest-dev,
66 libiw-dev,
67 libplatform-hardware-api-headers,
68 libplatform-hardware-api1-dev,
69+ libprocess-cpp-dev,
70+ libproperties-cpp-dev,
71 Standards-Version: 3.9.4
72 Homepage: http://launchpad.net/location-service
73 # If you aren't a member of ~phablet-team but need to upload packaging changes,
74@@ -57,6 +60,15 @@
75 Contains header files required to develop clients talking to the ubuntu
76 location service.
77
78+Package: ubuntu-location-service-tests
79+Architecture: any
80+Depends: ${misc:Depends},
81+ ${shlibs:Depends},
82+Description: location service aggregating position/velocity/heading
83+ updates and exporting them over dbus.
84+ .
85+ Contains all test executables
86+
87 Package: ubuntu-location-service-bin
88 Architecture: any
89 Depends: ${misc:Depends},
90
91=== modified file 'debian/rules'
92--- debian/rules 2013-08-19 21:48:28 +0000
93+++ debian/rules 2014-02-03 13:52:45 +0000
94@@ -11,8 +11,8 @@
95
96 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
97
98-export C=gcc-4.7
99-export CXX=g++-4.7
100+# export C=gcc-4.7
101+# export CXX=g++-4.7
102
103 export DPKG_GENSYMBOLS_CHECK_LEVEL=4
104
105
106=== modified file 'debian/ubuntu-location-service-bin.install'
107--- debian/ubuntu-location-service-bin.install 2013-10-08 14:48:43 +0000
108+++ debian/ubuntu-location-service-bin.install 2014-02-03 13:52:45 +0000
109@@ -1,4 +1,4 @@
110 etc/dbus-1/system.d/
111 etc/init/*
112 usr/bin/ubuntu-location-serviced
113-
114+usr/bin/ubuntu-location-serviced-cli
115
116=== added file 'debian/ubuntu-location-service-tests.install'
117--- debian/ubuntu-location-service-tests.install 1970-01-01 00:00:00 +0000
118+++ debian/ubuntu-location-service-tests.install 2014-02-03 13:52:45 +0000
119@@ -0,0 +1,1 @@
120+usr/bin/ubuntu-location-service-tests/*
121
122=== modified file 'doc/Doxyfile.in'
123--- doc/Doxyfile.in 2013-08-31 06:23:08 +0000
124+++ doc/Doxyfile.in 2014-02-03 13:52:45 +0000
125@@ -32,13 +32,13 @@
126 # This could be handy for archiving the generated documentation or
127 # if some version control system is used.
128
129-PROJECT_NUMBER = @UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@.@UBUNTU_LOCATION_SERVICE_VERSION_MINOR@.@UBUNTU_LOCATION_SERVICE_VERSION_PATCH@
130+PROJECT_NUMBER = @LOCATION_SERVICE_VERSION_MAJOR@.@LOCATION_SERVICE_VERSION_MINOR@.@LOCATION_SERVICE_VERSION_PATCH@
131
132 # Using the PROJECT_BRIEF tag one can provide an optional one line description
133 # for a project that appears at the top of each page and should give viewer
134 # a quick idea about the purpose of the project. Keep the description short.
135
136-PROJECT_BRIEF =
137+PROJECT_BRIEF = "An aggregating location service providing positioning and geocoding capabilities to applications."
138
139 # With the PROJECT_LOGO tag one can specify an logo or icon that is
140 # included in the documentation. The maximum height of the logo should not
141@@ -266,7 +266,7 @@
142 # func(std::string) {}). This also makes the inheritance and collaboration
143 # diagrams that involve STL classes more complete and accurate.
144
145-BUILTIN_STL_SUPPORT = NO
146+BUILTIN_STL_SUPPORT = YES
147
148 # If you use Microsoft's C++/CLI language, you should set this option to YES to
149 # enable parsing support.
150@@ -365,7 +365,7 @@
151 # Private class members and static file members will be hidden unless
152 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
153
154-EXTRACT_ALL = NO
155+EXTRACT_ALL = YES
156
157 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
158 # will be included in the documentation.
159@@ -380,7 +380,7 @@
160 # If the EXTRACT_STATIC tag is set to YES all static members of a file
161 # will be included in the documentation.
162
163-EXTRACT_STATIC = NO
164+EXTRACT_STATIC = YES
165
166 # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
167 # defined locally in source files will be included in the documentation.
168@@ -423,7 +423,7 @@
169 # If set to NO (the default) these declarations will be included in the
170 # documentation.
171
172-HIDE_FRIEND_COMPOUNDS = NO
173+HIDE_FRIEND_COMPOUNDS = YES
174
175 # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
176 # documentation blocks found inside the body of a function.
177@@ -668,7 +668,7 @@
178 # directories like "/usr/src/myproject". Separate the files or directories
179 # with spaces.
180
181-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../include
182+INPUT = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_CURRENT_SOURCE_DIR@/../include
183
184 # This tag can be used to specify the character encoding of the source files
185 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
186@@ -728,7 +728,7 @@
187 # directories that contain example code fragments that are included (see
188 # the \include command).
189
190-EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../examples
191+EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../tests
192
193 # If the value of the EXAMPLE_PATH tag contains directories, you can use the
194 # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
195@@ -791,7 +791,7 @@
196 # This can be useful if you have a project on for instance GitHub and want reuse
197 # the introduction page also for the doxygen output.
198
199-USE_MDFILE_AS_MAINPAGE =
200+USE_MDFILE_AS_MAINPAGE = @CMAKE_SOURCE_DIR@/README.md
201
202 #---------------------------------------------------------------------------
203 # configuration options related to source browsing
204@@ -807,7 +807,7 @@
205 # Setting the INLINE_SOURCES tag to YES will include the body
206 # of functions and classes directly in the documentation.
207
208-INLINE_SOURCES = YES
209+INLINE_SOURCES = NO
210
211 # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
212 # doxygen to hide any special comment blocks from generated source code
213@@ -929,7 +929,7 @@
214 # robust against future updates. Doxygen will copy the style sheet file to
215 # the output directory.
216
217-HTML_EXTRA_STYLESHEET =
218+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/extra.css
219
220 # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
221 # other source files which should be copied to the HTML output directory. Note
222@@ -975,7 +975,7 @@
223 # documentation will contain sections that can be hidden and shown after the
224 # page has loaded.
225
226-HTML_DYNAMIC_SECTIONS = NO
227+HTML_DYNAMIC_SECTIONS = YES
228
229 # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
230 # entries shown in the various tree structured indices initially; the user
231@@ -1145,7 +1145,7 @@
232 # navigation tree you can set this option to NO if you already set
233 # GENERATE_TREEVIEW to YES.
234
235-DISABLE_INDEX = NO
236+DISABLE_INDEX = YES
237
238 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
239 # structure should be generated to display hierarchical information.
240@@ -1157,7 +1157,7 @@
241 # Since the tree basically has the same information as the tab index you
242 # could consider to set DISABLE_INDEX to NO when enabling this option.
243
244-GENERATE_TREEVIEW = NO
245+GENERATE_TREEVIEW = YES
246
247 # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
248 # (range [0,1..20]) that doxygen will group on one line in the generated HTML
249@@ -1234,7 +1234,7 @@
250 # typically be disabled. For large projects the javascript based search engine
251 # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
252
253-SEARCHENGINE = NO
254+SEARCHENGINE = NO
255
256 # When the SERVER_BASED_SEARCH tag is enabled the search engine will be
257 # implemented using a web server instead of a web client using Javascript.
258@@ -1293,7 +1293,7 @@
259 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
260 # generate Latex output.
261
262-GENERATE_LATEX = NO
263+GENERATE_LATEX = YES
264
265 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
266 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
267@@ -1319,7 +1319,7 @@
268 # LaTeX documents. This may be useful for small projects and may help to
269 # save some trees in general.
270
271-COMPACT_LATEX = NO
272+COMPACT_LATEX = YES
273
274 # The PAPER_TYPE tag can be used to set the paper type that is used
275 # by the printer. Possible values are: a4, letter, legal and
276@@ -1377,7 +1377,7 @@
277 # Note that which sources are shown also depends on other settings
278 # such as SOURCE_BROWSER.
279
280-LATEX_SOURCE_CODE = NO
281+LATEX_SOURCE_CODE = NO
282
283 # The LATEX_BIB_STYLE tag can be used to specify the style to use for the
284 # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
285@@ -1434,7 +1434,7 @@
286 # If the GENERATE_MAN tag is set to YES (the default) Doxygen will
287 # generate man pages
288
289-GENERATE_MAN = NO
290+GENERATE_MAN = YES
291
292 # The MAN_OUTPUT tag is used to specify where the man pages will be put.
293 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
294@@ -1684,7 +1684,7 @@
295 # explicitly to a value larger than 0 to get control over the balance
296 # between CPU load and processing speed.
297
298-DOT_NUM_THREADS = 0
299+DOT_NUM_THREADS = 1
300
301 # By default doxygen will use the Helvetica font for all dot files that
302 # doxygen generates. When you want a differently looking font you can specify
303
304=== modified file 'examples/CMakeLists.txt'
305--- examples/CMakeLists.txt 2013-05-28 14:20:45 +0000
306+++ examples/CMakeLists.txt 2014-02-03 13:52:45 +0000
307@@ -1,7 +1,1 @@
308 add_subdirectory(service)
309-
310-
311-
312-
313-
314-
315
316=== modified file 'examples/service/CMakeLists.txt'
317--- examples/service/CMakeLists.txt 2013-08-29 09:21:07 +0000
318+++ examples/service/CMakeLists.txt 2014-02-03 13:52:45 +0000
319@@ -2,12 +2,12 @@
320 find_package(Boost COMPONENTS system)
321 find_package(Threads)
322
323-pkg_check_modules(DBUS dbus-1)
324-pkg_check_modules(DBUS_CPP dbus-cpp)
325+pkg_check_modules(DBUS dbus-1 REQUIRED)
326+pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
327 include_directories(
328 ${Boost_INCLUDE_DIRS}
329 ${DBUS_INCLUDE_DIRS}
330- ${DBUS_CPP_INCLUDE_DIRS}/dbus
331+ ${DBUS_CPP_INCLUDE_DIRS}
332
333 )
334
335@@ -33,6 +33,7 @@
336 ${CMAKE_THREAD_LIBS_INIT}
337 ${Boost_LIBRARIES}
338 ${DBUS_LIBRARIES}
339+ ${DBUS_CPP_LDFLAGS}
340 )
341
342 target_link_libraries(
343@@ -43,6 +44,7 @@
344 ${CMAKE_THREAD_LIBS_INIT}
345 ${Boost_LIBRARIES}
346 ${DBUS_LIBRARIES}
347+ ${DBUS_CPP_LDFLAGS}
348 )
349
350 add_custom_command(
351
352=== modified file 'examples/service/client.cpp'
353--- examples/service/client.cpp 2013-05-28 14:41:06 +0000
354+++ examples/service/client.cpp 2014-02-03 13:52:45 +0000
355@@ -17,16 +17,17 @@
356 */
357 #include "program_options.h"
358
359-#include "com/ubuntu/location/service/stub.h"
360+#include <com/ubuntu/location/service/stub.h>
361
362-#include <org/freedesktop/dbus/resolver.h>
363-#include <org/freedesktop/dbus/asio/executor.h>
364+#include <core/dbus/resolver.h>
365+#include <core/dbus/asio/executor.h>
366
367 #include <thread>
368
369 namespace cul = com::ubuntu::location;
370 namespace culs = com::ubuntu::location::service;
371-namespace dbus = org::freedesktop::dbus;
372+namespace culss = com::ubuntu::location::service::session;
373+namespace dbus = core::dbus;
374
375 int main(int argc, char** argv)
376 {
377@@ -53,36 +54,34 @@
378 {"system", dbus::WellKnownBus::system},
379 };
380
381- org::freedesktop::dbus::Bus::Ptr bus
382+ dbus::Bus::Ptr bus
383 {
384- new org::freedesktop::dbus::Bus{lut.at(options.value_for_key<std::string>("bus"))}
385+ new dbus::Bus{lut.at(options.value_for_key<std::string>("bus"))}
386 };
387- bus->install_executor(
388- org::freedesktop::dbus::Executor::Ptr(
389- new org::freedesktop::dbus::asio::Executor{bus}));
390+ bus->install_executor(dbus::asio::make_executor(bus));
391 std::thread t{[bus](){bus->run();}};
392
393 auto location_service =
394- org::freedesktop::dbus::resolve_service_on_bus<culs::Interface, culs::Stub>(bus);
395-
396- auto s1 = location_service->create_session_for_criteria(com::ubuntu::location::Criteria{});
397-
398- s1->install_position_updates_handler(
399- [&](const com::ubuntu::location::Update<com::ubuntu::location::Position>& new_position) {
400+ dbus::resolve_service_on_bus<culs::Interface, culs::Stub>(bus);
401+
402+ auto s1 = location_service->create_session_for_criteria(cul::Criteria{});
403+
404+ s1->updates().position.changed().connect(
405+ [&](const cul::Update<cul::Position>& new_position) {
406 std::cout << "On position updated: " << new_position << std::endl;
407 });
408- s1->install_velocity_updates_handler(
409- [&](const com::ubuntu::location::Update<com::ubuntu::location::Velocity>& new_velocity) {
410+ s1->updates().velocity.changed().connect(
411+ [&](const cul::Update<cul::Velocity>& new_velocity) {
412 std::cout << "On velocity_changed " << new_velocity << std::endl;
413 });
414- s1->install_heading_updates_handler(
415- [&](const com::ubuntu::location::Update<com::ubuntu::location::Heading>& new_heading) {
416+ s1->updates().heading.changed().connect(
417+ [&](const cul::Update<cul::Heading>& new_heading) {
418 std::cout << "On heading changed: " << new_heading << std::endl;
419 });
420
421- s1->start_position_updates();
422- s1->start_velocity_updates();
423- s1->start_heading_updates();
424+ s1->updates().position_status = culss::Interface::Updates::Status::enabled;
425+ s1->updates().heading_status = culss::Interface::Updates::Status::enabled;
426+ s1->updates().velocity_status = culss::Interface::Updates::Status::enabled;
427
428 if (t.joinable())
429 t.join();
430
431=== modified file 'examples/service/service.cpp'
432--- examples/service/service.cpp 2013-05-29 06:04:02 +0000
433+++ examples/service/service.cpp 2014-02-03 13:52:45 +0000
434@@ -17,19 +17,19 @@
435 */
436 #include "program_options.h"
437
438-#include "com/ubuntu/location/provider_factory.h"
439-
440-#include "com/ubuntu/location/service/default_configuration.h"
441-#include "com/ubuntu/location/service/implementation.h"
442-
443-#include <org/freedesktop/dbus/announcer.h>
444-#include <org/freedesktop/dbus/asio/executor.h>
445+#include <com/ubuntu/location/provider_factory.h>
446+
447+#include <com/ubuntu/location/service/default_configuration.h>
448+#include <com/ubuntu/location/service/implementation.h>
449+
450+#include <core/dbus/announcer.h>
451+#include <core/dbus/asio/executor.h>
452
453 #include <thread>
454
455 namespace cul = com::ubuntu::location;
456 namespace culs = com::ubuntu::location::service;
457-namespace dbus = org::freedesktop::dbus;
458+namespace dbus = core::dbus;
459
460 int main(int argc, char** argv)
461 {
462@@ -124,9 +124,7 @@
463 new dbus::Bus{lut.at(options.value_for_key<std::string>("bus"))}
464 };
465
466- bus->install_executor(
467- dbus::Executor::Ptr(
468- new dbus::asio::Executor{bus}));
469+ bus->install_executor(dbus::asio::make_executor(bus));
470
471 culs::DefaultConfiguration config;
472
473
474=== modified file 'include/CMakeLists.txt'
475--- include/CMakeLists.txt 2013-05-28 14:20:45 +0000
476+++ include/CMakeLists.txt 2014-02-03 13:52:45 +0000
477@@ -1,4 +1,4 @@
478 install(
479- DIRECTORY location_service/com
480- DESTINATION include/ubuntu-location-service-${UBUNTU_LOCATION_SERVICE_VERSION_MAJOR}
481-)
482\ No newline at end of file
483+ DIRECTORY location_service/com
484+ DESTINATION include/ubuntu-location-service-${UBUNTU_LOCATION_SERVICE_VERSION_MAJOR}
485+)
486
487=== removed file 'include/location_service/com/ubuntu/location/channel.h'
488--- include/location_service/com/ubuntu/location/channel.h 2013-05-28 14:41:06 +0000
489+++ include/location_service/com/ubuntu/location/channel.h 1970-01-01 00:00:00 +0000
490@@ -1,41 +0,0 @@
491-/*
492- * Copyright © 2012-2013 Canonical Ltd.
493- *
494- * This program is free software: you can redistribute it and/or modify it
495- * under the terms of the GNU Lesser General Public License version 3,
496- * as published by the Free Software Foundation.
497- *
498- * This program is distributed in the hope that it will be useful,
499- * but WITHOUT ANY WARRANTY; without even the implied warranty of
500- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
501- * GNU Lesser General Public License for more details.
502- *
503- * You should have received a copy of the GNU Lesser General Public License
504- * along with this program. If not, see <http://www.gnu.org/licenses/>.
505- *
506- * Authored by: Thomas Voß <thomas.voss@canonical.com>
507- */
508-#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CHANNEL_H_
509-#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CHANNEL_H_
510-
511-#include <boost/signals2.hpp>
512-
513-#include <memory>
514-#include <set>
515-
516-namespace com
517-{
518-namespace ubuntu
519-{
520-namespace location
521-{
522-template<typename T>
523-using Channel = boost::signals2::signal<void(const T&)>;
524-
525-typedef boost::signals2::scoped_connection ScopedChannelConnection;
526-typedef boost::signals2::connection ChannelConnection;
527-}
528-}
529-}
530-
531-#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CHANNEL_H_
532
533=== modified file 'include/location_service/com/ubuntu/location/clock.h'
534--- include/location_service/com/ubuntu/location/clock.h 2013-05-28 14:41:06 +0000
535+++ include/location_service/com/ubuntu/location/clock.h 2014-02-03 13:52:45 +0000
536@@ -26,15 +26,41 @@
537 {
538 namespace location
539 {
540+/**
541+ * @brief Defines the timebase of the location service.
542+ */
543 struct Clock
544 {
545+ /** @brief The underlying clock we are assuming for all time-stamping purposes. */
546+ typedef std::chrono::high_resolution_clock Type;
547+
548+ /**
549+ * @brief Duration type of the location service clock.
550+ */
551 typedef std::chrono::high_resolution_clock::duration Duration;
552+
553+ /**
554+ * @brief Timestamp type of the location service clock.
555+ */
556 typedef std::chrono::high_resolution_clock::time_point Timestamp;
557
558+ /**
559+ * @brief Samples a timestamp from the clock.
560+ * @return The current time.
561+ */
562 static inline Timestamp now()
563 {
564 return std::chrono::high_resolution_clock::now();
565 }
566+
567+ /**
568+ * @brief Samples a timestamp from the clock.
569+ * @return The minimum point in time representable by this clock.
570+ */
571+ static inline Timestamp beginning_of_time()
572+ {
573+ return std::chrono::high_resolution_clock::time_point::min();
574+ }
575 };
576 }
577 }
578
579=== modified file 'include/location_service/com/ubuntu/location/codec.h'
580--- include/location_service/com/ubuntu/location/codec.h 2013-05-28 14:41:06 +0000
581+++ include/location_service/com/ubuntu/location/codec.h 2014-02-03 13:52:45 +0000
582@@ -18,22 +18,20 @@
583 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CODEC_H_
584 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CODEC_H_
585
586-#include "com/ubuntu/location/accuracy.h"
587-#include "com/ubuntu/location/criteria.h"
588-#include "com/ubuntu/location/heading.h"
589-#include "com/ubuntu/location/position.h"
590-#include "com/ubuntu/location/update.h"
591-#include "com/ubuntu/location/velocity.h"
592-#include "com/ubuntu/location/units/units.h"
593-#include "com/ubuntu/location/wgs84/altitude.h"
594-#include "com/ubuntu/location/wgs84/latitude.h"
595-#include "com/ubuntu/location/wgs84/longitude.h"
596-
597-#include <org/freedesktop/dbus/codec.h>
598-
599-namespace org
600-{
601-namespace freedesktop
602+#include <com/ubuntu/location/criteria.h>
603+#include <com/ubuntu/location/heading.h>
604+#include <com/ubuntu/location/position.h>
605+#include <com/ubuntu/location/space_vehicle.h>
606+#include <com/ubuntu/location/update.h>
607+#include <com/ubuntu/location/velocity.h>
608+#include <com/ubuntu/location/units/units.h>
609+#include <com/ubuntu/location/wgs84/altitude.h>
610+#include <com/ubuntu/location/wgs84/latitude.h>
611+#include <com/ubuntu/location/wgs84/longitude.h>
612+
613+#include <core/dbus/codec.h>
614+
615+namespace core
616 {
617 namespace dbus
618 {
619@@ -46,6 +44,7 @@
620 {
621 return ArgumentType::floating_point;
622 }
623+
624 constexpr static bool is_basic_type()
625 {
626 return true;
627@@ -64,319 +63,283 @@
628 }
629
630 template<typename T>
631+struct Codec<com::ubuntu::location::Optional<T>>
632+{
633+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Optional<T>& in)
634+ {
635+ bool has_value{in};
636+ Codec<bool>::encode_argument(writer, has_value);
637+ if (has_value)
638+ Codec<typename com::ubuntu::location::Optional<T>::value_type>::encode_argument(writer, *in);
639+ }
640+
641+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::Optional<T>& in)
642+ {
643+ bool has_value{false};
644+ Codec<bool>::decode_argument(reader, has_value);
645+ if (has_value)
646+ {
647+ typename com::ubuntu::location::Optional<T>::value_type value;
648+ Codec<typename com::ubuntu::location::Optional<T>::value_type>::decode_argument(reader, value);
649+ in = value;
650+ } else
651+ {
652+ in.reset();
653+ }
654+ }
655+};
656+
657+template<typename T>
658 struct Codec<com::ubuntu::location::units::Quantity<T>>
659 {
660- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::units::Quantity<T>& in)
661+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::units::Quantity<T>& in)
662 {
663- Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::encode_argument(out, in.value());
664+ Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::encode_argument(writer, in.value());
665 }
666
667- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::units::Quantity<T>& in)
668+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::units::Quantity<T>& in)
669 {
670 typename com::ubuntu::location::units::Quantity<T>::value_type value;
671- Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::decode_argument(out, value);
672+ Codec<typename com::ubuntu::location::units::Quantity<T>::value_type>::decode_argument(reader, value);
673 in = com::ubuntu::location::units::Quantity<T>::from_value(value);
674- dbus_message_iter_next(out);
675- }
676-};
677-
678-namespace helper
679-{
680-template<typename T, typename U>
681-struct TypeMapper<com::ubuntu::location::wgs84::Coordinate<T,U>>
682-{
683- constexpr static ArgumentType type_value()
684- {
685- return ArgumentType::structure;
686- }
687- constexpr static bool is_basic_type()
688- {
689- return false;
690- }
691- constexpr static bool requires_signature()
692- {
693- return true;
694- }
695-
696- static std::string signature()
697- {
698- static const std::string s =
699- DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
700- TypeMapper<com::ubuntu::location::units::Quantity<U>>::signature() +
701- DBUS_STRUCT_END_CHAR_AS_STRING;
702- return s;
703- }
704-};
705-}
706+ }
707+};
708
709 template<typename T, typename U>
710 struct Codec<com::ubuntu::location::wgs84::Coordinate<T,U>>
711 {
712- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::wgs84::Coordinate<T, U>& in)
713- {
714- Codec<com::ubuntu::location::units::Quantity<U>>::encode_argument(out, in.value);
715- }
716-
717- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::wgs84::Coordinate<T, U>& in)
718- {
719- Codec<com::ubuntu::location::units::Quantity<U>>::decode_argument(out, in.value);
720- }
721-};
722-
723-namespace helper
724-{
725-template<>
726-struct TypeMapper<com::ubuntu::location::Position>
727-{
728- constexpr static ArgumentType type_value()
729- {
730- return ArgumentType::structure;
731- }
732- constexpr static bool is_basic_type()
733- {
734- return false;
735- }
736- constexpr static bool requires_signature()
737- {
738- return true;
739- }
740-
741- static std::string signature()
742- {
743- static const std::string s =
744- TypeMapper<uint64_t>::signature() +
745- TypeMapper<com::ubuntu::location::wgs84::Latitude>::signature() +
746- TypeMapper<com::ubuntu::location::wgs84::Longitude>::signature() +
747- TypeMapper<com::ubuntu::location::wgs84::Altitude>::signature();
748- return s;
749- }
750-};
751-}
752+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::wgs84::Coordinate<T, U>& in)
753+ {
754+ Codec<com::ubuntu::location::units::Quantity<U>>::encode_argument(writer, in.value);
755+ }
756+
757+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::wgs84::Coordinate<T, U>& in)
758+ {
759+ Codec<com::ubuntu::location::units::Quantity<U>>::decode_argument(reader, in.value);
760+ }
761+};
762
763 template<>
764 struct Codec<com::ubuntu::location::Position>
765 {
766- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::Position& in)
767- {
768- Codec<uint64_t>::encode_argument(out, in.flags().to_ulong());
769- if (in.has_latitude())
770- Codec<com::ubuntu::location::wgs84::Latitude>::encode_argument(out, in.latitude());
771- if (in.has_longitude())
772- Codec<com::ubuntu::location::wgs84::Longitude>::encode_argument(out, in.longitude());
773- if (in.has_altitude())
774- Codec<com::ubuntu::location::wgs84::Altitude>::encode_argument(out, in.altitude());
775- }
776-
777- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::Position& in)
778- {
779- com::ubuntu::location::wgs84::Latitude lat;
780- com::ubuntu::location::wgs84::Longitude lon;
781- com::ubuntu::location::wgs84::Altitude alt;
782- uint64_t flags_on_wire;
783- Codec<uint64_t>::decode_argument(out, flags_on_wire);
784- dbus_message_iter_next(out);
785-
786- com::ubuntu::location::Position::Flags flags{flags_on_wire};
787- if (flags.test(com::ubuntu::location::Position::latitude_flag))
788- {
789- Codec<com::ubuntu::location::wgs84::Latitude>::decode_argument(out, lat);
790- in.latitude(lat);
791- }
792- if (flags.test(com::ubuntu::location::Position::latitude_flag))
793- {
794- Codec<com::ubuntu::location::wgs84::Longitude>::decode_argument(out, lon);
795- in.longitude(lon);
796- }
797- if (flags.test(com::ubuntu::location::Position::altitude_flag))
798- {
799- Codec<com::ubuntu::location::wgs84::Altitude>::decode_argument(out, alt);
800- in.altitude(alt);
801- }
802- }
803-};
804-
805-namespace helper
806-{
807-template<>
808-struct TypeMapper<com::ubuntu::location::Velocity>
809-{
810- constexpr static ArgumentType type_value()
811- {
812- return ArgumentType::structure;
813- }
814- constexpr static bool is_basic_type()
815- {
816- return false;
817- }
818- constexpr static bool requires_signature()
819- {
820- return true;
821- }
822-
823- static std::string signature()
824- {
825- static const std::string s =
826- DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
827- TypeMapper<typename com::ubuntu::location::Velocity::Quantity>::signature() +
828- DBUS_STRUCT_END_CHAR_AS_STRING;
829- return s;
830- }
831-};
832-}
833-
834-template<>
835-struct Codec<com::ubuntu::location::Velocity>
836-{
837- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::Velocity& in)
838- {
839- Codec<typename com::ubuntu::location::Velocity::Quantity>::encode_argument(out, in.value);
840- }
841-
842- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::Velocity& in)
843- {
844- Codec<typename com::ubuntu::location::Velocity::Quantity>::decode_argument(out, in.value);
845- }
846-};
847-
848-namespace helper
849-{
850-template<>
851-struct TypeMapper<com::ubuntu::location::Heading>
852-{
853- constexpr static ArgumentType type_value()
854- {
855- return ArgumentType::structure;
856- }
857- constexpr static bool is_basic_type()
858- {
859- return false;
860- }
861- constexpr static bool requires_signature()
862- {
863- return true;
864- }
865-
866- static std::string signature()
867- {
868- static const std::string s =
869- DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
870- TypeMapper<typename com::ubuntu::location::Heading::Quantity>::signature() +
871- DBUS_STRUCT_END_CHAR_AS_STRING;
872- return s;
873- }
874-};
875-}
876-
877-template<>
878-struct Codec<com::ubuntu::location::Heading>
879-{
880- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::Heading& in)
881- {
882- Codec<typename com::ubuntu::location::Heading::Quantity>::encode_argument(out, in.value);
883- }
884-
885- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::Heading& in)
886- {
887- Codec<typename com::ubuntu::location::Heading::Quantity>::decode_argument(out, in.value);
888- }
889-};
890-
891-namespace helper
892-{
893-template<typename T>
894-struct TypeMapper<com::ubuntu::location::Accuracy<T>>
895-{
896- constexpr static ArgumentType type_value()
897- {
898- return ArgumentType::structure;
899- }
900- constexpr static bool is_basic_type()
901- {
902- return false;
903- }
904- constexpr static bool requires_signature()
905- {
906- return true;
907- }
908-
909- static std::string signature()
910- {
911- static const std::string s =
912- DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
913- TypeMapper<T>::signature() +
914- DBUS_STRUCT_END_CHAR_AS_STRING;
915- return s;
916- }
917-};
918-}
919-
920-template<typename T>
921-struct Codec<com::ubuntu::location::Accuracy<T>>
922-{
923- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::Accuracy<T>& in)
924- {
925- Codec<T>::encode_argument(out, in.value);
926- }
927-
928- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::Accuracy<T>& in)
929- {
930- Codec<T>::decode_argument(out, in.value);
931- }
932-};
933-
934-namespace helper
935-{
936-template<>
937-struct TypeMapper<com::ubuntu::location::Criteria>
938-{
939- constexpr static ArgumentType type_value()
940- {
941- return ArgumentType::structure;
942- }
943- constexpr static bool is_basic_type()
944- {
945- return false;
946- }
947- constexpr static bool requires_signature()
948- {
949- return true;
950- }
951-
952- static std::string signature()
953- {
954- static const std::string s =
955- DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
956- helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Latitude>>::signature() +
957- helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Longitude>>::signature() +
958- helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Altitude>>::signature() +
959- helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::Velocity>>::signature() +
960- helper::TypeMapper<com::ubuntu::location::Accuracy<com::ubuntu::location::Heading>>::signature() +
961- DBUS_STRUCT_END_CHAR_AS_STRING;
962- return s;
963- }
964-};
965-}
966+ typedef com::ubuntu::location::Position::Accuracy::Horizontal HorizontalAccuracy;
967+ typedef com::ubuntu::location::Position::Accuracy::Vertical VerticalAccuracy;
968+
969+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Position& in)
970+ {
971+ Codec<com::ubuntu::location::wgs84::Latitude>::encode_argument(writer, in.latitude);
972+ Codec<com::ubuntu::location::wgs84::Longitude>::encode_argument(writer, in.longitude);
973+ Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::encode_argument(writer, in.altitude);
974+
975+ Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::encode_argument(writer, in.accuracy.horizontal);
976+ Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::encode_argument(writer, in.accuracy.vertical);
977+ }
978+
979+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::Position& in)
980+ {
981+ Codec<com::ubuntu::location::wgs84::Latitude>::decode_argument(reader, in.latitude);
982+ Codec<com::ubuntu::location::wgs84::Longitude>::decode_argument(reader, in.longitude);
983+ Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::decode_argument(reader, in.altitude);
984+
985+ Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::decode_argument(reader, in.accuracy.horizontal);
986+ Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::decode_argument(reader, in.accuracy.vertical);
987+ }
988+};
989+
990+
991+namespace helper
992+{
993+template<>
994+struct TypeMapper<com::ubuntu::location::SpaceVehicle::Key>
995+{
996+ constexpr static ArgumentType type_value()
997+ {
998+ return ArgumentType::structure;
999+ }
1000+ constexpr static bool is_basic_type()
1001+ {
1002+ return false;
1003+ }
1004+ constexpr static bool requires_signature()
1005+ {
1006+ return true;
1007+ }
1008+
1009+ static std::string signature()
1010+ {
1011+ static const std::string s =
1012+ helper::TypeMapper<std::uint32_t>::signature() +
1013+ helper::TypeMapper<std::uint32_t>::signature();
1014+ return s;
1015+ }
1016+};
1017+template<>
1018+struct TypeMapper<com::ubuntu::location::SpaceVehicle>
1019+{
1020+ constexpr static ArgumentType type_value()
1021+ {
1022+ return ArgumentType::structure;
1023+ }
1024+ constexpr static bool is_basic_type()
1025+ {
1026+ return false;
1027+ }
1028+ constexpr static bool requires_signature()
1029+ {
1030+ return true;
1031+ }
1032+
1033+ inline static std::string signature()
1034+ {
1035+ std::string s =
1036+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING +
1037+ helper::TypeMapper<com::ubuntu::location::SpaceVehicle::Key>::signature() +
1038+ helper::TypeMapper<float>::signature() +
1039+ helper::TypeMapper<bool>::signature() +
1040+ helper::TypeMapper<bool>::signature() +
1041+ helper::TypeMapper<bool>::signature() +
1042+ helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() +
1043+ helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() +
1044+ DBUS_STRUCT_END_CHAR_AS_STRING;
1045+ return s;
1046+ }
1047+};
1048+}
1049+
1050+template<>
1051+struct Codec<com::ubuntu::location::SpaceVehicle::Key>
1052+{
1053+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle::Key& in)
1054+ {
1055+ writer.push_uint32(static_cast<std::uint32_t>(in.type));
1056+ writer.push_uint32(in.id);
1057+ }
1058+
1059+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::SpaceVehicle::Key& in)
1060+ {
1061+ in.type = static_cast<com::ubuntu::location::SpaceVehicle::Type>(reader.pop_uint32());
1062+ in.id = reader.pop_uint32();
1063+ }
1064+};
1065+
1066+template<>
1067+struct Codec<com::ubuntu::location::SpaceVehicle>
1068+{
1069+ inline static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle& in)
1070+ {
1071+ auto sub = writer.open_structure();
1072+
1073+ Codec<com::ubuntu::location::SpaceVehicle::Key>::encode_argument(sub, in.key);
1074+ sub.push_floating_point(in.snr);
1075+ sub.push_boolean(in.has_almanac_data);
1076+ sub.push_boolean(in.has_ephimeris_data);
1077+ sub.push_boolean(in.used_in_fix);
1078+ Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument(sub, in.azimuth);
1079+ Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument(sub, in.elevation);
1080+
1081+ writer.close_structure(std::move(sub));
1082+ }
1083+
1084+ inline static void decode_argument(Message::Reader& reader, com::ubuntu::location::SpaceVehicle& in)
1085+ {
1086+ auto sub = reader.pop_structure();
1087+
1088+ Codec<com::ubuntu::location::SpaceVehicle::Key>::decode_argument(sub, in.key);
1089+ in.snr = sub.pop_floating_point();
1090+ in.has_almanac_data = sub.pop_boolean();
1091+ in.has_ephimeris_data = sub.pop_boolean();
1092+ in.used_in_fix = sub.pop_boolean();
1093+ Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument(sub, in.azimuth);
1094+ Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument(sub, in.elevation);
1095+ }
1096+};
1097+
1098+namespace helper
1099+{
1100+template<>
1101+struct TypeMapper<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>>
1102+{
1103+ constexpr static ArgumentType type_value()
1104+ {
1105+ return ArgumentType::array;
1106+ }
1107+ constexpr static bool is_basic_type()
1108+ {
1109+ return false;
1110+ }
1111+ constexpr static bool requires_signature()
1112+ {
1113+ return true;
1114+ }
1115+
1116+ static std::string signature()
1117+ {
1118+ static const std::string s = DBUS_TYPE_ARRAY_AS_STRING + TypeMapper<com::ubuntu::location::SpaceVehicle>::signature();
1119+ return s;
1120+ }
1121+};
1122+}
1123+template<>
1124+struct Codec<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>>
1125+{
1126+ inline static void encode_argument(Message::Writer& writer, const std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& arg)
1127+ {
1128+ types::Signature signature(helper::TypeMapper<com::ubuntu::location::SpaceVehicle>::signature());
1129+ auto sub = writer.open_array(signature);
1130+
1131+ for(const auto& element : arg)
1132+ {
1133+ Codec<com::ubuntu::location::SpaceVehicle>::encode_argument(sub, element.second);
1134+ }
1135+
1136+ writer.close_array(std::move(sub));
1137+ }
1138+
1139+ inline static void decode_argument(Message::Reader& reader, std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& out)
1140+ {
1141+ auto sub = reader.pop_array();
1142+ while (sub.type() != ArgumentType::invalid)
1143+ {
1144+ com::ubuntu::location::SpaceVehicle sv;
1145+ Codec<com::ubuntu::location::SpaceVehicle>::decode_argument(sub, sv);
1146+ out.insert(std::make_pair(sv.key, sv));
1147+ }
1148+ }
1149+};
1150
1151 template<>
1152 struct Codec<com::ubuntu::location::Criteria>
1153 {
1154- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::Criteria& in)
1155- {
1156- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Latitude>>::encode_argument(out, in.latitude_accuracy);
1157- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Longitude>>::encode_argument(out, in.longitude_accuracy);
1158- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Altitude>>::encode_argument(out, in.altitude_accuracy);
1159- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Velocity>>::encode_argument(out, in.velocity_accuracy);
1160- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Heading>>::encode_argument(out, in.heading_accuracy);
1161- }
1162-
1163- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::Criteria& in)
1164- {
1165- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Latitude>>::decode_argument(out, in.latitude_accuracy);
1166- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Longitude>>::decode_argument(out, in.longitude_accuracy);
1167- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::wgs84::Altitude>>::decode_argument(out, in.altitude_accuracy);
1168- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Velocity>>::decode_argument(out, in.velocity_accuracy);
1169- Codec<com::ubuntu::location::Accuracy<com::ubuntu::location::Heading>>::decode_argument(out, in.heading_accuracy);
1170- }
1171+ typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> HorizontalAccuracy;
1172+ typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> VerticalAccuracy;
1173+ typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Velocity> VelocityAccuracy;
1174+ typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle> HeadingAccuracy;
1175+
1176+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Criteria& in)
1177+ {
1178+ Codec<bool>::encode_argument(writer, in.requires.position);
1179+ Codec<bool>::encode_argument(writer, in.requires.altitude);
1180+ Codec<bool>::encode_argument(writer, in.requires.heading);
1181+ Codec<bool>::encode_argument(writer, in.requires.velocity);
1182+
1183+ Codec<HorizontalAccuracy>::encode_argument(writer, in.accuracy.horizontal);
1184+ Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::encode_argument(writer, in.accuracy.vertical);
1185+ Codec<com::ubuntu::location::Optional<VelocityAccuracy>>::encode_argument(writer, in.accuracy.velocity);
1186+ Codec<com::ubuntu::location::Optional<HeadingAccuracy>>::encode_argument(writer, in.accuracy.heading);
1187+ }
1188+
1189+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::Criteria& in)
1190+ {
1191+ Codec<bool>::decode_argument(reader, in.requires.position);
1192+ Codec<bool>::decode_argument(reader, in.requires.altitude);
1193+ Codec<bool>::decode_argument(reader, in.requires.heading);
1194+ Codec<bool>::decode_argument(reader, in.requires.velocity);
1195+
1196+ Codec<HorizontalAccuracy>::decode_argument(reader, in.accuracy.horizontal);
1197+ Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::decode_argument(reader, in.accuracy.vertical);
1198+ Codec<com::ubuntu::location::Optional<VelocityAccuracy>>::decode_argument(reader, in.accuracy.velocity);
1199+ Codec<com::ubuntu::location::Optional<HeadingAccuracy>>::decode_argument(reader, in.accuracy.heading);
1200+ }
1201 };
1202 namespace helper
1203 {
1204@@ -409,23 +372,19 @@
1205 template<typename T>
1206 struct Codec<com::ubuntu::location::Update<T>>
1207 {
1208- static void encode_argument(DBusMessageIter* out, const com::ubuntu::location::Update<T>& in)
1209+ static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Update<T>& in)
1210 {
1211- Codec<T>::encode_argument(out, in.value);
1212- Codec<int64_t>::encode_argument(out, in.when.time_since_epoch().count());
1213+ Codec<T>::encode_argument(writer, in.value);
1214+ Codec<int64_t>::encode_argument(writer, in.when.time_since_epoch().count());
1215 }
1216
1217- static void decode_argument(DBusMessageIter* out, com::ubuntu::location::Update<T>& in)
1218+ static void decode_argument(Message::Reader& reader, com::ubuntu::location::Update<T>& in)
1219 {
1220- Codec<T>::decode_argument(out, in.value);
1221- int64_t value;
1222- Codec<int64_t>::decode_argument(out, value);
1223- dbus_message_iter_next(out);
1224- in.when = com::ubuntu::location::Clock::Timestamp(com::ubuntu::location::Clock::Duration(value));
1225+ Codec<T>::decode_argument(reader, in.value);
1226+ in.when = com::ubuntu::location::Clock::Timestamp(com::ubuntu::location::Clock::Duration(reader.pop_int64()));
1227 }
1228 };
1229 }
1230 }
1231-}
1232
1233 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CODEC_H_
1234
1235=== added directory 'include/location_service/com/ubuntu/location/connectivity'
1236=== added file 'include/location_service/com/ubuntu/location/connectivity/bounded_integer.h'
1237--- include/location_service/com/ubuntu/location/connectivity/bounded_integer.h 1970-01-01 00:00:00 +0000
1238+++ include/location_service/com/ubuntu/location/connectivity/bounded_integer.h 2014-02-03 13:52:45 +0000
1239@@ -0,0 +1,184 @@
1240+/*
1241+ * Copyright © 2012-2013 Canonical Ltd.
1242+ *
1243+ * This program is free software: you can redistribute it and/or modify it
1244+ * under the terms of the GNU Lesser General Public License version 3,
1245+ * as published by the Free Software Foundation.
1246+ *
1247+ * This program is distributed in the hope that it will be useful,
1248+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1249+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1250+ * GNU Lesser General Public License for more details.
1251+ *
1252+ * You should have received a copy of the GNU Lesser General Public License
1253+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1254+ *
1255+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1256+ */
1257+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_BOUNDED_INTEGER_H_
1258+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_BOUNDED_INTEGER_H_
1259+
1260+#include <iostream>
1261+#include <stdexcept>
1262+
1263+namespace com
1264+{
1265+namespace ubuntu
1266+{
1267+namespace location
1268+{
1269+namespace connectivity
1270+{
1271+/**
1272+ * @brief A helper class to handle bounded integer values, with an optional domain
1273+ * for tagging domain-specific types.
1274+ */
1275+template<int min, int max, int domain = 0>
1276+class BoundedInteger
1277+{
1278+public:
1279+ static_assert(min < max, "min >= max");
1280+
1281+ /**
1282+ * @brief Access the minimum value of the integer.
1283+ */
1284+ inline static int minimum()
1285+ {
1286+ return min;
1287+ }
1288+
1289+ /**
1290+ * @brief Access the maximum value of the integer.
1291+ */
1292+ inline static int maximum()
1293+ {
1294+ return max;
1295+ }
1296+
1297+ /**
1298+ * @brief Returns max - min.
1299+ */
1300+ inline static int range()
1301+ {
1302+ return max - min;
1303+ }
1304+
1305+ /**
1306+ * @brief Constructs an invalid instance.
1307+ */
1308+ BoundedInteger() : value(min-1)
1309+ {
1310+ }
1311+
1312+ /**
1313+ * @brief Constructs an instance from a raw value
1314+ * @param value The raw value.
1315+ * @throw std::runtime_error if value is not in [min, max].
1316+ */
1317+ explicit BoundedInteger(int value) : value(value)
1318+ {
1319+ if (value < min || value > max)
1320+ throw std::runtime_error(
1321+ std::to_string(value) + " is not in " + "[" +
1322+ std::to_string(min) + ", " + std::to_string(max) + "]");
1323+ }
1324+
1325+ /**
1326+ * @brief Copy c'tor.
1327+ * @param rhs The instance to copy from.
1328+ */
1329+ BoundedInteger(const BoundedInteger<min, max, domain>& rhs) : value(rhs.value)
1330+ {
1331+ }
1332+
1333+ /**
1334+ * @brief Assignment operator.
1335+ * @param rhs The instance to assign from.
1336+ * @return A mutable reference to this instance.
1337+ */
1338+ BoundedInteger<min, max, domain>& operator=(const BoundedInteger<min, max, domain>& rhs)
1339+ {
1340+ value = rhs.value;
1341+ return *this;
1342+ }
1343+
1344+ /**
1345+ * @brief Equality comparison operator.
1346+ * @param rhs The instance to compare to.
1347+ * @return true iff both instances' value are equal.
1348+ */
1349+ bool operator==(const BoundedInteger<min, max, domain>& rhs) const
1350+ {
1351+ return value == rhs.value;
1352+ }
1353+
1354+ /**
1355+ * @brief Implicit casting operator to a raw integer value.
1356+ * @return The raw integer value.
1357+ */
1358+ inline operator int() const
1359+ {
1360+ return get();
1361+ }
1362+
1363+ /**
1364+ * @brief is_valid checks whether the contained value is in [min, max].
1365+ * @return true iff the contained integer value is in [min, max].
1366+ */
1367+ inline bool is_valid() const
1368+ {
1369+ return min <= value && value <= max;
1370+ }
1371+
1372+ /**
1373+ * @brief Returns the raw integer value contained in this instance.
1374+ * @throw std::runtime_error if is_valid() returns false.
1375+ */
1376+ inline int get() const
1377+ {
1378+ if (!is_valid())
1379+ throw std::runtime_error("BoundedInteger::get: Contained value is not valid.");
1380+
1381+ return value;
1382+ }
1383+
1384+ /**
1385+ * @brief Assigns a new raw integer value
1386+ * @param new_value The new value.
1387+ * @throw std::runtime_error if new_value is not in [min, max].
1388+ */
1389+ inline void set(int new_value)
1390+ {
1391+ if (new_value < min || new_value > max)
1392+ throw std::runtime_error(
1393+ std::to_string(new_value) + " is not in " + "[" +
1394+ std::to_string(min) + ", " + std::to_string(max) + "]");
1395+
1396+ value = new_value;
1397+ }
1398+
1399+ /**
1400+ * @brief operator << pretty prints an instance of BoundedInteger.
1401+ * @param out The stream to print to.
1402+ * @param bi The instance to print.
1403+ * @return The stream that has been printed to.
1404+ */
1405+ inline friend std::ostream& operator<<(std::ostream& out, const BoundedInteger<min, max, domain>& bi)
1406+ {
1407+ out << bi.value;
1408+
1409+ if (!bi.is_valid())
1410+ out << " -> invalid";
1411+
1412+ return out;
1413+ }
1414+
1415+private:
1416+ int value;
1417+};
1418+}
1419+}
1420+}
1421+}
1422+
1423+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_BOUNDED_INTEGER_H_
1424
1425=== added file 'include/location_service/com/ubuntu/location/connectivity/manager.h'
1426--- include/location_service/com/ubuntu/location/connectivity/manager.h 1970-01-01 00:00:00 +0000
1427+++ include/location_service/com/ubuntu/location/connectivity/manager.h 2014-02-03 13:52:45 +0000
1428@@ -0,0 +1,93 @@
1429+/*
1430+ * Copyright © 2012-2013 Canonical Ltd.
1431+ *
1432+ * This program is free software: you can redistribute it and/or modify it
1433+ * under the terms of the GNU Lesser General Public License version 3,
1434+ * as published by the Free Software Foundation.
1435+ *
1436+ * This program is distributed in the hope that it will be useful,
1437+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1438+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1439+ * GNU Lesser General Public License for more details.
1440+ *
1441+ * You should have received a copy of the GNU Lesser General Public License
1442+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1443+ *
1444+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1445+ */
1446+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_MANAGER_H_
1447+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_MANAGER_H_
1448+
1449+#include <com/ubuntu/location/connectivity/radio_cell.h>
1450+#include <com/ubuntu/location/connectivity/wireless_network.h>
1451+
1452+#include <core/property.h>
1453+
1454+#include <string>
1455+#include <vector>
1456+
1457+namespace com
1458+{
1459+namespace ubuntu
1460+{
1461+namespace location
1462+{
1463+namespace connectivity
1464+{
1465+/**
1466+ * @brief The Manager class encapsulates access to network/radio information
1467+ */
1468+class Manager
1469+{
1470+public:
1471+ struct Errors
1472+ {
1473+ Errors() = delete;
1474+ /**
1475+ * @brief The ConnectivityManagementNotSupported struct is thrown if underlying
1476+ * platform does not provide support for connectivity mgmt.
1477+ */
1478+ struct ConnectivityManagementNotSupported : public std::runtime_error
1479+ {
1480+ ConnectivityManagementNotSupported()
1481+ : std::runtime_error(
1482+ "Underlying platform does not provide support for connectivity mgmt.")
1483+ {
1484+ }
1485+ };
1486+ };
1487+
1488+ Manager(const Manager& rhs) = delete;
1489+ virtual ~Manager() = default;
1490+
1491+ Manager& operator=(const Manager& rhs) = delete;
1492+ bool operator==(const Manager& rhs) const = delete;
1493+
1494+ /**
1495+ * @brief All wireless networks visible to the device.
1496+ * @return A getable/observable property carrying the visible wireless networks.
1497+ */
1498+ virtual const core::Property<std::vector<WirelessNetwork>>& visible_wireless_networks() = 0;
1499+
1500+ /**
1501+ * @brief All radio cells visible to the device.
1502+ * @return A getable/observable property carrying the visible radio cells.
1503+ */
1504+ virtual const core::Property<std::vector<RadioCell>>& visible_radio_cells() = 0;
1505+
1506+protected:
1507+ Manager() = default;
1508+};
1509+
1510+/**
1511+ * @brief Provides access to a platform-specific implementation/instance of a connectivity manager.
1512+ * @throw Manager::Errors::ConnectivityManagementNotSupported.
1513+ * @return An instance of a connectivity manager.
1514+ */
1515+const std::shared_ptr<Manager>& platform_default_manager();
1516+}
1517+}
1518+}
1519+}
1520+
1521+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_MANAGER_H_
1522
1523=== added file 'include/location_service/com/ubuntu/location/connectivity/radio_cell.h'
1524--- include/location_service/com/ubuntu/location/connectivity/radio_cell.h 1970-01-01 00:00:00 +0000
1525+++ include/location_service/com/ubuntu/location/connectivity/radio_cell.h 2014-02-03 13:52:45 +0000
1526@@ -0,0 +1,400 @@
1527+/*
1528+ * Copyright © 2012-2013 Canonical Ltd.
1529+ *
1530+ * This program is free software: you can redistribute it and/or modify it
1531+ * under the terms of the GNU Lesser General Public License version 3,
1532+ * as published by the Free Software Foundation.
1533+ *
1534+ * This program is distributed in the hope that it will be useful,
1535+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1536+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1537+ * GNU Lesser General Public License for more details.
1538+ *
1539+ * You should have received a copy of the GNU Lesser General Public License
1540+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1541+ *
1542+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1543+ */
1544+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_RADIO_CELL_H_
1545+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_RADIO_CELL_H_
1546+
1547+#include <com/ubuntu/location/connectivity/bounded_integer.h>
1548+
1549+namespace com
1550+{
1551+namespace ubuntu
1552+{
1553+namespace location
1554+{
1555+namespace connectivity
1556+{
1557+class RadioCell
1558+{
1559+public:
1560+ enum class Type
1561+ {
1562+ unknown,
1563+ gsm,
1564+ umts,
1565+ cdma,
1566+ lte
1567+ };
1568+
1569+ enum class Domain
1570+ {
1571+ mcc,
1572+ mnc,
1573+ lac,
1574+ id,
1575+ pid,
1576+ rss,
1577+ asu,
1578+ ta
1579+ };
1580+
1581+ template<int min, int max>
1582+ using MobileCountryCode = BoundedInteger<min, max, static_cast<int>(Domain::mcc)>;
1583+ template<int min, int max>
1584+ using MobileNetworkCode = BoundedInteger<min, max, static_cast<int>(Domain::mnc)>;
1585+ template<int min, int max>
1586+ using LocationAreaCode = BoundedInteger<min, max, static_cast<int>(Domain::lac)>;
1587+ template<int min, int max>
1588+ using CellId = BoundedInteger<min, max, static_cast<int>(Domain::id)>;
1589+ template<int min, int max>
1590+ using PhysicalId = BoundedInteger<min, max, static_cast<int>(Domain::pid)>;
1591+ template<int min, int max>
1592+ using ReceivedSignalStrength = BoundedInteger<min, max, static_cast<int>(Domain::rss)>;
1593+ template<int min, int max>
1594+ using ArbitraryStrengthUnit = BoundedInteger<min, max, static_cast<int>(Domain::asu)>;
1595+ template<int min, int max>
1596+ using TimingAdvance = BoundedInteger<min, max, static_cast<int>(Domain::ta)>;
1597+
1598+ struct Gsm
1599+ {
1600+ typedef MobileCountryCode<0,999> MCC;
1601+ typedef MobileNetworkCode<0,999> MNC;
1602+ typedef LocationAreaCode<0,65535> LAC;
1603+ typedef CellId<0,65535> ID;
1604+ typedef ReceivedSignalStrength<-113,-51> RSS;
1605+ typedef ArbitraryStrengthUnit<0,31> ASU;
1606+ typedef TimingAdvance<0,63> TA;
1607+
1608+ bool operator==(const Gsm& rhs) const
1609+ {
1610+ return mobile_country_code == rhs.mobile_country_code &&
1611+ mobile_network_code == rhs.mobile_network_code &&
1612+ location_area_code == rhs.location_area_code &&
1613+ id == rhs.id &&
1614+ received_signal_strength == rhs.received_signal_strength &&
1615+ arbitrary_strength_unit == rhs.arbitrary_strength_unit &&
1616+ timing_advance == rhs.timing_advance;
1617+ }
1618+
1619+ inline friend std::ostream& operator<<(std::ostream& out, const Gsm& gsm)
1620+ {
1621+ out << "("
1622+ << "mcc: " << gsm.mobile_country_code << ", "
1623+ << "mnc: " << gsm.mobile_network_code << ", "
1624+ << "lac: " << gsm.location_area_code << ", "
1625+ << "id: " << gsm.id << ", "
1626+ << "rss: " << gsm.received_signal_strength << ", "
1627+ << "asu: " << gsm.arbitrary_strength_unit << ", "
1628+ << "ta: " << gsm.timing_advance << ")";
1629+
1630+ return out;
1631+ }
1632+
1633+ MCC mobile_country_code;
1634+ MNC mobile_network_code;
1635+ LAC location_area_code;
1636+ ID id;
1637+ RSS received_signal_strength;
1638+ ASU arbitrary_strength_unit;
1639+ TA timing_advance;
1640+ };
1641+
1642+ struct Umts
1643+ {
1644+ typedef MobileCountryCode<0,999> MCC;
1645+ typedef MobileNetworkCode<0,999> MNC;
1646+ typedef LocationAreaCode<0,65535> LAC;
1647+ typedef CellId<0,268435455> ID;
1648+ typedef ReceivedSignalStrength<-121,-25> RSS;
1649+ typedef ArbitraryStrengthUnit<-5,91> ASU;
1650+
1651+ bool operator==(const Umts& rhs) const
1652+ {
1653+ return mobile_country_code == rhs.mobile_country_code &&
1654+ mobile_network_code == rhs.mobile_network_code &&
1655+ location_area_code == rhs.location_area_code &&
1656+ id == rhs.id &&
1657+ received_signal_strength == rhs.received_signal_strength &&
1658+ arbitrary_strength_unit == rhs.arbitrary_strength_unit;
1659+ }
1660+
1661+ inline friend std::ostream& operator<<(std::ostream& out, const Umts& umts)
1662+ {
1663+ out << "("
1664+ << "mcc: " << umts.mobile_country_code << ", "
1665+ << "mnc: " << umts.mobile_network_code << ", "
1666+ << "lac: " << umts.location_area_code << ", "
1667+ << "id: " << umts.id << ", "
1668+ << "rss: " << umts.received_signal_strength << ", "
1669+ << "asu: " << umts.arbitrary_strength_unit << ")";
1670+
1671+ return out;
1672+ }
1673+ MCC mobile_country_code;
1674+ MNC mobile_network_code;
1675+ LAC location_area_code;
1676+ ID id;
1677+ RSS received_signal_strength;
1678+ ASU arbitrary_strength_unit;
1679+ };
1680+
1681+ struct Cdma
1682+ {
1683+ typedef MobileCountryCode<0,999> MCC;
1684+ typedef MobileNetworkCode<0,32767> MNC;
1685+ typedef LocationAreaCode<0,65535> LAC;
1686+ typedef CellId<0,65535> ID;
1687+ typedef ReceivedSignalStrength<-100,-75> RSS;
1688+ typedef ArbitraryStrengthUnit<1,16> ASU;
1689+
1690+ bool operator==(const Cdma& rhs) const
1691+ {
1692+ return mobile_country_code == rhs.mobile_country_code &&
1693+ mobile_network_code == rhs.mobile_network_code &&
1694+ location_area_code == rhs.location_area_code &&
1695+ id == rhs.id &&
1696+ received_signal_strength == rhs.received_signal_strength &&
1697+ arbitrary_strength_unit == rhs.arbitrary_strength_unit;
1698+ }
1699+
1700+ inline friend std::ostream& operator<<(std::ostream& out, const Cdma& cdma)
1701+ {
1702+ out << "("
1703+ << "mcc: " << cdma.mobile_country_code << ", "
1704+ << "mnc: " << cdma.mobile_network_code << ", "
1705+ << "lac: " << cdma.location_area_code << ", "
1706+ << "id: " << cdma.id << ", "
1707+ << "rss: " << cdma.received_signal_strength << ", "
1708+ << "asu: " << cdma.arbitrary_strength_unit << ")";
1709+
1710+ return out;
1711+ }
1712+
1713+ MCC mobile_country_code;
1714+ MNC mobile_network_code;
1715+ LAC location_area_code;
1716+ ID id;
1717+ RSS received_signal_strength;
1718+ ASU arbitrary_strength_unit;
1719+ };
1720+
1721+ struct Lte
1722+ {
1723+ typedef MobileCountryCode<0,999> MCC;
1724+ typedef MobileNetworkCode<0,32767> MNC;
1725+ typedef LocationAreaCode<0,65535> LAC;
1726+ typedef CellId<0,268435455> ID;
1727+ typedef PhysicalId<0,503> PID;
1728+ typedef ReceivedSignalStrength<-137,-45> RSS;
1729+ typedef ArbitraryStrengthUnit<0,95> ASU;
1730+ typedef TimingAdvance<0,63> TA;
1731+
1732+ bool operator==(const Lte& rhs) const
1733+ {
1734+ return mobile_country_code == rhs.mobile_country_code &&
1735+ mobile_network_code == rhs.mobile_network_code &&
1736+ location_area_code == rhs.location_area_code &&
1737+ id == rhs.id &&
1738+ physical_id == rhs.physical_id &&
1739+ received_signal_strength == rhs.received_signal_strength &&
1740+ arbitrary_strength_unit == rhs.arbitrary_strength_unit &&
1741+ timing_advance == rhs.timing_advance;
1742+ }
1743+
1744+ inline friend std::ostream& operator<<(std::ostream& out, const Lte& lte)
1745+ {
1746+ out << "("
1747+ << "mcc: " << lte.mobile_country_code << ", "
1748+ << "mnc: " << lte.mobile_network_code << ", "
1749+ << "lac: " << lte.location_area_code << ", "
1750+ << "id: " << lte.id << ", "
1751+ << "id: " << lte.physical_id << ", "
1752+ << "rss: " << lte.received_signal_strength << ", "
1753+ << "asu: " << lte.arbitrary_strength_unit << ", "
1754+ << "ta: " << lte.timing_advance << ")";
1755+
1756+ return out;
1757+ }
1758+
1759+ MCC mobile_country_code;
1760+ MNC mobile_network_code;
1761+ LAC location_area_code;
1762+ ID id;
1763+ PID physical_id;
1764+ RSS received_signal_strength;
1765+ ASU arbitrary_strength_unit;
1766+ TA timing_advance;
1767+ };
1768+
1769+ RadioCell() : radio_type(Type::gsm), detail{Gsm()}
1770+ {
1771+ }
1772+
1773+ explicit RadioCell(const Gsm& gsm)
1774+ : radio_type(Type::gsm), detail{gsm}
1775+ {
1776+ }
1777+
1778+ explicit RadioCell(const Umts& umts)
1779+ : radio_type(Type::umts), detail{umts}
1780+ {
1781+ }
1782+
1783+ explicit RadioCell(const Cdma& cdma)
1784+ : radio_type(Type::cdma), detail{cdma}
1785+ {
1786+ }
1787+
1788+ explicit RadioCell(const Lte& lte)
1789+ : radio_type(Type::lte), detail{lte}
1790+ {
1791+ }
1792+
1793+ RadioCell(const RadioCell& rhs) : radio_type(rhs.radio_type)
1794+ {
1795+ switch(radio_type)
1796+ {
1797+ case Type::gsm: detail.gsm = rhs.detail.gsm; break;
1798+ case Type::cdma: detail.cdma = rhs.detail.cdma; break;
1799+ case Type::umts: detail.umts = rhs.detail.umts; break;
1800+ case Type::lte: detail.lte = rhs.detail.lte; break;
1801+ case Type::unknown: break;
1802+ }
1803+ }
1804+
1805+ RadioCell& operator=(const RadioCell& rhs)
1806+ {
1807+ radio_type = rhs.radio_type;
1808+ switch(radio_type)
1809+ {
1810+ case Type::gsm: detail.gsm = rhs.detail.gsm; break;
1811+ case Type::cdma: detail.cdma = rhs.detail.cdma; break;
1812+ case Type::umts: detail.umts = rhs.detail.umts; break;
1813+ case Type::lte: detail.lte = rhs.detail.lte; break;
1814+ case Type::unknown: break;
1815+ }
1816+
1817+ return *this;
1818+ }
1819+
1820+ bool operator==(const RadioCell& rhs) const
1821+ {
1822+ if (radio_type != rhs.radio_type)
1823+ return false;
1824+
1825+ switch(radio_type)
1826+ {
1827+ case Type::gsm: return detail.gsm == rhs.detail.gsm;
1828+ case Type::cdma: return detail.cdma == rhs.detail.cdma;
1829+ case Type::umts: return detail.umts == rhs.detail.umts;
1830+ case Type::lte: return detail.lte == rhs.detail.lte;
1831+ default: return true;
1832+ }
1833+
1834+ return false;
1835+ }
1836+
1837+ Type type() const
1838+ {
1839+ return radio_type;
1840+ }
1841+
1842+ const Gsm& gsm() const
1843+ {
1844+ if (radio_type != Type::gsm)
1845+ throw std::runtime_error("Bad access to unset network type.");
1846+
1847+ return detail.gsm;
1848+ }
1849+
1850+ const Umts& umts() const
1851+ {
1852+ if (radio_type != Type::umts)
1853+ throw std::runtime_error("Bad access to unset network type.");
1854+
1855+ return detail.umts;
1856+ }
1857+
1858+ const Cdma& cdma() const
1859+ {
1860+ if (radio_type != Type::cdma)
1861+ throw std::runtime_error("Bad access to unset network type.");
1862+
1863+ return detail.cdma;
1864+ }
1865+
1866+ const Lte& lte() const
1867+ {
1868+ if (radio_type != Type::lte)
1869+ throw std::runtime_error("Bad access to unset network type.");
1870+
1871+ return detail.lte;
1872+ }
1873+
1874+ inline friend std::ostream& operator<<(std::ostream& out, const RadioCell& cell)
1875+ {
1876+ switch (cell.radio_type)
1877+ {
1878+ case RadioCell::Type::gsm: out << cell.detail.gsm; break;
1879+ case RadioCell::Type::cdma: out << cell.detail.cdma; break;
1880+ case RadioCell::Type::umts: out << cell.detail.umts; break;
1881+ case RadioCell::Type::lte: out << cell.detail.lte; break;
1882+ case RadioCell::Type::unknown: break;
1883+ }
1884+
1885+ return out;
1886+ }
1887+
1888+private:
1889+ Type radio_type;
1890+
1891+ struct None {};
1892+ union Detail
1893+ {
1894+ inline Detail() : none(None{})
1895+ {
1896+ }
1897+
1898+ inline explicit Detail(const Gsm& gsm) : gsm(gsm)
1899+ {
1900+ }
1901+
1902+ inline explicit Detail(const Umts& umts) : umts(umts)
1903+ {
1904+ }
1905+
1906+ inline explicit Detail(const Cdma& cdma) : cdma(cdma)
1907+ {
1908+ }
1909+
1910+ inline explicit Detail(const Lte& lte) : lte(lte)
1911+ {
1912+ }
1913+ None none;
1914+ Gsm gsm;
1915+ Umts umts;
1916+ Cdma cdma;
1917+ Lte lte;
1918+ } detail;
1919+};
1920+}
1921+}
1922+}
1923+}
1924+
1925+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_RADIO_CELL_H_
1926+
1927
1928=== added file 'include/location_service/com/ubuntu/location/connectivity/wireless_network.h'
1929--- include/location_service/com/ubuntu/location/connectivity/wireless_network.h 1970-01-01 00:00:00 +0000
1930+++ include/location_service/com/ubuntu/location/connectivity/wireless_network.h 2014-02-03 13:52:45 +0000
1931@@ -0,0 +1,71 @@
1932+/*
1933+ * Copyright © 2012-2013 Canonical Ltd.
1934+ *
1935+ * This program is free software: you can redistribute it and/or modify it
1936+ * under the terms of the GNU Lesser General Public License version 3,
1937+ * as published by the Free Software Foundation.
1938+ *
1939+ * This program is distributed in the hope that it will be useful,
1940+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1941+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1942+ * GNU Lesser General Public License for more details.
1943+ *
1944+ * You should have received a copy of the GNU Lesser General Public License
1945+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1946+ *
1947+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1948+ */
1949+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
1950+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
1951+
1952+#include <com/ubuntu/location/connectivity/bounded_integer.h>
1953+
1954+#include <string>
1955+
1956+namespace com
1957+{
1958+namespace ubuntu
1959+{
1960+namespace location
1961+{
1962+namespace connectivity
1963+{
1964+struct WirelessNetwork
1965+{
1966+ enum class Domain
1967+ {
1968+ frequency,
1969+ channel
1970+ };
1971+
1972+ typedef BoundedInteger<2412, 5825, static_cast<int>(Domain::frequency)> Frequency;
1973+ typedef BoundedInteger<1, 165, static_cast<int>(Domain::channel)> Channel;
1974+
1975+ bool operator==(const WirelessNetwork& rhs) const
1976+ {
1977+ return bssid == rhs.bssid &&
1978+ frequency == rhs.frequency &&
1979+ channel == rhs.channel &&
1980+ snr == rhs.snr;
1981+ }
1982+
1983+ friend std::ostream& operator<<(std::ostream& out, const WirelessNetwork& wifi)
1984+ {
1985+ return out << "("
1986+ << "bssid: " << wifi.bssid << ", "
1987+ << "frequency: " << wifi.frequency << ", "
1988+ << "channel: " << wifi.channel << ", "
1989+ << "snr: " << wifi.snr << ")";
1990+ }
1991+
1992+ std::string bssid; ///< The BSSID of the network.
1993+ Frequency frequency; ///< Frequency of the network/AP.
1994+ Channel channel; ///< Channel of the network/AP.
1995+ float snr; ///< Signal-noise ratio of the specific network.
1996+};
1997+}
1998+}
1999+}
2000+}
2001+
2002+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_
2003
2004=== modified file 'include/location_service/com/ubuntu/location/criteria.h'
2005--- include/location_service/com/ubuntu/location/criteria.h 2013-05-28 14:41:06 +0000
2006+++ include/location_service/com/ubuntu/location/criteria.h 2014-02-03 13:52:45 +0000
2007@@ -18,16 +18,8 @@
2008 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CRITERIA_H_
2009 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CRITERIA_H_
2010
2011-#include "com/ubuntu/location/accuracy.h"
2012-#include "com/ubuntu/location/heading.h"
2013-#include "com/ubuntu/location/velocity.h"
2014-#include "com/ubuntu/location/wgs84/altitude.h"
2015-#include "com/ubuntu/location/wgs84/latitude.h"
2016-#include "com/ubuntu/location/wgs84/longitude.h"
2017-
2018-#include <limits>
2019-#include <ostream>
2020-#include <stdexcept>
2021+#include <com/ubuntu/location/optional.h>
2022+#include <com/ubuntu/location/units/units.h>
2023
2024 namespace com
2025 {
2026@@ -35,22 +27,40 @@
2027 {
2028 namespace location
2029 {
2030+/**
2031+ * @brief Summarizes criteria of a client session with respect to functionality
2032+ * and accuracy for position, velocity and heading measurements.
2033+ */
2034 struct Criteria
2035 {
2036- Criteria() : latitude_accuracy(),
2037- longitude_accuracy(),
2038- altitude_accuracy(),
2039- velocity_accuracy(),
2040- heading_accuracy()
2041- {
2042- }
2043-
2044- Accuracy<wgs84::Latitude> latitude_accuracy;
2045- Accuracy<wgs84::Longitude> longitude_accuracy;
2046- Accuracy<wgs84::Altitude> altitude_accuracy;
2047- Accuracy<Velocity> velocity_accuracy;
2048- Accuracy<Heading> heading_accuracy;
2049+ /**
2050+ * @brief satisfies checks whether this instance also satisfies another criteria instance.
2051+ * @param rhs The other criteria instance
2052+ * @return true iff this instance also satisfies the other instance, else false.
2053+ */
2054+ bool satisfies(const Criteria& rhs) const;
2055+
2056+ struct Requires
2057+ {
2058+ bool position = true; ///< The client needs position measurements.
2059+ bool altitude = false; ///< The client needs altitude measurements.
2060+ bool velocity = false; ///< The client needs velocity measurments.
2061+ bool heading = false; ///< The client needs heading measurements.
2062+ } requires = Requires{};
2063+
2064+ struct Accuracy
2065+ {
2066+ units::Quantity<units::Length> horizontal = 3000 * units::Meters; ///< The client requires measurements of at least this horizontal accuracy.
2067+ Optional<units::Quantity<units::Length>> vertical; ///< The client requires measurements of at least this vertical accuracy.
2068+ Optional<units::Quantity<units::Velocity>> velocity; ///< The client requires measurements of at least this velocity accuracy.
2069+ Optional<units::Quantity<units::PlaneAngle>> heading; ///< The client requires measurements of at least this heading accuracy.
2070+ } accuracy = Accuracy{};
2071 };
2072+
2073+/**
2074+ * @brief operator + merges lhs and rhs such that satisfying the new criteria satisfies lhs and rhs.
2075+ */
2076+Criteria operator+(const Criteria& lhs, const Criteria& rhs);
2077 }
2078 }
2079 }
2080
2081=== modified file 'include/location_service/com/ubuntu/location/default_provider_selection_policy.h'
2082--- include/location_service/com/ubuntu/location/default_provider_selection_policy.h 2013-05-28 14:41:06 +0000
2083+++ include/location_service/com/ubuntu/location/default_provider_selection_policy.h 2014-02-03 13:52:45 +0000
2084@@ -18,7 +18,7 @@
2085 #ifndef LOCATION_SERVICE_COM_UBUNTU_DEFAULT_PROVIDER_SELECTION_POLICY_H_
2086 #define LOCATION_SERVICE_COM_UBUNTU_DEFAULT_PROVIDER_SELECTION_POLICY_H_
2087
2088-#include "com/ubuntu/location/provider_selection_policy.h"
2089+#include <com/ubuntu/location/provider_selection_policy.h>
2090
2091 namespace com
2092 {
2093@@ -32,21 +32,21 @@
2094 DefaultProviderSelectionPolicy();
2095 ~DefaultProviderSelectionPolicy() noexcept;
2096
2097- ProviderSelection determine_provider_selection_from_set_for_criteria(
2098+ ProviderSelection determine_provider_selection_for_criteria(
2099 const Criteria& criteria,
2100- const std::set<Provider::Ptr>& providers);
2101+ const ProviderEnumerator& enumerator);
2102
2103 Provider::Ptr determine_position_updates_provider(
2104 const Criteria& criteria,
2105- const std::set<Provider::Ptr>& providers);
2106+ const ProviderEnumerator& enumerator);
2107
2108 Provider::Ptr determine_heading_updates_provider(
2109 const Criteria& criteria,
2110- const std::set<Provider::Ptr>& providers);
2111+ const ProviderEnumerator& enumerator);
2112
2113 Provider::Ptr determine_velocity_updates_provider(
2114 const Criteria& criteria,
2115- const std::set<Provider::Ptr>& providers);
2116+ const ProviderEnumerator& enumerator);
2117 };
2118 }
2119 }
2120
2121=== modified file 'include/location_service/com/ubuntu/location/engine.h'
2122--- include/location_service/com/ubuntu/location/engine.h 2013-05-28 14:41:06 +0000
2123+++ include/location_service/com/ubuntu/location/engine.h 2014-02-03 13:52:45 +0000
2124@@ -18,10 +18,16 @@
2125 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_ENGINE_H_
2126 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_ENGINE_H_
2127
2128-#include "com/ubuntu/location/criteria.h"
2129-#include "com/ubuntu/location/provider.h"
2130-#include "com/ubuntu/location/provider_selection_policy.h"
2131-
2132+#include <com/ubuntu/location/provider.h>
2133+#include <com/ubuntu/location/provider_enumerator.h>
2134+#include <com/ubuntu/location/provider_selection.h>
2135+#include <com/ubuntu/location/satellite_based_positioning_state.h>
2136+#include <com/ubuntu/location/space_vehicle.h>
2137+#include <com/ubuntu/location/wifi_and_cell_reporting_state.h>
2138+
2139+#include <core/property.h>
2140+
2141+#include <mutex>
2142 #include <set>
2143
2144 namespace com
2145@@ -30,26 +36,116 @@
2146 {
2147 namespace location
2148 {
2149-class Engine
2150+struct Criteria;
2151+class ProviderSelectionPolicy;
2152+/**
2153+ * @brief The Engine class encapsulates a positioning engine, relying on a set
2154+ * of providers and reporters to acquire and publish location information.
2155+ */
2156+class Engine : public ProviderEnumerator
2157 {
2158 public:
2159 typedef std::shared_ptr<Engine> Ptr;
2160
2161- Engine(const std::set<Provider::Ptr>& initial_providers,
2162- const ProviderSelectionPolicy::Ptr& provider_selection_policy);
2163+ /**
2164+ * @brief The State enum models the current state of the engine
2165+ */
2166+ enum class Status
2167+ {
2168+ off, ///< The engine is currently offline.
2169+ on, ///< The engine and providers are powered on but not navigating.
2170+ active ///< The engine and providers are powered on and navigating.
2171+ };
2172+
2173+ /**
2174+ * @brief The Configuration struct summarizes the state of the engine.
2175+ */
2176+ struct Configuration
2177+ {
2178+ /** Setable/getable/observable property for the satellite based positioning state. */
2179+ core::Property<SatelliteBasedPositioningState> satellite_based_positioning_state
2180+ {
2181+ SatelliteBasedPositioningState::on
2182+ };
2183+ /** Setable/getable/observable property for the satellite based positioning state. */
2184+ core::Property<WifiAndCellIdReportingState> wifi_and_cell_id_reporting_state
2185+ {
2186+ WifiAndCellIdReportingState::off
2187+ };
2188+ /** Setable/getable/observable property for the overall engine state. */
2189+ core::Property<Engine::Status> engine_state
2190+ {
2191+ Engine::Status::on
2192+ };
2193+ };
2194+
2195+ struct Updates
2196+ {
2197+ /** The current best known reference location */
2198+ core::Property<Update<Position>> reference_location{};
2199+ /** The current best known velocity estimate. */
2200+ core::Property<Update<Velocity>> reference_velocity{};
2201+ /** The current best known heading estimate. */
2202+ core::Property<Update<Heading>> reference_heading{};
2203+ /** The current set of visible SpaceVehicles. */
2204+ core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>> visible_space_vehicles{};
2205+ };
2206+
2207+ Engine(const std::shared_ptr<ProviderSelectionPolicy>& provider_selection_policy);
2208 Engine(const Engine&) = delete;
2209 Engine& operator=(const Engine&) = delete;
2210 virtual ~Engine() = default;
2211
2212+ /**
2213+ * @brief Calculates a set of providers that satisfies the given criteria.
2214+ * @param [in] criteria The criteria to be satisfied by the returned provider selection.
2215+ * @return A provider selection that satisfies the given criteria.
2216+ */
2217 virtual ProviderSelection determine_provider_selection_for_criteria(const Criteria& criteria);
2218
2219+ /**
2220+ * @brief Checks if the engine knows about a specific provider.
2221+ * @return True iff the engine knows about the provider.
2222+ */
2223 virtual bool has_provider(const Provider::Ptr& provider) noexcept;
2224+
2225+ /**
2226+ * @brief Makes a provider known to the engine.
2227+ * @param provider The new provider.
2228+ */
2229 virtual void add_provider(const Provider::Ptr& provider);
2230+
2231+ /**
2232+ * @brief Removes a provider from the engine.
2233+ * @param provider The provider to be removed.
2234+ */
2235 virtual void remove_provider(const Provider::Ptr& provider) noexcept;
2236
2237+ /**
2238+ * @brief Iterates all known providers and invokes the provided enumerator for each of them.
2239+ * @param enumerator The functor to be invoked for each provider.
2240+ */
2241+ virtual void for_each_provider(const std::function<void(const Provider::Ptr&)>& enumerator) const noexcept;
2242+
2243+ /** The engine's configuration. */
2244+ Configuration configuration;
2245+
2246+ /** All updates distributed via the engine. */
2247+ Updates updates;
2248+
2249 private:
2250- std::set<Provider::Ptr> providers;
2251- ProviderSelectionPolicy::Ptr provider_selection_policy;
2252+ struct ProviderConnections
2253+ {
2254+ core::ScopedConnection reference_location_updates;
2255+ core::ScopedConnection reference_velocity_updates;
2256+ core::ScopedConnection reference_heading_updates;
2257+ core::ScopedConnection wifi_and_cell_id_reporting_state_updates;
2258+ core::ScopedConnection space_vehicle_visibility_updates;
2259+ };
2260+
2261+ mutable std::mutex guard;
2262+ std::map<Provider::Ptr, ProviderConnections> providers;
2263+ std::shared_ptr<ProviderSelectionPolicy> provider_selection_policy;
2264 };
2265 }
2266 }
2267
2268=== modified file 'include/location_service/com/ubuntu/location/heading.h'
2269--- include/location_service/com/ubuntu/location/heading.h 2013-05-28 14:41:06 +0000
2270+++ include/location_service/com/ubuntu/location/heading.h 2014-02-03 13:52:45 +0000
2271@@ -18,12 +18,7 @@
2272 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_
2273 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_
2274
2275-#include "com/ubuntu/location/accuracy.h"
2276-#include "com/ubuntu/location/units/units.h"
2277-
2278-#include <limits>
2279-#include <ostream>
2280-#include <stdexcept>
2281+#include <com/ubuntu/location/units/units.h>
2282
2283 namespace com
2284 {
2285@@ -31,74 +26,8 @@
2286 {
2287 namespace location
2288 {
2289-struct Heading
2290-{
2291- typedef units::PlaneAngle Unit;
2292- typedef units::Quantity<Unit> Quantity;
2293-
2294- static const Quantity& min()
2295- {
2296- static const auto instance = Heading::Quantity::from_value(0.);
2297- return instance;
2298- }
2299- static const Quantity& max()
2300- {
2301- static const auto instance = Heading::Quantity::from_value(360.);
2302- return instance;
2303- }
2304-
2305- Heading(const Quantity& value = Quantity()) : value(value)
2306- {
2307- if (value < min())
2308- throw std::out_of_range("");
2309- if (value > max())
2310- throw std::out_of_range("");
2311- }
2312-
2313- bool operator==(const Heading& rhs) const
2314- {
2315- return value == rhs.value;
2316- }
2317-
2318- bool operator!=(const Heading& rhs) const
2319- {
2320- return value != rhs.value;
2321- }
2322-
2323- Quantity value;
2324-};
2325-
2326-inline std::ostream& operator<<(std::ostream& out, const Heading& heading)
2327-{
2328- out << "Heading(" << heading.value << ")";
2329- return out;
2330-}
2331-
2332-template<>
2333-struct AccuracyTraits<Heading>
2334-{
2335- static AccuracyLevel classify(const Heading& h)
2336- {
2337- static const auto half = 0.5 * Heading::max();
2338- if(h.value > half)
2339- return AccuracyLevel::worst;
2340-
2341- if(h.value < half)
2342- return AccuracyLevel::best;
2343-
2344- return AccuracyLevel::worst;
2345- }
2346-
2347- static Accuracy<Heading> best()
2348- {
2349- return Accuracy<Heading>{Heading{Heading::min()}};
2350- }
2351-
2352- static Accuracy<Heading> worst()
2353- {
2354- return Accuracy<Heading>{Heading{Heading::max()}};
2355- }
2356-};
2357+/** Heading is measured in ° deviation from true north. */
2358+typedef units::Quantity<units::PlaneAngle> Heading;
2359 }
2360 }
2361 }
2362
2363=== added file 'include/location_service/com/ubuntu/location/optional.h'
2364--- include/location_service/com/ubuntu/location/optional.h 1970-01-01 00:00:00 +0000
2365+++ include/location_service/com/ubuntu/location/optional.h 2014-02-03 13:52:45 +0000
2366@@ -0,0 +1,35 @@
2367+/*
2368+ * Copyright © 2012-2013 Canonical Ltd.
2369+ *
2370+ * This program is free software: you can redistribute it and/or modify it
2371+ * under the terms of the GNU Lesser General Public License version 3,
2372+ * as published by the Free Software Foundation.
2373+ *
2374+ * This program is distributed in the hope that it will be useful,
2375+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2376+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2377+ * GNU Lesser General Public License for more details.
2378+ *
2379+ * You should have received a copy of the GNU Lesser General Public License
2380+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2381+ *
2382+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2383+ */
2384+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_OPTIONAL_H_
2385+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_OPTIONAL_H_
2386+
2387+#include <boost/optional.hpp>
2388+
2389+namespace com
2390+{
2391+namespace ubuntu
2392+{
2393+namespace location
2394+{
2395+template<typename T>
2396+using Optional = boost::optional<T>;
2397+}
2398+}
2399+}
2400+
2401+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_OPTIONAL_H_
2402
2403=== modified file 'include/location_service/com/ubuntu/location/position.h'
2404--- include/location_service/com/ubuntu/location/position.h 2013-05-28 14:41:06 +0000
2405+++ include/location_service/com/ubuntu/location/position.h 2014-02-03 13:52:45 +0000
2406@@ -18,9 +18,11 @@
2407 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_POSITION_H_
2408 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_POSITION_H_
2409
2410-#include "com/ubuntu/location/wgs84/altitude.h"
2411-#include "com/ubuntu/location/wgs84/latitude.h"
2412-#include "com/ubuntu/location/wgs84/longitude.h"
2413+#include <com/ubuntu/location/wgs84/altitude.h>
2414+#include <com/ubuntu/location/wgs84/latitude.h>
2415+#include <com/ubuntu/location/wgs84/longitude.h>
2416+
2417+#include <com/ubuntu/location/optional.h>
2418
2419 #include <bitset>
2420 #include <ostream>
2421@@ -31,54 +33,30 @@
2422 {
2423 namespace location
2424 {
2425-class Position
2426+/**
2427+ * @brief The Position struct models a position in the wgs84 coordinate system.
2428+ */
2429+struct Position
2430 {
2431- public:
2432- enum Flag
2433- {
2434- latitude_flag = 0,
2435- longitude_flag = 1,
2436- altitude_flag = 2
2437- };
2438-
2439- typedef std::bitset<3> Flags;
2440-
2441- Position();
2442- Position(
2443- const wgs84::Latitude& latitude,
2444- const wgs84::Longitude& longitude);
2445- Position(
2446- const wgs84::Latitude& latitude,
2447- const wgs84::Longitude& longitude,
2448- const wgs84::Altitude& altitude);
2449+ Position() = default;
2450+ Position(const wgs84::Latitude&, const wgs84::Longitude&);
2451+ Position(const wgs84::Latitude&, const wgs84::Longitude&, const wgs84::Altitude&);
2452
2453 bool operator==(const Position& rhs) const;
2454 bool operator!=(const Position& rhs) const;
2455
2456- const Flags& flags() const;
2457-
2458- bool has_latitude() const;
2459- Position& latitude(const wgs84::Latitude& lat);
2460- const wgs84::Latitude& latitude() const;
2461-
2462- bool has_longitude() const;
2463- Position& longitude(const wgs84::Longitude& lon);
2464- const wgs84::Longitude& longitude() const;
2465-
2466- bool has_altitude() const;
2467- Position& altitude(const wgs84::Altitude& alt);
2468- const wgs84::Altitude& altitude() const;
2469-
2470- private:
2471- template<typename> friend struct Codec;
2472-
2473- struct
2474+ wgs84::Latitude latitude = wgs84::Latitude{};
2475+ wgs84::Longitude longitude = wgs84::Longitude{};
2476+ Optional<wgs84::Altitude> altitude = Optional<wgs84::Altitude>{};
2477+
2478+ struct Accuracy
2479 {
2480- Flags flags;
2481- wgs84::Latitude latitude;
2482- wgs84::Longitude longitude;
2483- wgs84::Altitude altitude;
2484- } fields;
2485+ typedef units::Quantity<units::Length> Horizontal;
2486+ typedef units::Quantity<units::Length> Vertical;
2487+
2488+ Optional<Horizontal> horizontal = Horizontal{};
2489+ Optional<Vertical> vertical = Optional<Vertical>{};
2490+ } accuracy = Accuracy{};
2491 };
2492
2493 std::ostream& operator<<(std::ostream& out, const Position& position);
2494
2495=== modified file 'include/location_service/com/ubuntu/location/provider.h'
2496--- include/location_service/com/ubuntu/location/provider.h 2013-05-28 14:41:06 +0000
2497+++ include/location_service/com/ubuntu/location/provider.h 2014-02-03 13:52:45 +0000
2498@@ -18,12 +18,16 @@
2499 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_H_
2500 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_H_
2501
2502-#include "com/ubuntu/location/channel.h"
2503-#include "com/ubuntu/location/criteria.h"
2504-#include "com/ubuntu/location/heading.h"
2505-#include "com/ubuntu/location/position.h"
2506-#include "com/ubuntu/location/update.h"
2507-#include "com/ubuntu/location/velocity.h"
2508+#include <com/ubuntu/location/criteria.h>
2509+#include <com/ubuntu/location/heading.h>
2510+#include <com/ubuntu/location/position.h>
2511+#include <com/ubuntu/location/space_vehicle.h>
2512+#include <com/ubuntu/location/update.h>
2513+#include <com/ubuntu/location/velocity.h>
2514+#include <com/ubuntu/location/wifi_and_cell_reporting_state.h>
2515+
2516+#include <core/property.h>
2517+#include <core/signal.h>
2518
2519 #include <atomic>
2520 #include <bitset>
2521@@ -35,97 +39,125 @@
2522 {
2523 namespace location
2524 {
2525+/**
2526+ * @brief The Provider class is the abstract base of all positioning providers.
2527+ */
2528 class Provider
2529 {
2530 public:
2531 typedef std::shared_ptr<Provider> Ptr;
2532
2533- enum class Feature : std::size_t
2534- {
2535- position,
2536- velocity,
2537- heading
2538- };
2539-
2540- typedef std::bitset<3> FeatureFlags;
2541-
2542- enum class Requirement : std::size_t
2543- {
2544- satellites,
2545- cell_network,
2546- data_network,
2547- monetary_spending
2548- };
2549-
2550- typedef std::bitset<4> RequirementFlags;
2551-
2552+ /**
2553+ * @brief Enumerates the known features that can be supported by providers.
2554+ */
2555+ enum class Features : std::size_t
2556+ {
2557+ none = 0, ///< The provider does not support any feature.
2558+ position = 1 << 0, ///< The provider features position updates.
2559+ velocity = 1 << 1, ///< The provider features velocity updates.
2560+ heading = 1 << 2 ///< The provider features heading updates.
2561+ };
2562+
2563+ /**
2564+ * @brief Enumerates the requirements of a provider implementation.
2565+ */
2566+ enum class Requirements : std::size_t
2567+ {
2568+ none = 0, ///< The provider does not require anything.
2569+ satellites = 1 << 0, ///< The provider requires satellites to be visible.
2570+ cell_network = 1 << 1, ///< The provider requires a cell-network to work correctly.
2571+ data_network = 1 << 2, ///< The provider requires a data-network to work correctly.
2572+ monetary_spending = 1 << 3 ///< Using the provider results in monetary cost.
2573+ };
2574+
2575+ /**
2576+ * @brief Facade for controlling the state of position/heading/velocity updates.
2577+ *
2578+ * Multiple observers can request state changes for updates. This class ensures
2579+ * that the specific updates are started and stopped if at least one observer
2580+ * requests them and stopped when the last observer issues a stop request.
2581+ */
2582 class Controller
2583 {
2584 public:
2585 typedef std::shared_ptr<Controller> Ptr;
2586
2587- template<typename T>
2588- class Cache
2589- {
2590- public:
2591- Cache() : d{ T{}, false }
2592- {
2593- }
2594- const T& value() const { return d.value; }
2595- void update(const T& new_value) { d.value = new_value; d.is_valid = true; }
2596- bool is_valid() const { return d.is_valid; }
2597- void invalidate() { d.is_valid = false; }
2598-
2599- private:
2600- struct
2601- {
2602- T value;
2603- bool is_valid;
2604- } d;
2605- };
2606-
2607 virtual ~Controller() = default;
2608 Controller(const Controller&) = delete;
2609 Controller& operator=(const Controller&) = delete;
2610
2611+ /**
2612+ * @brief Request to start position updates if not already running.
2613+ */
2614 virtual void start_position_updates();
2615+
2616+ /**
2617+ * @brief Request to stop position updates. Only stops the provider when the last observer calls this function.
2618+ */
2619 virtual void stop_position_updates();
2620+
2621+ /**
2622+ * @brief Checks if position updates are currently running.
2623+ * @return true iff position updates are currently running.
2624+ */
2625 bool are_position_updates_running() const;
2626
2627+ /**
2628+ * @brief Request to start heading updates if not already running.
2629+ */
2630 virtual void start_heading_updates();
2631+
2632+ /**
2633+ * @brief Request to stop heading updates. Only stops the provider when the last observer calls this function.
2634+ */
2635 virtual void stop_heading_updates();
2636+
2637+ /**
2638+ * @brief Checks if position updates are currently running.
2639+ * @return true iff position updates are currently running.
2640+ */
2641 bool are_heading_updates_running() const;
2642
2643+ /**
2644+ * @brief Request to start velocity updates if not already running.
2645+ */
2646 virtual void start_velocity_updates();
2647+
2648+ /**
2649+ * @brief Request to stop velocity updates. Only stops the provider when the last observer calls this function.
2650+ */
2651 virtual void stop_velocity_updates();
2652+
2653+ /**
2654+ * @brief Checks if velocity updates are currently running.
2655+ * @return true iff velocity updates are currently running.
2656+ */
2657 bool are_velocity_updates_running() const;
2658
2659- const Cache<Update<Position>>& cached_position_update() const;
2660- const Cache<Update<Heading>>& cached_heading_update() const;
2661- const Cache<Update<Velocity>>& cached_velocity_update() const;
2662-
2663 protected:
2664 friend class Provider;
2665 explicit Controller(Provider& instance);
2666
2667 private:
2668- void on_position_updated(const Update<Position>& position);
2669- void on_velocity_updated(const Update<Velocity>& velocity);
2670- void on_heading_updated(const Update<Heading>& heading);
2671-
2672 Provider& instance;
2673 std::atomic<int> position_updates_counter;
2674 std::atomic<int> heading_updates_counter;
2675 std::atomic<int> velocity_updates_counter;
2676- ScopedChannelConnection position_update_connection;
2677- ScopedChannelConnection velocity_update_connection;
2678- ScopedChannelConnection heading_update_connection;
2679- struct
2680- {
2681- Cache<Update<Position>> position;
2682- Cache<Update<Velocity>> velocity;
2683- Cache<Update<Heading>> heading;
2684- } cached;
2685+ };
2686+
2687+ /**
2688+ * @brief Wraps all updates that can be delivered by a provider.
2689+ */
2690+ struct Updates
2691+ {
2692+ /** Position updates. */
2693+ core::Signal<Update<Position>> position;
2694+ /** Heading updates. */
2695+ core::Signal<Update<Heading>> heading;
2696+ /** Velocity updates. */
2697+ core::Signal<Update<Velocity>> velocity;
2698+ /** Space vehicle visibility updates. */
2699+ core::Signal<Update<std::set<SpaceVehicle>>> svs;
2700 };
2701
2702 virtual ~Provider() = default;
2703@@ -133,43 +165,114 @@
2704 Provider(const Provider&) = delete;
2705 Provider& operator=(const Provider&) = delete;
2706
2707+ /**
2708+ * @brief Provides non-mutable access to this provider's updates.
2709+ * @return A non-mutable reference to the updates.
2710+ */
2711+ virtual const Updates& updates() const;
2712+
2713+ /**
2714+ * @brief Access to the controller facade of this provider instance.
2715+ */
2716 virtual const Controller::Ptr& state_controller() const;
2717
2718- virtual ChannelConnection subscribe_to_position_updates(std::function<void(const Update<Position>&)> f);
2719- virtual ChannelConnection subscribe_to_heading_updates(std::function<void(const Update<Heading>&)> f);
2720- virtual ChannelConnection subscribe_to_velocity_updates(std::function<void(const Update<Velocity>&)> f);
2721-
2722- virtual bool supports(const Feature& f) const;
2723- virtual bool requires(const Requirement& r) const;
2724-
2725- virtual bool matches_criteria(const Criteria&);
2726-
2727+ /**
2728+ * @brief Checks if the provider supports a specific feature.
2729+ * @param f Feature to test for
2730+ * @return true iff the provider supports the feature.
2731+ */
2732+ virtual bool supports(const Features& f) const;
2733+
2734+ /**
2735+ * @brief Checks if the provider has got a specific requirement.
2736+ * @param r Requirement to test for.
2737+ * @return true iff the provider has the specific requirement.
2738+ */
2739+ virtual bool requires(const Requirements& r) const;
2740+
2741+ /**
2742+ * @brief Checks if a provider satisfies a set of accuracy criteria.
2743+ * @param [in] criteria The criteria to check.
2744+ * @return true iff the provider satisfies the given criteria.
2745+ */
2746+ virtual bool matches_criteria(const Criteria& criteria);
2747+
2748+ /**
2749+ * @brief Called by the engine whenever the wifi and cell ID reporting state changes.
2750+ * @param state The new state.
2751+ */
2752+ virtual void on_wifi_and_cell_reporting_state_changed(WifiAndCellIdReportingState state);
2753+
2754+ /**
2755+ * @brief Called by the engine whenever the reference location changed.
2756+ * @param position The new reference location.
2757+ */
2758+ virtual void on_reference_location_updated(const Update<Position>& position);
2759+
2760+ /**
2761+ * @brief Called by the engine whenever the reference velocity changed.
2762+ * @param velocity The new reference velocity.
2763+ */
2764+ virtual void on_reference_velocity_updated(const Update<Velocity>& velocity);
2765+
2766+ /**
2767+ * @brief Called by the engine whenever the reference heading changed.
2768+ * @param heading The new reference heading.
2769+ */
2770+ virtual void on_reference_heading_updated(const Update<Heading>& heading);
2771+
2772 protected:
2773 explicit Provider(
2774- const FeatureFlags& feature_flags = FeatureFlags(),
2775- const RequirementFlags& requirement_flags = RequirementFlags());
2776+ const Features& features = Features::none,
2777+ const Requirements& requirements = Requirements::none);
2778
2779- void deliver_position_updates(const Update<Position>& update);
2780- void deliver_heading_updates(const Update<Heading>& update);
2781- void deliver_velocity_updates(const Update<Velocity>& update);
2782+ virtual Updates& mutable_updates();
2783
2784+ /**
2785+ * @brief Implementation-specific, empty by default.
2786+ */
2787 virtual void start_position_updates();
2788+
2789+ /**
2790+ * @brief Implementation-specific, empty by default.
2791+ */
2792 virtual void stop_position_updates();
2793
2794+ /**
2795+ * @brief Implementation-specific, empty by default.
2796+ */
2797 virtual void start_heading_updates();
2798+
2799+ /**
2800+ * @brief Implementation-specific, empty by default.
2801+ */
2802 virtual void stop_heading_updates();
2803
2804+ /**
2805+ * @brief Implementation-specific, empty by default.
2806+ */
2807 virtual void start_velocity_updates();
2808+
2809+ /**
2810+ * @brief Implementation-specific, empty by default.
2811+ */
2812 virtual void stop_velocity_updates();
2813
2814 private:
2815- FeatureFlags feature_flags;
2816- RequirementFlags requirement_flags;
2817- Channel<Update<Position>> position_updates_channel;
2818- Channel<Update<Heading>> heading_updates_channel;
2819- Channel<Update<Velocity>> velocity_updates_channel;
2820- Controller::Ptr controller;
2821+ struct
2822+ {
2823+ Features features = Features::none;
2824+ Requirements requirements = Requirements::none;
2825+ Updates updates;
2826+ Controller::Ptr controller = Controller::Ptr{};
2827+ } d;
2828 };
2829+
2830+Provider::Features operator|(Provider::Features lhs, Provider::Features rhs);
2831+Provider::Features operator&(Provider::Features lhs, Provider::Features rhs);
2832+
2833+Provider::Requirements operator|(Provider::Requirements lhs, Provider::Requirements rhs);
2834+Provider::Requirements operator&(Provider::Requirements lhs, Provider::Requirements rhs);
2835 }
2836 }
2837 }
2838
2839=== added file 'include/location_service/com/ubuntu/location/provider_enumerator.h'
2840--- include/location_service/com/ubuntu/location/provider_enumerator.h 1970-01-01 00:00:00 +0000
2841+++ include/location_service/com/ubuntu/location/provider_enumerator.h 2014-02-03 13:52:45 +0000
2842@@ -0,0 +1,49 @@
2843+/*
2844+ * Copyright © 2012-2013 Canonical Ltd.
2845+ *
2846+ * This program is free software: you can redistribute it and/or modify it
2847+ * under the terms of the GNU Lesser General Public License version 3,
2848+ * as published by the Free Software Foundation.
2849+ *
2850+ * This program is distributed in the hope that it will be useful,
2851+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2852+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2853+ * GNU Lesser General Public License for more details.
2854+ *
2855+ * You should have received a copy of the GNU Lesser General Public License
2856+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2857+ *
2858+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2859+ */
2860+#ifndef LOCATION_SERVICE_COM_UBUNTU_PROVIDER_ENUMERATOR_H_
2861+#define LOCATION_SERVICE_COM_UBUNTU_PROVIDER_ENUMERATOR_H_
2862+
2863+#include <functional>
2864+#include <memory>
2865+
2866+namespace com
2867+{
2868+namespace ubuntu
2869+{
2870+namespace location
2871+{
2872+class Provider;
2873+class ProviderEnumerator
2874+{
2875+public:
2876+ ProviderEnumerator(const ProviderEnumerator&) = delete;
2877+ virtual ~ProviderEnumerator() = default;
2878+
2879+ ProviderEnumerator& operator=(const ProviderEnumerator&) = delete;
2880+ bool operator==(const ProviderEnumerator&) const = delete;
2881+
2882+ virtual void for_each_provider(const std::function<void(const std::shared_ptr<Provider>&)>&) const = 0;
2883+
2884+protected:
2885+ ProviderEnumerator() = default;
2886+};
2887+}
2888+}
2889+}
2890+
2891+#endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_ENUMERATOR_H_
2892
2893=== modified file 'include/location_service/com/ubuntu/location/provider_factory.h'
2894--- include/location_service/com/ubuntu/location/provider_factory.h 2013-05-29 06:04:02 +0000
2895+++ include/location_service/com/ubuntu/location/provider_factory.h 2014-02-03 13:52:45 +0000
2896@@ -18,8 +18,8 @@
2897 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_FACTORY_H_
2898 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_FACTORY_H_
2899
2900-#include "com/ubuntu/location/configuration.h"
2901-#include "com/ubuntu/location/provider.h"
2902+#include <com/ubuntu/location/configuration.h>
2903+#include <com/ubuntu/location/provider.h>
2904
2905 #include <functional>
2906 #include <map>
2907@@ -57,7 +57,7 @@
2908 ProviderFactory& operator=(const ProviderFactory&) = delete;
2909
2910 std::mutex guard;
2911- std::map<std::string, Factory> factory_store;
2912+ std::map<std::string, Factory> factory_store;
2913 };
2914 }
2915 }
2916
2917=== added file 'include/location_service/com/ubuntu/location/provider_selection.h'
2918--- include/location_service/com/ubuntu/location/provider_selection.h 1970-01-01 00:00:00 +0000
2919+++ include/location_service/com/ubuntu/location/provider_selection.h 2014-02-03 13:52:45 +0000
2920@@ -0,0 +1,62 @@
2921+/*
2922+ * Copyright © 2012-2013 Canonical Ltd.
2923+ *
2924+ * This program is free software: you can redistribute it and/or modify it
2925+ * under the terms of the GNU Lesser General Public License version 3,
2926+ * as published by the Free Software Foundation.
2927+ *
2928+ * This program is distributed in the hope that it will be useful,
2929+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2930+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2931+ * GNU Lesser General Public License for more details.
2932+ *
2933+ * You should have received a copy of the GNU Lesser General Public License
2934+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2935+ *
2936+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2937+ */
2938+#ifndef LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_H_
2939+#define LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_H_
2940+
2941+#include <com/ubuntu/location/provider.h>
2942+
2943+#include <memory>
2944+
2945+namespace com
2946+{
2947+namespace ubuntu
2948+{
2949+namespace location
2950+{
2951+struct ProviderSelection
2952+{
2953+ inline Provider::Features to_feature_flags() const
2954+ {
2955+ Provider::Features flags = Provider::Features::none;
2956+
2957+ if (position_updates_provider)
2958+ flags = flags | Provider::Features::position;
2959+ if (heading_updates_provider)
2960+ flags = flags | Provider::Features::heading;
2961+ if(velocity_updates_provider)
2962+ flags = flags | Provider::Features::velocity;
2963+
2964+ return flags;
2965+ }
2966+
2967+ std::shared_ptr<Provider> position_updates_provider;
2968+ std::shared_ptr<Provider> heading_updates_provider;
2969+ std::shared_ptr<Provider> velocity_updates_provider;
2970+};
2971+
2972+inline bool operator==(const ProviderSelection& lhs, const ProviderSelection& rhs)
2973+{
2974+ return lhs.position_updates_provider == rhs.position_updates_provider &&
2975+ lhs.heading_updates_provider == rhs.heading_updates_provider &&
2976+ lhs.velocity_updates_provider == rhs.velocity_updates_provider;
2977+}
2978+}
2979+}
2980+}
2981+
2982+#endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_H_
2983
2984=== modified file 'include/location_service/com/ubuntu/location/provider_selection_policy.h'
2985--- include/location_service/com/ubuntu/location/provider_selection_policy.h 2013-06-10 11:10:00 +0000
2986+++ include/location_service/com/ubuntu/location/provider_selection_policy.h 2014-02-03 13:52:45 +0000
2987@@ -18,7 +18,8 @@
2988 #ifndef LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_POLICY_H_
2989 #define LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_POLICY_H_
2990
2991-#include "com/ubuntu/location/provider.h"
2992+#include <com/ubuntu/location/provider_enumerator.h>
2993+#include <com/ubuntu/location/provider_selection.h>
2994
2995 #include <memory>
2996
2997@@ -29,52 +30,23 @@
2998 namespace location
2999 {
3000 struct Criteria;
3001-
3002-struct ProviderSelection
3003-{
3004- ProviderSelection(const Provider::Ptr position = Provider::Ptr{},
3005- const Provider::Ptr heading = Provider::Ptr{},
3006- const Provider::Ptr velocity = Provider::Ptr{}) : position_updates_provider(position),
3007- heading_updates_provider(heading),
3008- velocity_updates_provider(velocity)
3009- {
3010- }
3011-
3012- Provider::FeatureFlags to_feature_flags() const
3013- {
3014- Provider::FeatureFlags flags;
3015- flags.set(static_cast<std::size_t>(Provider::Feature::position), static_cast<bool>(position_updates_provider));
3016- flags.set(static_cast<std::size_t>(Provider::Feature::heading), static_cast<bool>(heading_updates_provider));
3017- flags.set(static_cast<std::size_t>(Provider::Feature::velocity), static_cast<bool>(velocity_updates_provider));
3018-
3019- return flags;
3020- }
3021-
3022- Provider::Ptr position_updates_provider;
3023- Provider::Ptr heading_updates_provider;
3024- Provider::Ptr velocity_updates_provider;
3025-};
3026-
3027-inline bool operator==(const ProviderSelection& lhs, const ProviderSelection& rhs)
3028-{
3029- return lhs.position_updates_provider == rhs.position_updates_provider &&
3030- lhs.heading_updates_provider == rhs.heading_updates_provider &&
3031- lhs.velocity_updates_provider == rhs.velocity_updates_provider;
3032-}
3033+class Engine;
3034
3035 class ProviderSelectionPolicy
3036 {
3037 public:
3038 typedef std::shared_ptr<ProviderSelectionPolicy> Ptr;
3039
3040+ ProviderSelectionPolicy(const ProviderSelectionPolicy&) = delete;
3041+ ProviderSelectionPolicy& operator=(const ProviderSelectionPolicy&) = delete;
3042 virtual ~ProviderSelectionPolicy() = default;
3043
3044- virtual ProviderSelection determine_provider_selection_from_set_for_criteria(const Criteria& criteria, const std::set<Provider::Ptr>& providers) = 0;
3045+ virtual ProviderSelection determine_provider_selection_for_criteria(
3046+ const Criteria& criteria,
3047+ const ProviderEnumerator& enumerator) = 0;
3048+
3049 protected:
3050 ProviderSelectionPolicy() = default;
3051-private:
3052- ProviderSelectionPolicy(const ProviderSelectionPolicy&) = delete;
3053- ProviderSelectionPolicy& operator=(const ProviderSelectionPolicy&) = delete;
3054 };
3055 }
3056 }
3057
3058=== modified file 'include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h'
3059--- include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h 2013-05-28 14:41:06 +0000
3060+++ include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h 2014-02-03 13:52:45 +0000
3061@@ -18,14 +18,14 @@
3062 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_
3063 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_
3064
3065-#include "org/freedesktop/dbus/service.h"
3066-#include "org/freedesktop/dbus/traits/service.h"
3067-#include "org/freedesktop/dbus/types/struct.h"
3068-#include "org/freedesktop/dbus/types/stl/tuple.h"
3069+#include <core/dbus/service.h>
3070+#include <core/dbus/traits/service.h>
3071+#include <core/dbus/types/struct.h>
3072+#include <core/dbus/types/stl/tuple.h>
3073
3074 #include <string>
3075
3076-namespace dbus = org::freedesktop::dbus;
3077+namespace dbus = core::dbus;
3078
3079 namespace org
3080 {
3081@@ -43,13 +43,13 @@
3082
3083 friend std::ostream& operator<<(std::ostream& out, const Status& status)
3084 {
3085- static std::map<Status, std::string> lut =
3086- {
3087- {Status::error, "error"},
3088- {Status::unavailable, "unavailable"},
3089- {Status::acquiring, "acquiring"},
3090- {Status::available, "available"}
3091- };
3092+ static std::map<Status, std::string> lut =
3093+ {
3094+ {Status::error, "error"},
3095+ {Status::unavailable, "unavailable"},
3096+ {Status::acquiring, "acquiring"},
3097+ {Status::available, "available"}
3098+ };
3099
3100 return out << lut[status];
3101 }
3102@@ -59,7 +59,7 @@
3103 inline static std::string name()
3104 {
3105 return "GetProviderInfo";
3106- }
3107+ }
3108 typedef Geoclue Interface;
3109 typedef std::tuple<std::string, std::string> ResultType;
3110 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3111@@ -70,7 +70,7 @@
3112 inline static std::string name()
3113 {
3114 return "GetStatus";
3115- }
3116+ }
3117 typedef Geoclue Interface;
3118 typedef int32_t ResultType;
3119 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3120@@ -81,7 +81,7 @@
3121 inline static std::string name()
3122 {
3123 return "AddReference";
3124- }
3125+ }
3126 typedef Geoclue Interface;
3127 typedef void ResultType;
3128 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3129@@ -92,7 +92,7 @@
3130 inline static std::string name()
3131 {
3132 return "RemoveReference";
3133- }
3134+ }
3135 typedef Geoclue Interface;
3136 typedef void ResultType;
3137 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3138@@ -105,7 +105,7 @@
3139 inline static std::string name()
3140 {
3141 return "GetAddress";
3142- }
3143+ }
3144 typedef Address Interface;
3145 typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType;
3146 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3147@@ -127,24 +127,24 @@
3148
3149 struct Position
3150 {
3151- struct Field
3152- {
3153+ struct Field
3154+ {
3155 Field() = delete;
3156
3157 static const int none = 0;
3158 static const int latitude = 1;
3159 static const int longitude = 2;
3160 static const int altitude = 3;
3161- };
3162+ };
3163
3164- typedef std::bitset<4> FieldFlags;
3165+ typedef std::bitset<4> FieldFlags;
3166
3167 struct GetPosition
3168 {
3169 inline static std::string name()
3170 {
3171 return "GetPosition";
3172- }
3173+ }
3174 typedef Position Interface;
3175 typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType;
3176 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3177@@ -166,24 +166,24 @@
3178
3179 struct Velocity
3180 {
3181- struct Field
3182- {
3183+ struct Field
3184+ {
3185 Field() = delete;
3186
3187 static const int none = 0;
3188 static const int speed = 1;
3189 static const int direction = 2;
3190 static const int climb = 3;
3191- };
3192+ };
3193
3194- typedef std::bitset<4> FieldFlags;
3195+ typedef std::bitset<4> FieldFlags;
3196
3197 struct GetVelocity
3198 {
3199 inline static std::string name()
3200 {
3201 return "GetVelocity";
3202- }
3203+ }
3204 typedef Velocity Interface;
3205 typedef std::tuple<int32_t, int32_t, double, double, double> ResultType;
3206 inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3207@@ -205,9 +205,7 @@
3208 }
3209 }
3210
3211-namespace org
3212-{
3213-namespace freedesktop
3214+namespace core
3215 {
3216 namespace dbus
3217 {
3218@@ -255,6 +253,5 @@
3219 }
3220 }
3221 }
3222-}
3223
3224 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_
3225
3226=== modified file 'include/location_service/com/ubuntu/location/providers/geoclue/provider.h'
3227--- include/location_service/com/ubuntu/location/providers/geoclue/provider.h 2013-05-29 06:04:02 +0000
3228+++ include/location_service/com/ubuntu/location/providers/geoclue/provider.h 2014-02-03 13:52:45 +0000
3229@@ -18,8 +18,8 @@
3230 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_PROVIDER_H_
3231 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_PROVIDER_H_
3232
3233-#include "com/ubuntu/location/provider.h"
3234-#include "com/ubuntu/location/provider_factory.h"
3235+#include <com/ubuntu/location/provider.h>
3236+#include <com/ubuntu/location/provider_factory.h>
3237
3238 namespace com
3239 {
3240@@ -36,9 +36,6 @@
3241 public:
3242 static Provider::Ptr create_instance(const ProviderFactory::Configuration&);
3243
3244- static const Provider::FeatureFlags& default_feature_flags();
3245- static const Provider::RequirementFlags& default_requirement_flags();
3246-
3247 struct Configuration
3248 {
3249 static std::string key_name() { return "name"; }
3250@@ -46,8 +43,8 @@
3251 std::string name;
3252 std::string path;
3253
3254- Provider::FeatureFlags features;
3255- Provider::RequirementFlags requirements;
3256+ Provider::Features features = Provider::Features::none;
3257+ Provider::Requirements requirements = Provider::Requirements::none;
3258 };
3259
3260 Provider(const Configuration& config);
3261
3262=== removed directory 'include/location_service/com/ubuntu/location/providers/gps'
3263=== modified file 'include/location_service/com/ubuntu/location/providers/skyhook/provider.h'
3264--- include/location_service/com/ubuntu/location/providers/skyhook/provider.h 2013-05-29 06:04:02 +0000
3265+++ include/location_service/com/ubuntu/location/providers/skyhook/provider.h 2014-02-03 13:52:45 +0000
3266@@ -18,8 +18,8 @@
3267 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_SKYHOOK_PROVIDER_H_
3268 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_SKYHOOK_PROVIDER_H_
3269
3270-#include "com/ubuntu/location/provider.h"
3271-#include "com/ubuntu/location/provider_factory.h"
3272+#include <com/ubuntu/location/provider.h>
3273+#include <com/ubuntu/location/provider_factory.h>
3274
3275 #include <memory>
3276
3277
3278=== modified file 'include/location_service/com/ubuntu/location/proxy_provider.h'
3279--- include/location_service/com/ubuntu/location/proxy_provider.h 2013-05-28 14:41:06 +0000
3280+++ include/location_service/com/ubuntu/location/proxy_provider.h 2014-02-03 13:52:45 +0000
3281@@ -18,8 +18,8 @@
3282 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROXY_PROVIDER_H_
3283 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROXY_PROVIDER_H_
3284
3285-#include "com/ubuntu/location/provider.h"
3286-#include "com/ubuntu/location/provider_selection_policy.h"
3287+#include <com/ubuntu/location/provider.h>
3288+#include <com/ubuntu/location/provider_selection_policy.h>
3289
3290 #include <bitset>
3291 #include <memory>
3292@@ -38,10 +38,6 @@
3293 ProxyProvider(const ProviderSelection& selection);
3294 ~ProxyProvider() noexcept;
3295
3296- ChannelConnection subscribe_to_position_updates(std::function<void(const Update<Position>&)> f);
3297- ChannelConnection subscribe_to_heading_updates(std::function<void(const Update<Heading>&)> f);
3298- ChannelConnection subscribe_to_velocity_updates(std::function<void(const Update<Velocity>&)> f);
3299-
3300 virtual void start_position_updates();
3301 virtual void stop_position_updates();
3302
3303
3304=== added file 'include/location_service/com/ubuntu/location/satellite_based_positioning_state.h'
3305--- include/location_service/com/ubuntu/location/satellite_based_positioning_state.h 1970-01-01 00:00:00 +0000
3306+++ include/location_service/com/ubuntu/location/satellite_based_positioning_state.h 2014-02-03 13:52:45 +0000
3307@@ -0,0 +1,40 @@
3308+/*
3309+ * Copyright © 2012-2013 Canonical Ltd.
3310+ *
3311+ * This program is free software: you can redistribute it and/or modify it
3312+ * under the terms of the GNU Lesser General Public License version 3,
3313+ * as published by the Free Software Foundation.
3314+ *
3315+ * This program is distributed in the hope that it will be useful,
3316+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3317+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3318+ * GNU Lesser General Public License for more details.
3319+ *
3320+ * You should have received a copy of the GNU Lesser General Public License
3321+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3322+ *
3323+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
3324+ */
3325+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SATELLITE_BASED_POSITIONING_STATE_H_
3326+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SATELLITE_BASED_POSITIONING_STATE_H_
3327+
3328+namespace com
3329+{
3330+namespace ubuntu
3331+{
3332+namespace location
3333+{
3334+/**
3335+ * @brief The SatelliteBasedPositioningState enum describes whether satellite
3336+ * assisted positioning is enabled or disabled.
3337+ */
3338+enum class SatelliteBasedPositioningState
3339+{
3340+ on, ///< Satellite assisted positioning is on.
3341+ off ///< Satellite assisted positioning is off.
3342+};
3343+}
3344+}
3345+}
3346+
3347+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SATELLITE_BASED_POSITIONING_STATE_H_
3348
3349=== modified file 'include/location_service/com/ubuntu/location/service/configuration.h'
3350--- include/location_service/com/ubuntu/location/service/configuration.h 2013-05-28 14:41:06 +0000
3351+++ include/location_service/com/ubuntu/location/service/configuration.h 2014-02-03 13:52:45 +0000
3352@@ -18,11 +18,11 @@
3353 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_CONFIGURATION_H_
3354 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_CONFIGURATION_H_
3355
3356-#include "com/ubuntu/location/service/permission_manager.h"
3357+#include <com/ubuntu/location/service/permission_manager.h>
3358
3359-#include "com/ubuntu/location/engine.h"
3360-#include "com/ubuntu/location/provider.h"
3361-#include "com/ubuntu/location/provider_selection_policy.h"
3362+#include <com/ubuntu/location/engine.h>
3363+#include <com/ubuntu/location/provider.h>
3364+#include <com/ubuntu/location/provider_selection_policy.h>
3365
3366 #include <set>
3367
3368
3369=== modified file 'include/location_service/com/ubuntu/location/service/default_configuration.h'
3370--- include/location_service/com/ubuntu/location/service/default_configuration.h 2013-05-28 14:41:06 +0000
3371+++ include/location_service/com/ubuntu/location/service/default_configuration.h 2014-02-03 13:52:45 +0000
3372@@ -18,7 +18,7 @@
3373 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_DEFAULT_CONFIGURATION_H_
3374 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_DEFAULT_CONFIGURATION_H_
3375
3376-#include "com/ubuntu/location/service/configuration.h"
3377+#include <com/ubuntu/location/service/configuration.h>
3378
3379 #include <set>
3380
3381
3382=== modified file 'include/location_service/com/ubuntu/location/service/default_permission_manager.h'
3383--- include/location_service/com/ubuntu/location/service/default_permission_manager.h 2013-05-28 14:41:06 +0000
3384+++ include/location_service/com/ubuntu/location/service/default_permission_manager.h 2014-02-03 13:52:45 +0000
3385@@ -18,7 +18,7 @@
3386 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_DEFAULT_PERMISSION_MANAGER_H_
3387 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_DEFAULT_PERMISSION_MANAGER_H_
3388
3389-#include "com/ubuntu/location/service/permission_manager.h"
3390+#include <com/ubuntu/location/service/permission_manager.h>
3391
3392 #include <sys/types.h>
3393 #include <unistd.h>
3394
3395=== modified file 'include/location_service/com/ubuntu/location/service/implementation.h'
3396--- include/location_service/com/ubuntu/location/service/implementation.h 2013-06-10 11:10:00 +0000
3397+++ include/location_service/com/ubuntu/location/service/implementation.h 2014-02-03 13:52:45 +0000
3398@@ -18,12 +18,12 @@
3399 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_H_
3400 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_H_
3401
3402-#include "com/ubuntu/location/engine.h"
3403-#include "com/ubuntu/location/service/skeleton.h"
3404+#include <com/ubuntu/location/engine.h>
3405+#include <com/ubuntu/location/service/skeleton.h>
3406
3407 #include <memory>
3408
3409-namespace dbus = org::freedesktop::dbus;
3410+namespace dbus = core::dbus;
3411
3412 namespace com
3413 {
3414@@ -39,14 +39,14 @@
3415 typedef std::shared_ptr<Implementation> Ptr;
3416
3417 Implementation(
3418- const org::freedesktop::dbus::Bus::Ptr& bus,
3419+ const core::dbus::Bus::Ptr& bus,
3420 const Engine::Ptr& engine,
3421 const PermissionManager::Ptr& permission_manager);
3422 Implementation(const Implementation&) = delete;
3423 virtual ~Implementation() noexcept;
3424 Implementation& operator=(const Implementation&) = delete;
3425
3426- virtual session::Interface::Ptr create_session_for_criteria(const Criteria& criteria);
3427+ session::Interface::Ptr create_session_for_criteria(const Criteria& criteria);
3428
3429 private:
3430 struct Private;
3431
3432=== modified file 'include/location_service/com/ubuntu/location/service/interface.h'
3433--- include/location_service/com/ubuntu/location/service/interface.h 2013-06-10 11:10:00 +0000
3434+++ include/location_service/com/ubuntu/location/service/interface.h 2014-02-03 13:52:45 +0000
3435@@ -18,16 +18,18 @@
3436 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_
3437 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_
3438
3439-#include "com/ubuntu/location/service/session/interface.h"
3440-
3441-#include <org/freedesktop/dbus/service.h>
3442-#include <org/freedesktop/dbus/traits/service.h>
3443-#include <org/freedesktop/dbus/types/object_path.h>
3444+#include <com/ubuntu/location/service/session/interface.h>
3445+
3446+#include <com/ubuntu/location/space_vehicle.h>
3447+
3448+#include <core/dbus/service.h>
3449+#include <core/dbus/traits/service.h>
3450+#include <core/dbus/types/object_path.h>
3451
3452 #include <chrono>
3453 #include <functional>
3454
3455-namespace dbus = org::freedesktop::dbus;
3456+namespace dbus = core::dbus;
3457
3458 namespace com
3459 {
3460@@ -35,18 +37,31 @@
3461 {
3462 namespace location
3463 {
3464-
3465 struct Criteria;
3466-
3467 namespace service
3468 {
3469+/**
3470+ * @brief The Interface class models the primary interface to the location service.
3471+ */
3472 class Interface
3473 {
3474 protected:
3475 struct Errors
3476 {
3477- struct InsufficientPermissions { inline static std::string name() { return "com.ubuntu.location.Service.Error.InsufficientPermissions"; } };
3478- struct CreatingSession { inline static std::string name() { return "com.ubuntu.location.Service.Error.CreatingSession"; } };
3479+ struct InsufficientPermissions
3480+ {
3481+ inline static std::string name()
3482+ {
3483+ return "com.ubuntu.location.Service.Error.InsufficientPermissions";
3484+ }
3485+ };
3486+ struct CreatingSession
3487+ {
3488+ inline static std::string name()
3489+ {
3490+ return "com.ubuntu.location.Service.Error.CreatingSession";
3491+ }
3492+ };
3493 };
3494
3495 struct CreateSessionForCriteria
3496@@ -64,7 +79,82 @@
3497
3498 typedef dbus::types::ObjectPath ResultType;
3499
3500- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3501+ inline static const std::chrono::milliseconds default_timeout()
3502+ {
3503+ return std::chrono::seconds{1};
3504+ }
3505+ };
3506+
3507+ struct Properties
3508+ {
3509+ struct DoesSatelliteBasedPositioning
3510+ {
3511+ inline static const std::string& name()
3512+ {
3513+ static const std::string s
3514+ {
3515+ "DoesSatelliteBasedPositioning"
3516+ };
3517+ return s;
3518+ }
3519+
3520+ typedef com::ubuntu::location::service::Interface Interface;
3521+ typedef bool ValueType;
3522+ static const bool readable = true;
3523+ static const bool writable = true;
3524+ };
3525+
3526+ struct DoesReportCellAndWifiIds
3527+ {
3528+ inline static const std::string& name()
3529+ {
3530+ static const std::string s
3531+ {
3532+ "DoesReportCellAndWifiIds"
3533+ };
3534+ return s;
3535+ }
3536+
3537+ typedef com::ubuntu::location::service::Interface Interface;
3538+ typedef bool ValueType;
3539+ static const bool readable = true;
3540+ static const bool writable = true;
3541+ };
3542+
3543+ struct IsOnline
3544+ {
3545+ inline static const std::string& name()
3546+ {
3547+ static const std::string s
3548+ {
3549+ "IsOnline"
3550+ };
3551+ return s;
3552+ }
3553+
3554+ typedef com::ubuntu::location::service::Interface Interface;
3555+ typedef bool ValueType;
3556+ static const bool readable = true;
3557+ static const bool writable = true;
3558+ };
3559+
3560+ struct VisibleSpaceVehicles
3561+ {
3562+ inline static const std::string& name()
3563+ {
3564+ static const std::string s
3565+ {
3566+ "VisibleSpaceVehicles"
3567+ };
3568+ return s;
3569+ }
3570+
3571+ typedef com::ubuntu::location::service::Interface Interface;
3572+ typedef std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle> ValueType;
3573+
3574+ static const bool readable = true;
3575+ static const bool writable = false;
3576+ };
3577 };
3578
3579 Interface() = default;
3580@@ -72,6 +162,9 @@
3581 public:
3582 typedef std::shared_ptr<Interface> Ptr;
3583
3584+ /**
3585+ * @brief Queries the path that this object is known under.
3586+ */
3587 inline static const std::string& path()
3588 {
3589 static const std::string s{"/com/ubuntu/location/Service"};
3590@@ -82,6 +175,40 @@
3591 Interface& operator=(const Interface&) = delete;
3592 virtual ~Interface() = default;
3593
3594+ /**
3595+ * @brief Whether the service uses satellite-based positioning.
3596+ * @return A setable/getable/observable property.
3597+ */
3598+ virtual core::Property<bool>& does_satellite_based_positioning() = 0;
3599+
3600+ /**
3601+ * @brief Whether the overall service and its positioning engine is online or not.
3602+ * @return A setable/getable/observable property.
3603+ */
3604+ virtual core::Property<bool>& is_online() = 0;
3605+
3606+ /**
3607+ * @brief Whether the engine and its providers/reporters do call home to
3608+ * report reference locations together with wifi and cell ids.
3609+ *
3610+ * We consider this feature privacy sensitive and it defaults to false. The
3611+ * user has to explicitly opt-in into this feature.
3612+ *
3613+ * @return A setable/getable/observable property.
3614+ */
3615+ virtual core::Property<bool>& does_report_cell_and_wifi_ids() = 0;
3616+
3617+ /**
3618+ * @brief All space vehicles currently visible.
3619+ */
3620+ virtual core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles() = 0;
3621+
3622+ /**
3623+ * @brief Starts a new session for the given criteria
3624+ * @throw std::runtime_error in case of errors.
3625+ * @param criteria The client's requirements in terms of accuraccy and functionality
3626+ * @return A session instance.
3627+ */
3628 virtual session::Interface::Ptr create_session_for_criteria(const Criteria& criteria) = 0;
3629 };
3630 }
3631@@ -89,9 +216,7 @@
3632 }
3633 }
3634
3635-namespace org
3636-{
3637-namespace freedesktop
3638+namespace core
3639 {
3640 namespace dbus
3641 {
3642@@ -112,8 +237,7 @@
3643 }
3644 }
3645 }
3646-}
3647
3648-#include "com/ubuntu/location/codec.h"
3649+#include <com/ubuntu/location/codec.h>
3650
3651 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_
3652
3653=== modified file 'include/location_service/com/ubuntu/location/service/permission_manager.h'
3654--- include/location_service/com/ubuntu/location/service/permission_manager.h 2013-05-28 14:41:06 +0000
3655+++ include/location_service/com/ubuntu/location/service/permission_manager.h 2014-02-03 13:52:45 +0000
3656@@ -18,10 +18,7 @@
3657 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PERMISSION_MANAGER_H_
3658 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PERMISSION_MANAGER_H_
3659
3660-#include "com/ubuntu/location/channel.h"
3661-#include "com/ubuntu/location/provider_selection_policy.h"
3662-
3663-#include <functional>
3664+#include <memory>
3665
3666 namespace com
3667 {
3668@@ -29,29 +26,48 @@
3669 {
3670 namespace location
3671 {
3672+struct Criteria;
3673 namespace service
3674 {
3675+/**
3676+ * @brief Credentials of a remote session.
3677+ */
3678 struct Credentials
3679 {
3680+ /** The process id of the remote peer. */
3681 pid_t pid;
3682+ /** The user id the remote peer runs under. */
3683 uid_t uid;
3684 };
3685
3686+/**
3687+ * @brief The PermissionManager class is an interface to check whether an application is allowed to access the location services.
3688+ */
3689 class PermissionManager
3690 {
3691 public:
3692+ /** Manager pointer type. */
3693 typedef std::shared_ptr<PermissionManager> Ptr;
3694
3695+ /**
3696+ * @brief The Result enum summarizes the results of a query for permissions.
3697+ */
3698 enum class Result
3699 {
3700- granted,
3701- rejected
3702+ granted, ///< The app is allowed to access the location service.
3703+ rejected ///< The app is not allowed to access the location service.
3704 };
3705
3706 virtual ~PermissionManager() = default;
3707 PermissionManager(const PermissionManager&) = delete;
3708 PermissionManager& operator=(const PermissionManager&) = delete;
3709
3710+ /**
3711+ * @brief Checks whether the app with the given credentials is allowed to access the service for the given criteria.
3712+ * @param criteria The requirements of the remote peer.
3713+ * @param credentials The credentials identifying the remote peer.
3714+ * @return Result::granted if the remote peer is allowed to access the location service, Result::rejected otherwise.
3715+ */
3716 virtual Result check_permission_for_credentials(
3717 const Criteria& criteria,
3718 const Credentials& credentials) = 0;
3719
3720=== modified file 'include/location_service/com/ubuntu/location/service/session/implementation.h'
3721--- include/location_service/com/ubuntu/location/service/session/implementation.h 2013-06-10 11:10:00 +0000
3722+++ include/location_service/com/ubuntu/location/service/session/implementation.h 2014-02-03 13:52:45 +0000
3723@@ -18,9 +18,9 @@
3724 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_
3725 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_
3726
3727-#include "com/ubuntu/location/service/session/skeleton.h"
3728+#include <com/ubuntu/location/service/session/skeleton.h>
3729
3730-#include "com/ubuntu/location/provider.h"
3731+#include <com/ubuntu/location/provider.h>
3732
3733 #include <memory>
3734
3735@@ -34,13 +34,10 @@
3736 {
3737 namespace session
3738 {
3739-class Implementation : public Skeleton
3740+class Implementation : public Interface
3741 {
3742 public:
3743- Implementation(
3744- const org::freedesktop::dbus::Bus::Ptr& bus,
3745- const org::freedesktop::dbus::types::ObjectPath& session_path,
3746- const Provider::Ptr& provider);
3747+ Implementation(const Provider::Ptr& provider);
3748 Implementation(const Implementation&) = delete;
3749 virtual ~Implementation() noexcept;
3750 Implementation& operator=(const Implementation&) = delete;
3751
3752=== modified file 'include/location_service/com/ubuntu/location/service/session/interface.h'
3753--- include/location_service/com/ubuntu/location/service/session/interface.h 2013-06-10 11:10:00 +0000
3754+++ include/location_service/com/ubuntu/location/service/session/interface.h 2014-02-03 13:52:45 +0000
3755@@ -18,16 +18,13 @@
3756 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
3757 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
3758
3759-#include "com/ubuntu/location/channel.h"
3760-#include "com/ubuntu/location/heading.h"
3761-#include "com/ubuntu/location/position.h"
3762-#include "com/ubuntu/location/provider.h"
3763-#include "com/ubuntu/location/update.h"
3764-#include "com/ubuntu/location/velocity.h"
3765+#include <com/ubuntu/location/heading.h>
3766+#include <com/ubuntu/location/position.h>
3767+#include <com/ubuntu/location/provider.h>
3768+#include <com/ubuntu/location/update.h>
3769+#include <com/ubuntu/location/velocity.h>
3770
3771-#include <org/freedesktop/dbus/codec.h>
3772-#include <org/freedesktop/dbus/traits/service.h>
3773-#include <org/freedesktop/dbus/types/object_path.h>
3774+#include <core/property.h>
3775
3776 namespace com
3777 {
3778@@ -39,175 +36,70 @@
3779 {
3780 namespace session
3781 {
3782+/**
3783+ * @brief Models a session with the location service.
3784+ */
3785 class Interface
3786 {
3787 public:
3788- struct UpdatePosition
3789- {
3790- typedef com::ubuntu::location::service::session::Interface Interface;
3791-
3792- inline static const std::string& name()
3793- {
3794- static const std::string s
3795- {
3796- "UpdatePosition"
3797- };
3798- return s;
3799- }
3800-
3801- typedef void ResultType;
3802-
3803- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3804- };
3805-
3806- struct UpdateVelocity
3807- {
3808- typedef com::ubuntu::location::service::session::Interface Interface;
3809-
3810- inline static const std::string& name()
3811- {
3812- static const std::string s
3813- {
3814- "UpdateVelocity"
3815- };
3816- return s;
3817- }
3818-
3819- typedef void ResultType;
3820-
3821- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3822- };
3823-
3824- struct UpdateHeading
3825- {
3826- typedef com::ubuntu::location::service::session::Interface Interface;
3827-
3828- inline static const std::string& name()
3829- {
3830- static const std::string s
3831- {
3832- "UpdateHeading"
3833- };
3834- return s;
3835- }
3836-
3837- typedef void ResultType;
3838-
3839- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3840- };
3841-
3842- struct StartPositionUpdates
3843- {
3844- typedef com::ubuntu::location::service::session::Interface Interface;
3845-
3846- inline static const std::string& name()
3847- {
3848- static const std::string s
3849- {
3850- "StartPositionUpdates"
3851- };
3852- return s;
3853- }
3854-
3855- typedef void ResultType;
3856-
3857- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3858- };
3859-
3860- struct StopPositionUpdates
3861- {
3862- typedef com::ubuntu::location::service::session::Interface Interface;
3863-
3864- inline static const std::string& name()
3865- {
3866- static const std::string s
3867- {
3868- "StopPositionUpdates"
3869- };
3870- return s;
3871- }
3872-
3873- typedef void ResultType;
3874-
3875- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3876- };
3877-
3878- struct StartVelocityUpdates
3879- {
3880- typedef com::ubuntu::location::service::session::Interface Interface;
3881-
3882- inline static const std::string& name()
3883- {
3884- static const std::string s
3885- {
3886- "StartVelocityUpdates"
3887- };
3888- return s;
3889- }
3890-
3891- typedef void ResultType;
3892-
3893- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3894- };
3895-
3896- struct StopVelocityUpdates
3897- {
3898- typedef com::ubuntu::location::service::session::Interface Interface;
3899-
3900- inline static const std::string& name()
3901- {
3902- static const std::string s
3903- {
3904- "StopVelocityUpdates"
3905- };
3906- return s;
3907- }
3908-
3909- typedef void ResultType;
3910-
3911- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3912- };
3913-
3914- struct StartHeadingUpdates
3915- {
3916- typedef com::ubuntu::location::service::session::Interface Interface;
3917-
3918- inline static const std::string& name()
3919- {
3920- static const std::string s
3921- {
3922- "StartHeadingUpdates"
3923- };
3924- return s;
3925- }
3926-
3927- typedef void ResultType;
3928-
3929- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3930- };
3931-
3932- struct StopHeadingUpdates
3933- {
3934- typedef com::ubuntu::location::service::session::Interface Interface;
3935-
3936- inline static const std::string& name()
3937- {
3938- static const std::string s
3939- {
3940- "StopHeadingUpdates"
3941- };
3942- return s;
3943- }
3944-
3945- typedef void ResultType;
3946-
3947- inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; }
3948- };
3949+ struct UpdatePosition;
3950+ struct UpdateVelocity;
3951+ struct UpdateHeading;
3952+
3953+ struct StartPositionUpdates;
3954+ struct StopPositionUpdates;
3955+
3956+ struct StartVelocityUpdates;
3957+ struct StopVelocityUpdates;
3958+
3959+ struct StartHeadingUpdates;
3960+ struct StopHeadingUpdates;
3961
3962 struct Errors
3963 {
3964- struct ErrorParsingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorParsingUpdate"; } };
3965- struct ErrorStartingUpdate { inline static std::string name() { return "com.ubuntu.location.Service.Session.ErrorStartingUpdate"; } };
3966+ struct ErrorParsingUpdate;
3967+ struct ErrorStartingUpdate;
3968+ };
3969+ /**
3970+ * @brief Encapsulates updates provided for this session, and the ability to enable/disable updates.
3971+ */
3972+ struct Updates
3973+ {
3974+ /**
3975+ * @brief The Status enum models the possible states of updates.
3976+ */
3977+ enum class Status
3978+ {
3979+ enabled, ///< Updates are enabled and delivered to this session.
3980+ disabled ///< Updates are disabled and not delivered to this session.
3981+ };
3982+
3983+ /**
3984+ * @brief Updates for position measurements.
3985+ */
3986+ core::Property<Update<Position>> position{};
3987+ /**
3988+ * @brief Status of position updates, mutable.
3989+ */
3990+ core::Property<Status> position_status{Status::disabled};
3991+
3992+ /**
3993+ * @brief Updates for the heading measurements.
3994+ */
3995+ core::Property<Update<Heading>> heading{};
3996+ /**
3997+ * @brief Status of position updates, mutable.
3998+ */
3999+ core::Property<Status> heading_status{Status::disabled};
4000+
4001+ /**
4002+ * @brief Updates for velocity measurements.
4003+ */
4004+ core::Property<Update<Velocity>> velocity{};
4005+ /**
4006+ * @brief Status of velocity updates, mutable.
4007+ */
4008+ core::Property<Status> velocity_status{Status::disabled};
4009 };
4010
4011 typedef std::shared_ptr<Interface> Ptr;
4012@@ -216,60 +108,23 @@
4013 virtual ~Interface() noexcept;
4014 Interface& operator=(const Interface&) = delete;
4015
4016- virtual const org::freedesktop::dbus::types::ObjectPath& path() const = 0;
4017-
4018- ChannelConnection install_position_updates_handler(std::function<void(const Update<Position>&)> handler);
4019- ChannelConnection install_velocity_updates_handler(std::function<void(const Update<Velocity>&)> handler);
4020- ChannelConnection install_heading_updates_handler(std::function<void(const Update<Heading>&)> handler);
4021-
4022- virtual void start_position_updates() = 0;
4023- virtual void stop_position_updates() noexcept = 0;
4024- virtual void start_velocity_updates() = 0;
4025- virtual void stop_velocity_updates() noexcept = 0;
4026- virtual void start_heading_updates() = 0;
4027- virtual void stop_heading_updates() noexcept = 0;
4028-
4029-protected:
4030+ /**
4031+ * @brief Provides access to the updates delivered for this session.
4032+ * @return A mutable reference to updates.
4033+ */
4034+ virtual Updates& updates();
4035+
4036+protected:
4037 Interface();
4038
4039- Channel<Update<Position>>& access_position_updates_channel();
4040- Channel<Update<Heading>>& access_heading_updates_channel();
4041- Channel<Update<Velocity>>& access_velocity_updates_channel();
4042-
4043 private:
4044 struct Private;
4045- std::unique_ptr<Private> d;
4046-};
4047-}
4048-}
4049-}
4050-}
4051-}
4052-namespace org
4053-{
4054-namespace freedesktop
4055-{
4056-namespace dbus
4057-{
4058-namespace traits
4059-{
4060-template<>
4061-struct Service<com::ubuntu::location::service::session::Interface>
4062-{
4063- static const std::string& interface_name()
4064- {
4065- static const std::string s
4066- {
4067- "com.ubuntu.location.Service.Session"
4068- };
4069- return s;
4070- }
4071-};
4072-}
4073-}
4074-}
4075-}
4076-
4077-#include "com/ubuntu/location/codec.h"
4078+ std::shared_ptr<Private> d;
4079+};
4080+}
4081+}
4082+}
4083+}
4084+}
4085
4086 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_
4087
4088=== modified file 'include/location_service/com/ubuntu/location/service/session/skeleton.h'
4089--- include/location_service/com/ubuntu/location/service/session/skeleton.h 2013-06-10 11:10:00 +0000
4090+++ include/location_service/com/ubuntu/location/service/session/skeleton.h 2014-02-03 13:52:45 +0000
4091@@ -18,19 +18,19 @@
4092 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_SKELETON_H_
4093 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_SKELETON_H_
4094
4095-#include "com/ubuntu/location/service/session/interface.h"
4096-
4097-#include "com/ubuntu/location/channel.h"
4098-#include "com/ubuntu/location/heading.h"
4099-#include "com/ubuntu/location/position.h"
4100-#include "com/ubuntu/location/provider.h"
4101-#include "com/ubuntu/location/update.h"
4102-#include "com/ubuntu/location/velocity.h"
4103-
4104-#include <org/freedesktop/dbus/message.h>
4105-#include <org/freedesktop/dbus/skeleton.h>
4106-
4107-#include <functional>
4108+#include <com/ubuntu/location/service/session/interface.h>
4109+
4110+#include <com/ubuntu/location/heading.h>
4111+#include <com/ubuntu/location/position.h>
4112+#include <com/ubuntu/location/provider.h>
4113+#include <com/ubuntu/location/update.h>
4114+#include <com/ubuntu/location/velocity.h>
4115+
4116+#include <core/dbus/message.h>
4117+#include <core/dbus/object.h>
4118+#include <core/dbus/skeleton.h>
4119+
4120+#include <memory>
4121
4122 namespace com
4123 {
4124@@ -42,21 +42,23 @@
4125 {
4126 namespace session
4127 {
4128-class Skeleton : public org::freedesktop::dbus::Skeleton<Interface>
4129+class Skeleton : public core::dbus::Skeleton<Interface>
4130 {
4131 public:
4132- Skeleton(
4133- const org::freedesktop::dbus::Bus::Ptr& bus,
4134- const org::freedesktop::dbus::types::ObjectPath& session_path);
4135+ Skeleton(const Interface::Ptr& instance,
4136+ const core::dbus::Bus::Ptr& bus,
4137+ const core::dbus::Service::Ptr& service,
4138+ const core::dbus::Object::Ptr& session,
4139+ const core::dbus::types::ObjectPath& session_path);
4140 Skeleton(const Skeleton&) = delete;
4141 virtual ~Skeleton() noexcept;
4142 Skeleton& operator=(const Skeleton&) = delete;
4143
4144- virtual const org::freedesktop::dbus::types::ObjectPath& path() const;
4145+ virtual const core::dbus::types::ObjectPath& path() const;
4146
4147 private:
4148 struct Private;
4149- std::unique_ptr<Private> d;
4150+ std::shared_ptr<Private> d;
4151 };
4152 }
4153 }
4154
4155=== modified file 'include/location_service/com/ubuntu/location/service/session/stub.h'
4156--- include/location_service/com/ubuntu/location/service/session/stub.h 2013-06-10 11:10:00 +0000
4157+++ include/location_service/com/ubuntu/location/service/session/stub.h 2014-02-03 13:52:45 +0000
4158@@ -18,16 +18,15 @@
4159 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_STUB_H_
4160 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SESSION_SESSION_STUB_H_
4161
4162-#include "com/ubuntu/location/service/session/interface.h"
4163-
4164-#include "com/ubuntu/location/channel.h"
4165-#include "com/ubuntu/location/heading.h"
4166-#include "com/ubuntu/location/position.h"
4167-#include "com/ubuntu/location/provider.h"
4168-#include "com/ubuntu/location/update.h"
4169-#include "com/ubuntu/location/velocity.h"
4170-
4171-#include <org/freedesktop/dbus/stub.h>
4172+#include <com/ubuntu/location/service/session/interface.h>
4173+
4174+#include <com/ubuntu/location/heading.h>
4175+#include <com/ubuntu/location/position.h>
4176+#include <com/ubuntu/location/provider.h>
4177+#include <com/ubuntu/location/update.h>
4178+#include <com/ubuntu/location/velocity.h>
4179+
4180+#include <core/dbus/stub.h>
4181
4182 #include <memory>
4183
4184@@ -41,17 +40,17 @@
4185 {
4186 namespace session
4187 {
4188-class Stub : public org::freedesktop::dbus::Stub<Interface>
4189+class Stub : public core::dbus::Stub<Interface>
4190 {
4191 public:
4192 Stub(
4193- const org::freedesktop::dbus::Bus::Ptr& bus,
4194- const org::freedesktop::dbus::types::ObjectPath& session_path);
4195+ const core::dbus::Bus::Ptr& bus,
4196+ const core::dbus::types::ObjectPath& session_path);
4197 Stub(const Stub&) = delete;
4198 virtual ~Stub() noexcept;
4199 Stub& operator=(const Stub&) = delete;
4200
4201- virtual const org::freedesktop::dbus::types::ObjectPath& path() const;
4202+ virtual const core::dbus::types::ObjectPath& path() const;
4203
4204 virtual void start_position_updates();
4205 virtual void stop_position_updates() noexcept;
4206
4207=== modified file 'include/location_service/com/ubuntu/location/service/skeleton.h'
4208--- include/location_service/com/ubuntu/location/service/skeleton.h 2013-06-10 11:10:00 +0000
4209+++ include/location_service/com/ubuntu/location/service/skeleton.h 2014-02-03 13:52:45 +0000
4210@@ -18,11 +18,11 @@
4211 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SKELETON_H_
4212 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SKELETON_H_
4213
4214-#include "com/ubuntu/location/service/interface.h"
4215-#include "com/ubuntu/location/service/permission_manager.h"
4216-#include "com/ubuntu/location/service/session/interface.h"
4217+#include <com/ubuntu/location/service/interface.h>
4218+#include <com/ubuntu/location/service/permission_manager.h>
4219+#include <com/ubuntu/location/service/session/interface.h>
4220
4221-#include <org/freedesktop/dbus/skeleton.h>
4222+#include <core/dbus/skeleton.h>
4223
4224 namespace com
4225 {
4226@@ -32,7 +32,7 @@
4227 {
4228 namespace service
4229 {
4230-class Skeleton : public org::freedesktop::dbus::Skeleton<com::ubuntu::location::service::Interface>,
4231+class Skeleton : public core::dbus::Skeleton<com::ubuntu::location::service::Interface>,
4232 public std::enable_shared_from_this<Skeleton>
4233 {
4234 public:
4235@@ -43,6 +43,11 @@
4236 Skeleton& operator=(const Skeleton&) = delete;
4237 ~Skeleton() noexcept;
4238
4239+ core::Property<bool>& does_satellite_based_positioning();
4240+ core::Property<bool>& does_report_cell_and_wifi_ids();
4241+ core::Property<bool>& is_online();
4242+ core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles();
4243+
4244 private:
4245 struct Private;
4246 std::shared_ptr<Private> d;
4247
4248=== modified file 'include/location_service/com/ubuntu/location/service/stub.h'
4249--- include/location_service/com/ubuntu/location/service/stub.h 2013-06-10 11:10:00 +0000
4250+++ include/location_service/com/ubuntu/location/service/stub.h 2014-02-03 13:52:45 +0000
4251@@ -18,10 +18,10 @@
4252 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_STUB_H_
4253 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_STUB_H_
4254
4255-#include "com/ubuntu/location/service/interface.h"
4256-#include "com/ubuntu/location/service/session/interface.h"
4257+#include <com/ubuntu/location/service/interface.h>
4258+#include <com/ubuntu/location/service/session/interface.h>
4259
4260-#include <org/freedesktop/dbus/stub.h>
4261+#include <core/dbus/stub.h>
4262
4263 namespace com
4264 {
4265@@ -31,7 +31,7 @@
4266 {
4267 namespace service
4268 {
4269-class Stub : public org::freedesktop::dbus::Stub<Interface>
4270+class Stub : public core::dbus::Stub<Interface>
4271 {
4272 public:
4273 Stub(const dbus::Bus::Ptr& connection);
4274@@ -40,6 +40,10 @@
4275 ~Stub() noexcept;
4276
4277 session::Interface::Ptr create_session_for_criteria(const Criteria& criteria);
4278+ core::Property<bool>& does_satellite_based_positioning();
4279+ core::Property<bool>& does_report_cell_and_wifi_ids();
4280+ core::Property<bool>& is_online();
4281+ core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles();
4282
4283 private:
4284 struct Private;
4285
4286=== added file 'include/location_service/com/ubuntu/location/space_vehicle.h'
4287--- include/location_service/com/ubuntu/location/space_vehicle.h 1970-01-01 00:00:00 +0000
4288+++ include/location_service/com/ubuntu/location/space_vehicle.h 2014-02-03 13:52:45 +0000
4289@@ -0,0 +1,121 @@
4290+/*
4291+ * Copyright © 2012-2013 Canonical Ltd.
4292+ *
4293+ * This program is free software: you can redistribute it and/or modify it
4294+ * under the terms of the GNU Lesser General Public License version 3,
4295+ * as published by the Free Software Foundation.
4296+ *
4297+ * This program is distributed in the hope that it will be useful,
4298+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4299+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4300+ * GNU Lesser General Public License for more details.
4301+ *
4302+ * You should have received a copy of the GNU Lesser General Public License
4303+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4304+ *
4305+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
4306+ */
4307+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_SPACE_VEHICLE_H_
4308+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_SPACE_VEHICLE_H_
4309+
4310+#include <com/ubuntu/location/units/units.h>
4311+
4312+#include <iostream>
4313+#include <map>
4314+
4315+namespace com
4316+{
4317+namespace ubuntu
4318+{
4319+namespace location
4320+{
4321+/** @brief A space-vehicle as visible to providers. */
4322+struct SpaceVehicle
4323+{
4324+ /** @brief Numeric Id of an individual SpaceVehicle. */
4325+ typedef std::uint32_t Id;
4326+
4327+ enum class Type
4328+ {
4329+ unknown, ///< Unknown (and thus invalid) type.
4330+ beidou, ///< People's Republic of China's regional system, currently limited to Asia and the West Pacific
4331+ galileo, ///< A global system being developed by the European Union and other partner countries, planned to be operational by 2014 (and fully deployed by 2019).
4332+ glonass, ///< Russia's global navigation system. Fully operational worldwide.
4333+ gps, ///< Fully operational worldwide.
4334+ compass, ///< People's Republic of China's global system, planned to be operational by 2020.
4335+ irnss, ///< India's regional navigation system, planned to be operational by 2014, covering India and Northern Indian Ocean.
4336+ qzss ///< Japanese regional system covering Asia and Oceania.
4337+ };
4338+
4339+ struct Key
4340+ {
4341+ Type type = Type::unknown; ///< The positioning system this vehicle belongs to.
4342+ Id id = 0; ///< Unique id of the space vehicle.
4343+
4344+ inline bool operator==(const SpaceVehicle::Key& rhs) const
4345+ {
4346+ return type == rhs.type && id == rhs.id;
4347+ }
4348+
4349+ inline bool operator<(const SpaceVehicle::Key& rhs) const
4350+ {
4351+ if (type != rhs.type)
4352+ return type < rhs.type;
4353+
4354+ return id < rhs.id;
4355+ }
4356+ };
4357+
4358+ inline bool operator==(const SpaceVehicle& rhs) const
4359+ {
4360+ return key == rhs.key &&
4361+ has_almanac_data == rhs.has_almanac_data &&
4362+ has_ephimeris_data == rhs.has_ephimeris_data &&
4363+ used_in_fix == rhs.used_in_fix &&
4364+ units::roughly_equals(azimuth, rhs.azimuth) &&
4365+ units::roughly_equals(elevation, rhs.elevation);
4366+ }
4367+
4368+ inline bool operator<(const SpaceVehicle& rhs) const
4369+ {
4370+ return key < rhs.key;
4371+ }
4372+
4373+ Key key; ///< Unique key identifying an instance.
4374+ float snr = -std::numeric_limits<float>::max(); ///< Signal to noise ratio;
4375+ bool has_almanac_data = false; ///< Almanac data available for this vehicle.
4376+ bool has_ephimeris_data = false; ///< Ephimeris data is available for this vehicle.
4377+ bool used_in_fix = false; ///< This vehicle has been used to obtain a fix.
4378+ units::Quantity<units::PlaneAngle> azimuth; ///< Azimuth of SV.
4379+ units::Quantity<units::PlaneAngle> elevation; ///< Elevation of SV.
4380+};
4381+
4382+inline std::ostream& operator<<(std::ostream& out, const SpaceVehicle& sv)
4383+{
4384+ static const std::map<SpaceVehicle::Type, std::string> lut =
4385+ {
4386+ {SpaceVehicle::Type::unknown, "unknown"},
4387+ {SpaceVehicle::Type::beidou, "beidou"},
4388+ {SpaceVehicle::Type::galileo, "galileo"},
4389+ {SpaceVehicle::Type::glonass, "glonass"},
4390+ {SpaceVehicle::Type::gps, "gps"},
4391+ {SpaceVehicle::Type::compass, "compass"},
4392+ {SpaceVehicle::Type::irnss, "irnss"},
4393+ {SpaceVehicle::Type::qzss, "qzss" }
4394+ };
4395+ return out << "("
4396+ << "type: " << lut.at(sv.key.type) << ", "
4397+ << "prn: " << sv.key.id << ", "
4398+ << "snr: " << sv.snr << ", "
4399+ << "has_almanac_data: " << sv.has_almanac_data << ", "
4400+ << "has_ephimeris_data: " << sv.has_ephimeris_data << ", "
4401+ << "used_in_fix: " << sv.used_in_fix << ", "
4402+ << "azimuth: " << sv.azimuth << ", "
4403+ << "elevation: " << sv.elevation
4404+ << ")";
4405+}
4406+}
4407+}
4408+}
4409+
4410+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SPACE_VEHICLE_H_
4411
4412=== modified file 'include/location_service/com/ubuntu/location/units/units.h'
4413--- include/location_service/com/ubuntu/location/units/units.h 2013-05-28 14:41:06 +0000
4414+++ include/location_service/com/ubuntu/location/units/units.h 2014-02-03 13:52:45 +0000
4415@@ -57,6 +57,12 @@
4416 using boost::units::sin;
4417 using boost::units::cos;
4418 using boost::units::atan2;
4419+
4420+template<typename Unit>
4421+inline bool roughly_equals(const Quantity<Unit>& lhs, const Quantity<Unit>& rhs)
4422+{
4423+ return std::fabs(lhs.value()-rhs.value()) <= std::numeric_limits<double>::epsilon();
4424+}
4425 }
4426 }
4427 }
4428
4429=== modified file 'include/location_service/com/ubuntu/location/update.h'
4430--- include/location_service/com/ubuntu/location/update.h 2013-05-29 06:04:02 +0000
4431+++ include/location_service/com/ubuntu/location/update.h 2014-02-03 13:52:45 +0000
4432@@ -18,7 +18,7 @@
4433 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_UPDATE_H_
4434 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_UPDATE_H_
4435
4436-#include "com/ubuntu/location/clock.h"
4437+#include <com/ubuntu/location/clock.h>
4438
4439 #include <ostream>
4440
4441@@ -28,27 +28,56 @@
4442 {
4443 namespace location
4444 {
4445+/**
4446+ * @brief Templated class that wraps a value and timestamp.
4447+ * @tparam T The contained value.
4448+ */
4449 template<typename T>
4450 struct Update
4451 {
4452- Update(const T& value = T{}, const Clock::Timestamp& when = Clock::Timestamp{}) : value{value}, when{when}
4453+ /**
4454+ * @brief Constructs a valid update with the given value and timestamp.
4455+ * @param [in] value The value delivered with this update.
4456+ * @param [in] when The timestamp when the value was measured.
4457+ */
4458+ inline Update(const T& value = T{},
4459+ const Clock::Timestamp& when = Clock::now())
4460+ : value{value}, when{when}
4461 {
4462 }
4463
4464- bool operator==(const Update<T>& rhs) const
4465+ /**
4466+ * @brief operator == checks if two updates are equal.
4467+ * @param [in] rhs The update to check against.
4468+ * @return true iff this instance equals rhs.
4469+ */
4470+ inline bool operator==(const Update<T>& rhs) const
4471 {
4472 return value == rhs.value && when == rhs.when;
4473 }
4474
4475- bool operator!=(const Update<T>& rhs) const
4476+ /**
4477+ * @brief operator != checks if two updates are unequal.
4478+ * @param [in] rhs The update to check against.
4479+ * @return true iff this instance does not equal rhs.
4480+ */
4481+ inline bool operator!=(const Update<T>& rhs) const
4482 {
4483 return !(value == rhs.value && when == rhs.when);
4484 }
4485
4486+ /** The value delivered with this update. */
4487 T value;
4488- Clock::Timestamp when;
4489+
4490+ /** Time when the updated value was measured. */
4491+ Clock::Timestamp when = Clock::beginning_of_time();
4492 };
4493
4494+/**
4495+ * @brief Pretty-prints the update to the provided output stream.
4496+ * @param out The stream to write to.
4497+ * @param update The value to be printed.
4498+ */
4499 template<typename T>
4500 inline std::ostream& operator<<(std::ostream& out, const Update<T>& update)
4501 {
4502
4503=== modified file 'include/location_service/com/ubuntu/location/velocity.h'
4504--- include/location_service/com/ubuntu/location/velocity.h 2013-05-28 14:41:06 +0000
4505+++ include/location_service/com/ubuntu/location/velocity.h 2014-02-03 13:52:45 +0000
4506@@ -18,12 +18,7 @@
4507 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_VELOCITY_H_
4508 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_VELOCITY_H_
4509
4510-#include "com/ubuntu/location/accuracy.h"
4511-#include "com/ubuntu/location/units/units.h"
4512-
4513-#include <limits>
4514-#include <ostream>
4515-#include <stdexcept>
4516+#include <com/ubuntu/location/units/units.h>
4517
4518 namespace com
4519 {
4520@@ -31,74 +26,8 @@
4521 {
4522 namespace location
4523 {
4524-struct Velocity
4525-{
4526- typedef units::Velocity Unit;
4527- typedef units::Quantity<Unit> Quantity;
4528-
4529- static inline const Quantity& min()
4530- {
4531- static const Quantity instance = Quantity::from_value(0.);
4532- return instance;
4533- }
4534-
4535- static inline const Quantity max()
4536- {
4537- static const Quantity instance = Quantity::from_value(std::numeric_limits<double>::max());
4538- return instance;
4539- }
4540-
4541- Velocity(const Quantity& value = Quantity()) : value(value)
4542- {
4543- if (value < Velocity::min())
4544- throw std::out_of_range("");
4545- if (value > Velocity::max())
4546- throw std::out_of_range("");
4547- }
4548-
4549- inline bool operator==(const Velocity& rhs) const
4550- {
4551- return value == rhs.value;
4552- }
4553-
4554- inline bool operator!=(const Velocity& rhs) const
4555- {
4556- return value != rhs.value;
4557- }
4558-
4559- Quantity value;
4560-};
4561-
4562-inline std::ostream& operator<<(std::ostream& out, const Velocity& velocity)
4563-{
4564- out << "Velocity(" << velocity.value << ")";
4565- return out;
4566-}
4567-
4568-template<>
4569-struct AccuracyTraits<Velocity>
4570-{
4571- static AccuracyLevel classify(const Velocity& h)
4572- {
4573- if (h.value > (1.f * units::MetersPerSecond))
4574- return AccuracyLevel::worst;
4575-
4576- if (h.value <= (1.f * units::MetersPerSecond))
4577- return AccuracyLevel::best;
4578-
4579- return AccuracyLevel::worst;
4580- }
4581-
4582- static Accuracy<Velocity> best()
4583- {
4584- return Accuracy<Velocity>{Velocity{Velocity::min()}};
4585- }
4586-
4587- static Accuracy<Velocity> worst()
4588- {
4589- return Accuracy<Velocity>{Velocity{2*units::MetersPerSecond}};
4590- }
4591-};
4592+/** Velocity is measured in m/s. */
4593+typedef units::Quantity<units::Velocity> Velocity;
4594 }
4595 }
4596 }
4597
4598=== modified file 'include/location_service/com/ubuntu/location/wgs84/altitude.h'
4599--- include/location_service/com/ubuntu/location/wgs84/altitude.h 2013-05-28 14:41:06 +0000
4600+++ include/location_service/com/ubuntu/location/wgs84/altitude.h 2014-02-03 13:52:45 +0000
4601@@ -18,8 +18,8 @@
4602 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_ALTITUDE_H_
4603 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_ALTITUDE_H_
4604
4605-#include "com/ubuntu/location/units/units.h"
4606-#include "com/ubuntu/location/wgs84/coordinate.h"
4607+#include <com/ubuntu/location/units/units.h>
4608+#include <com/ubuntu/location/wgs84/coordinate.h>
4609
4610 namespace com
4611 {
4612
4613=== modified file 'include/location_service/com/ubuntu/location/wgs84/coordinate.h'
4614--- include/location_service/com/ubuntu/location/wgs84/coordinate.h 2013-05-28 14:41:06 +0000
4615+++ include/location_service/com/ubuntu/location/wgs84/coordinate.h 2014-02-03 13:52:45 +0000
4616@@ -18,7 +18,7 @@
4617 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_COORDINATE_H_
4618 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_COORDINATE_H_
4619
4620-#include "com/ubuntu/location/units/units.h"
4621+#include <com/ubuntu/location/units/units.h>
4622
4623 #include <ostream>
4624
4625@@ -39,12 +39,14 @@
4626 };
4627
4628 template<typename Tag, typename UnitType>
4629-struct Coordinate
4630+class Coordinate
4631 {
4632+public:
4633 typedef UnitType Unit;
4634 typedef units::Quantity<Unit> Quantity;
4635
4636- explicit Coordinate(const Quantity& value = Quantity()) : value(value)
4637+ explicit Coordinate(const Quantity& value = Quantity())
4638+ : value(value)
4639 {
4640 CoordinateTraits<Coordinate<Tag,UnitType>>::check_and_throw_if_invalid(value);
4641 }
4642
4643=== modified file 'include/location_service/com/ubuntu/location/wgs84/latitude.h'
4644--- include/location_service/com/ubuntu/location/wgs84/latitude.h 2013-05-28 14:41:06 +0000
4645+++ include/location_service/com/ubuntu/location/wgs84/latitude.h 2014-02-03 13:52:45 +0000
4646@@ -18,8 +18,8 @@
4647 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_
4648 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_
4649
4650-#include "com/ubuntu/location/units/units.h"
4651-#include "com/ubuntu/location/wgs84/coordinate.h"
4652+#include <com/ubuntu/location/units/units.h>
4653+#include <com/ubuntu/location/wgs84/coordinate.h>
4654
4655 #include <stdexcept>
4656
4657
4658=== modified file 'include/location_service/com/ubuntu/location/wgs84/longitude.h'
4659--- include/location_service/com/ubuntu/location/wgs84/longitude.h 2013-05-28 14:41:06 +0000
4660+++ include/location_service/com/ubuntu/location/wgs84/longitude.h 2014-02-03 13:52:45 +0000
4661@@ -18,8 +18,8 @@
4662 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LONGITUDE_H_
4663 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LONGITUDE_H_
4664
4665-#include "com/ubuntu/location/units/units.h"
4666-#include "com/ubuntu/location/wgs84/coordinate.h"
4667+#include <com/ubuntu/location/units/units.h>
4668+#include <com/ubuntu/location/wgs84/coordinate.h>
4669
4670 #include <stdexcept>
4671
4672
4673=== added file 'include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h'
4674--- include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h 1970-01-01 00:00:00 +0000
4675+++ include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h 2014-02-03 13:52:45 +0000
4676@@ -0,0 +1,36 @@
4677+/*
4678+ * Copyright © 2012-2013 Canonical Ltd.
4679+ *
4680+ * This program is free software: you can redistribute it and/or modify it
4681+ * under the terms of the GNU Lesser General Public License version 3,
4682+ * as published by the Free Software Foundation.
4683+ *
4684+ * This program is distributed in the hope that it will be useful,
4685+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4686+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4687+ * GNU Lesser General Public License for more details.
4688+ *
4689+ * You should have received a copy of the GNU Lesser General Public License
4690+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4691+ *
4692+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
4693+ */
4694+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WIFI_AND_CELL_REPORTING_STATE_H_
4695+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WIFI_AND_CELL_REPORTING_STATE_H_
4696+
4697+namespace com
4698+{
4699+namespace ubuntu
4700+{
4701+namespace location
4702+{
4703+enum class WifiAndCellIdReportingState
4704+{
4705+ on, ///< Wifi and Cell Ids might be reported to online location services.
4706+ off ///< Wifi and Cell Ids are _not_ reported. This is the default value.
4707+};
4708+}
4709+}
4710+}
4711+
4712+#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WIFI_AND_CELL_REPORTING_STATE_H_
4713
4714=== modified file 'src/location_service/com/ubuntu/location/CMakeLists.txt'
4715--- src/location_service/com/ubuntu/location/CMakeLists.txt 2013-10-08 14:48:43 +0000
4716+++ src/location_service/com/ubuntu/location/CMakeLists.txt 2014-02-03 13:52:45 +0000
4717@@ -5,12 +5,16 @@
4718
4719 default_provider_selection_policy.cpp
4720
4721+ criteria.cpp
4722 engine.cpp
4723 init_and_shutdown.cpp
4724 position.cpp
4725 provider.cpp
4726 provider_factory.cpp
4727 proxy_provider.cpp
4728+ set_name_for_thread.cpp
4729+
4730+ connectivity/ofono_nm_connectivity_manager.cpp
4731
4732 service/default_configuration.cpp
4733 service/default_permission_manager.cpp
4734@@ -43,6 +47,7 @@
4735
4736 ${Boost_LIBRARIES}
4737 ${DBUS_LIBRARIES}
4738+ ${DBUS_CPP_LDFLAGS}
4739 ${GLog_LIBRARY}
4740 ${GFlags_LIBRARY}
4741 )
4742@@ -52,21 +57,54 @@
4743 DESTINATION ${CMAKE_INSTALL_LIBDIR}
4744 )
4745
4746+add_library(
4747+ ubuntu-location-service-daemon
4748+
4749+ service/daemon
4750+)
4751+
4752 add_executable(
4753 ubuntu-location-serviced
4754
4755- service/main.cpp
4756+ service/daemon_main.cpp
4757+)
4758+
4759+add_executable(
4760+ ubuntu-location-serviced-cli
4761+
4762+ service/daemon_cli_main.cpp
4763 )
4764
4765 target_link_libraries(
4766- ubuntu-location-serviced
4767+ ubuntu-location-service-daemon
4768
4769 ubuntu-location-service
4770-
4771- ${ENABLED_PROVIDER_TARGETS}
4772-
4773- ${Boost_LIBRARIES}
4774- ${DBUS_LIBRARIES}
4775+)
4776+
4777+target_link_libraries(
4778+ ubuntu-location-serviced
4779+
4780+ ubuntu-location-service-daemon
4781+
4782+ ${ENABLED_PROVIDER_TARGETS}
4783+
4784+ ${Boost_LIBRARIES}
4785+ ${DBUS_LIBRARIES}
4786+ ${DBUS_CPP_LIBRARIES}
4787+ ${GLog_LIBRARY}
4788+ ${GFlags_LIBRARY}
4789+)
4790+
4791+target_link_libraries(
4792+ ubuntu-location-serviced-cli
4793+
4794+ ubuntu-location-service-daemon
4795+
4796+ ${ENABLED_PROVIDER_TARGETS}
4797+
4798+ ${Boost_LIBRARIES}
4799+ ${DBUS_LIBRARIES}
4800+ ${DBUS_CPP_LIBRARIES}
4801 ${GLog_LIBRARY}
4802 ${GFlags_LIBRARY}
4803 )
4804@@ -76,3 +114,8 @@
4805 DESTINATION ${CMAKE_INSTALL_BINDIR}
4806 )
4807
4808+install(
4809+ TARGETS ubuntu-location-serviced-cli
4810+ DESTINATION ${CMAKE_INSTALL_BINDIR}
4811+)
4812+
4813
4814=== added directory 'src/location_service/com/ubuntu/location/connectivity'
4815=== added file 'src/location_service/com/ubuntu/location/connectivity/nm.h'
4816--- src/location_service/com/ubuntu/location/connectivity/nm.h 1970-01-01 00:00:00 +0000
4817+++ src/location_service/com/ubuntu/location/connectivity/nm.h 2014-02-03 13:52:45 +0000
4818@@ -0,0 +1,255 @@
4819+/*
4820+ * Copyright © 2012-2013 Canonical Ltd.
4821+ *
4822+ * This program is free software: you can redistribute it and/or modify it
4823+ * under the terms of the GNU Lesser General Public License version 3,
4824+ * as published by the Free Software Foundation.
4825+ *
4826+ * This program is distributed in the hope that it will be useful,
4827+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4828+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4829+ * GNU Lesser General Public License for more details.
4830+ *
4831+ * You should have received a copy of the GNU Lesser General Public License
4832+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4833+ *
4834+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
4835+ */
4836+#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_NM_H
4837+#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_NM_H
4838+
4839+#include <core/dbus/bus.h>
4840+#include <core/dbus/object.h>
4841+#include <core/dbus/property.h>
4842+#include <core/dbus/service.h>
4843+#include <core/dbus/types/object_path.h>
4844+#include <core/dbus/types/struct.h>
4845+#include <core/dbus/types/stl/map.h>
4846+#include <core/dbus/types/stl/string.h>
4847+#include <core/dbus/types/stl/tuple.h>
4848+#include <core/dbus/types/stl/vector.h>
4849+
4850+namespace org
4851+{
4852+namespace freedesktop
4853+{
4854+struct NetworkManager
4855+{
4856+ struct AccessPoint
4857+ {
4858+ static const std::string& name()
4859+ {
4860+ static const std::string s{"org.freedesktop.NetworkManager.AccessPoint"};
4861+ return s;
4862+ }
4863+
4864+ struct Frequency
4865+ {
4866+ static const std::string& name()
4867+ {
4868+ static const std::string s{"Frequency"};
4869+ return s;
4870+ }
4871+
4872+ typedef AccessPoint Interface;
4873+ typedef std::uint32_t ValueType;
4874+ static const bool readable = true;
4875+ static const bool writable = false;
4876+ };
4877+
4878+ struct HwAddress
4879+ {
4880+ static const std::string& name()
4881+ {
4882+ static const std::string s{"HwAddress"};
4883+ return s;
4884+ }
4885+
4886+ typedef AccessPoint Interface;
4887+ typedef std::string ValueType;
4888+ static const bool readable = true;
4889+ static const bool writable = false;
4890+ };
4891+
4892+ struct Strength
4893+ {
4894+ static const std::string& name()
4895+ {
4896+ static const std::string s{"Strength"};
4897+ return s;
4898+ }
4899+
4900+ typedef AccessPoint Interface;
4901+ typedef std::int8_t ValueType;
4902+ static const bool readable = true;
4903+ static const bool writable = false;
4904+ };
4905+
4906+ AccessPoint(const std::shared_ptr<core::dbus::Object>& object)
4907+ : frequency(object->get_property<Frequency>()),
4908+ hw_address(object->get_property<HwAddress>()),
4909+ strength(object->get_property<Strength>())
4910+ {
4911+ }
4912+
4913+ std::shared_ptr<core::dbus::Property<Frequency>> frequency;
4914+ std::shared_ptr<core::dbus::Property<HwAddress>> hw_address;
4915+ std::shared_ptr<core::dbus::Property<Strength>> strength;
4916+ };
4917+
4918+ struct Device
4919+ {
4920+ static const std::string& name()
4921+ {
4922+ static const std::string s{"org.freedesktop.NetworkManager.Device"};
4923+ return s;
4924+ }
4925+
4926+ enum class Type
4927+ {
4928+ unknown = 0,
4929+ ethernet = 1,
4930+ wifi = 2,
4931+ unused_1 = 3,
4932+ unused_2 = 4,
4933+ bluetooth = 5,
4934+ olpc_mesh = 6,
4935+ wimax = 7,
4936+ modem = 8,
4937+ infiniband = 9,
4938+ bond = 10,
4939+ vlan = 11,
4940+ adsl = 12,
4941+ bridge = 13
4942+ };
4943+
4944+ struct Wireless
4945+ {
4946+ static const std::string& name()
4947+ {
4948+ static const std::string s{"org.freedesktop.NetworkManager.Device.Wireless"};
4949+ return s;
4950+ }
4951+
4952+ struct GetAccessPoints
4953+ {
4954+ static const std::string& name()
4955+ {
4956+ static const std::string s{"GetAccessPoints"};
4957+ return s;
4958+ }
4959+
4960+ typedef Wireless Interface;
4961+
4962+ static std::chrono::milliseconds default_timeout()
4963+ {
4964+ return std::chrono::seconds{1};
4965+ }
4966+ };
4967+ };
4968+
4969+ struct DeviceType
4970+ {
4971+ static const std::string& name()
4972+ {
4973+ static const std::string s{"DeviceType"};
4974+ return s;
4975+ }
4976+
4977+ typedef Device Interface;
4978+ typedef std::uint32_t ValueType;
4979+ static const bool readable = true;
4980+ static const bool writable = false;
4981+ };
4982+
4983+ Device(const std::shared_ptr<core::dbus::Service>& service,
4984+ const std::shared_ptr<core::dbus::Object>& object)
4985+ : service(service),
4986+ object(object),
4987+ device_type(object->get_property<DeviceType>())
4988+ {
4989+ }
4990+
4991+ Type type() const
4992+ {
4993+ return static_cast<Type>(device_type->get());
4994+ }
4995+
4996+ std::vector<AccessPoint> get_access_points() const
4997+ {
4998+ typedef std::vector<core::dbus::types::ObjectPath> ResultType;
4999+ auto result = object->invoke_method_synchronously<Wireless::GetAccessPoints, ResultType>();
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches