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