Merge lp:~mandel/location-service/add-auto-formatting into lp:location-service/trunk
- add-auto-formatting
- Merge into trunk
Status: | Approved |
---|---|
Approved by: | Thomas Voß |
Approved revision: | 191 |
Proposed branch: | lp:~mandel/location-service/add-auto-formatting |
Merge into: | lp:location-service/trunk |
Diff against target: |
30592 lines (+11828/-10771) 162 files modified
CMakeLists.txt (+35/-0) _clang-format (+48/-0) astyle-config (+44/-0) include/location_service/com/ubuntu/location/accuracy.h (+17/-12) include/location_service/com/ubuntu/location/clock.h (+1/-1) include/location_service/com/ubuntu/location/codec.h (+54/-44) include/location_service/com/ubuntu/location/configuration.h (+1/-1) include/location_service/com/ubuntu/location/connectivity/bounded_integer.h (+15/-15) include/location_service/com/ubuntu/location/connectivity/manager.h (+2/-4) include/location_service/com/ubuntu/location/connectivity/radio_cell.h (+54/-117) include/location_service/com/ubuntu/location/connectivity/wireless_network.h (+9/-15) include/location_service/com/ubuntu/location/criteria.h (+13/-9) include/location_service/com/ubuntu/location/default_provider_selection_policy.h (+10/-17) include/location_service/com/ubuntu/location/heading.h (+1/-1) include/location_service/com/ubuntu/location/init_and_shutdown.h (+1/-1) include/location_service/com/ubuntu/location/logging.h (+1/-2) include/location_service/com/ubuntu/location/optional.h (+2/-2) include/location_service/com/ubuntu/location/position.h (+10/-3) include/location_service/com/ubuntu/location/provider.h (+14/-16) include/location_service/com/ubuntu/location/provider_enumerator.h (+1/-1) include/location_service/com/ubuntu/location/provider_factory.h (+7/-5) include/location_service/com/ubuntu/location/provider_selection.h (+10/-4) include/location_service/com/ubuntu/location/provider_selection_policy.h (+3/-4) include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h (+55/-23) include/location_service/com/ubuntu/location/providers/geoclue/provider.h (+11/-5) include/location_service/com/ubuntu/location/providers/remote/interface.h (+45/-70) include/location_service/com/ubuntu/location/providers/remote/skeleton.h (+7/-3) include/location_service/com/ubuntu/location/providers/remote/stub.h (+7/-3) include/location_service/com/ubuntu/location/providers/skyhook/provider.h (+16/-7) include/location_service/com/ubuntu/location/proxy_provider.h (+2/-2) include/location_service/com/ubuntu/location/satellite_based_positioning_state.h (+3/-3) include/location_service/com/ubuntu/location/service/configuration.h (+4/-5) include/location_service/com/ubuntu/location/service/default_permission_manager.h (+6/-8) include/location_service/com/ubuntu/location/service/interface.h (+10/-28) include/location_service/com/ubuntu/location/service/permission_manager.h (+5/-7) include/location_service/com/ubuntu/location/service/session/implementation.h (+3/-3) include/location_service/com/ubuntu/location/service/session/interface.h (+4/-4) include/location_service/com/ubuntu/location/service/session/skeleton.h (+1/-1) include/location_service/com/ubuntu/location/service/session/stub.h (+4/-6) include/location_service/com/ubuntu/location/service/skeleton.h (+15/-17) include/location_service/com/ubuntu/location/service/stub.h (+4/-4) include/location_service/com/ubuntu/location/space_vehicle.h (+35/-38) include/location_service/com/ubuntu/location/units/units.h (+10/-11) include/location_service/com/ubuntu/location/update.h (+10/-11) include/location_service/com/ubuntu/location/velocity.h (+1/-1) include/location_service/com/ubuntu/location/wgs84/altitude.h (+5/-3) include/location_service/com/ubuntu/location/wgs84/coordinate.h (+11/-11) include/location_service/com/ubuntu/location/wgs84/latitude.h (+6/-2) include/location_service/com/ubuntu/location/wgs84/longitude.h (+6/-2) include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h (+3/-3) src/location_service/com/ubuntu/location/boost_ptree_settings.cpp (+3/-2) src/location_service/com/ubuntu/location/boost_ptree_settings.h (+1/-1) src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp (+334/-350) src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h (+9/-10) src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp (+73/-96) src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h (+3/-4) src/location_service/com/ubuntu/location/connectivity/dummy_connectivity_manager.h (+9/-5) src/location_service/com/ubuntu/location/connectivity/manager.cpp (+58/-19) src/location_service/com/ubuntu/location/connectivity/nm.h (+66/-68) src/location_service/com/ubuntu/location/connectivity/ofono.h (+522/-600) src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp (+390/-348) src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.h (+54/-39) src/location_service/com/ubuntu/location/connectivity/radio_cell.cpp (+31/-26) src/location_service/com/ubuntu/location/connectivity/wireless_network.cpp (+10/-5) src/location_service/com/ubuntu/location/criteria.cpp (+24/-6) src/location_service/com/ubuntu/location/default_permission_manager.cpp (+6/-5) src/location_service/com/ubuntu/location/default_provider_selection_policy.cpp (+56/-72) src/location_service/com/ubuntu/location/engine.cpp (+156/-145) src/location_service/com/ubuntu/location/engine.h (+24/-48) src/location_service/com/ubuntu/location/non_selecting_provider_selection_policy.cpp (+50/-33) src/location_service/com/ubuntu/location/non_selecting_provider_selection_policy.h (+1/-1) src/location_service/com/ubuntu/location/position.cpp (+27/-22) src/location_service/com/ubuntu/location/provider.cpp (+43/-15) src/location_service/com/ubuntu/location/provider_factory.cpp (+8/-15) src/location_service/com/ubuntu/location/providers/config.cpp (+14/-29) src/location_service/com/ubuntu/location/providers/dummy/provider.cpp (+54/-68) src/location_service/com/ubuntu/location/providers/dummy/provider.h (+16/-58) src/location_service/com/ubuntu/location/providers/geoclue/provider.cpp (+77/-90) src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp (+153/-168) src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h (+25/-22) src/location_service/com/ubuntu/location/providers/gps/hardware_abstraction_layer.h (+3/-3) src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h (+26/-11) src/location_service/com/ubuntu/location/providers/gps/null_gps_xtra_downloader.h (+19/-3) src/location_service/com/ubuntu/location/providers/gps/provider.cpp (+16/-17) src/location_service/com/ubuntu/location/providers/gps/provider.h (+6/-5) src/location_service/com/ubuntu/location/providers/remote/provider.cpp (+378/-319) src/location_service/com/ubuntu/location/providers/remote/provider.h (+1/-1) src/location_service/com/ubuntu/location/providers/remote/skeleton.cpp (+2/-1) src/location_service/com/ubuntu/location/providers/skyhook/provider.cpp (+43/-45) src/location_service/com/ubuntu/location/proxy_provider.cpp (+16/-21) src/location_service/com/ubuntu/location/satellite_based_positioning_state.cpp (+19/-19) src/location_service/com/ubuntu/location/service/daemon.cpp (+210/-215) src/location_service/com/ubuntu/location/service/daemon.h (+9/-21) src/location_service/com/ubuntu/location/service/daemon_cli_main.cpp (+4/-2) src/location_service/com/ubuntu/location/service/daemon_main.cpp (+4/-2) src/location_service/com/ubuntu/location/service/dbus_connection_factory.h (+2/-5) src/location_service/com/ubuntu/location/service/default_configuration.cpp (+3/-3) src/location_service/com/ubuntu/location/service/default_configuration.h (+5/-6) src/location_service/com/ubuntu/location/service/default_permission_manager.cpp (+6/-5) src/location_service/com/ubuntu/location/service/demultiplexing_reporter.cpp (+12/-8) src/location_service/com/ubuntu/location/service/demultiplexing_reporter.h (+13/-3) src/location_service/com/ubuntu/location/service/harvester.cpp (+20/-12) src/location_service/com/ubuntu/location/service/harvester.h (+1/-2) src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp (+149/-118) src/location_service/com/ubuntu/location/service/ichnaea_reporter.h (+23/-28) src/location_service/com/ubuntu/location/service/implementation.cpp (+69/-90) src/location_service/com/ubuntu/location/service/implementation.h (+2/-2) src/location_service/com/ubuntu/location/service/program_options.h (+51/-50) src/location_service/com/ubuntu/location/service/provider_daemon.cpp (+49/-60) src/location_service/com/ubuntu/location/service/provider_daemon.h (+1/-1) src/location_service/com/ubuntu/location/service/provider_daemon_main.cpp (+2/-4) src/location_service/com/ubuntu/location/service/runtime_tests.cpp (+43/-36) src/location_service/com/ubuntu/location/service/runtime_tests.h (+1/-1) src/location_service/com/ubuntu/location/service/session/implementation.cpp (+50/-55) src/location_service/com/ubuntu/location/service/session/interface.cpp (+2/-1) src/location_service/com/ubuntu/location/service/session/interface_p.h (+48/-51) src/location_service/com/ubuntu/location/service/session/skeleton.cpp (+91/-85) src/location_service/com/ubuntu/location/service/session/stub.cpp (+96/-85) src/location_service/com/ubuntu/location/service/skeleton.cpp (+83/-127) src/location_service/com/ubuntu/location/service/stub.cpp (+19/-17) src/location_service/com/ubuntu/location/service/trust_store_permission_manager.cpp (+42/-52) src/location_service/com/ubuntu/location/service/trust_store_permission_manager.h (+3/-4) src/location_service/com/ubuntu/location/set_name_for_thread.h (+1/-1) src/location_service/com/ubuntu/location/settings.cpp (+2/-0) src/location_service/com/ubuntu/location/settings.h (+24/-13) src/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.cpp (+19/-19) tests/acceptance_tests.cpp (+272/-309) tests/connectivity_manager_test.cpp (+133/-114) tests/controller_test.cpp (+11/-21) tests/daemon_and_cli_tests.cpp (+48/-71) tests/default_permission_manager_test.cpp (+2/-3) tests/demultiplexing_reporter_test.cpp (+6/-10) tests/did_finish_successfully.h (+5/-1) tests/dummy_provider_tests.cpp (+11/-16) tests/engine_test.cpp (+50/-67) tests/espoo_provider_test.cpp (+143/-137) tests/geoclue_provider_test.cpp (+2/-3) tests/gps_provider_test.cpp (+139/-188) tests/harvester_test.cpp (+9/-25) tests/heading_test.cpp (+7/-6) tests/ichnaea_reporter_test.cpp (+41/-83) tests/mock_connectivity_manager.h (+15/-16) tests/mock_event_consumer.h (+17/-17) tests/mock_network_manager.h (+81/-77) tests/mock_ofono.h (+82/-51) tests/mock_provider.h (+11/-6) tests/mock_reporter.h (+4/-5) tests/mongoose.c (+5311/-4272) tests/mongoose.h (+105/-96) tests/null_provider_selection_policy.h (+6/-11) tests/position_test.cpp (+11/-19) tests/provider_factory_test.cpp (+13/-11) tests/provider_selection_policy_test.cpp (+51/-59) tests/provider_test.cpp (+66/-45) tests/remote_provider_test.cpp (+199/-214) tests/remote_providerd_test.cpp (+120/-116) tests/session_test.cpp (+37/-25) tests/trust_store_permission_manager_test.cpp (+47/-53) tests/web_server.h (+21/-19) tests/wgs84_test.cpp (+57/-51) tools/CMakeLists.txt (+1/-0) tools/formatcode.in (+67/-0) |
To merge this branch: | bzr merge lp:~mandel/location-service/add-auto-formatting |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ricardo Salveti (community) | code, wait a bit more to land. | Disapprove | |
Thomas Voß (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+257240@code.launchpad.net |
Commit message
Add the autoformatting used in the diff projects from the team.
Description of the change
Add the autoformatting used in the diff projects from the team.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 185. By Manuel de la Peña
-
Run the autoformatting code.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:185
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 186. By Manuel de la Peña
-
Reverted the format changes and added the missing _clang_format file.
- 187. By Manuel de la Peña
-
Add missin astyle file.
- 188. By Manuel de la Peña
-
Performed style rule.
- 189. By Manuel de la Peña
-
Revert style changes.
- 190. By Manuel de la Peña
-
Merged with trunk.
- 191. By Manuel de la Peña
-
Ran format job.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:191
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ricardo Salveti (rsalveti) wrote : | # |
I'd like to put this landing on hold until we sort out the remaining critical issues with location-service (and make it reliable).
Landing a big cosmetic change creates a huge pain later on when tracing back changes and bisecting problems, for really no benefit. While I understand it's good to have a code style pattern, at this point I feel it could end up creating more problems for us.
We can land this once we're more comfortable with the codebase.
Unmerged revisions
- 191. By Manuel de la Peña
-
Ran format job.
- 190. By Manuel de la Peña
-
Merged with trunk.
- 189. By Manuel de la Peña
-
Revert style changes.
- 188. By Manuel de la Peña
-
Performed style rule.
- 187. By Manuel de la Peña
-
Add missin astyle file.
- 186. By Manuel de la Peña
-
Reverted the format changes and added the missing _clang_format file.
- 185. By Manuel de la Peña
-
Run the autoformatting code.
- 184. By Manuel de la Peña
-
Add auto-formatting shared between diff projects from the team.
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2014-09-18 23:06:08 +0000 | |||
3 | +++ CMakeLists.txt 2015-04-23 17:23:49 +0000 | |||
4 | @@ -54,6 +54,41 @@ | |||
5 | 54 | SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs") | 54 | SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs") |
6 | 55 | endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS) | 55 | endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS) |
7 | 56 | 56 | ||
8 | 57 | |||
9 | 58 | # | ||
10 | 59 | # Code style fixer. We put the code through astyle first because it makes some fixes that | ||
11 | 60 | # clang-format won't do (such as "char *p" -> "char* p"). But astyle messes up other things | ||
12 | 61 | # (particularly lambdas and assembly-style comments), which clang-format does right. | ||
13 | 62 | # So, we run clang-format after running astyle, which undoes the damage done by astyle | ||
14 | 63 | # without reverting desirable astyle fixes. | ||
15 | 64 | # | ||
16 | 65 | |||
17 | 66 | find_program(ASTYLE_COMMAND NAMES astyle) | ||
18 | 67 | if (NOT ASTYLE_COMMAND) | ||
19 | 68 | message(WARNING "Cannot find astyle: formatcode target will not be available") | ||
20 | 69 | else() | ||
21 | 70 | # astyle 2.03 creates DOS line endings, so we need to fix its output | ||
22 | 71 | find_program(DOS2UNIX_COMMAND NAMES dos2unix) | ||
23 | 72 | if (NOT DOS2UNIX_COMMAND) | ||
24 | 73 | message(WARNING "Cannot find dos2unix: formatcode target will not be available") | ||
25 | 74 | else() | ||
26 | 75 | find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.6 clang-format-3.5) | ||
27 | 76 | if (NOT CLANG_FORMAT_COMMAND) | ||
28 | 77 | message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available") | ||
29 | 78 | endif() | ||
30 | 79 | endif() | ||
31 | 80 | endif() | ||
32 | 81 | |||
33 | 82 | if (ASTYLE_COMMAND AND DOS2UNIX_COMMAND AND CLANG_FORMAT_COMMAND) | ||
34 | 83 | add_subdirectory(tools) | ||
35 | 84 | add_custom_target( | ||
36 | 85 | format | ||
37 | 86 | ${CMAKE_BINARY_DIR}/tools/formatcode ${CMAKE_SOURCE_DIR}/src ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND} | ||
38 | 87 | COMMAND ${CMAKE_BINARY_DIR}/tools/formatcode ${CMAKE_SOURCE_DIR}/include ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND} | ||
39 | 88 | COMMAND ${CMAKE_BINARY_DIR}/tools/formatcode ${CMAKE_SOURCE_DIR}/tests ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND} | ||
40 | 89 | ) | ||
41 | 90 | endif() | ||
42 | 91 | |||
43 | 57 | include_directories( | 92 | include_directories( |
44 | 58 | ${Boost_INCLUDE_DIRS} | 93 | ${Boost_INCLUDE_DIRS} |
45 | 59 | ${DBUS_INCLUDE_DIRS} | 94 | ${DBUS_INCLUDE_DIRS} |
46 | 60 | 95 | ||
47 | === added file '_clang-format' | |||
48 | --- _clang-format 1970-01-01 00:00:00 +0000 | |||
49 | +++ _clang-format 2015-04-23 17:23:49 +0000 | |||
50 | @@ -0,0 +1,48 @@ | |||
51 | 1 | --- | ||
52 | 2 | AccessModifierOffset: -4 | ||
53 | 3 | AlignEscapedNewlinesLeft: true | ||
54 | 4 | AlignTrailingComments: true | ||
55 | 5 | AllowAllParametersOfDeclarationOnNextLine: true | ||
56 | 6 | AllowShortFunctionsOnASingleLine: false | ||
57 | 7 | AllowShortIfStatementsOnASingleLine: false | ||
58 | 8 | AllowShortLoopsOnASingleLine: false | ||
59 | 9 | AlwaysBreakBeforeMultilineStrings: true | ||
60 | 10 | AlwaysBreakTemplateDeclarations: true | ||
61 | 11 | BinPackParameters: false | ||
62 | 12 | BreakBeforeBinaryOperators: false | ||
63 | 13 | BreakBeforeBraces: Allman | ||
64 | 14 | BreakBeforeTernaryOperators: false | ||
65 | 15 | BreakConstructorInitializersBeforeComma: true | ||
66 | 16 | ColumnLimit: 120 | ||
67 | 17 | ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
68 | 18 | ConstructorInitializerIndentWidth: 4 | ||
69 | 19 | ContinuationIndentWidth: 4 | ||
70 | 20 | Cpp11BracedListStyle: true | ||
71 | 21 | DerivePointerBinding: true | ||
72 | 22 | ExperimentalAutoDetectBinPacking: false | ||
73 | 23 | IndentCaseLabels: true | ||
74 | 24 | IndentFunctionDeclarationAfterType: true | ||
75 | 25 | IndentWidth: 4 | ||
76 | 26 | Language: Cpp | ||
77 | 27 | MaxEmptyLinesToKeep: 1 | ||
78 | 28 | NamespaceIndentation: None | ||
79 | 29 | ObjCSpaceBeforeProtocolList: false | ||
80 | 30 | PenaltyBreakBeforeFirstCallParameter: 1 | ||
81 | 31 | PenaltyBreakComment: 100 | ||
82 | 32 | PenaltyBreakFirstLessLess: 120 | ||
83 | 33 | PenaltyBreakString: 1000 | ||
84 | 34 | PenaltyExcessCharacter: 1000000 | ||
85 | 35 | PenaltyReturnTypeOnItsOwnLine: 200 | ||
86 | 36 | PointerBindsToType: true | ||
87 | 37 | SpaceBeforeAssignmentOperators: true | ||
88 | 38 | SpaceBeforeParens: ControlStatements | ||
89 | 39 | SpaceInEmptyParentheses: false | ||
90 | 40 | SpacesBeforeTrailingComments: 2 | ||
91 | 41 | SpacesInAngles: false | ||
92 | 42 | SpacesInCStyleCastParentheses: false | ||
93 | 43 | SpacesInParentheses: false | ||
94 | 44 | Standard: Cpp11 | ||
95 | 45 | TabWidth: 8 | ||
96 | 46 | UseTab: Never | ||
97 | 47 | ... | ||
98 | 48 | |||
99 | 0 | 49 | ||
100 | === added file 'astyle-config' | |||
101 | --- astyle-config 1970-01-01 00:00:00 +0000 | |||
102 | +++ astyle-config 2015-04-23 17:23:49 +0000 | |||
103 | @@ -0,0 +1,44 @@ | |||
104 | 1 | # Options for formatting code with astyle. | ||
105 | 2 | # | ||
106 | 3 | # This helps to make code match the style guide. | ||
107 | 4 | # | ||
108 | 5 | # Use like this: | ||
109 | 6 | # | ||
110 | 7 | # astyle --options=astyle-config mfile.h myfile.cpp | ||
111 | 8 | # | ||
112 | 9 | # Occasionally, astyle does something silly (particularly with lambdas), so it's | ||
113 | 10 | # still necessary to scan the changes for things that are wrong. | ||
114 | 11 | # But, for most files, it does a good job. | ||
115 | 12 | # | ||
116 | 13 | # Please consider using this before checking code in for review. Code reviews shouldn't | ||
117 | 14 | # have to deal with layout issues, they are just a distraction. It's better to be able | ||
118 | 15 | # to focus on semantics in a code review, with style issues out of the way. | ||
119 | 16 | |||
120 | 17 | --formatted | ||
121 | 18 | --style=allman | ||
122 | 19 | --min-conditional-indent=2 | ||
123 | 20 | --indent-switches | ||
124 | 21 | --max-instatement-indent=120 | ||
125 | 22 | --pad-header | ||
126 | 23 | --align-pointer=type | ||
127 | 24 | --align-reference=type | ||
128 | 25 | --add-brackets | ||
129 | 26 | --convert-tabs | ||
130 | 27 | --close-templates | ||
131 | 28 | --max-code-length=120 | ||
132 | 29 | |||
133 | 30 | # --pad-oper | ||
134 | 31 | # | ||
135 | 32 | # Commented out for now. It changes | ||
136 | 33 | # | ||
137 | 34 | # for (int i=0; i<10; ++i) | ||
138 | 35 | # to | ||
139 | 36 | # for (int i = 0; i < 10; ++i) | ||
140 | 37 | # | ||
141 | 38 | # Unfortunately, it also messes with rvalue references: | ||
142 | 39 | # | ||
143 | 40 | # ResourcePtr& operator=(ResourcePtr&& r); | ||
144 | 41 | # | ||
145 | 42 | # becomes: | ||
146 | 43 | # | ||
147 | 44 | # ResourcePtr& operator=(ResourcePtr && r); | ||
148 | 0 | 45 | ||
149 | === modified file 'include/location_service/com/ubuntu/location/accuracy.h' | |||
150 | --- include/location_service/com/ubuntu/location/accuracy.h 2013-05-28 14:41:06 +0000 | |||
151 | +++ include/location_service/com/ubuntu/location/accuracy.h 2015-04-23 17:23:49 +0000 | |||
152 | @@ -34,12 +34,12 @@ | |||
153 | 34 | postalcode, | 34 | postalcode, |
154 | 35 | street, | 35 | street, |
155 | 36 | detailed, | 36 | detailed, |
157 | 37 | 37 | ||
158 | 38 | best = detailed, | 38 | best = detailed, |
159 | 39 | worst = country | 39 | worst = country |
160 | 40 | }; | 40 | }; |
161 | 41 | 41 | ||
163 | 42 | template<typename T> | 42 | template <typename T> |
164 | 43 | struct AccuracyTraits | 43 | struct AccuracyTraits |
165 | 44 | { | 44 | { |
166 | 45 | static AccuracyLevel classify(const T& instance); | 45 | static AccuracyLevel classify(const T& instance); |
167 | @@ -47,14 +47,20 @@ | |||
168 | 47 | static T worst(); | 47 | static T worst(); |
169 | 48 | }; | 48 | }; |
170 | 49 | 49 | ||
172 | 50 | template<typename T> | 50 | template <typename T> |
173 | 51 | struct Accuracy | 51 | struct Accuracy |
174 | 52 | { | 52 | { |
175 | 53 | typedef typename T::Unit Unit; | 53 | typedef typename T::Unit Unit; |
176 | 54 | typedef typename T::Quantity Quantity; | 54 | typedef typename T::Quantity Quantity; |
177 | 55 | 55 | ||
180 | 56 | static Accuracy<T> best() { return AccuracyTraits<T>::best(); } | 56 | static Accuracy<T> best() |
181 | 57 | static Accuracy<T> worst() { return AccuracyTraits<T>::worst(); } | 57 | { |
182 | 58 | return AccuracyTraits<T>::best(); | ||
183 | 59 | } | ||
184 | 60 | static Accuracy<T> worst() | ||
185 | 61 | { | ||
186 | 62 | return AccuracyTraits<T>::worst(); | ||
187 | 63 | } | ||
188 | 58 | 64 | ||
189 | 59 | AccuracyLevel classify() const | 65 | AccuracyLevel classify() const |
190 | 60 | { | 66 | { |
191 | @@ -64,15 +70,14 @@ | |||
192 | 64 | T value; | 70 | T value; |
193 | 65 | }; | 71 | }; |
194 | 66 | 72 | ||
196 | 67 | template<typename T> | 73 | template <typename T> |
197 | 68 | inline std::ostream& operator<<(std::ostream& out, const Accuracy<T>& update) | 74 | inline std::ostream& operator<<(std::ostream& out, const Accuracy<T>& update) |
198 | 69 | { | 75 | { |
199 | 70 | out << "Accuracy(" << update.value << ")"; | 76 | out << "Accuracy(" << update.value << ")"; |
200 | 71 | return out; | 77 | return out; |
201 | 72 | } | 78 | } |
208 | 73 | 79 | } | |
209 | 74 | } | 80 | } |
210 | 75 | } | 81 | } |
211 | 76 | } | 82 | |
212 | 77 | 83 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_ACCURACY_H_ | |
207 | 78 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_ACCURACY_H_ | ||
213 | 79 | 84 | ||
214 | === modified file 'include/location_service/com/ubuntu/location/clock.h' | |||
215 | --- include/location_service/com/ubuntu/location/clock.h 2013-12-16 12:37:07 +0000 | |||
216 | +++ include/location_service/com/ubuntu/location/clock.h 2015-04-23 17:23:49 +0000 | |||
217 | @@ -66,4 +66,4 @@ | |||
218 | 66 | } | 66 | } |
219 | 67 | } | 67 | } |
220 | 68 | 68 | ||
222 | 69 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CLOCK_H_ | 69 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CLOCK_H_ |
223 | 70 | 70 | ||
224 | === modified file 'include/location_service/com/ubuntu/location/codec.h' | |||
225 | --- include/location_service/com/ubuntu/location/codec.h 2014-09-12 15:04:21 +0000 | |||
226 | +++ include/location_service/com/ubuntu/location/codec.h 2015-04-23 17:23:49 +0000 | |||
227 | @@ -38,7 +38,7 @@ | |||
228 | 38 | { | 38 | { |
229 | 39 | namespace helper | 39 | namespace helper |
230 | 40 | { | 40 | { |
232 | 41 | template<typename T> | 41 | template <typename T> |
233 | 42 | struct TypeMapper<com::ubuntu::location::units::Quantity<T>> | 42 | struct TypeMapper<com::ubuntu::location::units::Quantity<T>> |
234 | 43 | { | 43 | { |
235 | 44 | constexpr static ArgumentType type_value() | 44 | constexpr static ArgumentType type_value() |
236 | @@ -63,7 +63,7 @@ | |||
237 | 63 | }; | 63 | }; |
238 | 64 | } | 64 | } |
239 | 65 | 65 | ||
241 | 66 | template<typename T> | 66 | template <typename T> |
242 | 67 | struct Codec<com::ubuntu::location::Optional<T>> | 67 | struct Codec<com::ubuntu::location::Optional<T>> |
243 | 68 | { | 68 | { |
244 | 69 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Optional<T>& in) | 69 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Optional<T>& in) |
245 | @@ -71,7 +71,9 @@ | |||
246 | 71 | bool has_value{in}; | 71 | bool has_value{in}; |
247 | 72 | Codec<bool>::encode_argument(writer, has_value); | 72 | Codec<bool>::encode_argument(writer, has_value); |
248 | 73 | if (has_value) | 73 | if (has_value) |
249 | 74 | { | ||
250 | 74 | Codec<typename com::ubuntu::location::Optional<T>::value_type>::encode_argument(writer, *in); | 75 | Codec<typename com::ubuntu::location::Optional<T>::value_type>::encode_argument(writer, *in); |
251 | 76 | } | ||
252 | 75 | } | 77 | } |
253 | 76 | 78 | ||
254 | 77 | static void decode_argument(Message::Reader& reader, com::ubuntu::location::Optional<T>& in) | 79 | static void decode_argument(Message::Reader& reader, com::ubuntu::location::Optional<T>& in) |
255 | @@ -83,14 +85,15 @@ | |||
256 | 83 | typename com::ubuntu::location::Optional<T>::value_type value; | 85 | typename com::ubuntu::location::Optional<T>::value_type value; |
257 | 84 | Codec<typename com::ubuntu::location::Optional<T>::value_type>::decode_argument(reader, value); | 86 | Codec<typename com::ubuntu::location::Optional<T>::value_type>::decode_argument(reader, value); |
258 | 85 | in = value; | 87 | in = value; |
260 | 86 | } else | 88 | } |
261 | 89 | else | ||
262 | 87 | { | 90 | { |
263 | 88 | in.reset(); | 91 | in.reset(); |
264 | 89 | } | 92 | } |
265 | 90 | } | 93 | } |
266 | 91 | }; | 94 | }; |
267 | 92 | 95 | ||
269 | 93 | template<typename T> | 96 | template <typename T> |
270 | 94 | struct Codec<com::ubuntu::location::units::Quantity<T>> | 97 | struct Codec<com::ubuntu::location::units::Quantity<T>> |
271 | 95 | { | 98 | { |
272 | 96 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::units::Quantity<T>& in) | 99 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::units::Quantity<T>& in) |
273 | @@ -106,8 +109,8 @@ | |||
274 | 106 | } | 109 | } |
275 | 107 | }; | 110 | }; |
276 | 108 | 111 | ||
279 | 109 | template<typename T, typename U> | 112 | template <typename T, typename U> |
280 | 110 | struct Codec<com::ubuntu::location::wgs84::Coordinate<T,U>> | 113 | struct Codec<com::ubuntu::location::wgs84::Coordinate<T, U>> |
281 | 111 | { | 114 | { |
282 | 112 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::wgs84::Coordinate<T, U>& in) | 115 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::wgs84::Coordinate<T, U>& in) |
283 | 113 | { | 116 | { |
284 | @@ -120,7 +123,7 @@ | |||
285 | 120 | } | 123 | } |
286 | 121 | }; | 124 | }; |
287 | 122 | 125 | ||
289 | 123 | template<> | 126 | template <> |
290 | 124 | struct Codec<com::ubuntu::location::Position> | 127 | struct Codec<com::ubuntu::location::Position> |
291 | 125 | { | 128 | { |
292 | 126 | typedef com::ubuntu::location::Position::Accuracy::Horizontal HorizontalAccuracy; | 129 | typedef com::ubuntu::location::Position::Accuracy::Horizontal HorizontalAccuracy; |
293 | @@ -130,7 +133,8 @@ | |||
294 | 130 | { | 133 | { |
295 | 131 | Codec<com::ubuntu::location::wgs84::Latitude>::encode_argument(writer, in.latitude); | 134 | Codec<com::ubuntu::location::wgs84::Latitude>::encode_argument(writer, in.latitude); |
296 | 132 | Codec<com::ubuntu::location::wgs84::Longitude>::encode_argument(writer, in.longitude); | 135 | Codec<com::ubuntu::location::wgs84::Longitude>::encode_argument(writer, in.longitude); |
298 | 133 | Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::encode_argument(writer, in.altitude); | 136 | Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::encode_argument(writer, |
299 | 137 | in.altitude); | ||
300 | 134 | 138 | ||
301 | 135 | Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::encode_argument(writer, in.accuracy.horizontal); | 139 | Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::encode_argument(writer, in.accuracy.horizontal); |
302 | 136 | Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::encode_argument(writer, in.accuracy.vertical); | 140 | Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::encode_argument(writer, in.accuracy.vertical); |
303 | @@ -140,17 +144,17 @@ | |||
304 | 140 | { | 144 | { |
305 | 141 | Codec<com::ubuntu::location::wgs84::Latitude>::decode_argument(reader, in.latitude); | 145 | Codec<com::ubuntu::location::wgs84::Latitude>::decode_argument(reader, in.latitude); |
306 | 142 | Codec<com::ubuntu::location::wgs84::Longitude>::decode_argument(reader, in.longitude); | 146 | Codec<com::ubuntu::location::wgs84::Longitude>::decode_argument(reader, in.longitude); |
308 | 143 | Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::decode_argument(reader, in.altitude); | 147 | Codec<com::ubuntu::location::Optional<com::ubuntu::location::wgs84::Altitude>>::decode_argument(reader, |
309 | 148 | in.altitude); | ||
310 | 144 | 149 | ||
311 | 145 | Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::decode_argument(reader, in.accuracy.horizontal); | 150 | Codec<com::ubuntu::location::Optional<HorizontalAccuracy>>::decode_argument(reader, in.accuracy.horizontal); |
312 | 146 | Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::decode_argument(reader, in.accuracy.vertical); | 151 | Codec<com::ubuntu::location::Optional<VerticalAccuracy>>::decode_argument(reader, in.accuracy.vertical); |
313 | 147 | } | 152 | } |
314 | 148 | }; | 153 | }; |
315 | 149 | 154 | ||
316 | 150 | |||
317 | 151 | namespace helper | 155 | namespace helper |
318 | 152 | { | 156 | { |
320 | 153 | template<> | 157 | template <> |
321 | 154 | struct TypeMapper<com::ubuntu::location::SpaceVehicle::Key> | 158 | struct TypeMapper<com::ubuntu::location::SpaceVehicle::Key> |
322 | 155 | { | 159 | { |
323 | 156 | constexpr static ArgumentType type_value() | 160 | constexpr static ArgumentType type_value() |
324 | @@ -169,12 +173,11 @@ | |||
325 | 169 | static std::string signature() | 173 | static std::string signature() |
326 | 170 | { | 174 | { |
327 | 171 | static const std::string s = | 175 | static const std::string s = |
330 | 172 | helper::TypeMapper<std::uint32_t>::signature() + | 176 | helper::TypeMapper<std::uint32_t>::signature() + helper::TypeMapper<std::uint32_t>::signature(); |
329 | 173 | helper::TypeMapper<std::uint32_t>::signature(); | ||
331 | 174 | return s; | 177 | return s; |
332 | 175 | } | 178 | } |
333 | 176 | }; | 179 | }; |
335 | 177 | template<> | 180 | template <> |
336 | 178 | struct TypeMapper<com::ubuntu::location::SpaceVehicle> | 181 | struct TypeMapper<com::ubuntu::location::SpaceVehicle> |
337 | 179 | { | 182 | { |
338 | 180 | constexpr static ArgumentType type_value() | 183 | constexpr static ArgumentType type_value() |
339 | @@ -194,20 +197,20 @@ | |||
340 | 194 | { | 197 | { |
341 | 195 | std::string s = | 198 | std::string s = |
342 | 196 | DBUS_STRUCT_BEGIN_CHAR_AS_STRING + | 199 | DBUS_STRUCT_BEGIN_CHAR_AS_STRING + |
350 | 197 | helper::TypeMapper<com::ubuntu::location::SpaceVehicle::Key>::signature() + | 200 | helper::TypeMapper<com::ubuntu::location::SpaceVehicle::Key>::signature() + |
351 | 198 | helper::TypeMapper<float>::signature() + | 201 | helper::TypeMapper<float>::signature() + helper::TypeMapper<bool>::signature() + |
352 | 199 | helper::TypeMapper<bool>::signature() + | 202 | helper::TypeMapper<bool>::signature() + helper::TypeMapper<bool>::signature() + |
353 | 200 | helper::TypeMapper<bool>::signature() + | 203 | helper::TypeMapper< |
354 | 201 | helper::TypeMapper<bool>::signature() + | 204 | com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + |
355 | 202 | helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + | 205 | helper::TypeMapper< |
356 | 203 | helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + | 206 | com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + |
357 | 204 | DBUS_STRUCT_END_CHAR_AS_STRING; | 207 | DBUS_STRUCT_END_CHAR_AS_STRING; |
358 | 205 | return s; | 208 | return s; |
359 | 206 | } | 209 | } |
360 | 207 | }; | 210 | }; |
361 | 208 | } | 211 | } |
362 | 209 | 212 | ||
364 | 210 | template<> | 213 | template <> |
365 | 211 | struct Codec<com::ubuntu::location::SpaceVehicle::Key> | 214 | struct Codec<com::ubuntu::location::SpaceVehicle::Key> |
366 | 212 | { | 215 | { |
367 | 213 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle::Key& in) | 216 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle::Key& in) |
368 | @@ -223,7 +226,7 @@ | |||
369 | 223 | } | 226 | } |
370 | 224 | }; | 227 | }; |
371 | 225 | 228 | ||
373 | 226 | template<> | 229 | template <> |
374 | 227 | struct Codec<com::ubuntu::location::SpaceVehicle> | 230 | struct Codec<com::ubuntu::location::SpaceVehicle> |
375 | 228 | { | 231 | { |
376 | 229 | inline static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle& in) | 232 | inline static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle& in) |
377 | @@ -235,8 +238,10 @@ | |||
378 | 235 | sub.push_boolean(in.has_almanac_data); | 238 | sub.push_boolean(in.has_almanac_data); |
379 | 236 | sub.push_boolean(in.has_ephimeris_data); | 239 | sub.push_boolean(in.has_ephimeris_data); |
380 | 237 | sub.push_boolean(in.used_in_fix); | 240 | sub.push_boolean(in.used_in_fix); |
383 | 238 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument(sub, in.azimuth); | 241 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument( |
384 | 239 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument(sub, in.elevation); | 242 | sub, in.azimuth); |
385 | 243 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::encode_argument( | ||
386 | 244 | sub, in.elevation); | ||
387 | 240 | 245 | ||
388 | 241 | writer.close_structure(std::move(sub)); | 246 | writer.close_structure(std::move(sub)); |
389 | 242 | } | 247 | } |
390 | @@ -250,14 +255,16 @@ | |||
391 | 250 | in.has_almanac_data = sub.pop_boolean(); | 255 | in.has_almanac_data = sub.pop_boolean(); |
392 | 251 | in.has_ephimeris_data = sub.pop_boolean(); | 256 | in.has_ephimeris_data = sub.pop_boolean(); |
393 | 252 | in.used_in_fix = sub.pop_boolean(); | 257 | in.used_in_fix = sub.pop_boolean(); |
396 | 253 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument(sub, in.azimuth); | 258 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument( |
397 | 254 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument(sub, in.elevation); | 259 | sub, in.azimuth); |
398 | 260 | Codec<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::decode_argument( | ||
399 | 261 | sub, in.elevation); | ||
400 | 255 | } | 262 | } |
401 | 256 | }; | 263 | }; |
402 | 257 | 264 | ||
403 | 258 | namespace helper | 265 | namespace helper |
404 | 259 | { | 266 | { |
406 | 260 | template<> | 267 | template <> |
407 | 261 | struct TypeMapper<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>> | 268 | struct TypeMapper<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>> |
408 | 262 | { | 269 | { |
409 | 263 | constexpr static ArgumentType type_value() | 270 | constexpr static ArgumentType type_value() |
410 | @@ -275,20 +282,23 @@ | |||
411 | 275 | 282 | ||
412 | 276 | static std::string signature() | 283 | static std::string signature() |
413 | 277 | { | 284 | { |
415 | 278 | static const std::string s = DBUS_TYPE_ARRAY_AS_STRING + TypeMapper<com::ubuntu::location::SpaceVehicle>::signature(); | 285 | static const std::string s = |
416 | 286 | DBUS_TYPE_ARRAY_AS_STRING + TypeMapper<com::ubuntu::location::SpaceVehicle>::signature(); | ||
417 | 279 | return s; | 287 | return s; |
418 | 280 | } | 288 | } |
419 | 281 | }; | 289 | }; |
420 | 282 | } | 290 | } |
422 | 283 | template<> | 291 | template <> |
423 | 284 | struct Codec<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>> | 292 | struct Codec<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>> |
424 | 285 | { | 293 | { |
426 | 286 | inline static void encode_argument(Message::Writer& writer, const std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& arg) | 294 | inline static void encode_argument( |
427 | 295 | Message::Writer& writer, | ||
428 | 296 | const std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& arg) | ||
429 | 287 | { | 297 | { |
430 | 288 | types::Signature signature(helper::TypeMapper<com::ubuntu::location::SpaceVehicle>::signature()); | 298 | types::Signature signature(helper::TypeMapper<com::ubuntu::location::SpaceVehicle>::signature()); |
431 | 289 | auto sub = writer.open_array(signature); | 299 | auto sub = writer.open_array(signature); |
432 | 290 | 300 | ||
434 | 291 | for(const auto& element : arg) | 301 | for (const auto& element : arg) |
435 | 292 | { | 302 | { |
436 | 293 | Codec<com::ubuntu::location::SpaceVehicle>::encode_argument(sub, element.second); | 303 | Codec<com::ubuntu::location::SpaceVehicle>::encode_argument(sub, element.second); |
437 | 294 | } | 304 | } |
438 | @@ -296,7 +306,9 @@ | |||
439 | 296 | writer.close_array(std::move(sub)); | 306 | writer.close_array(std::move(sub)); |
440 | 297 | } | 307 | } |
441 | 298 | 308 | ||
443 | 299 | inline static void decode_argument(Message::Reader& reader, std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& out) | 309 | inline static void decode_argument( |
444 | 310 | Message::Reader& reader, | ||
445 | 311 | std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& out) | ||
446 | 300 | { | 312 | { |
447 | 301 | auto sub = reader.pop_array(); | 313 | auto sub = reader.pop_array(); |
448 | 302 | while (sub.type() != ArgumentType::invalid) | 314 | while (sub.type() != ArgumentType::invalid) |
449 | @@ -308,7 +320,7 @@ | |||
450 | 308 | } | 320 | } |
451 | 309 | }; | 321 | }; |
452 | 310 | 322 | ||
454 | 311 | template<> | 323 | template <> |
455 | 312 | struct Codec<com::ubuntu::location::Criteria> | 324 | struct Codec<com::ubuntu::location::Criteria> |
456 | 313 | { | 325 | { |
457 | 314 | typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> HorizontalAccuracy; | 326 | typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> HorizontalAccuracy; |
458 | @@ -343,7 +355,7 @@ | |||
459 | 343 | } | 355 | } |
460 | 344 | }; | 356 | }; |
461 | 345 | 357 | ||
463 | 346 | template<> | 358 | template <> |
464 | 347 | struct Codec<com::ubuntu::location::Provider::Features> | 359 | struct Codec<com::ubuntu::location::Provider::Features> |
465 | 348 | { | 360 | { |
466 | 349 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Provider::Features& in) | 361 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Provider::Features& in) |
467 | @@ -357,7 +369,7 @@ | |||
468 | 357 | } | 369 | } |
469 | 358 | }; | 370 | }; |
470 | 359 | 371 | ||
472 | 360 | template<> | 372 | template <> |
473 | 361 | struct Codec<com::ubuntu::location::Provider::Requirements> | 373 | struct Codec<com::ubuntu::location::Provider::Requirements> |
474 | 362 | { | 374 | { |
475 | 363 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Provider::Requirements& in) | 375 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Provider::Requirements& in) |
476 | @@ -371,7 +383,7 @@ | |||
477 | 371 | } | 383 | } |
478 | 372 | }; | 384 | }; |
479 | 373 | 385 | ||
481 | 374 | template<> | 386 | template <> |
482 | 375 | struct Codec<com::ubuntu::location::WifiAndCellIdReportingState> | 387 | struct Codec<com::ubuntu::location::WifiAndCellIdReportingState> |
483 | 376 | { | 388 | { |
484 | 377 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::WifiAndCellIdReportingState& in) | 389 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::WifiAndCellIdReportingState& in) |
485 | @@ -387,7 +399,7 @@ | |||
486 | 387 | 399 | ||
487 | 388 | namespace helper | 400 | namespace helper |
488 | 389 | { | 401 | { |
490 | 390 | template<typename T> | 402 | template <typename T> |
491 | 391 | struct TypeMapper<com::ubuntu::location::Update<T>> | 403 | struct TypeMapper<com::ubuntu::location::Update<T>> |
492 | 392 | { | 404 | { |
493 | 393 | constexpr static ArgumentType type_value() | 405 | constexpr static ArgumentType type_value() |
494 | @@ -405,15 +417,13 @@ | |||
495 | 405 | 417 | ||
496 | 406 | static std::string signature() | 418 | static std::string signature() |
497 | 407 | { | 419 | { |
501 | 408 | static const std::string s = | 420 | static const std::string s = helper::TypeMapper<T>::signature() + helper::TypeMapper<uint64_t>::signature(); |
499 | 409 | helper::TypeMapper<T>::signature() + | ||
500 | 410 | helper::TypeMapper<uint64_t>::signature(); | ||
502 | 411 | return s; | 421 | return s; |
503 | 412 | } | 422 | } |
504 | 413 | }; | 423 | }; |
505 | 414 | } | 424 | } |
506 | 415 | 425 | ||
508 | 416 | template<typename T> | 426 | template <typename T> |
509 | 417 | struct Codec<com::ubuntu::location::Update<T>> | 427 | struct Codec<com::ubuntu::location::Update<T>> |
510 | 418 | { | 428 | { |
511 | 419 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Update<T>& in) | 429 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Update<T>& in) |
512 | @@ -426,9 +436,9 @@ | |||
513 | 426 | { | 436 | { |
514 | 427 | Codec<T>::decode_argument(reader, in.value); | 437 | Codec<T>::decode_argument(reader, in.value); |
515 | 428 | in.when = com::ubuntu::location::Clock::Timestamp(com::ubuntu::location::Clock::Duration(reader.pop_int64())); | 438 | in.when = com::ubuntu::location::Clock::Timestamp(com::ubuntu::location::Clock::Duration(reader.pop_int64())); |
517 | 429 | } | 439 | } |
518 | 430 | }; | 440 | }; |
519 | 431 | } | 441 | } |
520 | 432 | } | 442 | } |
521 | 433 | 443 | ||
523 | 434 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CODEC_H_ | 444 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CODEC_H_ |
524 | 435 | 445 | ||
525 | === modified file 'include/location_service/com/ubuntu/location/configuration.h' | |||
526 | --- include/location_service/com/ubuntu/location/configuration.h 2013-05-29 06:04:02 +0000 | |||
527 | +++ include/location_service/com/ubuntu/location/configuration.h 2015-04-23 17:23:49 +0000 | |||
528 | @@ -31,4 +31,4 @@ | |||
529 | 31 | } | 31 | } |
530 | 32 | } | 32 | } |
531 | 33 | 33 | ||
532 | 34 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONFIGURATION_H_ | ||
533 | 35 | \ No newline at end of file | 34 | \ No newline at end of file |
534 | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONFIGURATION_H_ | ||
535 | 36 | \ No newline at end of file | 36 | \ No newline at end of file |
536 | 37 | 37 | ||
537 | === modified file 'include/location_service/com/ubuntu/location/connectivity/bounded_integer.h' | |||
538 | --- include/location_service/com/ubuntu/location/connectivity/bounded_integer.h 2014-06-10 11:53:01 +0000 | |||
539 | +++ include/location_service/com/ubuntu/location/connectivity/bounded_integer.h 2015-04-23 17:23:49 +0000 | |||
540 | @@ -33,7 +33,7 @@ | |||
541 | 33 | * @brief A helper class to handle bounded integer values, with an optional domain | 33 | * @brief A helper class to handle bounded integer values, with an optional domain |
542 | 34 | * for tagging domain-specific types. | 34 | * for tagging domain-specific types. |
543 | 35 | */ | 35 | */ |
545 | 36 | template<typename Tag, int min, int max, int inv = min-1> | 36 | template <typename Tag, int min, int max, int inv = min - 1> |
546 | 37 | class BoundedInteger | 37 | class BoundedInteger |
547 | 38 | { | 38 | { |
548 | 39 | public: | 39 | public: |
549 | @@ -79,16 +79,14 @@ | |||
550 | 79 | // Capping to [0,1] | 79 | // Capping to [0,1] |
551 | 80 | percent = std::min<float>(1., std::max<float>(0., percent)); | 80 | percent = std::min<float>(1., std::max<float>(0., percent)); |
552 | 81 | 81 | ||
557 | 82 | return BoundedInteger<Tag, min, max, inv> | 82 | return BoundedInteger<Tag, min, max, inv>{static_cast<int>(minimum() + percent * range())}; |
554 | 83 | { | ||
555 | 84 | static_cast<int>(minimum() + percent * range()) | ||
556 | 85 | }; | ||
558 | 86 | } | 83 | } |
559 | 87 | 84 | ||
560 | 88 | /** | 85 | /** |
561 | 89 | * @brief Constructs an invalid instance. | 86 | * @brief Constructs an invalid instance. |
562 | 90 | */ | 87 | */ |
564 | 91 | inline BoundedInteger() : value(min-1) | 88 | inline BoundedInteger() |
565 | 89 | : value(min - 1) | ||
566 | 92 | { | 90 | { |
567 | 93 | } | 91 | } |
568 | 94 | 92 | ||
569 | @@ -97,19 +95,20 @@ | |||
570 | 97 | * @param value The raw value. | 95 | * @param value The raw value. |
571 | 98 | * @throw std::runtime_error if value is not in [min, max]. | 96 | * @throw std::runtime_error if value is not in [min, max]. |
572 | 99 | */ | 97 | */ |
574 | 100 | inline explicit BoundedInteger(int value) : value(value) | 98 | inline explicit BoundedInteger(int value) |
575 | 99 | : value(value) | ||
576 | 101 | { | 100 | { |
577 | 102 | if (value < min || value > max) | 101 | if (value < min || value > max) |
581 | 103 | throw std::runtime_error( | 102 | throw std::runtime_error(std::to_string(value) + " is not in " + "[" + std::to_string(min) + ", " + |
582 | 104 | std::to_string(value) + " is not in " + "[" + | 103 | std::to_string(max) + "]"); |
580 | 105 | std::to_string(min) + ", " + std::to_string(max) + "]"); | ||
583 | 106 | } | 104 | } |
584 | 107 | 105 | ||
585 | 108 | /** | 106 | /** |
586 | 109 | * @brief Copy c'tor. | 107 | * @brief Copy c'tor. |
587 | 110 | * @param rhs The instance to copy from. | 108 | * @param rhs The instance to copy from. |
588 | 111 | */ | 109 | */ |
590 | 112 | inline BoundedInteger(const BoundedInteger<Tag, min, max, inv>& rhs) : value(rhs.value) | 110 | inline BoundedInteger(const BoundedInteger<Tag, min, max, inv>& rhs) |
591 | 111 | : value(rhs.value) | ||
592 | 113 | { | 112 | { |
593 | 114 | } | 113 | } |
594 | 115 | 114 | ||
595 | @@ -169,9 +168,8 @@ | |||
596 | 169 | inline void set(int new_value) | 168 | inline void set(int new_value) |
597 | 170 | { | 169 | { |
598 | 171 | if (new_value < min || new_value > max) | 170 | if (new_value < min || new_value > max) |
602 | 172 | throw std::runtime_error( | 171 | throw std::runtime_error(std::to_string(new_value) + " is not in " + "[" + std::to_string(min) + ", " + |
603 | 173 | std::to_string(new_value) + " is not in " + "[" + | 172 | std::to_string(max) + "]"); |
601 | 174 | std::to_string(min) + ", " + std::to_string(max) + "]"); | ||
604 | 175 | 173 | ||
605 | 176 | value = new_value; | 174 | value = new_value; |
606 | 177 | } | 175 | } |
607 | @@ -193,7 +191,9 @@ | |||
608 | 193 | out << bi.value; | 191 | out << bi.value; |
609 | 194 | 192 | ||
610 | 195 | if (!bi.is_valid()) | 193 | if (!bi.is_valid()) |
611 | 194 | { | ||
612 | 196 | out << " -> invalid"; | 195 | out << " -> invalid"; |
613 | 196 | } | ||
614 | 197 | 197 | ||
615 | 198 | return out; | 198 | return out; |
616 | 199 | } | 199 | } |
617 | @@ -206,4 +206,4 @@ | |||
618 | 206 | } | 206 | } |
619 | 207 | } | 207 | } |
620 | 208 | 208 | ||
622 | 209 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_BOUNDED_INTEGER_H_ | 209 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_BOUNDED_INTEGER_H_ |
623 | 210 | 210 | ||
624 | === modified file 'include/location_service/com/ubuntu/location/connectivity/manager.h' | |||
625 | --- include/location_service/com/ubuntu/location/connectivity/manager.h 2014-07-10 16:44:26 +0000 | |||
626 | +++ include/location_service/com/ubuntu/location/connectivity/manager.h 2015-04-23 17:23:49 +0000 | |||
627 | @@ -106,8 +106,7 @@ | |||
628 | 106 | struct ConnectivityManagementNotSupported : public std::runtime_error | 106 | struct ConnectivityManagementNotSupported : public std::runtime_error |
629 | 107 | { | 107 | { |
630 | 108 | ConnectivityManagementNotSupported() | 108 | ConnectivityManagementNotSupported() |
633 | 109 | : std::runtime_error( | 109 | : std::runtime_error("Underlying platform does not provide support for connectivity mgmt.") |
632 | 110 | "Underlying platform does not provide support for connectivity mgmt.") | ||
634 | 111 | { | 110 | { |
635 | 112 | } | 111 | } |
636 | 113 | }; | 112 | }; |
637 | @@ -154,7 +153,6 @@ | |||
638 | 154 | */ | 153 | */ |
639 | 155 | virtual const core::Property<bool>& is_wwan_hardware_enabled() const = 0; | 154 | virtual const core::Property<bool>& is_wwan_hardware_enabled() const = 0; |
640 | 156 | 155 | ||
641 | 157 | |||
642 | 158 | /** | 156 | /** |
643 | 159 | * @brief Returns a getable/observable property that describes the characteristics | 157 | * @brief Returns a getable/observable property that describes the characteristics |
644 | 160 | * of the active network connection. | 158 | * of the active network connection. |
645 | @@ -230,4 +228,4 @@ | |||
646 | 230 | } | 228 | } |
647 | 231 | } | 229 | } |
648 | 232 | 230 | ||
650 | 233 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_MANAGER_H_ | 231 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_MANAGER_H_ |
651 | 234 | 232 | ||
652 | === modified file 'include/location_service/com/ubuntu/location/connectivity/radio_cell.h' | |||
653 | --- include/location_service/com/ubuntu/location/connectivity/radio_cell.h 2014-06-10 11:53:01 +0000 | |||
654 | +++ include/location_service/com/ubuntu/location/connectivity/radio_cell.h 2015-04-23 17:23:49 +0000 | |||
655 | @@ -50,35 +50,53 @@ | |||
656 | 50 | }; | 50 | }; |
657 | 51 | 51 | ||
658 | 52 | /** @cond */ | 52 | /** @cond */ |
668 | 53 | struct Mcc {}; | 53 | struct Mcc |
669 | 54 | struct Mnc {}; | 54 | { |
670 | 55 | struct Lac {}; | 55 | }; |
671 | 56 | struct Id {}; | 56 | struct Mnc |
672 | 57 | struct Psc {}; | 57 | { |
673 | 58 | struct Pid {}; | 58 | }; |
674 | 59 | struct Rss {}; | 59 | struct Lac |
675 | 60 | struct Asu {}; | 60 | { |
676 | 61 | struct Ta {}; | 61 | }; |
677 | 62 | struct Id | ||
678 | 63 | { | ||
679 | 64 | }; | ||
680 | 65 | struct Psc | ||
681 | 66 | { | ||
682 | 67 | }; | ||
683 | 68 | struct Pid | ||
684 | 69 | { | ||
685 | 70 | }; | ||
686 | 71 | struct Rss | ||
687 | 72 | { | ||
688 | 73 | }; | ||
689 | 74 | struct Asu | ||
690 | 75 | { | ||
691 | 76 | }; | ||
692 | 77 | struct Ta | ||
693 | 78 | { | ||
694 | 79 | }; | ||
695 | 62 | 80 | ||
697 | 63 | template<int min, int max, int invalid = min-1> | 81 | template <int min, int max, int invalid = min - 1> |
698 | 64 | using MobileCountryCode = BoundedInteger<Mcc, min, max, invalid>; | 82 | using MobileCountryCode = BoundedInteger<Mcc, min, max, invalid>; |
700 | 65 | template<int min, int max, int invalid = min-1> | 83 | template <int min, int max, int invalid = min - 1> |
701 | 66 | using MobileNetworkCode = BoundedInteger<Mnc, min, max, invalid>; | 84 | using MobileNetworkCode = BoundedInteger<Mnc, min, max, invalid>; |
703 | 67 | template<int min, int max, int invalid = min-1> | 85 | template <int min, int max, int invalid = min - 1> |
704 | 68 | using LocationAreaCode = BoundedInteger<Lac, min, max, invalid>; | 86 | using LocationAreaCode = BoundedInteger<Lac, min, max, invalid>; |
706 | 69 | template<int min, int max, int invalid = min-1> | 87 | template <int min, int max, int invalid = min - 1> |
707 | 70 | using TrackingAreaCode = BoundedInteger<Lac, min, max, invalid>; | 88 | using TrackingAreaCode = BoundedInteger<Lac, min, max, invalid>; |
709 | 71 | template<int min, int max, int invalid = min-1> | 89 | template <int min, int max, int invalid = min - 1> |
710 | 72 | using CellId = BoundedInteger<Id, min, max, invalid>; | 90 | using CellId = BoundedInteger<Id, min, max, invalid>; |
712 | 73 | template<int min, int max, int invalid = min-1> | 91 | template <int min, int max, int invalid = min - 1> |
713 | 74 | using PrimaryScramblingCode = BoundedInteger<Psc, min, max, invalid>; | 92 | using PrimaryScramblingCode = BoundedInteger<Psc, min, max, invalid>; |
715 | 75 | template<int min, int max, int invalid = min-1> | 93 | template <int min, int max, int invalid = min - 1> |
716 | 76 | using PhysicalId = BoundedInteger<Pid, min, max, invalid>; | 94 | using PhysicalId = BoundedInteger<Pid, min, max, invalid>; |
718 | 77 | template<int min, int max, int invalid = min-1> | 95 | template <int min, int max, int invalid = min - 1> |
719 | 78 | using ReceivedSignalStrength = BoundedInteger<Rss, min, max, invalid>; | 96 | using ReceivedSignalStrength = BoundedInteger<Rss, min, max, invalid>; |
721 | 79 | template<int min, int max, int invalid = min-1> | 97 | template <int min, int max, int invalid = min - 1> |
722 | 80 | using ArbitraryStrengthUnit = BoundedInteger<Asu, min, max, invalid>; | 98 | using ArbitraryStrengthUnit = BoundedInteger<Asu, min, max, invalid>; |
724 | 81 | template<int min, int max, int invalid = min-1> | 99 | template <int min, int max, int invalid = min - 1> |
725 | 82 | using TimingAdvance = BoundedInteger<Ta, min, max, invalid>; | 100 | using TimingAdvance = BoundedInteger<Ta, min, max, invalid>; |
726 | 83 | /** @endcond */ | 101 | /** @endcond */ |
727 | 84 | 102 | ||
728 | @@ -86,41 +104,16 @@ | |||
729 | 86 | struct Gsm | 104 | struct Gsm |
730 | 87 | { | 105 | { |
731 | 88 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ | 106 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ |
738 | 89 | typedef MobileCountryCode | 107 | typedef MobileCountryCode<0, 999, std::numeric_limits<int>::max()> MCC; |
733 | 90 | < | ||
734 | 91 | 0, | ||
735 | 92 | 999, | ||
736 | 93 | std::numeric_limits<int>::max() | ||
737 | 94 | > MCC; | ||
739 | 95 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ | 108 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ |
746 | 96 | typedef MobileNetworkCode | 109 | typedef MobileNetworkCode<0, 999, std::numeric_limits<int>::max()> MNC; |
741 | 97 | < | ||
742 | 98 | 0, | ||
743 | 99 | 999, | ||
744 | 100 | std::numeric_limits<int>::max() | ||
745 | 101 | > MNC; | ||
747 | 102 | /** 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ | 110 | /** 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ |
754 | 103 | typedef LocationAreaCode | 111 | typedef LocationAreaCode<0, 65535, std::numeric_limits<int>::max()> LAC; |
749 | 104 | < | ||
750 | 105 | 0, | ||
751 | 106 | 65535, | ||
752 | 107 | std::numeric_limits<int>::max() | ||
753 | 108 | > LAC; | ||
755 | 109 | /** 16-bit GSM Cell Identity described in TS 27.007, 0..65535, INT_MAX if unknown */ | 112 | /** 16-bit GSM Cell Identity described in TS 27.007, 0..65535, INT_MAX if unknown */ |
762 | 110 | typedef CellId | 113 | typedef CellId<0, 65535, std::numeric_limits<int>::max()> ID; |
757 | 111 | < | ||
758 | 112 | 0, | ||
759 | 113 | 65535, | ||
760 | 114 | std::numeric_limits<int>::max() | ||
761 | 115 | > ID; | ||
763 | 116 | 114 | ||
764 | 117 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ | 115 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ |
771 | 118 | typedef ArbitraryStrengthUnit | 116 | typedef ArbitraryStrengthUnit<0, 31, 99> SignalStrength; |
766 | 119 | < | ||
767 | 120 | 0, | ||
768 | 121 | 31, | ||
769 | 122 | 99 | ||
770 | 123 | > SignalStrength; | ||
772 | 124 | 117 | ||
773 | 125 | MCC mobile_country_code; | 118 | MCC mobile_country_code; |
774 | 126 | MNC mobile_network_code; | 119 | MNC mobile_network_code; |
775 | @@ -133,40 +126,15 @@ | |||
776 | 133 | struct Umts | 126 | struct Umts |
777 | 134 | { | 127 | { |
778 | 135 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ | 128 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ |
785 | 136 | typedef MobileCountryCode | 129 | typedef MobileCountryCode<0, 999, std::numeric_limits<int>::max()> MCC; |
780 | 137 | < | ||
781 | 138 | 0, | ||
782 | 139 | 999, | ||
783 | 140 | std::numeric_limits<int>::max() | ||
784 | 141 | > MCC; | ||
786 | 142 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ | 130 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ |
793 | 143 | typedef MobileNetworkCode | 131 | typedef MobileNetworkCode<0, 999, std::numeric_limits<int>::max()> MNC; |
788 | 144 | < | ||
789 | 145 | 0, | ||
790 | 146 | 999, | ||
791 | 147 | std::numeric_limits<int>::max() | ||
792 | 148 | > MNC; | ||
794 | 149 | /** 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ | 132 | /** 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ |
801 | 150 | typedef LocationAreaCode | 133 | typedef LocationAreaCode<0, 65535, std::numeric_limits<int>::max()> LAC; |
796 | 151 | < | ||
797 | 152 | 0, | ||
798 | 153 | 65535, | ||
799 | 154 | std::numeric_limits<int>::max() | ||
800 | 155 | > LAC; | ||
802 | 156 | /** 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ | 134 | /** 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ |
809 | 157 | typedef CellId | 135 | typedef CellId<0, 268435455, std::numeric_limits<int>::max()> ID; |
804 | 158 | < | ||
805 | 159 | 0, | ||
806 | 160 | 268435455, | ||
807 | 161 | std::numeric_limits<int>::max() | ||
808 | 162 | > ID; | ||
810 | 163 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ | 136 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ |
817 | 164 | typedef ArbitraryStrengthUnit | 137 | typedef ArbitraryStrengthUnit<0, 31, 99> SignalStrength; |
812 | 165 | < | ||
813 | 166 | 0, | ||
814 | 167 | 31, | ||
815 | 168 | 99 | ||
816 | 169 | > SignalStrength; | ||
818 | 170 | 138 | ||
819 | 171 | MCC mobile_country_code; | 139 | MCC mobile_country_code; |
820 | 172 | MNC mobile_network_code; | 140 | MNC mobile_network_code; |
821 | @@ -179,47 +147,17 @@ | |||
822 | 179 | struct Lte | 147 | struct Lte |
823 | 180 | { | 148 | { |
824 | 181 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ | 149 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ |
831 | 182 | typedef MobileCountryCode | 150 | typedef MobileCountryCode<0, 999, std::numeric_limits<int>::max()> MCC; |
826 | 183 | < | ||
827 | 184 | 0, | ||
828 | 185 | 999, | ||
829 | 186 | std::numeric_limits<int>::max() | ||
830 | 187 | > MCC; | ||
832 | 188 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ | 151 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ |
839 | 189 | typedef MobileNetworkCode | 152 | typedef MobileNetworkCode<0, 999, std::numeric_limits<int>::max()> MNC; |
834 | 190 | < | ||
835 | 191 | 0, | ||
836 | 192 | 999, | ||
837 | 193 | std::numeric_limits<int>::max() | ||
838 | 194 | > MNC; | ||
840 | 195 | /** 16-bit Tracking Area Code, 0..65535, INT_MAX if unknown */ | 153 | /** 16-bit Tracking Area Code, 0..65535, INT_MAX if unknown */ |
847 | 196 | typedef TrackingAreaCode | 154 | typedef TrackingAreaCode<0, 65535, std::numeric_limits<int>::max()> TAC; |
842 | 197 | < | ||
843 | 198 | 0, | ||
844 | 199 | 65535, | ||
845 | 200 | std::numeric_limits<int>::max() | ||
846 | 201 | > TAC; | ||
848 | 202 | /** 28-bit Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ | 155 | /** 28-bit Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ |
855 | 203 | typedef CellId | 156 | typedef CellId<0, 268435455, std::numeric_limits<int>::max()> ID; |
850 | 204 | < | ||
851 | 205 | 0, | ||
852 | 206 | 268435455, | ||
853 | 207 | std::numeric_limits<int>::max() | ||
854 | 208 | > ID; | ||
856 | 209 | /** Physical cell id, 0..503, INT_MAX if unknown */ | 157 | /** Physical cell id, 0..503, INT_MAX if unknown */ |
863 | 210 | typedef PhysicalId | 158 | typedef PhysicalId<0, 503, std::numeric_limits<int>::max()> PID; |
858 | 211 | < | ||
859 | 212 | 0, | ||
860 | 213 | 503, | ||
861 | 214 | std::numeric_limits<int>::max() | ||
862 | 215 | > PID; | ||
864 | 216 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ | 159 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ |
871 | 217 | typedef ArbitraryStrengthUnit | 160 | typedef ArbitraryStrengthUnit<0, 31, 99> SignalStrength; |
866 | 218 | < | ||
867 | 219 | 0, | ||
868 | 220 | 31, | ||
869 | 221 | 99 | ||
870 | 222 | > SignalStrength; | ||
872 | 223 | 161 | ||
873 | 224 | MCC mobile_country_code; | 162 | MCC mobile_country_code; |
874 | 225 | MNC mobile_network_code; | 163 | MNC mobile_network_code; |
875 | @@ -279,5 +217,4 @@ | |||
876 | 279 | } | 217 | } |
877 | 280 | } | 218 | } |
878 | 281 | 219 | ||
881 | 282 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_RADIO_CELL_H_ | 220 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_RADIO_CELL_H_ |
880 | 283 | |||
882 | 284 | 221 | ||
883 | === modified file 'include/location_service/com/ubuntu/location/connectivity/wireless_network.h' | |||
884 | --- include/location_service/com/ubuntu/location/connectivity/wireless_network.h 2014-06-10 09:08:10 +0000 | |||
885 | +++ include/location_service/com/ubuntu/location/connectivity/wireless_network.h 2015-04-23 17:23:49 +0000 | |||
886 | @@ -52,27 +52,21 @@ | |||
887 | 52 | struct Tag | 52 | struct Tag |
888 | 53 | { | 53 | { |
889 | 54 | /** @brief Tags a frequency measurement for a wireless network. */ | 54 | /** @brief Tags a frequency measurement for a wireless network. */ |
891 | 55 | struct Frequency {}; | 55 | struct Frequency |
892 | 56 | { | ||
893 | 57 | }; | ||
894 | 56 | /** @brief Tags the signal strength of a wireless network. */ | 58 | /** @brief Tags the signal strength of a wireless network. */ |
896 | 57 | struct SignalStrength {}; | 59 | struct SignalStrength |
897 | 60 | { | ||
898 | 61 | }; | ||
899 | 58 | }; | 62 | }; |
900 | 59 | /** @endcond */ | 63 | /** @endcond */ |
901 | 60 | 64 | ||
902 | 61 | /** Frequency that an individual AP operates on. */ | 65 | /** Frequency that an individual AP operates on. */ |
909 | 62 | typedef BoundedInteger | 66 | typedef BoundedInteger<Tag::Frequency, 2412, 5825> Frequency; |
904 | 63 | < | ||
905 | 64 | Tag::Frequency, | ||
906 | 65 | 2412, | ||
907 | 66 | 5825 | ||
908 | 67 | > Frequency; | ||
910 | 68 | 67 | ||
911 | 69 | /** Strength of signal for an individual AP. */ | 68 | /** Strength of signal for an individual AP. */ |
918 | 70 | typedef BoundedInteger | 69 | typedef BoundedInteger<Tag::SignalStrength, 0, 100> SignalStrength; |
913 | 71 | < | ||
914 | 72 | Tag::SignalStrength, | ||
915 | 73 | 0, | ||
916 | 74 | 100 | ||
917 | 75 | > SignalStrength; | ||
919 | 76 | 70 | ||
920 | 77 | /** @cond */ | 71 | /** @cond */ |
921 | 78 | WirelessNetwork() = default; | 72 | WirelessNetwork() = default; |
922 | @@ -114,4 +108,4 @@ | |||
923 | 114 | } | 108 | } |
924 | 115 | } | 109 | } |
925 | 116 | 110 | ||
927 | 117 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_ | 111 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_WIRELESS_NETWORK_H_ |
928 | 118 | 112 | ||
929 | === modified file 'include/location_service/com/ubuntu/location/criteria.h' | |||
930 | --- include/location_service/com/ubuntu/location/criteria.h 2014-01-12 18:03:12 +0000 | |||
931 | +++ include/location_service/com/ubuntu/location/criteria.h 2015-04-23 17:23:49 +0000 | |||
932 | @@ -42,18 +42,22 @@ | |||
933 | 42 | 42 | ||
934 | 43 | struct Requires | 43 | struct Requires |
935 | 44 | { | 44 | { |
940 | 45 | bool position = true; ///< The client needs position measurements. | 45 | bool position = true; ///< The client needs position measurements. |
941 | 46 | bool altitude = false; ///< The client needs altitude measurements. | 46 | bool altitude = false; ///< The client needs altitude measurements. |
942 | 47 | bool velocity = false; ///< The client needs velocity measurments. | 47 | bool velocity = false; ///< The client needs velocity measurments. |
943 | 48 | bool heading = false; ///< The client needs heading measurements. | 48 | bool heading = false; ///< The client needs heading measurements. |
944 | 49 | } requires = Requires{}; | 49 | } requires = Requires{}; |
945 | 50 | 50 | ||
946 | 51 | struct Accuracy | 51 | struct Accuracy |
947 | 52 | { | 52 | { |
952 | 53 | units::Quantity<units::Length> horizontal = 3000 * units::Meters; ///< The client requires measurements of at least this horizontal accuracy. | 53 | units::Quantity<units::Length> horizontal = |
953 | 54 | Optional<units::Quantity<units::Length>> vertical; ///< The client requires measurements of at least this vertical accuracy. | 54 | 3000 * units::Meters; ///< The client requires measurements of at least this horizontal accuracy. |
954 | 55 | Optional<units::Quantity<units::Velocity>> velocity; ///< The client requires measurements of at least this velocity accuracy. | 55 | Optional<units::Quantity<units::Length>> vertical; ///< The client requires measurements of at least this |
955 | 56 | Optional<units::Quantity<units::PlaneAngle>> heading; ///< The client requires measurements of at least this heading accuracy. | 56 | ///vertical accuracy. |
956 | 57 | Optional<units::Quantity<units::Velocity>> velocity; ///< The client requires measurements of at least this | ||
957 | 58 | ///velocity accuracy. | ||
958 | 59 | Optional<units::Quantity<units::PlaneAngle>> heading; ///< The client requires measurements of at least this | ||
959 | 60 | ///heading accuracy. | ||
960 | 57 | } accuracy = Accuracy{}; | 61 | } accuracy = Accuracy{}; |
961 | 58 | }; | 62 | }; |
962 | 59 | 63 | ||
963 | @@ -65,4 +69,4 @@ | |||
964 | 65 | } | 69 | } |
965 | 66 | } | 70 | } |
966 | 67 | 71 | ||
968 | 68 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CRITERIA_H_ | 72 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CRITERIA_H_ |
969 | 69 | 73 | ||
970 | === modified file 'include/location_service/com/ubuntu/location/default_provider_selection_policy.h' | |||
971 | --- include/location_service/com/ubuntu/location/default_provider_selection_policy.h 2013-12-14 09:10:29 +0000 | |||
972 | +++ include/location_service/com/ubuntu/location/default_provider_selection_policy.h 2015-04-23 17:23:49 +0000 | |||
973 | @@ -31,25 +31,18 @@ | |||
974 | 31 | public: | 31 | public: |
975 | 32 | DefaultProviderSelectionPolicy(); | 32 | DefaultProviderSelectionPolicy(); |
976 | 33 | ~DefaultProviderSelectionPolicy() noexcept; | 33 | ~DefaultProviderSelectionPolicy() noexcept; |
993 | 34 | 34 | ||
994 | 35 | ProviderSelection determine_provider_selection_for_criteria( | 35 | ProviderSelection determine_provider_selection_for_criteria(const Criteria& criteria, |
995 | 36 | const Criteria& criteria, | 36 | const ProviderEnumerator& enumerator); |
996 | 37 | const ProviderEnumerator& enumerator); | 37 | |
997 | 38 | 38 | Provider::Ptr determine_position_updates_provider(const Criteria& criteria, const ProviderEnumerator& enumerator); | |
998 | 39 | Provider::Ptr determine_position_updates_provider( | 39 | |
999 | 40 | const Criteria& criteria, | 40 | Provider::Ptr determine_heading_updates_provider(const Criteria& criteria, const ProviderEnumerator& enumerator); |
1000 | 41 | const ProviderEnumerator& enumerator); | 41 | |
1001 | 42 | 42 | Provider::Ptr determine_velocity_updates_provider(const Criteria& criteria, const ProviderEnumerator& enumerator); | |
986 | 43 | Provider::Ptr determine_heading_updates_provider( | ||
987 | 44 | const Criteria& criteria, | ||
988 | 45 | const ProviderEnumerator& enumerator); | ||
989 | 46 | |||
990 | 47 | Provider::Ptr determine_velocity_updates_provider( | ||
991 | 48 | const Criteria& criteria, | ||
992 | 49 | const ProviderEnumerator& enumerator); | ||
1002 | 50 | }; | 43 | }; |
1003 | 51 | } | 44 | } |
1004 | 52 | } | 45 | } |
1005 | 53 | } | 46 | } |
1006 | 54 | 47 | ||
1008 | 55 | #endif // LOCATION_SERVICE_COM_UBUNTU_DEFAULT_PROVIDER_SELECTION_POLICY_H_ | 48 | #endif // LOCATION_SERVICE_COM_UBUNTU_DEFAULT_PROVIDER_SELECTION_POLICY_H_ |
1009 | 56 | 49 | ||
1010 | === modified file 'include/location_service/com/ubuntu/location/heading.h' | |||
1011 | --- include/location_service/com/ubuntu/location/heading.h 2013-12-12 14:36:32 +0000 | |||
1012 | +++ include/location_service/com/ubuntu/location/heading.h 2015-04-23 17:23:49 +0000 | |||
1013 | @@ -32,4 +32,4 @@ | |||
1014 | 32 | } | 32 | } |
1015 | 33 | } | 33 | } |
1016 | 34 | 34 | ||
1018 | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_ | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_ |
1019 | 36 | 36 | ||
1020 | === modified file 'include/location_service/com/ubuntu/location/init_and_shutdown.h' | |||
1021 | --- include/location_service/com/ubuntu/location/init_and_shutdown.h 2013-05-29 09:21:16 +0000 | |||
1022 | +++ include/location_service/com/ubuntu/location/init_and_shutdown.h 2015-04-23 17:23:49 +0000 | |||
1023 | @@ -33,4 +33,4 @@ | |||
1024 | 33 | } | 33 | } |
1025 | 34 | } | 34 | } |
1026 | 35 | 35 | ||
1027 | 36 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_INIT_AND_SHUTDOWN_H_ | ||
1028 | 37 | \ No newline at end of file | 36 | \ No newline at end of file |
1029 | 37 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_INIT_AND_SHUTDOWN_H_ | ||
1030 | 38 | \ No newline at end of file | 38 | \ No newline at end of file |
1031 | 39 | 39 | ||
1032 | === modified file 'include/location_service/com/ubuntu/location/logging.h' | |||
1033 | --- include/location_service/com/ubuntu/location/logging.h 2014-06-20 07:40:34 +0000 | |||
1034 | +++ include/location_service/com/ubuntu/location/logging.h 2015-04-23 17:23:49 +0000 | |||
1035 | @@ -21,5 +21,4 @@ | |||
1036 | 21 | #include <glog/logging.h> | 21 | #include <glog/logging.h> |
1037 | 22 | #include <glog/vlog_is_on.h> | 22 | #include <glog/vlog_is_on.h> |
1038 | 23 | 23 | ||
1041 | 24 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_LOGGING_H_ | 24 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_LOGGING_H_ |
1040 | 25 | |||
1042 | 26 | 25 | ||
1043 | === modified file 'include/location_service/com/ubuntu/location/optional.h' | |||
1044 | --- include/location_service/com/ubuntu/location/optional.h 2013-12-12 14:36:32 +0000 | |||
1045 | +++ include/location_service/com/ubuntu/location/optional.h 2015-04-23 17:23:49 +0000 | |||
1046 | @@ -26,10 +26,10 @@ | |||
1047 | 26 | { | 26 | { |
1048 | 27 | namespace location | 27 | namespace location |
1049 | 28 | { | 28 | { |
1051 | 29 | template<typename T> | 29 | template <typename T> |
1052 | 30 | using Optional = boost::optional<T>; | 30 | using Optional = boost::optional<T>; |
1053 | 31 | } | 31 | } |
1054 | 32 | } | 32 | } |
1055 | 33 | } | 33 | } |
1056 | 34 | 34 | ||
1058 | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_OPTIONAL_H_ | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_OPTIONAL_H_ |
1059 | 36 | 36 | ||
1060 | === modified file 'include/location_service/com/ubuntu/location/position.h' | |||
1061 | --- include/location_service/com/ubuntu/location/position.h 2014-06-17 08:06:08 +0000 | |||
1062 | +++ include/location_service/com/ubuntu/location/position.h 2015-04-23 17:23:49 +0000 | |||
1063 | @@ -50,8 +50,15 @@ | |||
1064 | 50 | Position() = default; | 50 | Position() = default; |
1065 | 51 | Position(const wgs84::Latitude&, const wgs84::Longitude&); | 51 | Position(const wgs84::Latitude&, const wgs84::Longitude&); |
1066 | 52 | Position(const wgs84::Latitude&, const wgs84::Longitude&, const wgs84::Altitude&); | 52 | Position(const wgs84::Latitude&, const wgs84::Longitude&, const wgs84::Altitude&); |
1069 | 53 | Position(const wgs84::Latitude&, const wgs84::Longitude&, const wgs84::Altitude&, const units::Quantity<units::Length>& hor_acc); | 53 | Position(const wgs84::Latitude&, |
1070 | 54 | Position(const wgs84::Latitude&, const wgs84::Longitude&, const wgs84::Altitude&, const units::Quantity<units::Length>& hor_acc, const units::Quantity<units::Length>& ver_acc); | 54 | const wgs84::Longitude&, |
1071 | 55 | const wgs84::Altitude&, | ||
1072 | 56 | const units::Quantity<units::Length>& hor_acc); | ||
1073 | 57 | Position(const wgs84::Latitude&, | ||
1074 | 58 | const wgs84::Longitude&, | ||
1075 | 59 | const wgs84::Altitude&, | ||
1076 | 60 | const units::Quantity<units::Length>& hor_acc, | ||
1077 | 61 | const units::Quantity<units::Length>& ver_acc); | ||
1078 | 55 | 62 | ||
1079 | 56 | bool operator==(const Position& rhs) const; | 63 | bool operator==(const Position& rhs) const; |
1080 | 57 | bool operator!=(const Position& rhs) const; | 64 | bool operator!=(const Position& rhs) const; |
1081 | @@ -68,4 +75,4 @@ | |||
1082 | 68 | } | 75 | } |
1083 | 69 | } | 76 | } |
1084 | 70 | } | 77 | } |
1086 | 71 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_POSITION_H_ | 78 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_POSITION_H_ |
1087 | 72 | 79 | ||
1088 | === modified file 'include/location_service/com/ubuntu/location/provider.h' | |||
1089 | --- include/location_service/com/ubuntu/location/provider.h 2015-01-21 20:13:28 +0000 | |||
1090 | +++ include/location_service/com/ubuntu/location/provider.h 2015-04-23 17:23:49 +0000 | |||
1091 | @@ -52,22 +52,22 @@ | |||
1092 | 52 | */ | 52 | */ |
1093 | 53 | enum class Features : std::size_t | 53 | enum class Features : std::size_t |
1094 | 54 | { | 54 | { |
1100 | 55 | none = 0, ///< The provider does not support any feature. | 55 | none = 0, ///< The provider does not support any feature. |
1101 | 56 | position = 1 << 0, ///< The provider features position updates. | 56 | position = 1 << 0, ///< The provider features position updates. |
1102 | 57 | velocity = 1 << 1, ///< The provider features velocity updates. | 57 | velocity = 1 << 1, ///< The provider features velocity updates. |
1103 | 58 | heading = 1 << 2 ///< The provider features heading updates. | 58 | heading = 1 << 2 ///< The provider features heading updates. |
1104 | 59 | }; | 59 | }; |
1105 | 60 | 60 | ||
1106 | 61 | /** | 61 | /** |
1107 | 62 | * @brief Enumerates the requirements of a provider implementation. | 62 | * @brief Enumerates the requirements of a provider implementation. |
1108 | 63 | */ | 63 | */ |
1109 | 64 | enum class Requirements : std::size_t | 64 | enum class Requirements : std::size_t |
1110 | 65 | { | 65 | { |
1116 | 66 | none = 0, ///< The provider does not require anything. | 66 | none = 0, ///< The provider does not require anything. |
1117 | 67 | satellites = 1 << 0, ///< The provider requires satellites to be visible. | 67 | satellites = 1 << 0, ///< The provider requires satellites to be visible. |
1118 | 68 | cell_network = 1 << 1, ///< The provider requires a cell-network to work correctly. | 68 | cell_network = 1 << 1, ///< The provider requires a cell-network to work correctly. |
1119 | 69 | data_network = 1 << 2, ///< The provider requires a data-network to work correctly. | 69 | data_network = 1 << 2, ///< The provider requires a data-network to work correctly. |
1120 | 70 | monetary_spending = 1 << 3 ///< Using the provider results in monetary cost. | 70 | monetary_spending = 1 << 3 ///< Using the provider results in monetary cost. |
1121 | 71 | }; | 71 | }; |
1122 | 72 | 72 | ||
1123 | 73 | /** | 73 | /** |
1124 | @@ -80,11 +80,11 @@ | |||
1125 | 80 | class Controller | 80 | class Controller |
1126 | 81 | { | 81 | { |
1127 | 82 | public: | 82 | public: |
1129 | 83 | typedef std::shared_ptr<Controller> Ptr; | 83 | typedef std::shared_ptr<Controller> Ptr; |
1130 | 84 | 84 | ||
1131 | 85 | virtual ~Controller() = default; | 85 | virtual ~Controller() = default; |
1132 | 86 | Controller(const Controller&) = delete; | 86 | Controller(const Controller&) = delete; |
1134 | 87 | Controller& operator=(const Controller&) = delete; | 87 | Controller& operator=(const Controller&) = delete; |
1135 | 88 | 88 | ||
1136 | 89 | /** | 89 | /** |
1137 | 90 | * @brief disable switches the provider to a disabled state, such that subsequent | 90 | * @brief disable switches the provider to a disabled state, such that subsequent |
1138 | @@ -234,9 +234,7 @@ | |||
1139 | 234 | virtual void on_reference_heading_updated(const Update<Heading>& heading); | 234 | virtual void on_reference_heading_updated(const Update<Heading>& heading); |
1140 | 235 | 235 | ||
1141 | 236 | protected: | 236 | protected: |
1145 | 237 | explicit Provider( | 237 | explicit Provider(const Features& features = Features::none, const Requirements& requirements = Requirements::none); |
1143 | 238 | const Features& features = Features::none, | ||
1144 | 239 | const Requirements& requirements = Requirements::none); | ||
1146 | 240 | 238 | ||
1147 | 241 | virtual Updates& mutable_updates(); | 239 | virtual Updates& mutable_updates(); |
1148 | 242 | 240 | ||
1149 | @@ -289,4 +287,4 @@ | |||
1150 | 289 | } | 287 | } |
1151 | 290 | } | 288 | } |
1152 | 291 | 289 | ||
1154 | 292 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_H_ | 290 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_H_ |
1155 | 293 | 291 | ||
1156 | === modified file 'include/location_service/com/ubuntu/location/provider_enumerator.h' | |||
1157 | --- include/location_service/com/ubuntu/location/provider_enumerator.h 2013-12-14 09:10:29 +0000 | |||
1158 | +++ include/location_service/com/ubuntu/location/provider_enumerator.h 2015-04-23 17:23:49 +0000 | |||
1159 | @@ -46,4 +46,4 @@ | |||
1160 | 46 | } | 46 | } |
1161 | 47 | } | 47 | } |
1162 | 48 | 48 | ||
1164 | 49 | #endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_ENUMERATOR_H_ | 49 | #endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_ENUMERATOR_H_ |
1165 | 50 | 50 | ||
1166 | === modified file 'include/location_service/com/ubuntu/location/provider_factory.h' | |||
1167 | --- include/location_service/com/ubuntu/location/provider_factory.h 2014-10-27 21:58:16 +0000 | |||
1168 | +++ include/location_service/com/ubuntu/location/provider_factory.h 2015-04-23 17:23:49 +0000 | |||
1169 | @@ -37,7 +37,7 @@ | |||
1170 | 37 | 37 | ||
1171 | 38 | class ProviderFactory | 38 | class ProviderFactory |
1172 | 39 | { | 39 | { |
1174 | 40 | public: | 40 | public: |
1175 | 41 | typedef com::ubuntu::location::Configuration Configuration; | 41 | typedef com::ubuntu::location::Configuration Configuration; |
1176 | 42 | typedef std::function<Provider::Ptr(const Configuration&)> Factory; | 42 | typedef std::function<Provider::Ptr(const Configuration&)> Factory; |
1177 | 43 | 43 | ||
1178 | @@ -50,13 +50,15 @@ | |||
1179 | 50 | // by calling the factory and passing it the given config. Please note that the name | 50 | // by calling the factory and passing it the given config. Please note that the name |
1180 | 51 | // can be decorated with @ for distinguishing providers of the same type but different configs. | 51 | // can be decorated with @ for distinguishing providers of the same type but different configs. |
1181 | 52 | // Eg.: | 52 | // Eg.: |
1184 | 53 | // --provider=remote::Provider@espoo --remote::Provider@espoo::name="com.ubuntu.espoo.service.Provider" --remote::Provider@espoo::path="/com/ubuntu/espoo/service/Provider" | 53 | // --provider=remote::Provider@espoo --remote::Provider@espoo::name="com.ubuntu.espoo.service.Provider" |
1185 | 54 | // --provider=remote::Provider@gps --remote::Provider@gps::name="com.ubuntu.android.gps.Provider" --remote::Provider@gps::path="/com/ubuntu/android/gps/Provider" | 54 | // --remote::Provider@espoo::path="/com/ubuntu/espoo/service/Provider" |
1186 | 55 | // --provider=remote::Provider@gps --remote::Provider@gps::name="com.ubuntu.android.gps.Provider" | ||
1187 | 56 | // --remote::Provider@gps::path="/com/ubuntu/android/gps/Provider" | ||
1188 | 55 | Provider::Ptr create_provider_for_name_with_config(const std::string& name, const Configuration& config); | 57 | Provider::Ptr create_provider_for_name_with_config(const std::string& name, const Configuration& config); |
1189 | 56 | 58 | ||
1190 | 57 | void enumerate(const std::function<void(const std::string&, const Factory&)>& enumerator); | 59 | void enumerate(const std::function<void(const std::string&, const Factory&)>& enumerator); |
1191 | 58 | 60 | ||
1193 | 59 | private: | 61 | private: |
1194 | 60 | ProviderFactory() = default; | 62 | ProviderFactory() = default; |
1195 | 61 | ~ProviderFactory() = default; | 63 | ~ProviderFactory() = default; |
1196 | 62 | 64 | ||
1197 | @@ -70,4 +72,4 @@ | |||
1198 | 70 | } | 72 | } |
1199 | 71 | } | 73 | } |
1200 | 72 | 74 | ||
1202 | 73 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_FACTORY_H_ | 75 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDER_FACTORY_H_ |
1203 | 74 | 76 | ||
1204 | === modified file 'include/location_service/com/ubuntu/location/provider_selection.h' | |||
1205 | --- include/location_service/com/ubuntu/location/provider_selection.h 2013-12-14 09:10:29 +0000 | |||
1206 | +++ include/location_service/com/ubuntu/location/provider_selection.h 2015-04-23 17:23:49 +0000 | |||
1207 | @@ -35,11 +35,17 @@ | |||
1208 | 35 | Provider::Features flags = Provider::Features::none; | 35 | Provider::Features flags = Provider::Features::none; |
1209 | 36 | 36 | ||
1210 | 37 | if (position_updates_provider) | 37 | if (position_updates_provider) |
1211 | 38 | { | ||
1212 | 38 | flags = flags | Provider::Features::position; | 39 | flags = flags | Provider::Features::position; |
1213 | 40 | } | ||
1214 | 39 | if (heading_updates_provider) | 41 | if (heading_updates_provider) |
1215 | 42 | { | ||
1216 | 40 | flags = flags | Provider::Features::heading; | 43 | flags = flags | Provider::Features::heading; |
1218 | 41 | if(velocity_updates_provider) | 44 | } |
1219 | 45 | if (velocity_updates_provider) | ||
1220 | 46 | { | ||
1221 | 42 | flags = flags | Provider::Features::velocity; | 47 | flags = flags | Provider::Features::velocity; |
1222 | 48 | } | ||
1223 | 43 | 49 | ||
1224 | 44 | return flags; | 50 | return flags; |
1225 | 45 | } | 51 | } |
1226 | @@ -52,11 +58,11 @@ | |||
1227 | 52 | inline bool operator==(const ProviderSelection& lhs, const ProviderSelection& rhs) | 58 | inline bool operator==(const ProviderSelection& lhs, const ProviderSelection& rhs) |
1228 | 53 | { | 59 | { |
1229 | 54 | return lhs.position_updates_provider == rhs.position_updates_provider && | 60 | return lhs.position_updates_provider == rhs.position_updates_provider && |
1232 | 55 | lhs.heading_updates_provider == rhs.heading_updates_provider && | 61 | lhs.heading_updates_provider == rhs.heading_updates_provider && |
1233 | 56 | lhs.velocity_updates_provider == rhs.velocity_updates_provider; | 62 | lhs.velocity_updates_provider == rhs.velocity_updates_provider; |
1234 | 57 | } | 63 | } |
1235 | 58 | } | 64 | } |
1236 | 59 | } | 65 | } |
1237 | 60 | } | 66 | } |
1238 | 61 | 67 | ||
1240 | 62 | #endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_H_ | 68 | #endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_H_ |
1241 | 63 | 69 | ||
1242 | === modified file 'include/location_service/com/ubuntu/location/provider_selection_policy.h' | |||
1243 | --- include/location_service/com/ubuntu/location/provider_selection_policy.h 2014-06-20 07:40:34 +0000 | |||
1244 | +++ include/location_service/com/ubuntu/location/provider_selection_policy.h 2015-04-23 17:23:49 +0000 | |||
1245 | @@ -43,9 +43,8 @@ | |||
1246 | 43 | ProviderSelectionPolicy& operator=(const ProviderSelectionPolicy&) = delete; | 43 | ProviderSelectionPolicy& operator=(const ProviderSelectionPolicy&) = delete; |
1247 | 44 | virtual ~ProviderSelectionPolicy() = default; | 44 | virtual ~ProviderSelectionPolicy() = default; |
1248 | 45 | 45 | ||
1252 | 46 | virtual ProviderSelection determine_provider_selection_for_criteria( | 46 | virtual ProviderSelection determine_provider_selection_for_criteria(const Criteria& criteria, |
1253 | 47 | const Criteria& criteria, | 47 | const ProviderEnumerator& enumerator) = 0; |
1251 | 48 | const ProviderEnumerator& enumerator) = 0; | ||
1254 | 49 | 48 | ||
1255 | 50 | protected: | 49 | protected: |
1256 | 51 | ProviderSelectionPolicy() = default; | 50 | ProviderSelectionPolicy() = default; |
1257 | @@ -54,4 +53,4 @@ | |||
1258 | 54 | } | 53 | } |
1259 | 55 | } | 54 | } |
1260 | 56 | 55 | ||
1262 | 57 | #endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_POLICY_H_ | 56 | #endif // LOCATION_SERVICE_COM_UBUNTU_PROVIDER_SELECTION_POLICY_H_ |
1263 | 58 | 57 | ||
1264 | === modified file 'include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h' | |||
1265 | --- include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h 2014-02-03 13:52:21 +0000 | |||
1266 | +++ include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h 2015-04-23 17:23:49 +0000 | |||
1267 | @@ -43,13 +43,10 @@ | |||
1268 | 43 | 43 | ||
1269 | 44 | friend std::ostream& operator<<(std::ostream& out, const Status& status) | 44 | friend std::ostream& operator<<(std::ostream& out, const Status& status) |
1270 | 45 | { | 45 | { |
1278 | 46 | static std::map<Status, std::string> lut = | 46 | static std::map<Status, std::string> lut = {{Status::error, "error"}, |
1279 | 47 | { | 47 | {Status::unavailable, "unavailable"}, |
1280 | 48 | {Status::error, "error"}, | 48 | {Status::acquiring, "acquiring"}, |
1281 | 49 | {Status::unavailable, "unavailable"}, | 49 | {Status::available, "available"}}; |
1275 | 50 | {Status::acquiring, "acquiring"}, | ||
1276 | 51 | {Status::available, "available"} | ||
1277 | 52 | }; | ||
1282 | 53 | 50 | ||
1283 | 54 | return out << lut[status]; | 51 | return out << lut[status]; |
1284 | 55 | } | 52 | } |
1285 | @@ -62,7 +59,10 @@ | |||
1286 | 62 | } | 59 | } |
1287 | 63 | typedef Geoclue Interface; | 60 | typedef Geoclue Interface; |
1288 | 64 | typedef std::tuple<std::string, std::string> ResultType; | 61 | typedef std::tuple<std::string, std::string> ResultType; |
1290 | 65 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 62 | inline static const std::chrono::milliseconds default_timeout() |
1291 | 63 | { | ||
1292 | 64 | return std::chrono::seconds{1}; | ||
1293 | 65 | } | ||
1294 | 66 | }; | 66 | }; |
1295 | 67 | 67 | ||
1296 | 68 | struct GetStatus | 68 | struct GetStatus |
1297 | @@ -73,7 +73,10 @@ | |||
1298 | 73 | } | 73 | } |
1299 | 74 | typedef Geoclue Interface; | 74 | typedef Geoclue Interface; |
1300 | 75 | typedef int32_t ResultType; | 75 | typedef int32_t ResultType; |
1302 | 76 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 76 | inline static const std::chrono::milliseconds default_timeout() |
1303 | 77 | { | ||
1304 | 78 | return std::chrono::seconds{1}; | ||
1305 | 79 | } | ||
1306 | 77 | }; | 80 | }; |
1307 | 78 | 81 | ||
1308 | 79 | struct AddReference | 82 | struct AddReference |
1309 | @@ -84,7 +87,10 @@ | |||
1310 | 84 | } | 87 | } |
1311 | 85 | typedef Geoclue Interface; | 88 | typedef Geoclue Interface; |
1312 | 86 | typedef void ResultType; | 89 | typedef void ResultType; |
1314 | 87 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 90 | inline static const std::chrono::milliseconds default_timeout() |
1315 | 91 | { | ||
1316 | 92 | return std::chrono::seconds{1}; | ||
1317 | 93 | } | ||
1318 | 88 | }; | 94 | }; |
1319 | 89 | 95 | ||
1320 | 90 | struct RemoveReference | 96 | struct RemoveReference |
1321 | @@ -95,7 +101,10 @@ | |||
1322 | 95 | } | 101 | } |
1323 | 96 | typedef Geoclue Interface; | 102 | typedef Geoclue Interface; |
1324 | 97 | typedef void ResultType; | 103 | typedef void ResultType; |
1326 | 98 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 104 | inline static const std::chrono::milliseconds default_timeout() |
1327 | 105 | { | ||
1328 | 106 | return std::chrono::seconds{1}; | ||
1329 | 107 | } | ||
1330 | 99 | }; | 108 | }; |
1331 | 100 | 109 | ||
1332 | 101 | struct Address | 110 | struct Address |
1333 | @@ -107,8 +116,13 @@ | |||
1334 | 107 | return "GetAddress"; | 116 | return "GetAddress"; |
1335 | 108 | } | 117 | } |
1336 | 109 | typedef Address Interface; | 118 | typedef Address Interface; |
1339 | 110 | typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType; | 119 | typedef std::tuple<int32_t, |
1340 | 111 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 120 | std::map<std::string, std::string>, |
1341 | 121 | dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType; | ||
1342 | 122 | inline static const std::chrono::milliseconds default_timeout() | ||
1343 | 123 | { | ||
1344 | 124 | return std::chrono::seconds{1}; | ||
1345 | 125 | } | ||
1346 | 112 | }; | 126 | }; |
1347 | 113 | 127 | ||
1348 | 114 | struct Signals | 128 | struct Signals |
1349 | @@ -120,7 +134,9 @@ | |||
1350 | 120 | return "PositionChanged"; | 134 | return "PositionChanged"; |
1351 | 121 | }; | 135 | }; |
1352 | 122 | typedef Address Interface; | 136 | typedef Address Interface; |
1354 | 123 | typedef std::tuple<int32_t, std::map<std::string, std::string>, dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType; | 137 | typedef std::tuple<int32_t, |
1355 | 138 | std::map<std::string, std::string>, | ||
1356 | 139 | dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType; | ||
1357 | 124 | }; | 140 | }; |
1358 | 125 | }; | 141 | }; |
1359 | 126 | }; | 142 | }; |
1360 | @@ -146,8 +162,16 @@ | |||
1361 | 146 | return "GetPosition"; | 162 | return "GetPosition"; |
1362 | 147 | } | 163 | } |
1363 | 148 | typedef Position Interface; | 164 | typedef Position Interface; |
1366 | 149 | typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType; | 165 | typedef std::tuple<int32_t, |
1367 | 150 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 166 | int32_t, |
1368 | 167 | double, | ||
1369 | 168 | double, | ||
1370 | 169 | double, | ||
1371 | 170 | dbus::types::Struct<std::tuple<int32_t, double, double>>> ResultType; | ||
1372 | 171 | inline static const std::chrono::milliseconds default_timeout() | ||
1373 | 172 | { | ||
1374 | 173 | return std::chrono::seconds{1}; | ||
1375 | 174 | } | ||
1376 | 151 | }; | 175 | }; |
1377 | 152 | 176 | ||
1378 | 153 | struct Signals | 177 | struct Signals |
1379 | @@ -159,7 +183,12 @@ | |||
1380 | 159 | return "PositionChanged"; | 183 | return "PositionChanged"; |
1381 | 160 | }; | 184 | }; |
1382 | 161 | typedef Position Interface; | 185 | typedef Position Interface; |
1384 | 162 | typedef std::tuple<int32_t, int32_t, double, double, double, dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType; | 186 | typedef std::tuple<int32_t, |
1385 | 187 | int32_t, | ||
1386 | 188 | double, | ||
1387 | 189 | double, | ||
1388 | 190 | double, | ||
1389 | 191 | dbus::types::Struct<std::tuple<int32_t, double, double>>> ArgumentType; | ||
1390 | 163 | }; | 192 | }; |
1391 | 164 | }; | 193 | }; |
1392 | 165 | }; | 194 | }; |
1393 | @@ -186,7 +215,10 @@ | |||
1394 | 186 | } | 215 | } |
1395 | 187 | typedef Velocity Interface; | 216 | typedef Velocity Interface; |
1396 | 188 | typedef std::tuple<int32_t, int32_t, double, double, double> ResultType; | 217 | typedef std::tuple<int32_t, int32_t, double, double, double> ResultType; |
1398 | 189 | inline static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } | 218 | inline static const std::chrono::milliseconds default_timeout() |
1399 | 219 | { | ||
1400 | 220 | return std::chrono::seconds{1}; | ||
1401 | 221 | } | ||
1402 | 190 | }; | 222 | }; |
1403 | 191 | struct Signals | 223 | struct Signals |
1404 | 192 | { | 224 | { |
1405 | @@ -211,7 +243,7 @@ | |||
1406 | 211 | { | 243 | { |
1407 | 212 | namespace traits | 244 | namespace traits |
1408 | 213 | { | 245 | { |
1410 | 214 | template<> | 246 | template <> |
1411 | 215 | struct Service<org::freedesktop::Geoclue> | 247 | struct Service<org::freedesktop::Geoclue> |
1412 | 216 | { | 248 | { |
1413 | 217 | inline static const std::string& interface_name() | 249 | inline static const std::string& interface_name() |
1414 | @@ -221,7 +253,7 @@ | |||
1415 | 221 | } | 253 | } |
1416 | 222 | }; | 254 | }; |
1417 | 223 | 255 | ||
1419 | 224 | template<> | 256 | template <> |
1420 | 225 | struct Service<org::freedesktop::Geoclue::Address> | 257 | struct Service<org::freedesktop::Geoclue::Address> |
1421 | 226 | { | 258 | { |
1422 | 227 | inline static const std::string& interface_name() | 259 | inline static const std::string& interface_name() |
1423 | @@ -231,7 +263,7 @@ | |||
1424 | 231 | } | 263 | } |
1425 | 232 | }; | 264 | }; |
1426 | 233 | 265 | ||
1428 | 234 | template<> | 266 | template <> |
1429 | 235 | struct Service<org::freedesktop::Geoclue::Position> | 267 | struct Service<org::freedesktop::Geoclue::Position> |
1430 | 236 | { | 268 | { |
1431 | 237 | inline static const std::string& interface_name() | 269 | inline static const std::string& interface_name() |
1432 | @@ -241,7 +273,7 @@ | |||
1433 | 241 | } | 273 | } |
1434 | 242 | }; | 274 | }; |
1435 | 243 | 275 | ||
1437 | 244 | template<> | 276 | template <> |
1438 | 245 | struct Service<org::freedesktop::Geoclue::Velocity> | 277 | struct Service<org::freedesktop::Geoclue::Velocity> |
1439 | 246 | { | 278 | { |
1440 | 247 | inline static const std::string& interface_name() | 279 | inline static const std::string& interface_name() |
1441 | @@ -254,4 +286,4 @@ | |||
1442 | 254 | } | 286 | } |
1443 | 255 | } | 287 | } |
1444 | 256 | 288 | ||
1446 | 257 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_ | 289 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_GEOCLUE_H_ |
1447 | 258 | 290 | ||
1448 | === modified file 'include/location_service/com/ubuntu/location/providers/geoclue/provider.h' | |||
1449 | --- include/location_service/com/ubuntu/location/providers/geoclue/provider.h 2013-12-10 09:42:54 +0000 | |||
1450 | +++ include/location_service/com/ubuntu/location/providers/geoclue/provider.h 2015-04-23 17:23:49 +0000 | |||
1451 | @@ -33,13 +33,19 @@ | |||
1452 | 33 | { | 33 | { |
1453 | 34 | class Provider : public com::ubuntu::location::Provider | 34 | class Provider : public com::ubuntu::location::Provider |
1454 | 35 | { | 35 | { |
1456 | 36 | public: | 36 | public: |
1457 | 37 | static Provider::Ptr create_instance(const ProviderFactory::Configuration&); | 37 | static Provider::Ptr create_instance(const ProviderFactory::Configuration&); |
1458 | 38 | 38 | ||
1459 | 39 | struct Configuration | 39 | struct Configuration |
1460 | 40 | { | 40 | { |
1463 | 41 | static std::string key_name() { return "name"; } | 41 | static std::string key_name() |
1464 | 42 | static std::string key_path() { return "path"; } | 42 | { |
1465 | 43 | return "name"; | ||
1466 | 44 | } | ||
1467 | 45 | static std::string key_path() | ||
1468 | 46 | { | ||
1469 | 47 | return "path"; | ||
1470 | 48 | } | ||
1471 | 43 | std::string name; | 49 | std::string name; |
1472 | 44 | std::string path; | 50 | std::string path; |
1473 | 45 | 51 | ||
1474 | @@ -61,7 +67,7 @@ | |||
1475 | 61 | virtual void start_heading_updates(); | 67 | virtual void start_heading_updates(); |
1476 | 62 | virtual void stop_heading_updates(); | 68 | virtual void stop_heading_updates(); |
1477 | 63 | 69 | ||
1479 | 64 | private: | 70 | private: |
1480 | 65 | struct Private; | 71 | struct Private; |
1481 | 66 | std::unique_ptr<Private> d; | 72 | std::unique_ptr<Private> d; |
1482 | 67 | }; | 73 | }; |
1483 | @@ -70,4 +76,4 @@ | |||
1484 | 70 | } | 76 | } |
1485 | 71 | } | 77 | } |
1486 | 72 | } | 78 | } |
1488 | 73 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_PROVIDER_H_ | 79 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_GEOCLUE_PROVIDER_H_ |
1489 | 74 | 80 | ||
1490 | === modified file 'include/location_service/com/ubuntu/location/providers/remote/interface.h' | |||
1491 | --- include/location_service/com/ubuntu/location/providers/remote/interface.h 2015-01-21 20:04:56 +0000 | |||
1492 | +++ include/location_service/com/ubuntu/location/providers/remote/interface.h 2015-04-23 17:23:49 +0000 | |||
1493 | @@ -99,26 +99,20 @@ | |||
1494 | 99 | // Creates a new skeleton instance and installs the interface | 99 | // Creates a new skeleton instance and installs the interface |
1495 | 100 | // com::ubuntu::remote::Interface on it. | 100 | // com::ubuntu::remote::Interface on it. |
1496 | 101 | Skeleton(const core::dbus::Object::Ptr& object) | 101 | Skeleton(const core::dbus::Object::Ptr& object) |
1517 | 102 | : object{object}, | 102 | : object{object} |
1518 | 103 | properties | 103 | , properties{object->get_property<Properties::HasPosition>(), |
1519 | 104 | { | 104 | object->get_property<Properties::HasVelocity>(), |
1520 | 105 | object->get_property<Properties::HasPosition>(), | 105 | object->get_property<Properties::HasHeading>(), |
1521 | 106 | object->get_property<Properties::HasVelocity>(), | 106 | object->get_property<Properties::RequiresSatellites>(), |
1522 | 107 | object->get_property<Properties::HasHeading>(), | 107 | object->get_property<Properties::RequiresCellNetwork>(), |
1523 | 108 | object->get_property<Properties::RequiresSatellites>(), | 108 | object->get_property<Properties::RequiresDataNetwork>(), |
1524 | 109 | object->get_property<Properties::RequiresCellNetwork>(), | 109 | object->get_property<Properties::RequiresMonetarySpending>(), |
1525 | 110 | object->get_property<Properties::RequiresDataNetwork>(), | 110 | object->get_property<Properties::ArePositionUpdatesRunning>(), |
1526 | 111 | object->get_property<Properties::RequiresMonetarySpending>(), | 111 | object->get_property<Properties::AreHeadingUpdatesRunning>(), |
1527 | 112 | object->get_property<Properties::ArePositionUpdatesRunning>(), | 112 | object->get_property<Properties::AreVelocityUpdatesRunning>()} |
1528 | 113 | object->get_property<Properties::AreHeadingUpdatesRunning>(), | 113 | , signals{object->get_signal<Signals::PositionChanged>(), |
1529 | 114 | object->get_property<Properties::AreVelocityUpdatesRunning>() | 114 | object->get_signal<Signals::HeadingChanged>(), |
1530 | 115 | }, | 115 | object->get_signal<Signals::VelocityChanged>()} |
1511 | 116 | signals | ||
1512 | 117 | { | ||
1513 | 118 | object->get_signal<Signals::PositionChanged>(), | ||
1514 | 119 | object->get_signal<Signals::HeadingChanged>(), | ||
1515 | 120 | object->get_signal<Signals::VelocityChanged>() | ||
1516 | 121 | } | ||
1531 | 122 | { | 116 | { |
1532 | 123 | } | 117 | } |
1533 | 124 | 118 | ||
1534 | @@ -141,20 +135,14 @@ | |||
1535 | 141 | // All known signals. | 135 | // All known signals. |
1536 | 142 | struct | 136 | struct |
1537 | 143 | { | 137 | { |
1552 | 144 | std::shared_ptr<core::dbus::Signal< | 138 | std::shared_ptr<core::dbus::Signal<Signals::PositionChanged, Signals::PositionChanged::ArgumentType>> |
1553 | 145 | Signals::PositionChanged, | 139 | position_changed; |
1554 | 146 | Signals::PositionChanged::ArgumentType | 140 | |
1555 | 147 | >> position_changed; | 141 | std::shared_ptr<core::dbus::Signal<Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType>> |
1556 | 148 | 142 | heading_changed; | |
1557 | 149 | std::shared_ptr<core::dbus::Signal< | 143 | |
1558 | 150 | Signals::HeadingChanged, | 144 | std::shared_ptr<core::dbus::Signal<Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType>> |
1559 | 151 | Signals::HeadingChanged::ArgumentType | 145 | velocity_changed; |
1546 | 152 | >> heading_changed; | ||
1547 | 153 | |||
1548 | 154 | std::shared_ptr<core::dbus::Signal< | ||
1549 | 155 | Signals::VelocityChanged, | ||
1550 | 156 | Signals::VelocityChanged::ArgumentType | ||
1551 | 157 | >> velocity_changed; | ||
1560 | 158 | } signals; | 146 | } signals; |
1561 | 159 | }; | 147 | }; |
1562 | 160 | 148 | ||
1563 | @@ -163,26 +151,20 @@ | |||
1564 | 163 | // Creates a new skeleton instance and installs the interface | 151 | // Creates a new skeleton instance and installs the interface |
1565 | 164 | // com::ubuntu::remote::Interface on it. | 152 | // com::ubuntu::remote::Interface on it. |
1566 | 165 | Stub(const core::dbus::Object::Ptr& object) | 153 | Stub(const core::dbus::Object::Ptr& object) |
1587 | 166 | : object{object}, | 154 | : object{object} |
1588 | 167 | properties | 155 | , properties{object->get_property<Properties::HasPosition>(), |
1589 | 168 | { | 156 | object->get_property<Properties::HasVelocity>(), |
1590 | 169 | object->get_property<Properties::HasPosition>(), | 157 | object->get_property<Properties::HasHeading>(), |
1591 | 170 | object->get_property<Properties::HasVelocity>(), | 158 | object->get_property<Properties::RequiresSatellites>(), |
1592 | 171 | object->get_property<Properties::HasHeading>(), | 159 | object->get_property<Properties::RequiresCellNetwork>(), |
1593 | 172 | object->get_property<Properties::RequiresSatellites>(), | 160 | object->get_property<Properties::RequiresDataNetwork>(), |
1594 | 173 | object->get_property<Properties::RequiresCellNetwork>(), | 161 | object->get_property<Properties::RequiresMonetarySpending>(), |
1595 | 174 | object->get_property<Properties::RequiresDataNetwork>(), | 162 | object->get_property<Properties::ArePositionUpdatesRunning>(), |
1596 | 175 | object->get_property<Properties::RequiresMonetarySpending>(), | 163 | object->get_property<Properties::AreHeadingUpdatesRunning>(), |
1597 | 176 | object->get_property<Properties::ArePositionUpdatesRunning>(), | 164 | object->get_property<Properties::AreVelocityUpdatesRunning>()} |
1598 | 177 | object->get_property<Properties::AreHeadingUpdatesRunning>(), | 165 | , signals{object->get_signal<Signals::PositionChanged>(), |
1599 | 178 | object->get_property<Properties::AreVelocityUpdatesRunning>() | 166 | object->get_signal<Signals::HeadingChanged>(), |
1600 | 179 | }, | 167 | object->get_signal<Signals::VelocityChanged>()} |
1581 | 180 | signals | ||
1582 | 181 | { | ||
1583 | 182 | object->get_signal<Signals::PositionChanged>(), | ||
1584 | 183 | object->get_signal<Signals::HeadingChanged>(), | ||
1585 | 184 | object->get_signal<Signals::VelocityChanged>() | ||
1586 | 185 | } | ||
1601 | 186 | { | 168 | { |
1602 | 187 | } | 169 | } |
1603 | 188 | 170 | ||
1604 | @@ -205,27 +187,20 @@ | |||
1605 | 205 | // All known signals. | 187 | // All known signals. |
1606 | 206 | struct | 188 | struct |
1607 | 207 | { | 189 | { |
1622 | 208 | std::shared_ptr<core::dbus::Signal< | 190 | std::shared_ptr<core::dbus::Signal<Signals::PositionChanged, Signals::PositionChanged::ArgumentType>> |
1623 | 209 | Signals::PositionChanged, | 191 | position_changed; |
1624 | 210 | Signals::PositionChanged::ArgumentType | 192 | |
1625 | 211 | >> position_changed; | 193 | std::shared_ptr<core::dbus::Signal<Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType>> |
1626 | 212 | 194 | heading_changed; | |
1627 | 213 | std::shared_ptr<core::dbus::Signal< | 195 | |
1628 | 214 | Signals::HeadingChanged, | 196 | std::shared_ptr<core::dbus::Signal<Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType>> |
1629 | 215 | Signals::HeadingChanged::ArgumentType | 197 | velocity_changed; |
1616 | 216 | >> heading_changed; | ||
1617 | 217 | |||
1618 | 218 | std::shared_ptr<core::dbus::Signal< | ||
1619 | 219 | Signals::VelocityChanged, | ||
1620 | 220 | Signals::VelocityChanged::ArgumentType | ||
1621 | 221 | >> velocity_changed; | ||
1630 | 222 | } signals; | 198 | } signals; |
1631 | 223 | }; | 199 | }; |
1632 | 224 | |||
1633 | 225 | }; | 200 | }; |
1634 | 226 | } | 201 | } |
1635 | 227 | } | 202 | } |
1636 | 228 | } | 203 | } |
1637 | 229 | } | 204 | } |
1638 | 230 | } | 205 | } |
1640 | 231 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_ | 206 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_ |
1641 | 232 | 207 | ||
1642 | === modified file 'include/location_service/com/ubuntu/location/providers/remote/skeleton.h' | |||
1643 | --- include/location_service/com/ubuntu/location/providers/remote/skeleton.h 2014-09-12 13:11:42 +0000 | |||
1644 | +++ include/location_service/com/ubuntu/location/providers/remote/skeleton.h 2015-04-23 17:23:49 +0000 | |||
1645 | @@ -20,10 +20,14 @@ | |||
1646 | 20 | 20 | ||
1647 | 21 | #include <com/ubuntu/location/provider.h> | 21 | #include <com/ubuntu/location/provider.h> |
1648 | 22 | 22 | ||
1650 | 23 | namespace core { namespace dbus { | 23 | namespace core |
1651 | 24 | { | ||
1652 | 25 | namespace dbus | ||
1653 | 26 | { | ||
1654 | 24 | class Bus; | 27 | class Bus; |
1655 | 25 | class Object; | 28 | class Object; |
1657 | 26 | }} | 29 | } |
1658 | 30 | } | ||
1659 | 27 | 31 | ||
1660 | 28 | namespace com | 32 | namespace com |
1661 | 29 | { | 33 | { |
1662 | @@ -56,4 +60,4 @@ | |||
1663 | 56 | } | 60 | } |
1664 | 57 | } | 61 | } |
1665 | 58 | } | 62 | } |
1667 | 59 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_SKELETON_H_ | 63 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_SKELETON_H_ |
1668 | 60 | 64 | ||
1669 | === modified file 'include/location_service/com/ubuntu/location/providers/remote/stub.h' | |||
1670 | --- include/location_service/com/ubuntu/location/providers/remote/stub.h 2014-09-12 13:11:42 +0000 | |||
1671 | +++ include/location_service/com/ubuntu/location/providers/remote/stub.h 2015-04-23 17:23:49 +0000 | |||
1672 | @@ -20,10 +20,14 @@ | |||
1673 | 20 | 20 | ||
1674 | 21 | #include <com/ubuntu/location/provider.h> | 21 | #include <com/ubuntu/location/provider.h> |
1675 | 22 | 22 | ||
1677 | 23 | namespace core { namespace dbus { | 23 | namespace core |
1678 | 24 | { | ||
1679 | 25 | namespace dbus | ||
1680 | 26 | { | ||
1681 | 24 | class Bus; | 27 | class Bus; |
1682 | 25 | class Object; | 28 | class Object; |
1684 | 26 | }} | 29 | } |
1685 | 30 | } | ||
1686 | 27 | 31 | ||
1687 | 28 | namespace com | 32 | namespace com |
1688 | 29 | { | 33 | { |
1689 | @@ -52,4 +56,4 @@ | |||
1690 | 52 | } | 56 | } |
1691 | 53 | } | 57 | } |
1692 | 54 | } | 58 | } |
1694 | 55 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_STUB_H_ | 59 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PROVIDERS_REMOTE_STUB_H_ |
1695 | 56 | 60 | ||
1696 | === modified file 'include/location_service/com/ubuntu/location/providers/skyhook/provider.h' | |||
1697 | --- include/location_service/com/ubuntu/location/providers/skyhook/provider.h 2013-12-10 09:42:54 +0000 | |||
1698 | +++ include/location_service/com/ubuntu/location/providers/skyhook/provider.h 2015-04-23 17:23:49 +0000 | |||
1699 | @@ -35,17 +35,26 @@ | |||
1700 | 35 | { | 35 | { |
1701 | 36 | class Provider : public com::ubuntu::location::Provider | 36 | class Provider : public com::ubuntu::location::Provider |
1702 | 37 | { | 37 | { |
1704 | 38 | public: | 38 | public: |
1705 | 39 | static Provider::Ptr create_instance(const ProviderFactory::Configuration& config); | 39 | static Provider::Ptr create_instance(const ProviderFactory::Configuration& config); |
1707 | 40 | 40 | ||
1708 | 41 | static const Provider::FeatureFlags& default_feature_flags(); | 41 | static const Provider::FeatureFlags& default_feature_flags(); |
1709 | 42 | static const Provider::RequirementFlags& default_requirement_flags(); | 42 | static const Provider::RequirementFlags& default_requirement_flags(); |
1710 | 43 | 43 | ||
1711 | 44 | struct Configuration | 44 | struct Configuration |
1712 | 45 | { | 45 | { |
1716 | 46 | static std::string key_username() { return "username"; } | 46 | static std::string key_username() |
1717 | 47 | static std::string key_realm() { return "realm"; } | 47 | { |
1718 | 48 | static std::string key_period() { return "period"; } | 48 | return "username"; |
1719 | 49 | } | ||
1720 | 50 | static std::string key_realm() | ||
1721 | 51 | { | ||
1722 | 52 | return "realm"; | ||
1723 | 53 | } | ||
1724 | 54 | static std::string key_period() | ||
1725 | 55 | { | ||
1726 | 56 | return "period"; | ||
1727 | 57 | } | ||
1728 | 49 | 58 | ||
1729 | 50 | std::string user_name; | 59 | std::string user_name; |
1730 | 51 | std::string realm; | 60 | std::string realm; |
1731 | @@ -68,7 +77,7 @@ | |||
1732 | 68 | virtual void start_heading_updates(); | 77 | virtual void start_heading_updates(); |
1733 | 69 | virtual void stop_heading_updates(); | 78 | virtual void stop_heading_updates(); |
1734 | 70 | 79 | ||
1736 | 71 | private: | 80 | private: |
1737 | 72 | struct Private; | 81 | struct Private; |
1738 | 73 | std::unique_ptr<Private> d; | 82 | std::unique_ptr<Private> d; |
1739 | 74 | }; | 83 | }; |
1740 | @@ -77,4 +86,4 @@ | |||
1741 | 77 | } | 86 | } |
1742 | 78 | } | 87 | } |
1743 | 79 | } | 88 | } |
1745 | 80 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_SKYHOOK_PROVIDER_H_ | 89 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROVIDERS_SKYHOOK_PROVIDER_H_ |
1746 | 81 | 90 | ||
1747 | === modified file 'include/location_service/com/ubuntu/location/proxy_provider.h' | |||
1748 | --- include/location_service/com/ubuntu/location/proxy_provider.h 2014-06-20 07:40:34 +0000 | |||
1749 | +++ include/location_service/com/ubuntu/location/proxy_provider.h 2015-04-23 17:23:49 +0000 | |||
1750 | @@ -46,7 +46,7 @@ | |||
1751 | 46 | 46 | ||
1752 | 47 | virtual void start_heading_updates(); | 47 | virtual void start_heading_updates(); |
1753 | 48 | virtual void stop_heading_updates(); | 48 | virtual void stop_heading_updates(); |
1755 | 49 | 49 | ||
1756 | 50 | private: | 50 | private: |
1757 | 51 | ProviderSelection providers; | 51 | ProviderSelection providers; |
1758 | 52 | 52 | ||
1759 | @@ -61,4 +61,4 @@ | |||
1760 | 61 | } | 61 | } |
1761 | 62 | } | 62 | } |
1762 | 63 | 63 | ||
1764 | 64 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROXY_PROVIDER_H_ | 64 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_PROXY_PROVIDER_H_ |
1765 | 65 | 65 | ||
1766 | === modified file 'include/location_service/com/ubuntu/location/satellite_based_positioning_state.h' | |||
1767 | --- include/location_service/com/ubuntu/location/satellite_based_positioning_state.h 2014-11-14 11:26:45 +0000 | |||
1768 | +++ include/location_service/com/ubuntu/location/satellite_based_positioning_state.h 2015-04-23 17:23:49 +0000 | |||
1769 | @@ -32,8 +32,8 @@ | |||
1770 | 32 | */ | 32 | */ |
1771 | 33 | enum class SatelliteBasedPositioningState | 33 | enum class SatelliteBasedPositioningState |
1772 | 34 | { | 34 | { |
1775 | 35 | on, ///< Satellite assisted positioning is on. | 35 | on, ///< Satellite assisted positioning is on. |
1776 | 36 | off ///< Satellite assisted positioning is off. | 36 | off ///< Satellite assisted positioning is off. |
1777 | 37 | }; | 37 | }; |
1778 | 38 | 38 | ||
1779 | 39 | /** @brief Pretty prints the given state to the given stream. */ | 39 | /** @brief Pretty prints the given state to the given stream. */ |
1780 | @@ -44,4 +44,4 @@ | |||
1781 | 44 | } | 44 | } |
1782 | 45 | } | 45 | } |
1783 | 46 | 46 | ||
1785 | 47 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SATELLITE_BASED_POSITIONING_STATE_H_ | 47 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SATELLITE_BASED_POSITIONING_STATE_H_ |
1786 | 48 | 48 | ||
1787 | === modified file 'include/location_service/com/ubuntu/location/service/configuration.h' | |||
1788 | --- include/location_service/com/ubuntu/location/service/configuration.h 2014-11-14 11:33:05 +0000 | |||
1789 | +++ include/location_service/com/ubuntu/location/service/configuration.h 2015-04-23 17:23:49 +0000 | |||
1790 | @@ -41,10 +41,9 @@ | |||
1791 | 41 | Configuration(const Configuration&) = delete; | 41 | Configuration(const Configuration&) = delete; |
1792 | 42 | Configuration& operator=(const Configuration&) = delete; | 42 | Configuration& operator=(const Configuration&) = delete; |
1793 | 43 | 43 | ||
1798 | 44 | virtual std::shared_ptr<Engine> the_engine( | 44 | virtual std::shared_ptr<Engine> the_engine(const std::set<Provider::Ptr>& provider_set, |
1799 | 45 | const std::set<Provider::Ptr>& provider_set, | 45 | const ProviderSelectionPolicy::Ptr& provider_selection_policy) = 0; |
1800 | 46 | const ProviderSelectionPolicy::Ptr& provider_selection_policy) = 0; | 46 | |
1797 | 47 | |||
1801 | 48 | virtual ProviderSelectionPolicy::Ptr the_provider_selection_policy() = 0; | 47 | virtual ProviderSelectionPolicy::Ptr the_provider_selection_policy() = 0; |
1802 | 49 | virtual std::set<Provider::Ptr> the_provider_set() = 0; | 48 | virtual std::set<Provider::Ptr> the_provider_set() = 0; |
1803 | 50 | virtual PermissionManager::Ptr the_permission_manager() = 0; | 49 | virtual PermissionManager::Ptr the_permission_manager() = 0; |
1804 | @@ -57,4 +56,4 @@ | |||
1805 | 57 | } | 56 | } |
1806 | 58 | } | 57 | } |
1807 | 59 | 58 | ||
1809 | 60 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_CONFIGURATION_H_ | 59 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_CONFIGURATION_H_ |
1810 | 61 | 60 | ||
1811 | === modified file 'include/location_service/com/ubuntu/location/service/default_permission_manager.h' | |||
1812 | --- include/location_service/com/ubuntu/location/service/default_permission_manager.h 2013-12-10 09:42:54 +0000 | |||
1813 | +++ include/location_service/com/ubuntu/location/service/default_permission_manager.h 2015-04-23 17:23:49 +0000 | |||
1814 | @@ -33,17 +33,15 @@ | |||
1815 | 33 | { | 33 | { |
1816 | 34 | class DefaultPermissionManager : public PermissionManager | 34 | class DefaultPermissionManager : public PermissionManager |
1817 | 35 | { | 35 | { |
1819 | 36 | public: | 36 | public: |
1820 | 37 | typedef std::shared_ptr<DefaultPermissionManager> Ptr; | 37 | typedef std::shared_ptr<DefaultPermissionManager> Ptr; |
1821 | 38 | 38 | ||
1822 | 39 | DefaultPermissionManager(); | 39 | DefaultPermissionManager(); |
1823 | 40 | ~DefaultPermissionManager() noexcept; | 40 | ~DefaultPermissionManager() noexcept; |
1830 | 41 | 41 | ||
1831 | 42 | Result check_permission_for_credentials( | 42 | Result check_permission_for_credentials(const Criteria&, const Credentials& credentials); |
1832 | 43 | const Criteria&, | 43 | |
1833 | 44 | const Credentials& credentials); | 44 | private: |
1828 | 45 | |||
1829 | 46 | private: | ||
1834 | 47 | pid_t pid; | 45 | pid_t pid; |
1835 | 48 | uid_t uid; | 46 | uid_t uid; |
1836 | 49 | }; | 47 | }; |
1837 | @@ -51,4 +49,4 @@ | |||
1838 | 51 | } | 49 | } |
1839 | 52 | } | 50 | } |
1840 | 53 | } | 51 | } |
1842 | 54 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_DEFAULT_PERMISSION_MANAGER_H_ | 52 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_DEFAULT_PERMISSION_MANAGER_H_ |
1843 | 55 | 53 | ||
1844 | === modified file 'include/location_service/com/ubuntu/location/service/interface.h' | |||
1845 | --- include/location_service/com/ubuntu/location/service/interface.h 2014-08-01 15:59:25 +0000 | |||
1846 | +++ include/location_service/com/ubuntu/location/service/interface.h 2015-04-23 17:23:49 +0000 | |||
1847 | @@ -45,7 +45,7 @@ | |||
1848 | 45 | */ | 45 | */ |
1849 | 46 | class Interface | 46 | class Interface |
1850 | 47 | { | 47 | { |
1852 | 48 | protected: | 48 | protected: |
1853 | 49 | struct Errors | 49 | struct Errors |
1854 | 50 | { | 50 | { |
1855 | 51 | struct InsufficientPermissions | 51 | struct InsufficientPermissions |
1856 | @@ -70,10 +70,7 @@ | |||
1857 | 70 | 70 | ||
1858 | 71 | inline static const std::string& name() | 71 | inline static const std::string& name() |
1859 | 72 | { | 72 | { |
1864 | 73 | static const std::string s | 73 | static const std::string s{"CreateSessionForCriteria"}; |
1861 | 74 | { | ||
1862 | 75 | "CreateSessionForCriteria" | ||
1863 | 76 | }; | ||
1865 | 77 | return s; | 74 | return s; |
1866 | 78 | } | 75 | } |
1867 | 79 | 76 | ||
1868 | @@ -91,10 +88,7 @@ | |||
1869 | 91 | { | 88 | { |
1870 | 92 | inline static const std::string& name() | 89 | inline static const std::string& name() |
1871 | 93 | { | 90 | { |
1876 | 94 | static const std::string s | 91 | static const std::string s{"DoesSatelliteBasedPositioning"}; |
1873 | 95 | { | ||
1874 | 96 | "DoesSatelliteBasedPositioning" | ||
1875 | 97 | }; | ||
1877 | 98 | return s; | 92 | return s; |
1878 | 99 | } | 93 | } |
1879 | 100 | 94 | ||
1880 | @@ -108,10 +102,7 @@ | |||
1881 | 108 | { | 102 | { |
1882 | 109 | inline static const std::string& name() | 103 | inline static const std::string& name() |
1883 | 110 | { | 104 | { |
1888 | 111 | static const std::string s | 105 | static const std::string s{"DoesReportCellAndWifiIds"}; |
1885 | 112 | { | ||
1886 | 113 | "DoesReportCellAndWifiIds" | ||
1887 | 114 | }; | ||
1889 | 115 | return s; | 106 | return s; |
1890 | 116 | } | 107 | } |
1891 | 117 | 108 | ||
1892 | @@ -125,10 +116,7 @@ | |||
1893 | 125 | { | 116 | { |
1894 | 126 | inline static const std::string& name() | 117 | inline static const std::string& name() |
1895 | 127 | { | 118 | { |
1900 | 128 | static const std::string s | 119 | static const std::string s{"IsOnline"}; |
1897 | 129 | { | ||
1898 | 130 | "IsOnline" | ||
1899 | 131 | }; | ||
1901 | 132 | return s; | 120 | return s; |
1902 | 133 | } | 121 | } |
1903 | 134 | 122 | ||
1904 | @@ -142,10 +130,7 @@ | |||
1905 | 142 | { | 130 | { |
1906 | 143 | inline static const std::string& name() | 131 | inline static const std::string& name() |
1907 | 144 | { | 132 | { |
1912 | 145 | static const std::string s | 133 | static const std::string s{"VisibleSpaceVehicles"}; |
1909 | 146 | { | ||
1910 | 147 | "VisibleSpaceVehicles" | ||
1911 | 148 | }; | ||
1913 | 149 | return s; | 134 | return s; |
1914 | 150 | } | 135 | } |
1915 | 151 | 136 | ||
1916 | @@ -159,7 +144,7 @@ | |||
1917 | 159 | 144 | ||
1918 | 160 | Interface() = default; | 145 | Interface() = default; |
1919 | 161 | 146 | ||
1921 | 162 | public: | 147 | public: |
1922 | 163 | typedef std::shared_ptr<Interface> Ptr; | 148 | typedef std::shared_ptr<Interface> Ptr; |
1923 | 164 | 149 | ||
1924 | 165 | /** | 150 | /** |
1925 | @@ -222,15 +207,12 @@ | |||
1926 | 222 | { | 207 | { |
1927 | 223 | namespace traits | 208 | namespace traits |
1928 | 224 | { | 209 | { |
1930 | 225 | template<> | 210 | template <> |
1931 | 226 | struct Service<com::ubuntu::location::service::Interface> | 211 | struct Service<com::ubuntu::location::service::Interface> |
1932 | 227 | { | 212 | { |
1933 | 228 | static const std::string& interface_name() | 213 | static const std::string& interface_name() |
1934 | 229 | { | 214 | { |
1939 | 230 | static const std::string s | 215 | static const std::string s{"com.ubuntu.location.Service"}; |
1936 | 231 | { | ||
1937 | 232 | "com.ubuntu.location.Service" | ||
1938 | 233 | }; | ||
1940 | 234 | return s; | 216 | return s; |
1941 | 235 | } | 217 | } |
1942 | 236 | }; | 218 | }; |
1943 | @@ -240,4 +222,4 @@ | |||
1944 | 240 | 222 | ||
1945 | 241 | #include <com/ubuntu/location/codec.h> | 223 | #include <com/ubuntu/location/codec.h> |
1946 | 242 | 224 | ||
1948 | 243 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_ | 225 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_INTERFACE_H_ |
1949 | 244 | 226 | ||
1950 | === modified file 'include/location_service/com/ubuntu/location/service/permission_manager.h' | |||
1951 | --- include/location_service/com/ubuntu/location/service/permission_manager.h 2014-06-23 04:57:59 +0000 | |||
1952 | +++ include/location_service/com/ubuntu/location/service/permission_manager.h 2015-04-23 17:23:49 +0000 | |||
1953 | @@ -53,8 +53,8 @@ | |||
1954 | 53 | */ | 53 | */ |
1955 | 54 | enum class Result | 54 | enum class Result |
1956 | 55 | { | 55 | { |
1959 | 56 | granted, ///< The app is allowed to access the location service. | 56 | granted, ///< The app is allowed to access the location service. |
1960 | 57 | rejected ///< The app is not allowed to access the location service. | 57 | rejected ///< The app is not allowed to access the location service. |
1961 | 58 | }; | 58 | }; |
1962 | 59 | 59 | ||
1963 | 60 | virtual ~PermissionManager() = default; | 60 | virtual ~PermissionManager() = default; |
1964 | @@ -67,10 +67,8 @@ | |||
1965 | 67 | * @param credentials The credentials identifying the remote peer. | 67 | * @param credentials The credentials identifying the remote peer. |
1966 | 68 | * @return Result::granted if the remote peer is allowed to access the location service, Result::rejected otherwise. | 68 | * @return Result::granted if the remote peer is allowed to access the location service, Result::rejected otherwise. |
1967 | 69 | */ | 69 | */ |
1972 | 70 | virtual Result check_permission_for_credentials( | 70 | virtual Result check_permission_for_credentials(const Criteria& criteria, const Credentials& credentials) = 0; |
1973 | 71 | const Criteria& criteria, | 71 | |
1970 | 72 | const Credentials& credentials) = 0; | ||
1971 | 73 | |||
1974 | 74 | protected: | 72 | protected: |
1975 | 75 | PermissionManager() = default; | 73 | PermissionManager() = default; |
1976 | 76 | }; | 74 | }; |
1977 | @@ -78,4 +76,4 @@ | |||
1978 | 78 | } | 76 | } |
1979 | 79 | } | 77 | } |
1980 | 80 | } | 78 | } |
1982 | 81 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PERMISSION_MANAGER_H_ | 79 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_PERMISSION_MANAGER_H_ |
1983 | 82 | 80 | ||
1984 | === modified file 'include/location_service/com/ubuntu/location/service/session/implementation.h' | |||
1985 | --- include/location_service/com/ubuntu/location/service/session/implementation.h 2014-02-03 13:52:21 +0000 | |||
1986 | +++ include/location_service/com/ubuntu/location/service/session/implementation.h 2015-04-23 17:23:49 +0000 | |||
1987 | @@ -36,7 +36,7 @@ | |||
1988 | 36 | { | 36 | { |
1989 | 37 | class Implementation : public Interface | 37 | class Implementation : public Interface |
1990 | 38 | { | 38 | { |
1992 | 39 | public: | 39 | public: |
1993 | 40 | Implementation(const Provider::Ptr& provider); | 40 | Implementation(const Provider::Ptr& provider); |
1994 | 41 | Implementation(const Implementation&) = delete; | 41 | Implementation(const Implementation&) = delete; |
1995 | 42 | virtual ~Implementation() noexcept; | 42 | virtual ~Implementation() noexcept; |
1996 | @@ -51,7 +51,7 @@ | |||
1997 | 51 | virtual void start_heading_updates(); | 51 | virtual void start_heading_updates(); |
1998 | 52 | virtual void stop_heading_updates() noexcept; | 52 | virtual void stop_heading_updates() noexcept; |
1999 | 53 | 53 | ||
2001 | 54 | private: | 54 | private: |
2002 | 55 | struct Private; | 55 | struct Private; |
2003 | 56 | std::unique_ptr<Private> d; | 56 | std::unique_ptr<Private> d; |
2004 | 57 | }; | 57 | }; |
2005 | @@ -61,4 +61,4 @@ | |||
2006 | 61 | } | 61 | } |
2007 | 62 | } | 62 | } |
2008 | 63 | 63 | ||
2010 | 64 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_ | 64 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_IMPLEMENTATION_H_ |
2011 | 65 | 65 | ||
2012 | === modified file 'include/location_service/com/ubuntu/location/service/session/interface.h' | |||
2013 | --- include/location_service/com/ubuntu/location/service/session/interface.h 2014-05-19 09:55:25 +0000 | |||
2014 | +++ include/location_service/com/ubuntu/location/service/session/interface.h 2015-04-23 17:23:49 +0000 | |||
2015 | @@ -70,8 +70,8 @@ | |||
2016 | 70 | */ | 70 | */ |
2017 | 71 | enum class Status | 71 | enum class Status |
2018 | 72 | { | 72 | { |
2021 | 73 | enabled, ///< Updates are enabled and delivered to this session. | 73 | enabled, ///< Updates are enabled and delivered to this session. |
2022 | 74 | disabled ///< Updates are disabled and not delivered to this session. | 74 | disabled ///< Updates are disabled and not delivered to this session. |
2023 | 75 | }; | 75 | }; |
2024 | 76 | 76 | ||
2025 | 77 | /** | 77 | /** |
2026 | @@ -114,7 +114,7 @@ | |||
2027 | 114 | */ | 114 | */ |
2028 | 115 | virtual Updates& updates(); | 115 | virtual Updates& updates(); |
2029 | 116 | 116 | ||
2031 | 117 | protected: | 117 | protected: |
2032 | 118 | Interface(); | 118 | Interface(); |
2033 | 119 | 119 | ||
2034 | 120 | private: | 120 | private: |
2035 | @@ -127,4 +127,4 @@ | |||
2036 | 127 | } | 127 | } |
2037 | 128 | } | 128 | } |
2038 | 129 | 129 | ||
2040 | 130 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_ | 130 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_INTERFACE_H_ |
2041 | 131 | 131 | ||
2042 | === modified file 'include/location_service/com/ubuntu/location/service/session/skeleton.h' | |||
2043 | --- include/location_service/com/ubuntu/location/service/session/skeleton.h 2014-08-01 12:51:25 +0000 | |||
2044 | +++ include/location_service/com/ubuntu/location/service/session/skeleton.h 2015-04-23 17:23:49 +0000 | |||
2045 | @@ -119,4 +119,4 @@ | |||
2046 | 119 | } | 119 | } |
2047 | 120 | } | 120 | } |
2048 | 121 | 121 | ||
2050 | 122 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_SKELETON_H_ | 122 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_SKELETON_H_ |
2051 | 123 | 123 | ||
2052 | === modified file 'include/location_service/com/ubuntu/location/service/session/stub.h' | |||
2053 | --- include/location_service/com/ubuntu/location/service/session/stub.h 2014-02-03 13:52:21 +0000 | |||
2054 | +++ include/location_service/com/ubuntu/location/service/session/stub.h 2015-04-23 17:23:49 +0000 | |||
2055 | @@ -42,10 +42,8 @@ | |||
2056 | 42 | { | 42 | { |
2057 | 43 | class Stub : public core::dbus::Stub<Interface> | 43 | class Stub : public core::dbus::Stub<Interface> |
2058 | 44 | { | 44 | { |
2063 | 45 | public: | 45 | public: |
2064 | 46 | Stub( | 46 | Stub(const core::dbus::Bus::Ptr& bus, const core::dbus::types::ObjectPath& session_path); |
2061 | 47 | const core::dbus::Bus::Ptr& bus, | ||
2062 | 48 | const core::dbus::types::ObjectPath& session_path); | ||
2065 | 49 | Stub(const Stub&) = delete; | 47 | Stub(const Stub&) = delete; |
2066 | 50 | virtual ~Stub() noexcept; | 48 | virtual ~Stub() noexcept; |
2067 | 51 | Stub& operator=(const Stub&) = delete; | 49 | Stub& operator=(const Stub&) = delete; |
2068 | @@ -61,7 +59,7 @@ | |||
2069 | 61 | virtual void start_heading_updates(); | 59 | virtual void start_heading_updates(); |
2070 | 62 | virtual void stop_heading_updates() noexcept; | 60 | virtual void stop_heading_updates() noexcept; |
2071 | 63 | 61 | ||
2073 | 64 | private: | 62 | private: |
2074 | 65 | struct Private; | 63 | struct Private; |
2075 | 66 | std::unique_ptr<Private> d; | 64 | std::unique_ptr<Private> d; |
2076 | 67 | }; | 65 | }; |
2077 | @@ -70,4 +68,4 @@ | |||
2078 | 70 | } | 68 | } |
2079 | 71 | } | 69 | } |
2080 | 72 | } | 70 | } |
2082 | 73 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_STUB_H_ | 71 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SESSION_STUB_H_ |
2083 | 74 | 72 | ||
2084 | === modified file 'include/location_service/com/ubuntu/location/service/skeleton.h' | |||
2085 | --- include/location_service/com/ubuntu/location/service/skeleton.h 2015-02-13 13:19:18 +0000 | |||
2086 | +++ include/location_service/com/ubuntu/location/service/skeleton.h 2015-04-23 17:23:49 +0000 | |||
2087 | @@ -38,9 +38,8 @@ | |||
2088 | 38 | { | 38 | { |
2089 | 39 | namespace service | 39 | namespace service |
2090 | 40 | { | 40 | { |
2094 | 41 | class Skeleton | 41 | class Skeleton : public core::dbus::Skeleton<com::ubuntu::location::service::Interface>, |
2095 | 42 | : public core::dbus::Skeleton<com::ubuntu::location::service::Interface>, | 42 | public std::enable_shared_from_this<Skeleton> |
2093 | 43 | public std::enable_shared_from_this<Skeleton> | ||
2096 | 44 | { | 43 | { |
2097 | 45 | public: | 44 | public: |
2098 | 46 | typedef std::shared_ptr<Skeleton> Ptr; | 45 | typedef std::shared_ptr<Skeleton> Ptr; |
2099 | @@ -123,10 +122,9 @@ | |||
2100 | 123 | 122 | ||
2101 | 124 | // Tries to register the given session under the given path in the session store. | 123 | // Tries to register the given session under the given path in the session store. |
2102 | 125 | // Returns true iff the session has been added to the store. | 124 | // Returns true iff the session has been added to the store. |
2107 | 126 | bool add_to_session_store_for_path( | 125 | bool add_to_session_store_for_path(const core::dbus::types::ObjectPath& path, |
2108 | 127 | const core::dbus::types::ObjectPath& path, | 126 | std::unique_ptr<core::dbus::ServiceWatcher> watcher, |
2109 | 128 | std::unique_ptr<core::dbus::ServiceWatcher> watcher, | 127 | const session::Interface::Ptr& session); |
2106 | 129 | const session::Interface::Ptr& session); | ||
2110 | 130 | 128 | ||
2111 | 131 | // Removes the session with the given path from the session store. | 129 | // Removes the session with the given path from the session store. |
2112 | 132 | void remove_from_session_store_for_path(const core::dbus::types::ObjectPath& path); | 130 | void remove_from_session_store_for_path(const core::dbus::types::ObjectPath& path); |
2113 | @@ -145,19 +143,19 @@ | |||
2114 | 145 | // The skeleton object representing com.ubuntu.location.service.Interface on the bus. | 143 | // The skeleton object representing com.ubuntu.location.service.Interface on the bus. |
2115 | 146 | core::dbus::Object::Ptr object; | 144 | core::dbus::Object::Ptr object; |
2116 | 147 | // We emit property changes manually. | 145 | // We emit property changes manually. |
2122 | 148 | core::dbus::Signal | 146 | core::dbus::Signal<core::dbus::interfaces::Properties::Signals::PropertiesChanged, |
2123 | 149 | < | 147 | core::dbus::interfaces::Properties::Signals::PropertiesChanged::ArgumentType>::Ptr |
2124 | 150 | core::dbus::interfaces::Properties::Signals::PropertiesChanged, | 148 | properties_changed; |
2120 | 151 | core::dbus::interfaces::Properties::Signals::PropertiesChanged::ArgumentType | ||
2121 | 152 | >::Ptr properties_changed; | ||
2125 | 153 | 149 | ||
2126 | 154 | // DBus properties as exposed on the bus for com.ubuntu.location.service.Interface | 150 | // DBus properties as exposed on the bus for com.ubuntu.location.service.Interface |
2127 | 155 | struct | 151 | struct |
2128 | 156 | { | 152 | { |
2133 | 157 | std::shared_ptr< core::dbus::Property<Interface::Properties::DoesSatelliteBasedPositioning> > does_satellite_based_positioning; | 153 | std::shared_ptr<core::dbus::Property<Interface::Properties::DoesSatelliteBasedPositioning>> |
2134 | 158 | std::shared_ptr< core::dbus::Property<Interface::Properties::DoesReportCellAndWifiIds> > does_report_cell_and_wifi_ids; | 154 | does_satellite_based_positioning; |
2135 | 159 | std::shared_ptr< core::dbus::Property<Interface::Properties::IsOnline> > is_online; | 155 | std::shared_ptr<core::dbus::Property<Interface::Properties::DoesReportCellAndWifiIds>> |
2136 | 160 | std::shared_ptr< core::dbus::Property<Interface::Properties::VisibleSpaceVehicles> > visible_space_vehicles; | 156 | does_report_cell_and_wifi_ids; |
2137 | 157 | std::shared_ptr<core::dbus::Property<Interface::Properties::IsOnline>> is_online; | ||
2138 | 158 | std::shared_ptr<core::dbus::Property<Interface::Properties::VisibleSpaceVehicles>> visible_space_vehicles; | ||
2139 | 161 | } properties; | 159 | } properties; |
2140 | 162 | // We sign up to property changes here, to be able to report them to the bus | 160 | // We sign up to property changes here, to be able to report them to the bus |
2141 | 163 | struct | 161 | struct |
2142 | @@ -181,4 +179,4 @@ | |||
2143 | 181 | } | 179 | } |
2144 | 182 | } | 180 | } |
2145 | 183 | } | 181 | } |
2147 | 184 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SKELETON_H_ | 182 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_SKELETON_H_ |
2148 | 185 | 183 | ||
2149 | === modified file 'include/location_service/com/ubuntu/location/service/stub.h' | |||
2150 | --- include/location_service/com/ubuntu/location/service/stub.h 2014-02-03 13:52:21 +0000 | |||
2151 | +++ include/location_service/com/ubuntu/location/service/stub.h 2015-04-23 17:23:49 +0000 | |||
2152 | @@ -33,7 +33,7 @@ | |||
2153 | 33 | { | 33 | { |
2154 | 34 | class Stub : public core::dbus::Stub<Interface> | 34 | class Stub : public core::dbus::Stub<Interface> |
2155 | 35 | { | 35 | { |
2157 | 36 | public: | 36 | public: |
2158 | 37 | Stub(const dbus::Bus::Ptr& connection); | 37 | Stub(const dbus::Bus::Ptr& connection); |
2159 | 38 | Stub(const Stub&) = delete; | 38 | Stub(const Stub&) = delete; |
2160 | 39 | Stub& operator=(const Stub&) = delete; | 39 | Stub& operator=(const Stub&) = delete; |
2161 | @@ -42,10 +42,10 @@ | |||
2162 | 42 | session::Interface::Ptr create_session_for_criteria(const Criteria& criteria); | 42 | session::Interface::Ptr create_session_for_criteria(const Criteria& criteria); |
2163 | 43 | core::Property<bool>& does_satellite_based_positioning(); | 43 | core::Property<bool>& does_satellite_based_positioning(); |
2164 | 44 | core::Property<bool>& does_report_cell_and_wifi_ids(); | 44 | core::Property<bool>& does_report_cell_and_wifi_ids(); |
2166 | 45 | core::Property<bool>& is_online(); | 45 | core::Property<bool>& is_online(); |
2167 | 46 | core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles(); | 46 | core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles(); |
2168 | 47 | 47 | ||
2170 | 48 | private: | 48 | private: |
2171 | 49 | struct Private; | 49 | struct Private; |
2172 | 50 | std::unique_ptr<Private> d; | 50 | std::unique_ptr<Private> d; |
2173 | 51 | }; | 51 | }; |
2174 | @@ -53,4 +53,4 @@ | |||
2175 | 53 | } | 53 | } |
2176 | 54 | } | 54 | } |
2177 | 55 | } | 55 | } |
2179 | 56 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_STUB_H_ | 56 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SERVICE_STUB_H_ |
2180 | 57 | 57 | ||
2181 | === modified file 'include/location_service/com/ubuntu/location/space_vehicle.h' | |||
2182 | --- include/location_service/com/ubuntu/location/space_vehicle.h 2014-05-20 07:26:03 +0000 | |||
2183 | +++ include/location_service/com/ubuntu/location/space_vehicle.h 2015-04-23 17:23:49 +0000 | |||
2184 | @@ -38,21 +38,23 @@ | |||
2185 | 38 | /** @brief Enumerates all known space-vehicle types. */ | 38 | /** @brief Enumerates all known space-vehicle types. */ |
2186 | 39 | enum class Type | 39 | enum class Type |
2187 | 40 | { | 40 | { |
2197 | 41 | unknown, ///< Unknown (and thus invalid) type. | 41 | unknown, ///< Unknown (and thus invalid) type. |
2198 | 42 | beidou, ///< People's Republic of China's regional system, currently limited to Asia and the West Pacific | 42 | beidou, ///< People's Republic of China's regional system, currently limited to Asia and the West Pacific |
2199 | 43 | 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). | 43 | galileo, ///< A global system being developed by the European Union and other partner countries, planned to be |
2200 | 44 | glonass, ///< Russia's global navigation system. Fully operational worldwide. | 44 | ///operational by 2014 (and fully deployed by 2019). |
2201 | 45 | gps, ///< Fully operational worldwide. | 45 | glonass, ///< Russia's global navigation system. Fully operational worldwide. |
2202 | 46 | compass, ///< People's Republic of China's global system, planned to be operational by 2020. | 46 | gps, ///< Fully operational worldwide. |
2203 | 47 | irnss, ///< India's regional navigation system, planned to be operational by 2014, covering India and Northern Indian Ocean. | 47 | compass, ///< People's Republic of China's global system, planned to be operational by 2020. |
2204 | 48 | qzss ///< Japanese regional system covering Asia and Oceania. | 48 | irnss, ///< India's regional navigation system, planned to be operational by 2014, covering India and Northern |
2205 | 49 | }; | 49 | ///Indian Ocean. |
2206 | 50 | qzss ///< Japanese regional system covering Asia and Oceania. | ||
2207 | 51 | }; | ||
2208 | 50 | 52 | ||
2209 | 51 | /** @brief Uniquely identifies a space vehicle, given its type and its id. */ | 53 | /** @brief Uniquely identifies a space vehicle, given its type and its id. */ |
2210 | 52 | struct Key | 54 | struct Key |
2211 | 53 | { | 55 | { |
2214 | 54 | Type type = Type::unknown; ///< The positioning system this vehicle belongs to. | 56 | Type type = Type::unknown; ///< The positioning system this vehicle belongs to. |
2215 | 55 | Id id = 0; ///< Unique id of the space vehicle. | 57 | Id id = 0; ///< Unique id of the space vehicle. |
2216 | 56 | 58 | ||
2217 | 57 | inline bool operator==(const SpaceVehicle::Key& rhs) const | 59 | inline bool operator==(const SpaceVehicle::Key& rhs) const |
2218 | 58 | { | 60 | { |
2219 | @@ -62,7 +64,9 @@ | |||
2220 | 62 | inline bool operator<(const SpaceVehicle::Key& rhs) const | 64 | inline bool operator<(const SpaceVehicle::Key& rhs) const |
2221 | 63 | { | 65 | { |
2222 | 64 | if (type != rhs.type) | 66 | if (type != rhs.type) |
2223 | 67 | { | ||
2224 | 65 | return type < rhs.type; | 68 | return type < rhs.type; |
2225 | 69 | } | ||
2226 | 66 | 70 | ||
2227 | 67 | return id < rhs.id; | 71 | return id < rhs.id; |
2228 | 68 | } | 72 | } |
2229 | @@ -70,12 +74,9 @@ | |||
2230 | 70 | 74 | ||
2231 | 71 | inline bool operator==(const SpaceVehicle& rhs) const | 75 | inline bool operator==(const SpaceVehicle& rhs) const |
2232 | 72 | { | 76 | { |
2239 | 73 | return key == rhs.key && | 77 | return key == rhs.key && has_almanac_data == rhs.has_almanac_data && |
2240 | 74 | has_almanac_data == rhs.has_almanac_data && | 78 | has_ephimeris_data == rhs.has_ephimeris_data && used_in_fix == rhs.used_in_fix && |
2241 | 75 | has_ephimeris_data == rhs.has_ephimeris_data && | 79 | units::roughly_equals(azimuth, rhs.azimuth) && units::roughly_equals(elevation, rhs.elevation); |
2236 | 76 | used_in_fix == rhs.used_in_fix && | ||
2237 | 77 | units::roughly_equals(azimuth, rhs.azimuth) && | ||
2238 | 78 | units::roughly_equals(elevation, rhs.elevation); | ||
2242 | 79 | } | 80 | } |
2243 | 80 | 81 | ||
2244 | 81 | inline bool operator<(const SpaceVehicle& rhs) const | 82 | inline bool operator<(const SpaceVehicle& rhs) const |
2245 | @@ -83,28 +84,25 @@ | |||
2246 | 83 | return key < rhs.key; | 84 | return key < rhs.key; |
2247 | 84 | } | 85 | } |
2248 | 85 | 86 | ||
2256 | 86 | Key key; ///< Unique key identifying an instance. | 87 | Key key; ///< Unique key identifying an instance. |
2257 | 87 | float snr = -std::numeric_limits<float>::max(); ///< Signal to noise ratio; | 88 | float snr = -std::numeric_limits<float>::max(); ///< Signal to noise ratio; |
2258 | 88 | bool has_almanac_data = false; ///< Almanac data available for this vehicle. | 89 | bool has_almanac_data = false; ///< Almanac data available for this vehicle. |
2259 | 89 | bool has_ephimeris_data = false; ///< Ephimeris data is available for this vehicle. | 90 | bool has_ephimeris_data = false; ///< Ephimeris data is available for this vehicle. |
2260 | 90 | bool used_in_fix = false; ///< This vehicle has been used to obtain a fix. | 91 | bool used_in_fix = false; ///< This vehicle has been used to obtain a fix. |
2261 | 91 | units::Quantity<units::PlaneAngle> azimuth; ///< Azimuth of SV. | 92 | units::Quantity<units::PlaneAngle> azimuth; ///< Azimuth of SV. |
2262 | 92 | units::Quantity<units::PlaneAngle> elevation; ///< Elevation of SV. | 93 | units::Quantity<units::PlaneAngle> elevation; ///< Elevation of SV. |
2263 | 93 | }; | 94 | }; |
2264 | 94 | 95 | ||
2265 | 95 | inline std::ostream& operator<<(std::ostream& out, const SpaceVehicle& sv) | 96 | inline std::ostream& operator<<(std::ostream& out, const SpaceVehicle& sv) |
2266 | 96 | { | 97 | { |
2278 | 97 | static const std::map<SpaceVehicle::Type, std::string> lut = | 98 | static const std::map<SpaceVehicle::Type, std::string> lut = {{SpaceVehicle::Type::unknown, "unknown"}, |
2279 | 98 | { | 99 | {SpaceVehicle::Type::beidou, "beidou"}, |
2280 | 99 | {SpaceVehicle::Type::unknown, "unknown"}, | 100 | {SpaceVehicle::Type::galileo, "galileo"}, |
2281 | 100 | {SpaceVehicle::Type::beidou, "beidou"}, | 101 | {SpaceVehicle::Type::glonass, "glonass"}, |
2282 | 101 | {SpaceVehicle::Type::galileo, "galileo"}, | 102 | {SpaceVehicle::Type::gps, "gps"}, |
2283 | 102 | {SpaceVehicle::Type::glonass, "glonass"}, | 103 | {SpaceVehicle::Type::compass, "compass"}, |
2284 | 103 | {SpaceVehicle::Type::gps, "gps"}, | 104 | {SpaceVehicle::Type::irnss, "irnss"}, |
2285 | 104 | {SpaceVehicle::Type::compass, "compass"}, | 105 | {SpaceVehicle::Type::qzss, "qzss"}}; |
2275 | 105 | {SpaceVehicle::Type::irnss, "irnss"}, | ||
2276 | 106 | {SpaceVehicle::Type::qzss, "qzss" } | ||
2277 | 107 | }; | ||
2286 | 108 | return out << "(" | 106 | return out << "(" |
2287 | 109 | << "type: " << lut.at(sv.key.type) << ", " | 107 | << "type: " << lut.at(sv.key.type) << ", " |
2288 | 110 | << "prn: " << sv.key.id << ", " | 108 | << "prn: " << sv.key.id << ", " |
2289 | @@ -113,11 +111,10 @@ | |||
2290 | 113 | << "has_ephimeris_data: " << sv.has_ephimeris_data << ", " | 111 | << "has_ephimeris_data: " << sv.has_ephimeris_data << ", " |
2291 | 114 | << "used_in_fix: " << sv.used_in_fix << ", " | 112 | << "used_in_fix: " << sv.used_in_fix << ", " |
2292 | 115 | << "azimuth: " << sv.azimuth << ", " | 113 | << "azimuth: " << sv.azimuth << ", " |
2295 | 116 | << "elevation: " << sv.elevation | 114 | << "elevation: " << sv.elevation << ")"; |
2294 | 117 | << ")"; | ||
2296 | 118 | } | 115 | } |
2297 | 119 | } | 116 | } |
2298 | 120 | } | 117 | } |
2299 | 121 | } | 118 | } |
2300 | 122 | 119 | ||
2302 | 123 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SPACE_VEHICLE_H_ | 120 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_SPACE_VEHICLE_H_ |
2303 | 124 | 121 | ||
2304 | === modified file 'include/location_service/com/ubuntu/location/units/units.h' | |||
2305 | --- include/location_service/com/ubuntu/location/units/units.h 2013-12-10 09:42:54 +0000 | |||
2306 | +++ include/location_service/com/ubuntu/location/units/units.h 2015-04-23 17:23:49 +0000 | |||
2307 | @@ -49,7 +49,7 @@ | |||
2308 | 49 | static const Velocity MeterPerSecond; | 49 | static const Velocity MeterPerSecond; |
2309 | 50 | static const Velocity MetersPerSecond; | 50 | static const Velocity MetersPerSecond; |
2310 | 51 | 51 | ||
2312 | 52 | template<typename Unit> | 52 | template <typename Unit> |
2313 | 53 | using Quantity = boost::units::quantity<Unit, double>; | 53 | using Quantity = boost::units::quantity<Unit, double>; |
2314 | 54 | 54 | ||
2315 | 55 | typedef boost::units::si::dimensionless Dimensionless; | 55 | typedef boost::units::si::dimensionless Dimensionless; |
2316 | @@ -58,15 +58,14 @@ | |||
2317 | 58 | using boost::units::cos; | 58 | using boost::units::cos; |
2318 | 59 | using boost::units::atan2; | 59 | using boost::units::atan2; |
2319 | 60 | 60 | ||
2321 | 61 | template<typename Unit> | 61 | template <typename Unit> |
2322 | 62 | inline bool roughly_equals(const Quantity<Unit>& lhs, const Quantity<Unit>& rhs) | 62 | inline bool roughly_equals(const Quantity<Unit>& lhs, const Quantity<Unit>& rhs) |
2323 | 63 | { | 63 | { |
2333 | 64 | return std::fabs(lhs.value()-rhs.value()) <= std::numeric_limits<double>::epsilon(); | 64 | return std::fabs(lhs.value() - rhs.value()) <= std::numeric_limits<double>::epsilon(); |
2334 | 65 | } | 65 | } |
2335 | 66 | } | 66 | } |
2336 | 67 | } | 67 | } |
2337 | 68 | } | 68 | } |
2338 | 69 | } | 69 | } |
2339 | 70 | 70 | ||
2340 | 71 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_UNITS_UNITS_H_ | 71 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_UNITS_UNITS_H_ |
2332 | 72 | |||
2341 | 73 | 72 | ||
2342 | === modified file 'include/location_service/com/ubuntu/location/update.h' | |||
2343 | --- include/location_service/com/ubuntu/location/update.h 2013-12-10 09:42:54 +0000 | |||
2344 | +++ include/location_service/com/ubuntu/location/update.h 2015-04-23 17:23:49 +0000 | |||
2345 | @@ -32,7 +32,7 @@ | |||
2346 | 32 | * @brief Templated class that wraps a value and timestamp. | 32 | * @brief Templated class that wraps a value and timestamp. |
2347 | 33 | * @tparam T The contained value. | 33 | * @tparam T The contained value. |
2348 | 34 | */ | 34 | */ |
2350 | 35 | template<typename T> | 35 | template <typename T> |
2351 | 36 | struct Update | 36 | struct Update |
2352 | 37 | { | 37 | { |
2353 | 38 | /** | 38 | /** |
2354 | @@ -40,9 +40,9 @@ | |||
2355 | 40 | * @param [in] value The value delivered with this update. | 40 | * @param [in] value The value delivered with this update. |
2356 | 41 | * @param [in] when The timestamp when the value was measured. | 41 | * @param [in] when The timestamp when the value was measured. |
2357 | 42 | */ | 42 | */ |
2361 | 43 | inline Update(const T& value = T{}, | 43 | inline Update(const T& value = T{}, const Clock::Timestamp& when = Clock::now()) |
2362 | 44 | const Clock::Timestamp& when = Clock::now()) | 44 | : value{value} |
2363 | 45 | : value{value}, when{when} | 45 | , when{when} |
2364 | 46 | { | 46 | { |
2365 | 47 | } | 47 | } |
2366 | 48 | 48 | ||
2367 | @@ -78,15 +78,14 @@ | |||
2368 | 78 | * @param out The stream to write to. | 78 | * @param out The stream to write to. |
2369 | 79 | * @param update The value to be printed. | 79 | * @param update The value to be printed. |
2370 | 80 | */ | 80 | */ |
2372 | 81 | template<typename T> | 81 | template <typename T> |
2373 | 82 | inline std::ostream& operator<<(std::ostream& out, const Update<T>& update) | 82 | inline std::ostream& operator<<(std::ostream& out, const Update<T>& update) |
2374 | 83 | { | 83 | { |
2375 | 84 | out << "Update(" << update.value << ", " << update.when.time_since_epoch().count() << ")"; | 84 | out << "Update(" << update.value << ", " << update.when.time_since_epoch().count() << ")"; |
2376 | 85 | return out; | 85 | return out; |
2377 | 86 | } | 86 | } |
2384 | 87 | 87 | } | |
2385 | 88 | } | 88 | } |
2386 | 89 | } | 89 | } |
2387 | 90 | } | 90 | |
2388 | 91 | 91 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_UPDATE_H_ | |
2383 | 92 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_UPDATE_H_ | ||
2389 | 93 | 92 | ||
2390 | === modified file 'include/location_service/com/ubuntu/location/velocity.h' | |||
2391 | --- include/location_service/com/ubuntu/location/velocity.h 2014-06-20 07:40:34 +0000 | |||
2392 | +++ include/location_service/com/ubuntu/location/velocity.h 2015-04-23 17:23:49 +0000 | |||
2393 | @@ -32,4 +32,4 @@ | |||
2394 | 32 | } | 32 | } |
2395 | 33 | } | 33 | } |
2396 | 34 | 34 | ||
2398 | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_VELOCITY_H_ | 35 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_VELOCITY_H_ |
2399 | 36 | 36 | ||
2400 | === modified file 'include/location_service/com/ubuntu/location/wgs84/altitude.h' | |||
2401 | --- include/location_service/com/ubuntu/location/wgs84/altitude.h 2013-12-10 09:42:54 +0000 | |||
2402 | +++ include/location_service/com/ubuntu/location/wgs84/altitude.h 2015-04-23 17:23:49 +0000 | |||
2403 | @@ -35,13 +35,15 @@ | |||
2404 | 35 | } | 35 | } |
2405 | 36 | typedef Coordinate<tag::Altitude, units::Length> Altitude; | 36 | typedef Coordinate<tag::Altitude, units::Length> Altitude; |
2406 | 37 | 37 | ||
2408 | 38 | template<> | 38 | template <> |
2409 | 39 | struct CoordinateTraits<Altitude> | 39 | struct CoordinateTraits<Altitude> |
2410 | 40 | { | 40 | { |
2412 | 41 | static void check_and_throw_if_invalid(const typename Altitude::Quantity&) {} | 41 | static void check_and_throw_if_invalid(const typename Altitude::Quantity&) |
2413 | 42 | { | ||
2414 | 43 | } | ||
2415 | 42 | }; | 44 | }; |
2416 | 43 | } | 45 | } |
2417 | 44 | } | 46 | } |
2418 | 45 | } | 47 | } |
2419 | 46 | } | 48 | } |
2421 | 47 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_ALTITUDE_H_ | 49 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_ALTITUDE_H_ |
2422 | 48 | 50 | ||
2423 | === modified file 'include/location_service/com/ubuntu/location/wgs84/coordinate.h' | |||
2424 | --- include/location_service/com/ubuntu/location/wgs84/coordinate.h 2013-12-12 14:36:32 +0000 | |||
2425 | +++ include/location_service/com/ubuntu/location/wgs84/coordinate.h 2015-04-23 17:23:49 +0000 | |||
2426 | @@ -30,7 +30,7 @@ | |||
2427 | 30 | { | 30 | { |
2428 | 31 | namespace wgs84 | 31 | namespace wgs84 |
2429 | 32 | { | 32 | { |
2431 | 33 | template<typename Coordinate> | 33 | template <typename Coordinate> |
2432 | 34 | struct CoordinateTraits | 34 | struct CoordinateTraits |
2433 | 35 | { | 35 | { |
2434 | 36 | static void check_and_throw_if_invalid(const typename Coordinate::Quantity& coordinate) | 36 | static void check_and_throw_if_invalid(const typename Coordinate::Quantity& coordinate) |
2435 | @@ -38,7 +38,7 @@ | |||
2436 | 38 | } | 38 | } |
2437 | 39 | }; | 39 | }; |
2438 | 40 | 40 | ||
2440 | 41 | template<typename Tag, typename UnitType> | 41 | template <typename Tag, typename UnitType> |
2441 | 42 | class Coordinate | 42 | class Coordinate |
2442 | 43 | { | 43 | { |
2443 | 44 | public: | 44 | public: |
2444 | @@ -48,15 +48,15 @@ | |||
2445 | 48 | explicit Coordinate(const Quantity& value = Quantity()) | 48 | explicit Coordinate(const Quantity& value = Quantity()) |
2446 | 49 | : value(value) | 49 | : value(value) |
2447 | 50 | { | 50 | { |
2449 | 51 | CoordinateTraits<Coordinate<Tag,UnitType>>::check_and_throw_if_invalid(value); | 51 | CoordinateTraits<Coordinate<Tag, UnitType>>::check_and_throw_if_invalid(value); |
2450 | 52 | } | 52 | } |
2451 | 53 | 53 | ||
2453 | 54 | bool operator==(const Coordinate<Tag,UnitType>& rhs) const | 54 | bool operator==(const Coordinate<Tag, UnitType>& rhs) const |
2454 | 55 | { | 55 | { |
2455 | 56 | return value == rhs.value; | 56 | return value == rhs.value; |
2456 | 57 | } | 57 | } |
2457 | 58 | 58 | ||
2459 | 59 | bool operator!=(const Coordinate<Tag,UnitType>& rhs) const | 59 | bool operator!=(const Coordinate<Tag, UnitType>& rhs) const |
2460 | 60 | { | 60 | { |
2461 | 61 | return value != rhs.value; | 61 | return value != rhs.value; |
2462 | 62 | } | 62 | } |
2463 | @@ -64,14 +64,14 @@ | |||
2464 | 64 | Quantity value; | 64 | Quantity value; |
2465 | 65 | }; | 65 | }; |
2466 | 66 | 66 | ||
2469 | 67 | template<typename T, typename U> | 67 | template <typename T, typename U> |
2470 | 68 | Coordinate<T,U> operator-(const Coordinate<T,U>& lhs, const Coordinate<T,U>& rhs) | 68 | Coordinate<T, U> operator-(const Coordinate<T, U>& lhs, const Coordinate<T, U>& rhs) |
2471 | 69 | { | 69 | { |
2473 | 70 | return Coordinate<T,U> {rhs.value - lhs.value}; | 70 | return Coordinate<T, U>{rhs.value - lhs.value}; |
2474 | 71 | } | 71 | } |
2475 | 72 | 72 | ||
2478 | 73 | template<typename T, typename U> | 73 | template <typename T, typename U> |
2479 | 74 | std::ostream& operator<<(std::ostream& out, const Coordinate<T,U>& coord) | 74 | std::ostream& operator<<(std::ostream& out, const Coordinate<T, U>& coord) |
2480 | 75 | { | 75 | { |
2481 | 76 | out << "Coordinate(" << coord.value << ")"; | 76 | out << "Coordinate(" << coord.value << ")"; |
2482 | 77 | return out; | 77 | return out; |
2483 | @@ -80,4 +80,4 @@ | |||
2484 | 80 | } | 80 | } |
2485 | 81 | } | 81 | } |
2486 | 82 | } | 82 | } |
2488 | 83 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_COORDINATE_H_ | 83 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_COORDINATE_H_ |
2489 | 84 | 84 | ||
2490 | === modified file 'include/location_service/com/ubuntu/location/wgs84/latitude.h' | |||
2491 | --- include/location_service/com/ubuntu/location/wgs84/latitude.h 2013-12-10 09:42:54 +0000 | |||
2492 | +++ include/location_service/com/ubuntu/location/wgs84/latitude.h 2015-04-23 17:23:49 +0000 | |||
2493 | @@ -37,7 +37,7 @@ | |||
2494 | 37 | } | 37 | } |
2495 | 38 | typedef Coordinate<tag::Latitude, units::PlaneAngle> Latitude; | 38 | typedef Coordinate<tag::Latitude, units::PlaneAngle> Latitude; |
2496 | 39 | 39 | ||
2498 | 40 | template<> | 40 | template <> |
2499 | 41 | struct CoordinateTraits<Latitude> | 41 | struct CoordinateTraits<Latitude> |
2500 | 42 | { | 42 | { |
2501 | 43 | static double min() | 43 | static double min() |
2502 | @@ -52,13 +52,17 @@ | |||
2503 | 52 | static void check_and_throw_if_invalid(const typename Latitude::Quantity& coordinate) | 52 | static void check_and_throw_if_invalid(const typename Latitude::Quantity& coordinate) |
2504 | 53 | { | 53 | { |
2505 | 54 | if (coordinate.value() < min()) | 54 | if (coordinate.value() < min()) |
2506 | 55 | { | ||
2507 | 55 | throw std::out_of_range(u8"Latitude(coordinate.value() < min())"); | 56 | throw std::out_of_range(u8"Latitude(coordinate.value() < min())"); |
2508 | 57 | } | ||
2509 | 56 | if (coordinate.value() > max()) | 58 | if (coordinate.value() > max()) |
2510 | 59 | { | ||
2511 | 57 | throw std::out_of_range(u8"Latitude(coordinate.value() > max())"); | 60 | throw std::out_of_range(u8"Latitude(coordinate.value() > max())"); |
2512 | 61 | } | ||
2513 | 58 | } | 62 | } |
2514 | 59 | }; | 63 | }; |
2515 | 60 | } | 64 | } |
2516 | 61 | } | 65 | } |
2517 | 62 | } | 66 | } |
2518 | 63 | } | 67 | } |
2520 | 64 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_ | 68 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_ |
2521 | 65 | 69 | ||
2522 | === modified file 'include/location_service/com/ubuntu/location/wgs84/longitude.h' | |||
2523 | --- include/location_service/com/ubuntu/location/wgs84/longitude.h 2013-12-10 09:42:54 +0000 | |||
2524 | +++ include/location_service/com/ubuntu/location/wgs84/longitude.h 2015-04-23 17:23:49 +0000 | |||
2525 | @@ -37,7 +37,7 @@ | |||
2526 | 37 | } | 37 | } |
2527 | 38 | typedef Coordinate<tag::Longitude, units::PlaneAngle> Longitude; | 38 | typedef Coordinate<tag::Longitude, units::PlaneAngle> Longitude; |
2528 | 39 | 39 | ||
2530 | 40 | template<> | 40 | template <> |
2531 | 41 | struct CoordinateTraits<Longitude> | 41 | struct CoordinateTraits<Longitude> |
2532 | 42 | { | 42 | { |
2533 | 43 | static double min() | 43 | static double min() |
2534 | @@ -52,13 +52,17 @@ | |||
2535 | 52 | static void check_and_throw_if_invalid(const typename Longitude::Quantity& coordinate) | 52 | static void check_and_throw_if_invalid(const typename Longitude::Quantity& coordinate) |
2536 | 53 | { | 53 | { |
2537 | 54 | if (coordinate.value() < min()) | 54 | if (coordinate.value() < min()) |
2538 | 55 | { | ||
2539 | 55 | throw std::out_of_range(u8"Longitude(coordinate.value() < min())"); | 56 | throw std::out_of_range(u8"Longitude(coordinate.value() < min())"); |
2540 | 57 | } | ||
2541 | 56 | if (coordinate.value() > max()) | 58 | if (coordinate.value() > max()) |
2542 | 59 | { | ||
2543 | 57 | throw std::out_of_range(u8"Longitude(coordinate.value() > max())"); | 60 | throw std::out_of_range(u8"Longitude(coordinate.value() > max())"); |
2544 | 61 | } | ||
2545 | 58 | } | 62 | } |
2546 | 59 | }; | 63 | }; |
2547 | 60 | } | 64 | } |
2548 | 61 | } | 65 | } |
2549 | 62 | } | 66 | } |
2550 | 63 | } | 67 | } |
2552 | 64 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_ | 68 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_ |
2553 | 65 | 69 | ||
2554 | === modified file 'include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h' | |||
2555 | --- include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h 2014-11-14 11:26:45 +0000 | |||
2556 | +++ include/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.h 2015-04-23 17:23:49 +0000 | |||
2557 | @@ -28,8 +28,8 @@ | |||
2558 | 28 | { | 28 | { |
2559 | 29 | enum class WifiAndCellIdReportingState | 29 | enum class WifiAndCellIdReportingState |
2560 | 30 | { | 30 | { |
2563 | 31 | on, ///< Wifi and Cell Ids might be reported to online location services. | 31 | on, ///< Wifi and Cell Ids might be reported to online location services. |
2564 | 32 | off ///< Wifi and Cell Ids are _not_ reported. This is the default value. | 32 | off ///< Wifi and Cell Ids are _not_ reported. This is the default value. |
2565 | 33 | }; | 33 | }; |
2566 | 34 | 34 | ||
2567 | 35 | /** @brief Pretty prints the given state to the given stream. */ | 35 | /** @brief Pretty prints the given state to the given stream. */ |
2568 | @@ -40,4 +40,4 @@ | |||
2569 | 40 | } | 40 | } |
2570 | 41 | } | 41 | } |
2571 | 42 | 42 | ||
2573 | 43 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WIFI_AND_CELL_REPORTING_STATE_H_ | 43 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WIFI_AND_CELL_REPORTING_STATE_H_ |
2574 | 44 | 44 | ||
2575 | === modified file 'src/location_service/com/ubuntu/location/boost_ptree_settings.cpp' | |||
2576 | --- src/location_service/com/ubuntu/location/boost_ptree_settings.cpp 2015-01-14 13:41:54 +0000 | |||
2577 | +++ src/location_service/com/ubuntu/location/boost_ptree_settings.cpp 2015-04-23 17:23:49 +0000 | |||
2578 | @@ -25,7 +25,8 @@ | |||
2579 | 25 | namespace location = com::ubuntu::location; | 25 | namespace location = com::ubuntu::location; |
2580 | 26 | 26 | ||
2581 | 27 | // Creates a new instance, reading values from the given filename. | 27 | // Creates a new instance, reading values from the given filename. |
2583 | 28 | location::BoostPtreeSettings::BoostPtreeSettings(const std::string& fn) : fn{fn} | 28 | location::BoostPtreeSettings::BoostPtreeSettings(const std::string& fn) |
2584 | 29 | : fn{fn} | ||
2585 | 29 | { | 30 | { |
2586 | 30 | try | 31 | try |
2587 | 31 | { | 32 | { |
2588 | @@ -52,7 +53,7 @@ | |||
2589 | 52 | 53 | ||
2590 | 53 | // Returns true iff a value is known for the given key. | 54 | // Returns true iff a value is known for the given key. |
2591 | 54 | bool location::BoostPtreeSettings::has_value_for_key(const std::string& key) const | 55 | bool location::BoostPtreeSettings::has_value_for_key(const std::string& key) const |
2593 | 55 | { | 56 | { |
2594 | 56 | return tree.count(key) > 0; | 57 | return tree.count(key) > 0; |
2595 | 57 | } | 58 | } |
2596 | 58 | 59 | ||
2597 | 59 | 60 | ||
2598 | === modified file 'src/location_service/com/ubuntu/location/boost_ptree_settings.h' | |||
2599 | --- src/location_service/com/ubuntu/location/boost_ptree_settings.h 2014-11-14 19:24:45 +0000 | |||
2600 | +++ src/location_service/com/ubuntu/location/boost_ptree_settings.h 2015-04-23 17:23:49 +0000 | |||
2601 | @@ -59,4 +59,4 @@ | |||
2602 | 59 | } | 59 | } |
2603 | 60 | } | 60 | } |
2604 | 61 | 61 | ||
2606 | 62 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_BOOST_PTREE_SETTINGS_H_ | 62 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_BOOST_PTREE_SETTINGS_H_ |
2607 | 63 | 63 | ||
2608 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp' | |||
2609 | --- src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp 2014-11-10 12:31:47 +0000 | |||
2610 | +++ src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp 2015-04-23 17:23:49 +0000 | |||
2611 | @@ -24,15 +24,14 @@ | |||
2612 | 24 | { | 24 | { |
2613 | 25 | // We use this for debugging purposes. | 25 | // We use this for debugging purposes. |
2614 | 26 | const bool also_apply_cell_change_heuristics_to_gsm_cells = | 26 | const bool also_apply_cell_change_heuristics_to_gsm_cells = |
2618 | 27 | core::posix::this_process::env::get( | 27 | core::posix::this_process::env::get("COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_FOR_GSM_TOO", "false") == "true"; |
2616 | 28 | "COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_FOR_GSM_TOO", | ||
2617 | 29 | "false") == "true"; | ||
2619 | 30 | 28 | ||
2620 | 31 | std::int64_t timeout_in_seconds() | 29 | std::int64_t timeout_in_seconds() |
2621 | 32 | { | 30 | { |
2622 | 33 | auto value = core::posix::this_process::env::get("COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_TIMEOUT", "60"); | 31 | auto value = core::posix::this_process::env::get("COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_TIMEOUT", "60"); |
2623 | 34 | std::stringstream ss(value); | 32 | std::stringstream ss(value); |
2625 | 35 | std::uint64_t result; ss >> result; | 33 | std::uint64_t result; |
2626 | 34 | ss >> result; | ||
2627 | 36 | 35 | ||
2628 | 37 | return result; | 36 | return result; |
2629 | 38 | } | 37 | } |
2630 | @@ -50,65 +49,56 @@ | |||
2631 | 50 | 49 | ||
2632 | 51 | const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type>& detail::CachedRadioCell::type_lut() | 50 | const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type>& detail::CachedRadioCell::type_lut() |
2633 | 52 | { | 51 | { |
2658 | 53 | static const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type> lut | 52 | static const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type> lut{ |
2659 | 54 | { | 53 | {org::Ofono::Manager::Modem::NetworkRegistration::Technology::gsm(), |
2660 | 55 | { | 54 | com::ubuntu::location::connectivity::RadioCell::Type::gsm}, |
2661 | 56 | org::Ofono::Manager::Modem::NetworkRegistration::Technology::gsm(), | 55 | {org::Ofono::Manager::Modem::NetworkRegistration::Technology::lte(), |
2662 | 57 | com::ubuntu::location::connectivity::RadioCell::Type::gsm | 56 | com::ubuntu::location::connectivity::RadioCell::Type::lte}, |
2663 | 58 | }, | 57 | {org::Ofono::Manager::Modem::NetworkRegistration::Technology::umts(), |
2664 | 59 | { | 58 | com::ubuntu::location::connectivity::RadioCell::Type::umts}, |
2665 | 60 | org::Ofono::Manager::Modem::NetworkRegistration::Technology::lte(), | 59 | {org::Ofono::Manager::Modem::NetworkRegistration::Technology::edge(), |
2666 | 61 | com::ubuntu::location::connectivity::RadioCell::Type::lte | 60 | com::ubuntu::location::connectivity::RadioCell::Type::gsm}, |
2667 | 62 | }, | 61 | {org::Ofono::Manager::Modem::NetworkRegistration::Technology::hspa(), |
2668 | 63 | { | 62 | com::ubuntu::location::connectivity::RadioCell::Type::umts}, |
2669 | 64 | org::Ofono::Manager::Modem::NetworkRegistration::Technology::umts(), | 63 | {std::string(), com::ubuntu::location::connectivity::RadioCell::Type::unknown}}; |
2646 | 65 | com::ubuntu::location::connectivity::RadioCell::Type::umts | ||
2647 | 66 | }, | ||
2648 | 67 | { | ||
2649 | 68 | org::Ofono::Manager::Modem::NetworkRegistration::Technology::edge(), | ||
2650 | 69 | com::ubuntu::location::connectivity::RadioCell::Type::gsm | ||
2651 | 70 | }, | ||
2652 | 71 | { | ||
2653 | 72 | org::Ofono::Manager::Modem::NetworkRegistration::Technology::hspa(), | ||
2654 | 73 | com::ubuntu::location::connectivity::RadioCell::Type::umts | ||
2655 | 74 | }, | ||
2656 | 75 | {std::string(), com::ubuntu::location::connectivity::RadioCell::Type::unknown} | ||
2657 | 76 | }; | ||
2670 | 77 | 64 | ||
2671 | 78 | return lut; | 65 | return lut; |
2672 | 79 | } | 66 | } |
2673 | 80 | 67 | ||
2681 | 81 | detail::CachedRadioCell::CellChangeHeuristics::CellChangeHeuristics( | 68 | detail::CachedRadioCell::CellChangeHeuristics::CellChangeHeuristics(boost::asio::io_service& io_service, bool needed) |
2682 | 82 | boost::asio::io_service& io_service, | 69 | : needed(needed) |
2683 | 83 | bool needed) | 70 | , io_service(io_service) |
2684 | 84 | : needed(needed), | 71 | , invalidation_timer(io_service) |
2685 | 85 | io_service(io_service), | 72 | , valid(true) |
2679 | 86 | invalidation_timer(io_service), | ||
2680 | 87 | valid(true) | ||
2686 | 88 | { | 73 | { |
2687 | 89 | } | 74 | } |
2688 | 90 | 75 | ||
2689 | 91 | detail::CachedRadioCell::CachedRadioCell(const org::Ofono::Manager::Modem& modem, boost::asio::io_service& io_service) | 76 | detail::CachedRadioCell::CachedRadioCell(const org::Ofono::Manager::Modem& modem, boost::asio::io_service& io_service) |
2696 | 92 | : RadioCell(), | 77 | : RadioCell() |
2697 | 93 | cell_change_heuristics(io_service, is_running_on_problematic_modem_firmware(modem)), | 78 | , cell_change_heuristics(io_service, is_running_on_problematic_modem_firmware(modem)) |
2698 | 94 | roaming(false), | 79 | , roaming(false) |
2699 | 95 | radio_type(Type::gsm), | 80 | , radio_type(Type::gsm) |
2700 | 96 | modem(modem), | 81 | , modem(modem) |
2701 | 97 | detail{} | 82 | , detail{} |
2702 | 98 | { | 83 | { |
2703 | 99 | auto status = query_status(); | 84 | auto status = query_status(); |
2704 | 100 | radio_type = query_technology(); | 85 | radio_type = query_technology(); |
2705 | 101 | 86 | ||
2710 | 102 | connections.network_registration_properties_changed = modem.network_registration.signals.property_changed->connect([this](const std::tuple<std::string, core::dbus::types::Variant>& tuple) | 87 | connections.network_registration_properties_changed = modem.network_registration.signals.property_changed->connect( |
2711 | 103 | { | 88 | [this](const std::tuple<std::string, core::dbus::types::Variant>& tuple) |
2712 | 104 | on_network_registration_property_changed(tuple); | 89 | { |
2713 | 105 | }); | 90 | on_network_registration_property_changed(tuple); |
2714 | 91 | }); | ||
2715 | 106 | 92 | ||
2716 | 107 | if (not is_registered_or_roaming(status)) | 93 | if (not is_registered_or_roaming(status)) |
2717 | 94 | { | ||
2718 | 108 | return; | 95 | return; |
2719 | 96 | } | ||
2720 | 109 | 97 | ||
2721 | 110 | if (radio_type == com::ubuntu::location::connectivity::RadioCell::Type::unknown) | 98 | if (radio_type == com::ubuntu::location::connectivity::RadioCell::Type::unknown) |
2722 | 99 | { | ||
2723 | 111 | return; | 100 | return; |
2724 | 101 | } | ||
2725 | 112 | 102 | ||
2726 | 113 | auto lac = query_lac(); | 103 | auto lac = query_lac(); |
2727 | 114 | auto mcc = query_mcc(); | 104 | auto mcc = query_mcc(); |
2728 | @@ -116,53 +106,47 @@ | |||
2729 | 116 | auto cell_id = query_cid(); | 106 | auto cell_id = query_cid(); |
2730 | 117 | auto strength = query_strength(); | 107 | auto strength = query_strength(); |
2731 | 118 | 108 | ||
2779 | 119 | switch(radio_type) | 109 | switch (radio_type) |
2780 | 120 | { | 110 | { |
2781 | 121 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 111 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
2782 | 122 | { | 112 | { |
2783 | 123 | com::ubuntu::location::connectivity::RadioCell::Gsm gsm | 113 | com::ubuntu::location::connectivity::RadioCell::Gsm gsm{ |
2784 | 124 | { | 114 | com::ubuntu::location::connectivity::RadioCell::Gsm::MCC{mcc}, |
2785 | 125 | com::ubuntu::location::connectivity::RadioCell::Gsm::MCC{mcc}, | 115 | com::ubuntu::location::connectivity::RadioCell::Gsm::MNC{mnc}, |
2786 | 126 | com::ubuntu::location::connectivity::RadioCell::Gsm::MNC{mnc}, | 116 | com::ubuntu::location::connectivity::RadioCell::Gsm::LAC{lac}, |
2787 | 127 | com::ubuntu::location::connectivity::RadioCell::Gsm::LAC{lac}, | 117 | com::ubuntu::location::connectivity::RadioCell::Gsm::ID{cell_id}, |
2788 | 128 | com::ubuntu::location::connectivity::RadioCell::Gsm::ID{cell_id}, | 118 | com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(strength / 100.f)}; |
2789 | 129 | com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(strength/100.f) | 119 | VLOG(1) << gsm; |
2790 | 130 | }; | 120 | detail.gsm = gsm; |
2791 | 131 | VLOG(1) << gsm; | 121 | break; |
2792 | 132 | detail.gsm = gsm; | 122 | } |
2793 | 133 | break; | 123 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
2794 | 134 | } | 124 | { |
2795 | 135 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 125 | com::ubuntu::location::connectivity::RadioCell::Lte lte{ |
2796 | 136 | { | 126 | com::ubuntu::location::connectivity::RadioCell::Lte::MCC{mcc}, |
2797 | 137 | com::ubuntu::location::connectivity::RadioCell::Lte lte | 127 | com::ubuntu::location::connectivity::RadioCell::Lte::MNC{mnc}, |
2798 | 138 | { | 128 | com::ubuntu::location::connectivity::RadioCell::Lte::TAC{lac}, |
2799 | 139 | com::ubuntu::location::connectivity::RadioCell::Lte::MCC{mcc}, | 129 | com::ubuntu::location::connectivity::RadioCell::Lte::ID{cell_id}, |
2800 | 140 | com::ubuntu::location::connectivity::RadioCell::Lte::MNC{mnc}, | 130 | com::ubuntu::location::connectivity::RadioCell::Lte::PID{}, |
2801 | 141 | com::ubuntu::location::connectivity::RadioCell::Lte::TAC{lac}, | 131 | com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(strength / 100.f)}; |
2802 | 142 | com::ubuntu::location::connectivity::RadioCell::Lte::ID{cell_id}, | 132 | VLOG(1) << lte; |
2803 | 143 | com::ubuntu::location::connectivity::RadioCell::Lte::PID{}, | 133 | detail.lte = lte; |
2804 | 144 | com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(strength/100.f) | 134 | break; |
2805 | 145 | }; | 135 | } |
2806 | 146 | VLOG(1) << lte; | 136 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
2807 | 147 | detail.lte = lte; | 137 | { |
2808 | 148 | break; | 138 | com::ubuntu::location::connectivity::RadioCell::Umts umts{ |
2809 | 149 | } | 139 | com::ubuntu::location::connectivity::RadioCell::Umts::MCC{mcc}, |
2810 | 150 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 140 | com::ubuntu::location::connectivity::RadioCell::Umts::MNC{mnc}, |
2811 | 151 | { | 141 | com::ubuntu::location::connectivity::RadioCell::Umts::LAC{lac}, |
2812 | 152 | com::ubuntu::location::connectivity::RadioCell::Umts umts | 142 | com::ubuntu::location::connectivity::RadioCell::Umts::ID{cell_id}, |
2813 | 153 | { | 143 | com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(strength / 100.f)}; |
2814 | 154 | com::ubuntu::location::connectivity::RadioCell::Umts::MCC{mcc}, | 144 | VLOG(1) << umts; |
2815 | 155 | com::ubuntu::location::connectivity::RadioCell::Umts::MNC{mnc}, | 145 | detail.umts = umts; |
2816 | 156 | com::ubuntu::location::connectivity::RadioCell::Umts::LAC{lac}, | 146 | break; |
2817 | 157 | com::ubuntu::location::connectivity::RadioCell::Umts::ID{cell_id}, | 147 | } |
2818 | 158 | com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(strength/100.f) | 148 | default: |
2819 | 159 | }; | 149 | break; |
2773 | 160 | VLOG(1) << umts; | ||
2774 | 161 | detail.umts = umts; | ||
2775 | 162 | break; | ||
2776 | 163 | } | ||
2777 | 164 | default: | ||
2778 | 165 | break; | ||
2820 | 166 | } | 150 | } |
2821 | 167 | 151 | ||
2822 | 168 | roaming = status == org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::roaming; | 152 | roaming = status == org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::roaming; |
2823 | @@ -172,7 +156,8 @@ | |||
2824 | 172 | 156 | ||
2825 | 173 | detail::CachedRadioCell::~CachedRadioCell() | 157 | detail::CachedRadioCell::~CachedRadioCell() |
2826 | 174 | { | 158 | { |
2828 | 175 | modem.network_registration.signals.property_changed->disconnect(connections.network_registration_properties_changed); | 159 | modem.network_registration.signals.property_changed->disconnect( |
2829 | 160 | connections.network_registration_properties_changed); | ||
2830 | 176 | } | 161 | } |
2831 | 177 | 162 | ||
2832 | 178 | const core::Property<bool>& detail::CachedRadioCell::is_roaming() const | 163 | const core::Property<bool>& detail::CachedRadioCell::is_roaming() const |
2833 | @@ -198,7 +183,9 @@ | |||
2834 | 198 | const com::ubuntu::location::connectivity::RadioCell::Gsm& detail::CachedRadioCell::gsm() const | 183 | const com::ubuntu::location::connectivity::RadioCell::Gsm& detail::CachedRadioCell::gsm() const |
2835 | 199 | { | 184 | { |
2836 | 200 | if (radio_type != com::ubuntu::location::connectivity::RadioCell::Type::gsm) | 185 | if (radio_type != com::ubuntu::location::connectivity::RadioCell::Type::gsm) |
2837 | 186 | { | ||
2838 | 201 | throw std::runtime_error("Bad access to unset network type."); | 187 | throw std::runtime_error("Bad access to unset network type."); |
2839 | 188 | } | ||
2840 | 202 | 189 | ||
2841 | 203 | return detail.gsm; | 190 | return detail.gsm; |
2842 | 204 | } | 191 | } |
2843 | @@ -206,7 +193,9 @@ | |||
2844 | 206 | const com::ubuntu::location::connectivity::RadioCell::Umts& detail::CachedRadioCell::umts() const | 193 | const com::ubuntu::location::connectivity::RadioCell::Umts& detail::CachedRadioCell::umts() const |
2845 | 207 | { | 194 | { |
2846 | 208 | if (radio_type != RadioCell::Type::umts) | 195 | if (radio_type != RadioCell::Type::umts) |
2847 | 196 | { | ||
2848 | 209 | throw std::runtime_error("Bad access to unset network type."); | 197 | throw std::runtime_error("Bad access to unset network type."); |
2849 | 198 | } | ||
2850 | 210 | 199 | ||
2851 | 211 | return detail.umts; | 200 | return detail.umts; |
2852 | 212 | } | 201 | } |
2853 | @@ -214,14 +203,18 @@ | |||
2854 | 214 | const com::ubuntu::location::connectivity::RadioCell::Lte& detail::CachedRadioCell::lte() const | 203 | const com::ubuntu::location::connectivity::RadioCell::Lte& detail::CachedRadioCell::lte() const |
2855 | 215 | { | 204 | { |
2856 | 216 | if (radio_type != RadioCell::Type::lte) | 205 | if (radio_type != RadioCell::Type::lte) |
2857 | 206 | { | ||
2858 | 217 | throw std::runtime_error("Bad access to unset network type."); | 207 | throw std::runtime_error("Bad access to unset network type."); |
2859 | 208 | } | ||
2860 | 218 | 209 | ||
2861 | 219 | return detail.lte; | 210 | return detail.lte; |
2862 | 220 | } | 211 | } |
2863 | 221 | 212 | ||
2865 | 222 | void detail::CachedRadioCell::on_network_registration_property_changed(const std::tuple<std::string, core::dbus::types::Variant>& tuple) | 213 | void detail::CachedRadioCell::on_network_registration_property_changed( |
2866 | 214 | const std::tuple<std::string, core::dbus::types::Variant>& tuple) | ||
2867 | 223 | { | 215 | { |
2869 | 224 | VLOG(10) << "Property changed on modem " << modem.object->path() << " for network registration: " << std::get<0>(tuple); | 216 | VLOG(10) << "Property changed on modem " << modem.object->path() |
2870 | 217 | << " for network registration: " << std::get<0>(tuple); | ||
2871 | 225 | 218 | ||
2872 | 226 | const auto& key = std::get<0>(tuple); | 219 | const auto& key = std::get<0>(tuple); |
2873 | 227 | const auto& variant = std::get<1>(tuple); | 220 | const auto& variant = std::get<1>(tuple); |
2874 | @@ -232,9 +225,7 @@ | |||
2875 | 232 | { | 225 | { |
2876 | 233 | did_cell_identity_change = true; | 226 | did_cell_identity_change = true; |
2877 | 234 | 227 | ||
2881 | 235 | auto value = variant.as< | 228 | auto value = variant.as<org::Ofono::Manager::Modem::NetworkRegistration::Technology::ValueType>(); |
2879 | 236 | org::Ofono::Manager::Modem::NetworkRegistration::Technology::ValueType | ||
2880 | 237 | >(); | ||
2882 | 238 | 229 | ||
2883 | 239 | auto it = type_lut().find(value); | 230 | auto it = type_lut().find(value); |
2884 | 240 | 231 | ||
2885 | @@ -251,251 +242,254 @@ | |||
2886 | 251 | } | 242 | } |
2887 | 252 | 243 | ||
2888 | 253 | if (radio_type == it->second) | 244 | if (radio_type == it->second) |
2889 | 245 | { | ||
2890 | 254 | return; | 246 | return; |
2891 | 247 | } | ||
2892 | 255 | 248 | ||
2894 | 256 | switch(radio_type) | 249 | switch (radio_type) |
2895 | 257 | { | 250 | { |
2962 | 258 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 251 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
2963 | 259 | switch(it->second) | 252 | switch (it->second) |
2964 | 260 | { | 253 | { |
2965 | 261 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 254 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
2966 | 262 | detail.umts.location_area_code = detail.gsm.location_area_code; | 255 | detail.umts.location_area_code = detail.gsm.location_area_code; |
2967 | 263 | detail.umts.mobile_network_code = detail.gsm.mobile_network_code; | 256 | detail.umts.mobile_network_code = detail.gsm.mobile_network_code; |
2968 | 264 | detail.umts.mobile_country_code = detail.gsm.mobile_country_code; | 257 | detail.umts.mobile_country_code = detail.gsm.mobile_country_code; |
2969 | 265 | detail.umts.strength.reset(); | 258 | detail.umts.strength.reset(); |
2970 | 266 | detail.umts.id.reset(); | 259 | detail.umts.id.reset(); |
2971 | 267 | break; | 260 | break; |
2972 | 268 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 261 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
2973 | 269 | detail.lte.tracking_area_code = detail.gsm.location_area_code; | 262 | detail.lte.tracking_area_code = detail.gsm.location_area_code; |
2974 | 270 | detail.lte.mobile_network_code = detail.gsm.mobile_network_code; | 263 | detail.lte.mobile_network_code = detail.gsm.mobile_network_code; |
2975 | 271 | detail.lte.mobile_country_code = detail.gsm.mobile_country_code; | 264 | detail.lte.mobile_country_code = detail.gsm.mobile_country_code; |
2976 | 272 | detail.lte.strength.reset(); | 265 | detail.lte.strength.reset(); |
2977 | 273 | detail.lte.id.reset(); | 266 | detail.lte.id.reset(); |
2978 | 274 | break; | 267 | break; |
2979 | 275 | default: | 268 | default: |
2980 | 276 | break; | 269 | break; |
2981 | 277 | } | 270 | } |
2982 | 278 | break; | 271 | break; |
2983 | 279 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 272 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
2984 | 280 | switch(it->second) | 273 | switch (it->second) |
2985 | 281 | { | 274 | { |
2986 | 282 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 275 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
2987 | 283 | detail.gsm.location_area_code = detail.umts.location_area_code; | 276 | detail.gsm.location_area_code = detail.umts.location_area_code; |
2988 | 284 | detail.gsm.mobile_network_code = detail.umts.mobile_network_code; | 277 | detail.gsm.mobile_network_code = detail.umts.mobile_network_code; |
2989 | 285 | detail.gsm.mobile_country_code = detail.umts.mobile_country_code; | 278 | detail.gsm.mobile_country_code = detail.umts.mobile_country_code; |
2990 | 286 | detail.gsm.strength.reset(); | 279 | detail.gsm.strength.reset(); |
2991 | 287 | detail.gsm.id.reset(); | 280 | detail.gsm.id.reset(); |
2992 | 288 | break; | 281 | break; |
2993 | 289 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 282 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
2994 | 290 | detail.lte.tracking_area_code = detail.umts.location_area_code; | 283 | detail.lte.tracking_area_code = detail.umts.location_area_code; |
2995 | 291 | detail.lte.mobile_network_code = detail.umts.mobile_network_code; | 284 | detail.lte.mobile_network_code = detail.umts.mobile_network_code; |
2996 | 292 | detail.lte.mobile_country_code = detail.umts.mobile_country_code; | 285 | detail.lte.mobile_country_code = detail.umts.mobile_country_code; |
2997 | 293 | detail.lte.strength.reset(); | 286 | detail.lte.strength.reset(); |
2998 | 294 | detail.lte.id.reset(); | 287 | detail.lte.id.reset(); |
2999 | 295 | break; | 288 | break; |
3000 | 296 | default: | 289 | default: |
3001 | 297 | break; | 290 | break; |
3002 | 298 | } | 291 | } |
3003 | 299 | break; | 292 | break; |
3004 | 300 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 293 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3005 | 301 | switch(it->second) | 294 | switch (it->second) |
3006 | 302 | { | 295 | { |
3007 | 303 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 296 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3008 | 304 | detail.gsm.location_area_code = detail.lte.tracking_area_code; | 297 | detail.gsm.location_area_code = detail.lte.tracking_area_code; |
3009 | 305 | detail.gsm.mobile_network_code = detail.lte.mobile_network_code; | 298 | detail.gsm.mobile_network_code = detail.lte.mobile_network_code; |
3010 | 306 | detail.gsm.mobile_country_code = detail.lte.mobile_country_code; | 299 | detail.gsm.mobile_country_code = detail.lte.mobile_country_code; |
3011 | 307 | detail.gsm.strength.reset(); | 300 | detail.gsm.strength.reset(); |
3012 | 308 | detail.gsm.id.reset(); | 301 | detail.gsm.id.reset(); |
3013 | 309 | break; | 302 | break; |
3014 | 310 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 303 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3015 | 311 | detail.umts.location_area_code = detail.lte.tracking_area_code; | 304 | detail.umts.location_area_code = detail.lte.tracking_area_code; |
3016 | 312 | detail.umts.mobile_network_code = detail.lte.mobile_network_code; | 305 | detail.umts.mobile_network_code = detail.lte.mobile_network_code; |
3017 | 313 | detail.umts.mobile_country_code = detail.lte.mobile_country_code; | 306 | detail.umts.mobile_country_code = detail.lte.mobile_country_code; |
3018 | 314 | detail.umts.strength.reset(); | 307 | detail.umts.strength.reset(); |
3019 | 315 | detail.umts.id.reset(); | 308 | detail.umts.id.reset(); |
3020 | 316 | break; | 309 | break; |
3021 | 317 | default: | 310 | default: |
3022 | 318 | break; | 311 | break; |
3023 | 319 | } | 312 | } |
3024 | 320 | default: | 313 | default: |
3025 | 321 | // We take the default path here, specifically for cases where | 314 | // We take the default path here, specifically for cases where |
3026 | 322 | // we started out with Technology::unknown. | 315 | // we started out with Technology::unknown. |
3027 | 323 | break; | 316 | break; |
3028 | 324 | }; | 317 | }; |
3029 | 325 | 318 | ||
3030 | 326 | radio_type = it->second; | 319 | radio_type = it->second; |
3031 | 327 | 320 | ||
3032 | 328 | if (cell_change_heuristics.valid.get()) | 321 | if (cell_change_heuristics.valid.get()) |
3033 | 322 | { | ||
3034 | 329 | on_changed(); | 323 | on_changed(); |
3035 | 324 | } | ||
3036 | 330 | } | 325 | } |
3037 | 331 | 326 | ||
3038 | 332 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::CellId::name()) | 327 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::CellId::name()) |
3039 | 333 | { | 328 | { |
3040 | 334 | did_cell_identity_change = true; | 329 | did_cell_identity_change = true; |
3041 | 335 | 330 | ||
3045 | 336 | auto value = variant.as< | 331 | auto value = variant.as<org::Ofono::Manager::Modem::NetworkRegistration::CellId::ValueType>(); |
3043 | 337 | org::Ofono::Manager::Modem::NetworkRegistration::CellId::ValueType | ||
3044 | 338 | >(); | ||
3046 | 339 | 332 | ||
3048 | 340 | switch(radio_type) | 333 | switch (radio_type) |
3049 | 341 | { | 334 | { |
3064 | 342 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 335 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3065 | 343 | detail.gsm.id.set(value); | 336 | detail.gsm.id.set(value); |
3066 | 344 | VLOG(1) << detail.gsm; | 337 | VLOG(1) << detail.gsm; |
3067 | 345 | break; | 338 | break; |
3068 | 346 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 339 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3069 | 347 | detail.umts.id.set(value); | 340 | detail.umts.id.set(value); |
3070 | 348 | VLOG(1) << detail.umts; | 341 | VLOG(1) << detail.umts; |
3071 | 349 | break; | 342 | break; |
3072 | 350 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 343 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3073 | 351 | detail.lte.id.set(value); | 344 | detail.lte.id.set(value); |
3074 | 352 | VLOG(1) << detail.lte; | 345 | VLOG(1) << detail.lte; |
3075 | 353 | break; | 346 | break; |
3076 | 354 | default: | 347 | default: |
3077 | 355 | break; | 348 | break; |
3078 | 356 | }; | 349 | }; |
3079 | 357 | 350 | ||
3080 | 358 | if (cell_change_heuristics.valid.get()) | 351 | if (cell_change_heuristics.valid.get()) |
3081 | 352 | { | ||
3082 | 359 | on_changed(); | 353 | on_changed(); |
3083 | 354 | } | ||
3084 | 360 | } | 355 | } |
3085 | 361 | 356 | ||
3086 | 362 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode::name()) | 357 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode::name()) |
3087 | 363 | { | 358 | { |
3088 | 364 | did_cell_identity_change = true; | 359 | did_cell_identity_change = true; |
3089 | 365 | 360 | ||
3094 | 366 | auto value = variant.as< | 361 | auto value = variant.as<org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode::ValueType>(); |
3095 | 367 | org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode::ValueType | 362 | switch (radio_type) |
3092 | 368 | >(); | ||
3093 | 369 | switch(radio_type) | ||
3096 | 370 | { | 363 | { |
3111 | 371 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 364 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3112 | 372 | detail.gsm.location_area_code.set(value); | 365 | detail.gsm.location_area_code.set(value); |
3113 | 373 | VLOG(1) << detail.gsm; | 366 | VLOG(1) << detail.gsm; |
3114 | 374 | break; | 367 | break; |
3115 | 375 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 368 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3116 | 376 | detail.umts.location_area_code.set(value); | 369 | detail.umts.location_area_code.set(value); |
3117 | 377 | VLOG(1) << detail.umts; | 370 | VLOG(1) << detail.umts; |
3118 | 378 | break; | 371 | break; |
3119 | 379 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 372 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3120 | 380 | detail.lte.tracking_area_code.set(value); | 373 | detail.lte.tracking_area_code.set(value); |
3121 | 381 | VLOG(1) << detail.lte; | 374 | VLOG(1) << detail.lte; |
3122 | 382 | break; | 375 | break; |
3123 | 383 | default: | 376 | default: |
3124 | 384 | break; | 377 | break; |
3125 | 385 | }; | 378 | }; |
3126 | 386 | 379 | ||
3127 | 387 | if (cell_change_heuristics.valid.get()) | 380 | if (cell_change_heuristics.valid.get()) |
3128 | 381 | { | ||
3129 | 388 | on_changed(); | 382 | on_changed(); |
3130 | 383 | } | ||
3131 | 389 | } | 384 | } |
3132 | 390 | 385 | ||
3133 | 391 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode::name()) | 386 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode::name()) |
3134 | 392 | { | 387 | { |
3135 | 393 | did_cell_identity_change = true; | 388 | did_cell_identity_change = true; |
3136 | 394 | 389 | ||
3144 | 395 | std::stringstream ss | 390 | std::stringstream ss{ |
3145 | 396 | { | 391 | variant.as<org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode::ValueType>()}; |
3146 | 397 | variant.as< | 392 | int value{-1}; |
3147 | 398 | org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode::ValueType | 393 | ss >> value; |
3141 | 399 | >() | ||
3142 | 400 | }; | ||
3143 | 401 | int value{-1}; ss >> value; | ||
3148 | 402 | 394 | ||
3150 | 403 | switch(radio_type) | 395 | switch (radio_type) |
3151 | 404 | { | 396 | { |
3166 | 405 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 397 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3167 | 406 | detail.gsm.mobile_country_code.set(value); | 398 | detail.gsm.mobile_country_code.set(value); |
3168 | 407 | VLOG(1) << detail.gsm; | 399 | VLOG(1) << detail.gsm; |
3169 | 408 | break; | 400 | break; |
3170 | 409 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 401 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3171 | 410 | detail.umts.mobile_country_code.set(value); | 402 | detail.umts.mobile_country_code.set(value); |
3172 | 411 | VLOG(1) << detail.umts; | 403 | VLOG(1) << detail.umts; |
3173 | 412 | break; | 404 | break; |
3174 | 413 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 405 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3175 | 414 | detail.lte.mobile_country_code.set(value); | 406 | detail.lte.mobile_country_code.set(value); |
3176 | 415 | VLOG(1) << detail.lte; | 407 | VLOG(1) << detail.lte; |
3177 | 416 | break; | 408 | break; |
3178 | 417 | default: | 409 | default: |
3179 | 418 | break; | 410 | break; |
3180 | 419 | }; | 411 | }; |
3181 | 420 | 412 | ||
3182 | 421 | if (cell_change_heuristics.valid.get()) | 413 | if (cell_change_heuristics.valid.get()) |
3183 | 414 | { | ||
3184 | 422 | on_changed(); | 415 | on_changed(); |
3185 | 416 | } | ||
3186 | 423 | } | 417 | } |
3187 | 424 | 418 | ||
3188 | 425 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode::name()) | 419 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode::name()) |
3189 | 426 | { | 420 | { |
3190 | 427 | did_cell_identity_change = true; | 421 | did_cell_identity_change = true; |
3191 | 428 | 422 | ||
3199 | 429 | std::stringstream ss | 423 | std::stringstream ss{ |
3200 | 430 | { | 424 | variant.as<org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode::ValueType>()}; |
3201 | 431 | variant.as< | 425 | int value{-1}; |
3202 | 432 | org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode::ValueType | 426 | ss >> value; |
3196 | 433 | >() | ||
3197 | 434 | }; | ||
3198 | 435 | int value{-1}; ss >> value; | ||
3203 | 436 | 427 | ||
3205 | 437 | switch(radio_type) | 428 | switch (radio_type) |
3206 | 438 | { | 429 | { |
3221 | 439 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 430 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3222 | 440 | detail.gsm.mobile_network_code.set(value); | 431 | detail.gsm.mobile_network_code.set(value); |
3223 | 441 | VLOG(1) << detail.gsm; | 432 | VLOG(1) << detail.gsm; |
3224 | 442 | break; | 433 | break; |
3225 | 443 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 434 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3226 | 444 | detail.umts.mobile_network_code.set(value); | 435 | detail.umts.mobile_network_code.set(value); |
3227 | 445 | VLOG(1) << detail.umts; | 436 | VLOG(1) << detail.umts; |
3228 | 446 | break; | 437 | break; |
3229 | 447 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 438 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3230 | 448 | detail.lte.mobile_network_code.set(value); | 439 | detail.lte.mobile_network_code.set(value); |
3231 | 449 | VLOG(1) << detail.lte; | 440 | VLOG(1) << detail.lte; |
3232 | 450 | break; | 441 | break; |
3233 | 451 | default: | 442 | default: |
3234 | 452 | break; | 443 | break; |
3235 | 453 | }; | 444 | }; |
3236 | 454 | 445 | ||
3237 | 455 | if (cell_change_heuristics.valid.get()) | 446 | if (cell_change_heuristics.valid.get()) |
3238 | 447 | { | ||
3239 | 456 | on_changed(); | 448 | on_changed(); |
3240 | 449 | } | ||
3241 | 457 | } | 450 | } |
3242 | 458 | 451 | ||
3243 | 459 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::Strength::name()) | 452 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::Strength::name()) |
3244 | 460 | { | 453 | { |
3248 | 461 | auto value = variant.as< | 454 | auto value = variant.as<org::Ofono::Manager::Modem::NetworkRegistration::Strength::ValueType>(); |
3246 | 462 | org::Ofono::Manager::Modem::NetworkRegistration::Strength::ValueType | ||
3247 | 463 | >(); | ||
3249 | 464 | 455 | ||
3251 | 465 | switch(radio_type) | 456 | switch (radio_type) |
3252 | 466 | { | 457 | { |
3270 | 467 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 458 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3271 | 468 | detail.gsm.strength | 459 | detail.gsm.strength = |
3272 | 469 | = com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(value/100.f); | 460 | com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(value / 100.f); |
3273 | 470 | VLOG(1) << detail.gsm; | 461 | VLOG(1) << detail.gsm; |
3274 | 471 | break; | 462 | break; |
3275 | 472 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 463 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3276 | 473 | detail.umts.strength | 464 | detail.umts.strength = |
3277 | 474 | = com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(value/100.f); | 465 | com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(value / 100.f); |
3278 | 475 | VLOG(1) << detail.umts; | 466 | VLOG(1) << detail.umts; |
3279 | 476 | break; | 467 | break; |
3280 | 477 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 468 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3281 | 478 | detail.lte.strength | 469 | detail.lte.strength = |
3282 | 479 | = com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(value/100.f); | 470 | com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(value / 100.f); |
3283 | 480 | VLOG(1) << detail.lte; | 471 | VLOG(1) << detail.lte; |
3284 | 481 | break; | 472 | break; |
3285 | 482 | default: | 473 | default: |
3286 | 483 | break; | 474 | break; |
3287 | 484 | }; | 475 | }; |
3288 | 485 | 476 | ||
3289 | 486 | if (cell_change_heuristics.valid.get()) | 477 | if (cell_change_heuristics.valid.get()) |
3290 | 478 | { | ||
3291 | 487 | on_changed(); | 479 | on_changed(); |
3292 | 480 | } | ||
3293 | 488 | } | 481 | } |
3294 | 489 | 482 | ||
3295 | 490 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::Status::name()) | 483 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::Status::name()) |
3296 | 491 | { | 484 | { |
3300 | 492 | roaming = | 485 | roaming = variant.as<org::Ofono::Manager::Modem::NetworkRegistration::Status::ValueType>() == |
3301 | 493 | variant.as<org::Ofono::Manager::Modem::NetworkRegistration::Status::ValueType>() == | 486 | org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming; |
3299 | 494 | org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming; | ||
3302 | 495 | } | 487 | } |
3303 | 496 | 488 | ||
3304 | 497 | if (did_cell_identity_change) | 489 | if (did_cell_identity_change) |
3305 | 490 | { | ||
3306 | 498 | execute_cell_change_heuristics_if_appropriate(); | 491 | execute_cell_change_heuristics_if_appropriate(); |
3307 | 492 | } | ||
3308 | 499 | } | 493 | } |
3309 | 500 | 494 | ||
3310 | 501 | void detail::CachedRadioCell::execute_cell_change_heuristics_if_appropriate() | 495 | void detail::CachedRadioCell::execute_cell_change_heuristics_if_appropriate() |
3311 | @@ -504,9 +498,9 @@ | |||
3312 | 504 | // whenever the cell identity changes, we start a timer and invalidate the | 498 | // whenever the cell identity changes, we start a timer and invalidate the |
3313 | 505 | // cell to account for situations where the underlying modem firmware does not | 499 | // cell to account for situations where the underlying modem firmware does not |
3314 | 506 | // report cell changes when on a 3G data connection. | 500 | // report cell changes when on a 3G data connection. |
3316 | 507 | if (cell_change_heuristics.needed && // Only carry out this step if it is actually required | 501 | if (cell_change_heuristics.needed && // Only carry out this step if it is actually required |
3317 | 508 | (radio_type == com::ubuntu::location::connectivity::RadioCell::Type::umts || | 502 | (radio_type == com::ubuntu::location::connectivity::RadioCell::Type::umts || |
3319 | 509 | also_apply_cell_change_heuristics_to_gsm_cells)) // and if it's a 3G cell. | 503 | also_apply_cell_change_heuristics_to_gsm_cells)) // and if it's a 3G cell. |
3320 | 510 | { | 504 | { |
3321 | 511 | static const boost::posix_time::seconds timeout{timeout_in_seconds()}; | 505 | static const boost::posix_time::seconds timeout{timeout_in_seconds()}; |
3322 | 512 | 506 | ||
3323 | @@ -514,10 +508,12 @@ | |||
3324 | 514 | 508 | ||
3325 | 515 | cell_change_heuristics.invalidation_timer.expires_from_now(timeout); | 509 | cell_change_heuristics.invalidation_timer.expires_from_now(timeout); |
3326 | 516 | cell_change_heuristics.invalidation_timer.async_wait([this](boost::system::error_code ec) | 510 | cell_change_heuristics.invalidation_timer.async_wait([this](boost::system::error_code ec) |
3331 | 517 | { | 511 | { |
3332 | 518 | if (not ec) | 512 | if (not ec) |
3333 | 519 | cell_change_heuristics.valid = false; | 513 | { |
3334 | 520 | }); | 514 | cell_change_heuristics.valid = false; |
3335 | 515 | } | ||
3336 | 516 | }); | ||
3337 | 521 | 517 | ||
3338 | 522 | cell_change_heuristics.valid = is_cell_details_valid(); | 518 | cell_change_heuristics.valid = is_cell_details_valid(); |
3339 | 523 | } | 519 | } |
3340 | @@ -526,32 +522,42 @@ | |||
3341 | 526 | // Queries the status from the Ofono NetworkRegistration. | 522 | // Queries the status from the Ofono NetworkRegistration. |
3342 | 527 | org::Ofono::Manager::Modem::NetworkRegistration::Status::Value detail::CachedRadioCell::query_status() | 523 | org::Ofono::Manager::Modem::NetworkRegistration::Status::Value detail::CachedRadioCell::query_status() |
3343 | 528 | { | 524 | { |
3349 | 529 | auto status = | 525 | auto status = modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Status>(); |
3345 | 530 | modem.network_registration.get | ||
3346 | 531 | < | ||
3347 | 532 | org::Ofono::Manager::Modem::NetworkRegistration::Status | ||
3348 | 533 | >(); | ||
3350 | 534 | 526 | ||
3351 | 535 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unregistered) | 527 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unregistered) |
3352 | 528 | { | ||
3353 | 536 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unregistered; | 529 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unregistered; |
3354 | 530 | } | ||
3355 | 537 | 531 | ||
3356 | 538 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::registered) | 532 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::registered) |
3357 | 533 | { | ||
3358 | 539 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::registered; | 534 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::registered; |
3359 | 535 | } | ||
3360 | 540 | 536 | ||
3361 | 541 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::searching) | 537 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::searching) |
3362 | 538 | { | ||
3363 | 542 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::searching; | 539 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::searching; |
3364 | 540 | } | ||
3365 | 543 | 541 | ||
3366 | 544 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::denied) | 542 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::denied) |
3367 | 543 | { | ||
3368 | 545 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::denied; | 544 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::denied; |
3369 | 545 | } | ||
3370 | 546 | 546 | ||
3371 | 547 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unknown) | 547 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unknown) |
3372 | 548 | { | ||
3373 | 548 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unknown; | 549 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unknown; |
3374 | 550 | } | ||
3375 | 549 | 551 | ||
3376 | 550 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unregistered) | 552 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unregistered) |
3377 | 553 | { | ||
3378 | 551 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unregistered; | 554 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unregistered; |
3379 | 555 | } | ||
3380 | 552 | 556 | ||
3381 | 553 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming) | 557 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming) |
3382 | 558 | { | ||
3383 | 554 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::roaming; | 559 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::roaming; |
3384 | 560 | } | ||
3385 | 555 | 561 | ||
3386 | 556 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unknown; | 562 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unknown; |
3387 | 557 | } | 563 | } |
3388 | @@ -559,15 +565,14 @@ | |||
3389 | 559 | // Queries the technology from the Ofono NetworkRegistration. | 565 | // Queries the technology from the Ofono NetworkRegistration. |
3390 | 560 | com::ubuntu::location::connectivity::RadioCell::Type detail::CachedRadioCell::query_technology() | 566 | com::ubuntu::location::connectivity::RadioCell::Type detail::CachedRadioCell::query_technology() |
3391 | 561 | { | 567 | { |
3396 | 562 | auto technology = | 568 | auto technology = modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Technology>(); |
3393 | 563 | modem.network_registration.get< | ||
3394 | 564 | org::Ofono::Manager::Modem::NetworkRegistration::Technology | ||
3395 | 565 | >(); | ||
3397 | 566 | 569 | ||
3398 | 567 | auto it = type_lut().find(technology); | 570 | auto it = type_lut().find(technology); |
3399 | 568 | 571 | ||
3400 | 569 | if (it == type_lut().end()) | 572 | if (it == type_lut().end()) |
3401 | 573 | { | ||
3402 | 570 | return com::ubuntu::location::connectivity::RadioCell::Type::unknown; | 574 | return com::ubuntu::location::connectivity::RadioCell::Type::unknown; |
3403 | 575 | } | ||
3404 | 571 | 576 | ||
3405 | 572 | return it->second; | 577 | return it->second; |
3406 | 573 | } | 578 | } |
3407 | @@ -575,60 +580,44 @@ | |||
3408 | 575 | // Queries the cell id from the Ofono NetworkRegistration. | 580 | // Queries the cell id from the Ofono NetworkRegistration. |
3409 | 576 | int detail::CachedRadioCell::query_cid() | 581 | int detail::CachedRadioCell::query_cid() |
3410 | 577 | { | 582 | { |
3415 | 578 | return modem.network_registration.get | 583 | return modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::CellId>(); |
3412 | 579 | < | ||
3413 | 580 | org::Ofono::Manager::Modem::NetworkRegistration::CellId | ||
3414 | 581 | >(); | ||
3416 | 582 | } | 584 | } |
3417 | 583 | 585 | ||
3418 | 584 | // Queries the location area code from the Ofono NetworkRegistration. | 586 | // Queries the location area code from the Ofono NetworkRegistration. |
3419 | 585 | std::uint16_t detail::CachedRadioCell::query_lac() | 587 | std::uint16_t detail::CachedRadioCell::query_lac() |
3420 | 586 | { | 588 | { |
3425 | 587 | return modem.network_registration.get | 589 | return modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode>(); |
3422 | 588 | < | ||
3423 | 589 | org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode | ||
3424 | 590 | >(); | ||
3426 | 591 | } | 590 | } |
3427 | 592 | 591 | ||
3428 | 593 | // Queries the mobile network code from the Ofono NetworkRegistration. | 592 | // Queries the mobile network code from the Ofono NetworkRegistration. |
3429 | 594 | int detail::CachedRadioCell::query_mnc() | 593 | int detail::CachedRadioCell::query_mnc() |
3430 | 595 | { | 594 | { |
3439 | 596 | std::stringstream ssmnc | 595 | std::stringstream ssmnc{ |
3440 | 597 | { | 596 | modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode>()}; |
3441 | 598 | modem.network_registration.get | 597 | int mnc{0}; |
3442 | 599 | < | 598 | ssmnc >> mnc; |
3435 | 600 | org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode | ||
3436 | 601 | >() | ||
3437 | 602 | }; | ||
3438 | 603 | int mnc{0}; ssmnc >> mnc; | ||
3443 | 604 | return mnc; | 599 | return mnc; |
3444 | 605 | } | 600 | } |
3445 | 606 | 601 | ||
3446 | 607 | // Queries the mobile country code from the Ofono NetworkRegistration. | 602 | // Queries the mobile country code from the Ofono NetworkRegistration. |
3447 | 608 | int detail::CachedRadioCell::query_mcc() | 603 | int detail::CachedRadioCell::query_mcc() |
3448 | 609 | { | 604 | { |
3457 | 610 | std::stringstream ssmcc | 605 | std::stringstream ssmcc{ |
3458 | 611 | { | 606 | modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode>()}; |
3459 | 612 | modem.network_registration.get | 607 | int mcc{0}; |
3460 | 613 | < | 608 | ssmcc >> mcc; |
3453 | 614 | org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode | ||
3454 | 615 | >() | ||
3455 | 616 | }; | ||
3456 | 617 | int mcc{0}; ssmcc >> mcc; | ||
3461 | 618 | return mcc; | 609 | return mcc; |
3462 | 619 | } | 610 | } |
3463 | 620 | 611 | ||
3464 | 621 | // Queries the signal strength from the Ofono NetworkRegistration. | 612 | // Queries the signal strength from the Ofono NetworkRegistration. |
3465 | 622 | std::int8_t detail::CachedRadioCell::query_strength() | 613 | std::int8_t detail::CachedRadioCell::query_strength() |
3466 | 623 | { | 614 | { |
3471 | 624 | return modem.network_registration.get | 615 | return modem.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Strength>(); |
3468 | 625 | < | ||
3469 | 626 | org::Ofono::Manager::Modem::NetworkRegistration::Strength | ||
3470 | 627 | >(); | ||
3472 | 628 | } | 616 | } |
3473 | 629 | 617 | ||
3474 | 630 | // Returns true iff status is either roaming or registered. | 618 | // Returns true iff status is either roaming or registered. |
3476 | 631 | bool detail::CachedRadioCell::is_registered_or_roaming(org::Ofono::Manager::Modem::NetworkRegistration::Status::Value status) | 619 | bool detail::CachedRadioCell::is_registered_or_roaming( |
3477 | 620 | org::Ofono::Manager::Modem::NetworkRegistration::Status::Value status) | ||
3478 | 632 | { | 621 | { |
3479 | 633 | return status == org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::registered || | 622 | return status == org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::registered || |
3480 | 634 | status == org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::roaming; | 623 | status == org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::roaming; |
3481 | @@ -637,16 +626,16 @@ | |||
3482 | 637 | // Returns true iff all the parts of the cell are populated with valid values. | 626 | // Returns true iff all the parts of the cell are populated with valid values. |
3483 | 638 | bool detail::CachedRadioCell::is_cell_details_valid() | 627 | bool detail::CachedRadioCell::is_cell_details_valid() |
3484 | 639 | { | 628 | { |
3486 | 640 | switch(radio_type) | 629 | switch (radio_type) |
3487 | 641 | { | 630 | { |
3496 | 642 | case com::ubuntu::location::connectivity::RadioCell::Type::unknown: | 631 | case com::ubuntu::location::connectivity::RadioCell::Type::unknown: |
3497 | 643 | return false; | 632 | return false; |
3498 | 644 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: | 633 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
3499 | 645 | return is_gsm_valid(); | 634 | return is_gsm_valid(); |
3500 | 646 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: | 635 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
3501 | 647 | return is_umts_valid(); | 636 | return is_umts_valid(); |
3502 | 648 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: | 637 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
3503 | 649 | return is_lte_valid(); | 638 | return is_lte_valid(); |
3504 | 650 | } | 639 | } |
3505 | 651 | 640 | ||
3506 | 652 | return false; | 641 | return false; |
3507 | @@ -655,46 +644,41 @@ | |||
3508 | 655 | // Retuns true iff the GSM cell details are valid. | 644 | // Retuns true iff the GSM cell details are valid. |
3509 | 656 | bool detail::CachedRadioCell::is_gsm_valid() | 645 | bool detail::CachedRadioCell::is_gsm_valid() |
3510 | 657 | { | 646 | { |
3516 | 658 | return gsm().mobile_country_code.is_valid() && | 647 | return gsm().mobile_country_code.is_valid() && gsm().mobile_network_code.is_valid() && |
3517 | 659 | gsm().mobile_network_code.is_valid() && | 648 | gsm().location_area_code.is_valid() && gsm().id.is_valid() && gsm().strength.is_valid(); |
3513 | 660 | gsm().location_area_code.is_valid() && | ||
3514 | 661 | gsm().id.is_valid() && | ||
3515 | 662 | gsm().strength.is_valid(); | ||
3518 | 663 | } | 649 | } |
3519 | 664 | 650 | ||
3520 | 665 | // Returns true iff the Umts cell details are valid. | 651 | // Returns true iff the Umts cell details are valid. |
3521 | 666 | bool detail::CachedRadioCell::is_umts_valid() | 652 | bool detail::CachedRadioCell::is_umts_valid() |
3522 | 667 | { | 653 | { |
3528 | 668 | return umts().mobile_country_code.is_valid() && | 654 | return umts().mobile_country_code.is_valid() && umts().mobile_network_code.is_valid() && |
3529 | 669 | umts().mobile_network_code.is_valid() && | 655 | umts().location_area_code.is_valid() && umts().id.is_valid() && umts().strength.is_valid(); |
3525 | 670 | umts().location_area_code.is_valid() && | ||
3526 | 671 | umts().id.is_valid() && | ||
3527 | 672 | umts().strength.is_valid(); | ||
3530 | 673 | } | 656 | } |
3531 | 674 | 657 | ||
3532 | 675 | // Returns true iff the Lte cell details are valid. | 658 | // Returns true iff the Lte cell details are valid. |
3533 | 676 | bool detail::CachedRadioCell::is_lte_valid() | 659 | bool detail::CachedRadioCell::is_lte_valid() |
3534 | 677 | { | 660 | { |
3540 | 678 | return lte().mobile_country_code.is_valid() && | 661 | return lte().mobile_country_code.is_valid() && lte().mobile_network_code.is_valid() && |
3541 | 679 | lte().mobile_network_code.is_valid() && | 662 | lte().tracking_area_code.is_valid() && lte().id.is_valid() && lte().physical_id.is_valid() && |
3537 | 680 | lte().tracking_area_code.is_valid() && | ||
3538 | 681 | lte().id.is_valid() && | ||
3539 | 682 | lte().physical_id.is_valid() && | ||
3542 | 683 | lte().strength.is_valid(); | 663 | lte().strength.is_valid(); |
3543 | 684 | } | 664 | } |
3544 | 685 | 665 | ||
3558 | 686 | detail::CachedRadioCell::Detail::Detail() : none(detail::CachedRadioCell::None{}) | 666 | detail::CachedRadioCell::Detail::Detail() |
3559 | 687 | { | 667 | : none(detail::CachedRadioCell::None{}) |
3560 | 688 | } | 668 | { |
3561 | 689 | 669 | } | |
3562 | 690 | detail::CachedRadioCell::Detail::Detail(const com::ubuntu::location::connectivity::RadioCell::Gsm& gsm) : gsm(gsm) | 670 | |
3563 | 691 | { | 671 | detail::CachedRadioCell::Detail::Detail(const com::ubuntu::location::connectivity::RadioCell::Gsm& gsm) |
3564 | 692 | } | 672 | : gsm(gsm) |
3565 | 693 | 673 | { | |
3566 | 694 | detail::CachedRadioCell::Detail::Detail(const com::ubuntu::location::connectivity::RadioCell::Umts& umts) : umts(umts) | 674 | } |
3567 | 695 | { | 675 | |
3568 | 696 | } | 676 | detail::CachedRadioCell::Detail::Detail(const com::ubuntu::location::connectivity::RadioCell::Umts& umts) |
3569 | 697 | 677 | : umts(umts) | |
3570 | 698 | detail::CachedRadioCell::Detail::Detail(const com::ubuntu::location::connectivity::RadioCell::Lte& lte) : lte(lte) | 678 | { |
3571 | 679 | } | ||
3572 | 680 | |||
3573 | 681 | detail::CachedRadioCell::Detail::Detail(const com::ubuntu::location::connectivity::RadioCell::Lte& lte) | ||
3574 | 682 | : lte(lte) | ||
3575 | 699 | { | 683 | { |
3576 | 700 | } | 684 | } |
3577 | 701 | 685 | ||
3578 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h' | |||
3579 | --- src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h 2014-10-13 12:38:40 +0000 | |||
3580 | +++ src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h 2015-04-23 17:23:49 +0000 | |||
3581 | @@ -72,8 +72,7 @@ | |||
3582 | 72 | // cell change heuristics go here. | 72 | // cell change heuristics go here. |
3583 | 73 | struct CellChangeHeuristics | 73 | struct CellChangeHeuristics |
3584 | 74 | { | 74 | { |
3587 | 75 | CellChangeHeuristics(boost::asio::io_service& io_service, | 75 | CellChangeHeuristics(boost::asio::io_service& io_service, bool needed); |
3586 | 76 | bool needed); | ||
3588 | 77 | // True if the heuristic is needed | 76 | // True if the heuristic is needed |
3589 | 78 | const bool needed; | 77 | const bool needed; |
3590 | 79 | // The io_service for setting up timeouts. | 78 | // The io_service for setting up timeouts. |
3591 | @@ -86,7 +85,7 @@ | |||
3592 | 86 | // Property to indicate whether the current cell is | 85 | // Property to indicate whether the current cell is |
3593 | 87 | // still valid according to the cell change heuristics. | 86 | // still valid according to the cell change heuristics. |
3594 | 88 | core::Property<bool> valid; | 87 | core::Property<bool> valid; |
3596 | 89 | } cell_change_heuristics; | 88 | } cell_change_heuristics; |
3597 | 90 | // Executes the cell change heuristics if precondition is met. | 89 | // Executes the cell change heuristics if precondition is met. |
3598 | 91 | void execute_cell_change_heuristics_if_appropriate(); | 90 | void execute_cell_change_heuristics_if_appropriate(); |
3599 | 92 | 91 | ||
3600 | @@ -123,15 +122,15 @@ | |||
3601 | 123 | // Encapsulates all event connections that have to be cut on destruction. | 122 | // Encapsulates all event connections that have to be cut on destruction. |
3602 | 124 | struct | 123 | struct |
3603 | 125 | { | 124 | { |
3609 | 126 | core::dbus::Signal | 125 | core::dbus::Signal<org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged, |
3610 | 127 | < | 126 | org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged::ArgumentType>:: |
3611 | 128 | org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged, | 127 | SubscriptionToken network_registration_properties_changed; |
3607 | 129 | org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged::ArgumentType | ||
3608 | 130 | >::SubscriptionToken network_registration_properties_changed; | ||
3612 | 131 | } connections; | 128 | } connections; |
3613 | 132 | 129 | ||
3614 | 133 | // Marks the unset type in a variant. | 130 | // Marks the unset type in a variant. |
3616 | 134 | struct None {}; | 131 | struct None |
3617 | 132 | { | ||
3618 | 133 | }; | ||
3619 | 135 | 134 | ||
3620 | 136 | // Our custom variant handling the different known cell identity details. | 135 | // Our custom variant handling the different known cell identity details. |
3621 | 137 | union Detail | 136 | union Detail |
3622 | @@ -154,4 +153,4 @@ | |||
3623 | 154 | }; | 153 | }; |
3624 | 155 | } | 154 | } |
3625 | 156 | 155 | ||
3627 | 157 | #endif // CACHED_RADIO_CELL_H_ | 156 | #endif // CACHED_RADIO_CELL_H_ |
3628 | 158 | 157 | ||
3629 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp' | |||
3630 | --- src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp 2014-08-14 20:33:37 +0000 | |||
3631 | +++ src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp 2015-04-23 17:23:49 +0000 | |||
3632 | @@ -27,25 +27,23 @@ | |||
3633 | 27 | return std::string(ssid.begin(), ssid.end()); | 27 | return std::string(ssid.begin(), ssid.end()); |
3634 | 28 | } | 28 | } |
3635 | 29 | 29 | ||
3638 | 30 | com::ubuntu::location::connectivity::WirelessNetwork::Mode | 30 | com::ubuntu::location::connectivity::WirelessNetwork::Mode wifi_mode_from_ap_mode( |
3639 | 31 | wifi_mode_from_ap_mode(org::freedesktop::NetworkManager::AccessPoint::Mode::ValueType value) | 31 | org::freedesktop::NetworkManager::AccessPoint::Mode::ValueType value) |
3640 | 32 | { | 32 | { |
3645 | 33 | com::ubuntu::location::connectivity::WirelessNetwork::Mode mode | 33 | com::ubuntu::location::connectivity::WirelessNetwork::Mode mode{ |
3646 | 34 | { | 34 | com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown}; |
3643 | 35 | com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown | ||
3644 | 36 | }; | ||
3647 | 37 | 35 | ||
3648 | 38 | switch (value) | 36 | switch (value) |
3649 | 39 | { | 37 | { |
3659 | 40 | case org::freedesktop::NetworkManager::AccessPoint::Mode::Value::unknown: | 38 | case org::freedesktop::NetworkManager::AccessPoint::Mode::Value::unknown: |
3660 | 41 | mode = com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown; | 39 | mode = com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown; |
3661 | 42 | break; | 40 | break; |
3662 | 43 | case org::freedesktop::NetworkManager::AccessPoint::Mode::Value::adhoc: | 41 | case org::freedesktop::NetworkManager::AccessPoint::Mode::Value::adhoc: |
3663 | 44 | mode = com::ubuntu::location::connectivity::WirelessNetwork::Mode::adhoc; | 42 | mode = com::ubuntu::location::connectivity::WirelessNetwork::Mode::adhoc; |
3664 | 45 | break; | 43 | break; |
3665 | 46 | case org::freedesktop::NetworkManager::AccessPoint::Mode::Value::infra: | 44 | case org::freedesktop::NetworkManager::AccessPoint::Mode::Value::infra: |
3666 | 47 | mode = com::ubuntu::location::connectivity::WirelessNetwork::Mode::infrastructure; | 45 | mode = com::ubuntu::location::connectivity::WirelessNetwork::Mode::infrastructure; |
3667 | 48 | break; | 46 | break; |
3668 | 49 | } | 47 | } |
3669 | 50 | 48 | ||
3670 | 51 | return mode; | 49 | return mode; |
3671 | @@ -77,101 +75,76 @@ | |||
3672 | 77 | return frequency_; | 75 | return frequency_; |
3673 | 78 | } | 76 | } |
3674 | 79 | 77 | ||
3676 | 80 | const core::Property<connectivity::WirelessNetwork::SignalStrength>& detail::CachedWirelessNetwork::signal_strength() const | 78 | const core::Property<connectivity::WirelessNetwork::SignalStrength>& detail::CachedWirelessNetwork::signal_strength() |
3677 | 79 | const | ||
3678 | 81 | { | 80 | { |
3679 | 82 | return signal_strength_; | 81 | return signal_strength_; |
3680 | 83 | } | 82 | } |
3681 | 84 | 83 | ||
3687 | 85 | detail::CachedWirelessNetwork::CachedWirelessNetwork( | 84 | detail::CachedWirelessNetwork::CachedWirelessNetwork(const org::freedesktop::NetworkManager::Device& device, |
3688 | 86 | const org::freedesktop::NetworkManager::Device& device, | 85 | const org::freedesktop::NetworkManager::AccessPoint& ap) |
3689 | 87 | const org::freedesktop::NetworkManager::AccessPoint& ap) | 86 | : device_(device) |
3690 | 88 | : device_(device), | 87 | , access_point_(ap) |
3686 | 89 | access_point_(ap) | ||
3691 | 90 | { | 88 | { |
3696 | 91 | last_seen_ = std::chrono::system_clock::time_point | 89 | last_seen_ = |
3697 | 92 | { | 90 | std::chrono::system_clock::time_point{std::chrono::system_clock::duration{access_point_.last_seen->get()}}; |
3694 | 93 | std::chrono::system_clock::duration{access_point_.last_seen->get()} | ||
3695 | 94 | }; | ||
3698 | 95 | 91 | ||
3699 | 96 | bssid_ = access_point_.hw_address->get(); | 92 | bssid_ = access_point_.hw_address->get(); |
3700 | 97 | ssid_ = utf8_ssid_to_string(access_point_.ssid->get()); | 93 | ssid_ = utf8_ssid_to_string(access_point_.ssid->get()); |
3701 | 98 | mode_ = wifi_mode_from_ap_mode(access_point_.mode->get()); | 94 | mode_ = wifi_mode_from_ap_mode(access_point_.mode->get()); |
3710 | 99 | frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency | 95 | frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency{ |
3711 | 100 | { | 96 | static_cast<int>(access_point_.frequency->get())}; |
3712 | 101 | static_cast<int>(access_point_.frequency->get()) | 97 | signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength{ |
3713 | 102 | }; | 98 | static_cast<int>(access_point_.strength->get())}; |
3706 | 103 | signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength | ||
3707 | 104 | { | ||
3708 | 105 | static_cast<int>(access_point_.strength->get()) | ||
3709 | 106 | }; | ||
3714 | 107 | 99 | ||
3715 | 108 | // Wire up all the connections | 100 | // Wire up all the connections |
3716 | 109 | access_point_.properties_changed->connect([this](const std::map<std::string, core::dbus::types::Variant>& dict) | 101 | access_point_.properties_changed->connect([this](const std::map<std::string, core::dbus::types::Variant>& dict) |
3720 | 110 | { | 102 | { |
3721 | 111 | on_access_point_properties_changed(dict); | 103 | on_access_point_properties_changed(dict); |
3722 | 112 | }); | 104 | }); |
3723 | 113 | } | 105 | } |
3724 | 114 | 106 | ||
3726 | 115 | void detail::CachedWirelessNetwork::on_access_point_properties_changed(const std::map<std::string, core::dbus::types::Variant>& dict) | 107 | void detail::CachedWirelessNetwork::on_access_point_properties_changed( |
3727 | 108 | const std::map<std::string, core::dbus::types::Variant>& dict) | ||
3728 | 116 | { | 109 | { |
3729 | 117 | // We route by string | 110 | // We route by string |
3787 | 118 | static const std::unordered_map<std::string, std::function<void(CachedWirelessNetwork&, const core::dbus::types::Variant&)> > lut | 111 | static const std::unordered_map<std::string, |
3788 | 119 | { | 112 | std::function<void(CachedWirelessNetwork&, const core::dbus::types::Variant&)>> lut{ |
3789 | 120 | { | 113 | {org::freedesktop::NetworkManager::AccessPoint::HwAddress::name(), |
3790 | 121 | org::freedesktop::NetworkManager::AccessPoint::HwAddress::name(), | 114 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
3791 | 122 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) | 115 | { |
3792 | 123 | { | 116 | thiz.bssid_ = value.as<org::freedesktop::NetworkManager::AccessPoint::HwAddress::ValueType>(); |
3793 | 124 | thiz.bssid_ = value.as<org::freedesktop::NetworkManager::AccessPoint::HwAddress::ValueType>(); | 117 | }}, |
3794 | 125 | } | 118 | {org::freedesktop::NetworkManager::AccessPoint::Ssid::name(), |
3795 | 126 | }, | 119 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
3796 | 127 | { | 120 | { |
3797 | 128 | org::freedesktop::NetworkManager::AccessPoint::Ssid::name(), | 121 | thiz.ssid_ = |
3798 | 129 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) | 122 | utf8_ssid_to_string(value.as<org::freedesktop::NetworkManager::AccessPoint::Ssid::ValueType>()); |
3799 | 130 | { | 123 | }}, |
3800 | 131 | thiz.ssid_ = utf8_ssid_to_string(value.as<org::freedesktop::NetworkManager::AccessPoint::Ssid::ValueType>()); | 124 | {org::freedesktop::NetworkManager::AccessPoint::Strength::name(), |
3801 | 132 | } | 125 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
3802 | 133 | }, | 126 | { |
3803 | 134 | { | 127 | thiz.signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength{ |
3804 | 135 | org::freedesktop::NetworkManager::AccessPoint::Strength::name(), | 128 | value.as<org::freedesktop::NetworkManager::AccessPoint::Strength::ValueType>()}; |
3805 | 136 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) | 129 | }}, |
3806 | 137 | { | 130 | {org::freedesktop::NetworkManager::AccessPoint::Frequency::name(), |
3807 | 138 | thiz.signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength | 131 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
3808 | 139 | { | 132 | { |
3809 | 140 | value.as<org::freedesktop::NetworkManager::AccessPoint::Strength::ValueType>() | 133 | thiz.frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency{ |
3810 | 141 | }; | 134 | static_cast<int>(value.as<org::freedesktop::NetworkManager::AccessPoint::Frequency::ValueType>())}; |
3811 | 142 | } | 135 | }}, |
3812 | 143 | }, | 136 | {org::freedesktop::NetworkManager::AccessPoint::Mode::name(), |
3813 | 144 | { | 137 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
3814 | 145 | org::freedesktop::NetworkManager::AccessPoint::Frequency::name(), | 138 | { |
3815 | 146 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) | 139 | thiz.mode_ = |
3816 | 147 | { | 140 | wifi_mode_from_ap_mode(value.as<org::freedesktop::NetworkManager::AccessPoint::Mode::ValueType>()); |
3817 | 148 | thiz.frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency | 141 | }}, |
3818 | 149 | { | 142 | {org::freedesktop::NetworkManager::AccessPoint::LastSeen::name(), |
3819 | 150 | static_cast<int>(value.as<org::freedesktop::NetworkManager::AccessPoint::Frequency::ValueType>()) | 143 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
3820 | 151 | }; | 144 | { |
3821 | 152 | } | 145 | thiz.last_seen_ = std::chrono::system_clock::time_point{std::chrono::system_clock::duration{ |
3822 | 153 | }, | 146 | value.as<org::freedesktop::NetworkManager::AccessPoint::LastSeen::ValueType>()}}; |
3823 | 154 | { | 147 | }}}; |
3767 | 155 | org::freedesktop::NetworkManager::AccessPoint::Mode::name(), | ||
3768 | 156 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) | ||
3769 | 157 | { | ||
3770 | 158 | thiz.mode_ = wifi_mode_from_ap_mode(value.as<org::freedesktop::NetworkManager::AccessPoint::Mode::ValueType>()); | ||
3771 | 159 | } | ||
3772 | 160 | }, | ||
3773 | 161 | { | ||
3774 | 162 | org::freedesktop::NetworkManager::AccessPoint::LastSeen::name(), | ||
3775 | 163 | [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) | ||
3776 | 164 | { | ||
3777 | 165 | thiz.last_seen_ = std::chrono::system_clock::time_point | ||
3778 | 166 | { | ||
3779 | 167 | std::chrono::system_clock::duration | ||
3780 | 168 | { | ||
3781 | 169 | value.as<org::freedesktop::NetworkManager::AccessPoint::LastSeen::ValueType>() | ||
3782 | 170 | } | ||
3783 | 171 | }; | ||
3784 | 172 | } | ||
3785 | 173 | } | ||
3786 | 174 | }; | ||
3824 | 175 | 148 | ||
3825 | 176 | for (const auto& pair : dict) | 149 | for (const auto& pair : dict) |
3826 | 177 | { | 150 | { |
3827 | @@ -182,8 +155,12 @@ | |||
3828 | 182 | // log the issue for later analysis. | 155 | // log the issue for later analysis. |
3829 | 183 | try | 156 | try |
3830 | 184 | { | 157 | { |
3833 | 185 | if (lut.count(pair.first) > 0) lut.at(pair.first)(*this, pair.second); | 158 | if (lut.count(pair.first) > 0) |
3834 | 186 | } catch (...) | 159 | { |
3835 | 160 | lut.at(pair.first)(*this, pair.second); | ||
3836 | 161 | } | ||
3837 | 162 | } | ||
3838 | 163 | catch (...) | ||
3839 | 187 | { | 164 | { |
3840 | 188 | VLOG(1) << "Exception while updating state for property change: " << pair.first; | 165 | VLOG(1) << "Exception while updating state for property change: " << pair.first; |
3841 | 189 | } | 166 | } |
3842 | 190 | 167 | ||
3843 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h' | |||
3844 | --- src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h 2014-08-14 20:25:22 +0000 | |||
3845 | +++ src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h 2015-04-23 17:23:49 +0000 | |||
3846 | @@ -37,9 +37,8 @@ | |||
3847 | 37 | // Constructs a new instance associated with the ap and the (remote) device | 37 | // Constructs a new instance associated with the ap and the (remote) device |
3848 | 38 | // it belongs to. Please note that the caching nature of the class ensures that | 38 | // it belongs to. Please note that the caching nature of the class ensures that |
3849 | 39 | // ap and device stubs are kept alive. | 39 | // ap and device stubs are kept alive. |
3853 | 40 | CachedWirelessNetwork( | 40 | CachedWirelessNetwork(const org::freedesktop::NetworkManager::Device& device, |
3854 | 41 | const org::freedesktop::NetworkManager::Device& device, | 41 | const org::freedesktop::NetworkManager::AccessPoint& ap); |
3852 | 42 | const org::freedesktop::NetworkManager::AccessPoint& ap); | ||
3855 | 43 | 42 | ||
3856 | 44 | // Timestamp when the network became visible. | 43 | // Timestamp when the network became visible. |
3857 | 45 | const core::Property<std::chrono::system_clock::time_point>& last_seen() const override; | 44 | const core::Property<std::chrono::system_clock::time_point>& last_seen() const override; |
3858 | @@ -76,4 +75,4 @@ | |||
3859 | 76 | }; | 75 | }; |
3860 | 77 | } | 76 | } |
3861 | 78 | 77 | ||
3863 | 79 | #endif // CACHED_WIRELESS_NETWORK_H_ | 78 | #endif // CACHED_WIRELESS_NETWORK_H_ |
3864 | 80 | 79 | ||
3865 | === modified file 'src/location_service/com/ubuntu/location/connectivity/dummy_connectivity_manager.h' | |||
3866 | --- src/location_service/com/ubuntu/location/connectivity/dummy_connectivity_manager.h 2014-10-08 20:51:25 +0000 | |||
3867 | +++ src/location_service/com/ubuntu/location/connectivity/dummy_connectivity_manager.h 2015-04-23 17:23:49 +0000 | |||
3868 | @@ -50,7 +50,8 @@ | |||
3869 | 50 | return properties.is_wwan_hardware_enabled; | 50 | return properties.is_wwan_hardware_enabled; |
3870 | 51 | } | 51 | } |
3871 | 52 | 52 | ||
3873 | 53 | const core::Property<com::ubuntu::location::connectivity::Characteristics>& active_connection_characteristics() const | 53 | const core::Property<com::ubuntu::location::connectivity::Characteristics>& active_connection_characteristics() |
3874 | 54 | const | ||
3875 | 54 | { | 55 | { |
3876 | 55 | return properties.active_connection_characteristics; | 56 | return properties.active_connection_characteristics; |
3877 | 56 | } | 57 | } |
3878 | @@ -74,7 +75,8 @@ | |||
3879 | 74 | return sigs.wireless_network_removed; | 75 | return sigs.wireless_network_removed; |
3880 | 75 | } | 76 | } |
3881 | 76 | 77 | ||
3883 | 77 | void enumerate_visible_wireless_networks(const std::function<void(const com::ubuntu::location::connectivity::WirelessNetwork::Ptr&)>&) const | 78 | void enumerate_visible_wireless_networks( |
3884 | 79 | const std::function<void(const com::ubuntu::location::connectivity::WirelessNetwork::Ptr&)>&) const | ||
3885 | 78 | { | 80 | { |
3886 | 79 | } | 81 | } |
3887 | 80 | 82 | ||
3888 | @@ -88,7 +90,8 @@ | |||
3889 | 88 | return sigs.connected_cell_removed; | 90 | return sigs.connected_cell_removed; |
3890 | 89 | } | 91 | } |
3891 | 90 | 92 | ||
3893 | 91 | void enumerate_connected_radio_cells(const std::function<void(const com::ubuntu::location::connectivity::RadioCell::Ptr&)>&) const | 93 | void enumerate_connected_radio_cells( |
3894 | 94 | const std::function<void(const com::ubuntu::location::connectivity::RadioCell::Ptr&)>&) const | ||
3895 | 92 | { | 95 | { |
3896 | 93 | } | 96 | } |
3897 | 94 | 97 | ||
3898 | @@ -98,7 +101,8 @@ | |||
3899 | 98 | core::Property<bool> is_wwan_enabled{false}; | 101 | core::Property<bool> is_wwan_enabled{false}; |
3900 | 99 | core::Property<bool> is_wifi_hardware_enabled{false}; | 102 | core::Property<bool> is_wifi_hardware_enabled{false}; |
3901 | 100 | core::Property<bool> is_wwan_hardware_enabled{false}; | 103 | core::Property<bool> is_wwan_hardware_enabled{false}; |
3903 | 101 | core::Property<com::ubuntu::location::connectivity::State> state{com::ubuntu::location::connectivity::State::unknown}; | 104 | core::Property<com::ubuntu::location::connectivity::State> state{ |
3904 | 105 | com::ubuntu::location::connectivity::State::unknown}; | ||
3905 | 102 | core::Property<com::ubuntu::location::connectivity::Characteristics> active_connection_characteristics{}; | 106 | core::Property<com::ubuntu::location::connectivity::Characteristics> active_connection_characteristics{}; |
3906 | 103 | } properties; | 107 | } properties; |
3907 | 104 | 108 | ||
3908 | @@ -113,4 +117,4 @@ | |||
3909 | 113 | }; | 117 | }; |
3910 | 114 | } | 118 | } |
3911 | 115 | 119 | ||
3913 | 116 | #endif // DUMMY_CONNECTIVITY_MANAGER_H_ | 120 | #endif // DUMMY_CONNECTIVITY_MANAGER_H_ |
3914 | 117 | 121 | ||
3915 | === modified file 'src/location_service/com/ubuntu/location/connectivity/manager.cpp' | |||
3916 | --- src/location_service/com/ubuntu/location/connectivity/manager.cpp 2014-10-02 06:59:46 +0000 | |||
3917 | +++ src/location_service/com/ubuntu/location/connectivity/manager.cpp 2015-04-23 17:23:49 +0000 | |||
3918 | @@ -24,14 +24,30 @@ | |||
3919 | 24 | { | 24 | { |
3920 | 25 | switch (state) | 25 | switch (state) |
3921 | 26 | { | 26 | { |
3930 | 27 | case State::unknown: out << "State::unknown"; break; | 27 | case State::unknown: |
3931 | 28 | case State::asleep: out << "State::asleep"; break; | 28 | out << "State::unknown"; |
3932 | 29 | case State::disconnected: out << "State::disconnected"; break; | 29 | break; |
3933 | 30 | case State::disconnecting: out << "State::disconnecting"; break; | 30 | case State::asleep: |
3934 | 31 | case State::connecting: out << "State::connecting"; break; | 31 | out << "State::asleep"; |
3935 | 32 | case State::connected_local: out << "State::connected_local"; break; | 32 | break; |
3936 | 33 | case State::connected_site: out << "State::connected_site"; break; | 33 | case State::disconnected: |
3937 | 34 | case State::connected_global: out << "State::connected_global"; break; | 34 | out << "State::disconnected"; |
3938 | 35 | break; | ||
3939 | 36 | case State::disconnecting: | ||
3940 | 37 | out << "State::disconnecting"; | ||
3941 | 38 | break; | ||
3942 | 39 | case State::connecting: | ||
3943 | 40 | out << "State::connecting"; | ||
3944 | 41 | break; | ||
3945 | 42 | case State::connected_local: | ||
3946 | 43 | out << "State::connected_local"; | ||
3947 | 44 | break; | ||
3948 | 45 | case State::connected_site: | ||
3949 | 46 | out << "State::connected_site"; | ||
3950 | 47 | break; | ||
3951 | 48 | case State::connected_global: | ||
3952 | 49 | out << "State::connected_global"; | ||
3953 | 50 | break; | ||
3954 | 35 | } | 51 | } |
3955 | 36 | 52 | ||
3956 | 37 | return out; | 53 | return out; |
3957 | @@ -53,18 +69,41 @@ | |||
3958 | 53 | 69 | ||
3959 | 54 | out << "["; | 70 | out << "["; |
3960 | 55 | 71 | ||
3965 | 56 | if ((characteristics & connectivity::Characteristics::connection_goes_via_wifi) != connectivity::Characteristics::none) | 72 | if ((characteristics & connectivity::Characteristics::connection_goes_via_wifi) != |
3966 | 57 | { out << "connection_goes_via_wifi"; first = false; } | 73 | connectivity::Characteristics::none) |
3967 | 58 | if ((characteristics & connectivity::Characteristics::connection_goes_via_wwan) != connectivity::Characteristics::none) | 74 | { |
3968 | 59 | { out << (first ? "" : ", ") << "connection_goes_via_wwan"; first = false; } | 75 | out << "connection_goes_via_wifi"; |
3969 | 76 | first = false; | ||
3970 | 77 | } | ||
3971 | 78 | if ((characteristics & connectivity::Characteristics::connection_goes_via_wwan) != | ||
3972 | 79 | connectivity::Characteristics::none) | ||
3973 | 80 | { | ||
3974 | 81 | out << (first ? "" : ", ") << "connection_goes_via_wwan"; | ||
3975 | 82 | first = false; | ||
3976 | 83 | } | ||
3977 | 60 | if ((characteristics & connectivity::Characteristics::connection_is_roaming) != connectivity::Characteristics::none) | 84 | if ((characteristics & connectivity::Characteristics::connection_is_roaming) != connectivity::Characteristics::none) |
3985 | 61 | { out << (first ? "" : ", ") << "connection_is_roaming"; first = false; } | 85 | { |
3986 | 62 | if ((characteristics & connectivity::Characteristics::connection_has_monetary_costs) != connectivity::Characteristics::none) | 86 | out << (first ? "" : ", ") << "connection_is_roaming"; |
3987 | 63 | { out << (first ? "" : ", ") << "connection_has_monetary_costs"; first = false; } | 87 | first = false; |
3988 | 64 | if ((characteristics & connectivity::Characteristics::connection_is_bandwith_limited) != connectivity::Characteristics::none) | 88 | } |
3989 | 65 | { out << (first ? "" : ", ") << "connection_is_bandwidth_limited"; first = false; } | 89 | if ((characteristics & connectivity::Characteristics::connection_has_monetary_costs) != |
3990 | 66 | if ((characteristics & connectivity::Characteristics::connection_is_volume_limited) != connectivity::Characteristics::none) | 90 | connectivity::Characteristics::none) |
3991 | 67 | { out << (first ? "" : ", ") << "connection_is_volume_limited"; first = false; } | 91 | { |
3992 | 92 | out << (first ? "" : ", ") << "connection_has_monetary_costs"; | ||
3993 | 93 | first = false; | ||
3994 | 94 | } | ||
3995 | 95 | if ((characteristics & connectivity::Characteristics::connection_is_bandwith_limited) != | ||
3996 | 96 | connectivity::Characteristics::none) | ||
3997 | 97 | { | ||
3998 | 98 | out << (first ? "" : ", ") << "connection_is_bandwidth_limited"; | ||
3999 | 99 | first = false; | ||
4000 | 100 | } | ||
4001 | 101 | if ((characteristics & connectivity::Characteristics::connection_is_volume_limited) != | ||
4002 | 102 | connectivity::Characteristics::none) | ||
4003 | 103 | { | ||
4004 | 104 | out << (first ? "" : ", ") << "connection_is_volume_limited"; | ||
4005 | 105 | first = false; | ||
4006 | 106 | } | ||
4007 | 68 | 107 | ||
4008 | 69 | out << "]"; | 108 | out << "]"; |
4009 | 70 | return out; | 109 | return out; |
4010 | 71 | 110 | ||
4011 | === modified file 'src/location_service/com/ubuntu/location/connectivity/nm.h' | |||
4012 | --- src/location_service/com/ubuntu/location/connectivity/nm.h 2015-02-26 10:59:22 +0000 | |||
4013 | +++ src/location_service/com/ubuntu/location/connectivity/nm.h 2015-04-23 17:23:49 +0000 | |||
4014 | @@ -151,14 +151,14 @@ | |||
4015 | 151 | }; | 151 | }; |
4016 | 152 | 152 | ||
4017 | 153 | AccessPoint(const std::shared_ptr<core::dbus::Object>& object) | 153 | AccessPoint(const std::shared_ptr<core::dbus::Object>& object) |
4026 | 154 | : object(object), | 154 | : object(object) |
4027 | 155 | frequency(object->get_property<Frequency>()), | 155 | , frequency(object->get_property<Frequency>()) |
4028 | 156 | last_seen(object->get_property<LastSeen>()), | 156 | , last_seen(object->get_property<LastSeen>()) |
4029 | 157 | mode(object->get_property<Mode>()), | 157 | , mode(object->get_property<Mode>()) |
4030 | 158 | hw_address(object->get_property<HwAddress>()), | 158 | , hw_address(object->get_property<HwAddress>()) |
4031 | 159 | ssid(object->get_property<Ssid>()), | 159 | , ssid(object->get_property<Ssid>()) |
4032 | 160 | strength(object->get_property<Strength>()), | 160 | , strength(object->get_property<Strength>()) |
4033 | 161 | properties_changed(object->get_signal<PropertiesChanged>()) | 161 | , properties_changed(object->get_signal<PropertiesChanged>()) |
4034 | 162 | { | 162 | { |
4035 | 163 | } | 163 | } |
4036 | 164 | 164 | ||
4037 | @@ -291,17 +291,13 @@ | |||
4038 | 291 | static const bool writable = false; | 291 | static const bool writable = false; |
4039 | 292 | }; | 292 | }; |
4040 | 293 | 293 | ||
4052 | 294 | Device(const std::shared_ptr<core::dbus::Service>& service, | 294 | Device(const std::shared_ptr<core::dbus::Service>& service, const std::shared_ptr<core::dbus::Object>& object) |
4053 | 295 | const std::shared_ptr<core::dbus::Object>& object) | 295 | : service(service) |
4054 | 296 | : service(service), | 296 | , object(object) |
4055 | 297 | object(object), | 297 | , device_type(object->get_property<DeviceType>()) |
4056 | 298 | device_type(object->get_property<DeviceType>()), | 298 | , signals{object->get_signal<Wireless::Signals::ScanDone>(), |
4057 | 299 | signals | 299 | object->get_signal<Wireless::Signals::AccessPointAdded>(), |
4058 | 300 | { | 300 | object->get_signal<Wireless::Signals::AccessPointRemoved>()} |
4048 | 301 | object->get_signal<Wireless::Signals::ScanDone>(), | ||
4049 | 302 | object->get_signal<Wireless::Signals::AccessPointAdded>(), | ||
4050 | 303 | object->get_signal<Wireless::Signals::AccessPointRemoved>() | ||
4051 | 304 | } | ||
4059 | 305 | { | 301 | { |
4060 | 306 | } | 302 | } |
4061 | 307 | 303 | ||
4062 | @@ -316,10 +312,14 @@ | |||
4063 | 316 | auto result = object->transact_method<Wireless::GetAccessPoints, ResultType>(); | 312 | auto result = object->transact_method<Wireless::GetAccessPoints, ResultType>(); |
4064 | 317 | 313 | ||
4065 | 318 | if (result.is_error()) | 314 | if (result.is_error()) |
4066 | 315 | { | ||
4067 | 319 | throw std::runtime_error(result.error().print()); | 316 | throw std::runtime_error(result.error().print()); |
4068 | 317 | } | ||
4069 | 320 | 318 | ||
4070 | 321 | for (const auto& path : result.value()) | 319 | for (const auto& path : result.value()) |
4071 | 320 | { | ||
4072 | 322 | f(path); | 321 | f(path); |
4073 | 322 | } | ||
4074 | 323 | } | 323 | } |
4075 | 324 | 324 | ||
4076 | 325 | std::vector<AccessPoint> get_access_points() const | 325 | std::vector<AccessPoint> get_access_points() const |
4077 | @@ -328,12 +328,16 @@ | |||
4078 | 328 | auto result = object->invoke_method_synchronously<Wireless::GetAccessPoints, ResultType>(); | 328 | auto result = object->invoke_method_synchronously<Wireless::GetAccessPoints, ResultType>(); |
4079 | 329 | 329 | ||
4080 | 330 | if (result.is_error()) | 330 | if (result.is_error()) |
4081 | 331 | { | ||
4082 | 331 | throw std::runtime_error(result.error().print()); | 332 | throw std::runtime_error(result.error().print()); |
4083 | 333 | } | ||
4084 | 332 | 334 | ||
4085 | 333 | std::vector<AccessPoint> aps; | 335 | std::vector<AccessPoint> aps; |
4086 | 334 | 336 | ||
4087 | 335 | for (const auto& path : result.value()) | 337 | for (const auto& path : result.value()) |
4088 | 338 | { | ||
4089 | 336 | aps.push_back(AccessPoint(service->object_for_path(path))); | 339 | aps.push_back(AccessPoint(service->object_for_path(path))); |
4090 | 340 | } | ||
4091 | 337 | 341 | ||
4092 | 338 | return aps; | 342 | return aps; |
4093 | 339 | } | 343 | } |
4094 | @@ -350,8 +354,10 @@ | |||
4095 | 350 | struct | 354 | struct |
4096 | 351 | { | 355 | { |
4097 | 352 | core::dbus::Signal<Wireless::Signals::ScanDone, Wireless::Signals::ScanDone::ArgumentType>::Ptr scan_done; | 356 | core::dbus::Signal<Wireless::Signals::ScanDone, Wireless::Signals::ScanDone::ArgumentType>::Ptr scan_done; |
4100 | 353 | core::dbus::Signal<Wireless::Signals::AccessPointAdded, Wireless::Signals::AccessPointAdded::ArgumentType>::Ptr ap_added; | 357 | core::dbus::Signal<Wireless::Signals::AccessPointAdded, |
4101 | 354 | core::dbus::Signal<Wireless::Signals::AccessPointRemoved, Wireless::Signals::AccessPointRemoved::ArgumentType>::Ptr ap_removed; | 358 | Wireless::Signals::AccessPointAdded::ArgumentType>::Ptr ap_added; |
4102 | 359 | core::dbus::Signal<Wireless::Signals::AccessPointRemoved, | ||
4103 | 360 | Wireless::Signals::AccessPointRemoved::ArgumentType>::Ptr ap_removed; | ||
4104 | 355 | } signals; | 361 | } signals; |
4105 | 356 | }; | 362 | }; |
4106 | 357 | 363 | ||
4107 | @@ -382,12 +388,9 @@ | |||
4108 | 382 | 388 | ||
4109 | 383 | ActiveConnection(const std::shared_ptr<core::dbus::Service>& service, | 389 | ActiveConnection(const std::shared_ptr<core::dbus::Service>& service, |
4110 | 384 | const std::shared_ptr<core::dbus::Object>& object) | 390 | const std::shared_ptr<core::dbus::Object>& object) |
4117 | 385 | : service{service}, | 391 | : service{service} |
4118 | 386 | object{object}, | 392 | , object{object} |
4119 | 387 | properties | 393 | , properties{object->get_property<Properties::Devices>()} |
4114 | 388 | { | ||
4115 | 389 | object->get_property<Properties::Devices>() | ||
4116 | 390 | } | ||
4120 | 391 | { | 394 | { |
4121 | 392 | } | 395 | } |
4122 | 393 | 396 | ||
4123 | @@ -396,14 +399,16 @@ | |||
4124 | 396 | auto device_paths = properties.devices->get(); | 399 | auto device_paths = properties.devices->get(); |
4125 | 397 | 400 | ||
4126 | 398 | for (const auto& device_path : device_paths) | 401 | for (const auto& device_path : device_paths) |
4127 | 402 | { | ||
4128 | 399 | functor(device_path); | 403 | functor(device_path); |
4129 | 404 | } | ||
4130 | 400 | } | 405 | } |
4131 | 401 | 406 | ||
4132 | 402 | std::shared_ptr<core::dbus::Service> service; | 407 | std::shared_ptr<core::dbus::Service> service; |
4133 | 403 | std::shared_ptr<core::dbus::Object> object; | 408 | std::shared_ptr<core::dbus::Object> object; |
4134 | 404 | struct | 409 | struct |
4135 | 405 | { | 410 | { |
4137 | 406 | std::shared_ptr<core::dbus::Property<Properties::Devices> > devices; | 411 | std::shared_ptr<core::dbus::Property<Properties::Devices>> devices; |
4138 | 407 | } properties; | 412 | } properties; |
4139 | 408 | }; | 413 | }; |
4140 | 409 | 414 | ||
4141 | @@ -603,41 +608,35 @@ | |||
4142 | 603 | }; | 608 | }; |
4143 | 604 | 609 | ||
4144 | 605 | NetworkManager(const core::dbus::Bus::Ptr& bus) | 610 | NetworkManager(const core::dbus::Bus::Ptr& bus) |
4164 | 606 | : service(core::dbus::Service::use_service<NetworkManager>(bus)), | 611 | : service(core::dbus::Service::use_service<NetworkManager>(bus)) |
4165 | 607 | object(service->object_for_path(core::dbus::types::ObjectPath("/org/freedesktop/NetworkManager"))), | 612 | , object(service->object_for_path(core::dbus::types::ObjectPath("/org/freedesktop/NetworkManager"))) |
4166 | 608 | properties | 613 | , properties{object->get_property<Properties::Connectivity>(), |
4167 | 609 | { | 614 | object->get_property<Properties::PrimaryConnection>(), |
4168 | 610 | object->get_property<Properties::Connectivity>(), | 615 | object->get_property<Properties::State>(), |
4169 | 611 | object->get_property<Properties::PrimaryConnection>(), | 616 | object->get_property<Properties::WirelessEnabled>(), |
4170 | 612 | object->get_property<Properties::State>(), | 617 | object->get_property<Properties::WirelessHardwareEnabled>(), |
4171 | 613 | object->get_property<Properties::WirelessEnabled>(), | 618 | object->get_property<Properties::WwanEnabled>(), |
4172 | 614 | object->get_property<Properties::WirelessHardwareEnabled>(), | 619 | object->get_property<Properties::WwanHardwareEnabled>()} |
4173 | 615 | object->get_property<Properties::WwanEnabled>(), | 620 | , signals{object->get_signal<Signals::DeviceAdded>(), |
4174 | 616 | object->get_property<Properties::WwanHardwareEnabled>() | 621 | object->get_signal<Signals::DeviceRemoved>(), |
4175 | 617 | }, | 622 | object->get_signal<Signals::PropertiesChanged>(), |
4176 | 618 | signals | 623 | object->get_signal<Signals::StateChanged>()} |
4158 | 619 | { | ||
4159 | 620 | object->get_signal<Signals::DeviceAdded>(), | ||
4160 | 621 | object->get_signal<Signals::DeviceRemoved>(), | ||
4161 | 622 | object->get_signal<Signals::PropertiesChanged>(), | ||
4162 | 623 | object->get_signal<Signals::StateChanged>() | ||
4163 | 624 | } | ||
4177 | 625 | { | 624 | { |
4178 | 626 | } | 625 | } |
4179 | 627 | 626 | ||
4180 | 628 | void for_each_device(const std::function<void(const core::dbus::types::ObjectPath&)>& f) | 627 | void for_each_device(const std::function<void(const core::dbus::types::ObjectPath&)>& f) |
4181 | 629 | { | 628 | { |
4187 | 630 | auto result = | 629 | auto result = object->transact_method<NetworkManager::GetDevices, std::vector<core::dbus::types::ObjectPath>>(); |
4183 | 631 | object->transact_method< | ||
4184 | 632 | NetworkManager::GetDevices, | ||
4185 | 633 | std::vector<core::dbus::types::ObjectPath> | ||
4186 | 634 | >(); | ||
4188 | 635 | 630 | ||
4189 | 636 | if (result.is_error()) | 631 | if (result.is_error()) |
4190 | 632 | { | ||
4191 | 637 | throw std::runtime_error(result.error().print()); | 633 | throw std::runtime_error(result.error().print()); |
4192 | 634 | } | ||
4193 | 638 | 635 | ||
4194 | 639 | for (const auto& path : result.value()) | 636 | for (const auto& path : result.value()) |
4195 | 637 | { | ||
4196 | 640 | f(path); | 638 | f(path); |
4197 | 639 | } | ||
4198 | 641 | } | 640 | } |
4199 | 642 | 641 | ||
4200 | 643 | Device device_for_path(const core::dbus::types::ObjectPath& path) | 642 | Device device_for_path(const core::dbus::types::ObjectPath& path) |
4201 | @@ -648,20 +647,18 @@ | |||
4202 | 648 | std::vector<Device> get_devices() | 647 | std::vector<Device> get_devices() |
4203 | 649 | { | 648 | { |
4204 | 650 | auto result = | 649 | auto result = |
4208 | 651 | object->invoke_method_synchronously< | 650 | object |
4209 | 652 | NetworkManager::GetDevices, | 651 | ->invoke_method_synchronously<NetworkManager::GetDevices, std::vector<core::dbus::types::ObjectPath>>(); |
4207 | 653 | std::vector<core::dbus::types::ObjectPath>>(); | ||
4210 | 654 | 652 | ||
4211 | 655 | if (result.is_error()) | 653 | if (result.is_error()) |
4212 | 654 | { | ||
4213 | 656 | throw std::runtime_error(result.error().print()); | 655 | throw std::runtime_error(result.error().print()); |
4214 | 656 | } | ||
4215 | 657 | 657 | ||
4216 | 658 | std::vector<Device> devices; | 658 | std::vector<Device> devices; |
4217 | 659 | for (const auto& path : result.value()) | 659 | for (const auto& path : result.value()) |
4218 | 660 | { | 660 | { |
4223 | 661 | devices.emplace_back( | 661 | devices.emplace_back(Device(service, service->object_for_path(path))); |
4220 | 662 | Device( | ||
4221 | 663 | service, | ||
4222 | 664 | service->object_for_path(path))); | ||
4224 | 665 | } | 662 | } |
4225 | 666 | 663 | ||
4226 | 667 | return devices; | 664 | return devices; |
4227 | @@ -672,23 +669,24 @@ | |||
4228 | 672 | 669 | ||
4229 | 673 | struct | 670 | struct |
4230 | 674 | { | 671 | { |
4238 | 675 | std::shared_ptr<core::dbus::Property<Properties::Connectivity> > connectivity; | 672 | std::shared_ptr<core::dbus::Property<Properties::Connectivity>> connectivity; |
4239 | 676 | std::shared_ptr<core::dbus::Property<Properties::PrimaryConnection> > primary_connection; | 673 | std::shared_ptr<core::dbus::Property<Properties::PrimaryConnection>> primary_connection; |
4240 | 677 | std::shared_ptr<core::dbus::Property<Properties::State> > state; | 674 | std::shared_ptr<core::dbus::Property<Properties::State>> state; |
4241 | 678 | std::shared_ptr<core::dbus::Property<Properties::WirelessEnabled> > is_wifi_enabled; | 675 | std::shared_ptr<core::dbus::Property<Properties::WirelessEnabled>> is_wifi_enabled; |
4242 | 679 | std::shared_ptr<core::dbus::Property<Properties::WirelessHardwareEnabled> > is_wifi_hardware_enabled; | 676 | std::shared_ptr<core::dbus::Property<Properties::WirelessHardwareEnabled>> is_wifi_hardware_enabled; |
4243 | 680 | std::shared_ptr<core::dbus::Property<Properties::WwanEnabled> > is_wwan_enabled; | 677 | std::shared_ptr<core::dbus::Property<Properties::WwanEnabled>> is_wwan_enabled; |
4244 | 681 | std::shared_ptr<core::dbus::Property<Properties::WwanHardwareEnabled> > is_wwan_hardware_enabled; | 678 | std::shared_ptr<core::dbus::Property<Properties::WwanHardwareEnabled>> is_wwan_hardware_enabled; |
4245 | 682 | } properties; | 679 | } properties; |
4246 | 683 | struct | 680 | struct |
4247 | 684 | { | 681 | { |
4248 | 685 | core::dbus::Signal<Signals::DeviceAdded, Signals::DeviceAdded::ArgumentType>::Ptr device_added; | 682 | core::dbus::Signal<Signals::DeviceAdded, Signals::DeviceAdded::ArgumentType>::Ptr device_added; |
4249 | 686 | core::dbus::Signal<Signals::DeviceRemoved, Signals::DeviceRemoved::ArgumentType>::Ptr device_removed; | 683 | core::dbus::Signal<Signals::DeviceRemoved, Signals::DeviceRemoved::ArgumentType>::Ptr device_removed; |
4251 | 687 | core::dbus::Signal<Signals::PropertiesChanged, Signals::PropertiesChanged::ArgumentType>::Ptr properties_changed; | 684 | core::dbus::Signal<Signals::PropertiesChanged, Signals::PropertiesChanged::ArgumentType>::Ptr |
4252 | 685 | properties_changed; | ||
4253 | 688 | core::dbus::Signal<Signals::StateChanged, Signals::StateChanged::ArgumentType>::Ptr state_changed; | 686 | core::dbus::Signal<Signals::StateChanged, Signals::StateChanged::ArgumentType>::Ptr state_changed; |
4254 | 689 | } signals; | 687 | } signals; |
4255 | 690 | }; | 688 | }; |
4256 | 691 | } | 689 | } |
4257 | 692 | } | 690 | } |
4258 | 693 | 691 | ||
4260 | 694 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_NM_H | 692 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_NM_H |
4261 | 695 | 693 | ||
4262 | === modified file 'src/location_service/com/ubuntu/location/connectivity/ofono.h' | |||
4263 | --- src/location_service/com/ubuntu/location/connectivity/ofono.h 2015-01-06 12:35:02 +0000 | |||
4264 | +++ src/location_service/com/ubuntu/location/connectivity/ofono.h 2015-04-23 17:23:49 +0000 | |||
4265 | @@ -36,84 +36,31 @@ | |||
4266 | 36 | { | 36 | { |
4267 | 37 | struct Ofono | 37 | struct Ofono |
4268 | 38 | { | 38 | { |
4269 | 39 | static const std::string& name() | ||
4270 | 40 | { | ||
4271 | 41 | static const std::string s{"org.ofono"}; | ||
4272 | 42 | return s; | ||
4273 | 43 | } | ||
4274 | 44 | struct Manager | ||
4275 | 45 | { | ||
4276 | 46 | typedef std::shared_ptr<Manager> Ptr; | ||
4277 | 47 | |||
4278 | 48 | static const std::string& name() | 39 | static const std::string& name() |
4279 | 49 | { | 40 | { |
4281 | 50 | static const std::string s{"org.ofono.Manager"}; | 41 | static const std::string s{"org.ofono"}; |
4282 | 51 | return s; | 42 | return s; |
4283 | 52 | } | 43 | } |
4339 | 53 | 44 | struct Manager | |
4340 | 54 | struct GetModems | 45 | { |
4341 | 55 | { | 46 | typedef std::shared_ptr<Manager> Ptr; |
4342 | 56 | static const std::string& name() | 47 | |
4343 | 57 | { | 48 | static const std::string& name() |
4344 | 58 | static const std::string s{"GetModems"}; | 49 | { |
4345 | 59 | return s; | 50 | static const std::string s{"org.ofono.Manager"}; |
4346 | 60 | } | 51 | return s; |
4347 | 61 | 52 | } | |
4348 | 62 | typedef Manager Interface; | 53 | |
4349 | 63 | typedef std::vector< | 54 | struct GetModems |
4295 | 64 | core::dbus::types::Struct< | ||
4296 | 65 | core::dbus::types::ObjectPath | ||
4297 | 66 | > | ||
4298 | 67 | > ResultType; | ||
4299 | 68 | |||
4300 | 69 | static std::chrono::milliseconds default_timeout() | ||
4301 | 70 | { | ||
4302 | 71 | return std::chrono::seconds{1}; | ||
4303 | 72 | } | ||
4304 | 73 | }; | ||
4305 | 74 | |||
4306 | 75 | struct ModemAdded | ||
4307 | 76 | { | ||
4308 | 77 | static const std::string& name() | ||
4309 | 78 | { | ||
4310 | 79 | static const std::string s{"ModemAdded"}; | ||
4311 | 80 | return s; | ||
4312 | 81 | } | ||
4313 | 82 | |||
4314 | 83 | typedef Manager Interface; | ||
4315 | 84 | typedef std::tuple<core::dbus::types::ObjectPath, std::map<std::string, std::string>> ArgumentType; | ||
4316 | 85 | }; | ||
4317 | 86 | |||
4318 | 87 | struct ModemRemoved | ||
4319 | 88 | { | ||
4320 | 89 | static const std::string& name() | ||
4321 | 90 | { | ||
4322 | 91 | static const std::string s{"ModemRemoved"}; | ||
4323 | 92 | return s; | ||
4324 | 93 | } | ||
4325 | 94 | |||
4326 | 95 | typedef Manager Interface; | ||
4327 | 96 | typedef core::dbus::types::ObjectPath ArgumentType; | ||
4328 | 97 | }; | ||
4329 | 98 | |||
4330 | 99 | struct Modem | ||
4331 | 100 | { | ||
4332 | 101 | static const std::string& name() | ||
4333 | 102 | { | ||
4334 | 103 | static const std::string s{"org.ofono.Modem"}; | ||
4335 | 104 | return s; | ||
4336 | 105 | } | ||
4337 | 106 | |||
4338 | 107 | struct GetProperties | ||
4350 | 108 | { | 55 | { |
4351 | 109 | static const std::string& name() | 56 | static const std::string& name() |
4352 | 110 | { | 57 | { |
4354 | 111 | static const std::string s{"GetProperties"}; | 58 | static const std::string s{"GetModems"}; |
4355 | 112 | return s; | 59 | return s; |
4356 | 113 | } | 60 | } |
4357 | 114 | 61 | ||
4360 | 115 | typedef Modem Interface; | 62 | typedef Manager Interface; |
4361 | 116 | typedef std::map<std::string, core::dbus::types::Variant> ValueType; | 63 | typedef std::vector<core::dbus::types::Struct<core::dbus::types::ObjectPath>> ResultType; |
4362 | 117 | 64 | ||
4363 | 118 | static std::chrono::milliseconds default_timeout() | 65 | static std::chrono::milliseconds default_timeout() |
4364 | 119 | { | 66 | { |
4365 | @@ -121,287 +68,37 @@ | |||
4366 | 121 | } | 68 | } |
4367 | 122 | }; | 69 | }; |
4368 | 123 | 70 | ||
4650 | 124 | struct PropertyChanged | 71 | struct ModemAdded |
4651 | 125 | { | 72 | { |
4652 | 126 | inline static std::string name() | 73 | static const std::string& name() |
4653 | 127 | { | 74 | { |
4654 | 128 | return "PropertyChanged"; | 75 | static const std::string s{"ModemAdded"}; |
4655 | 129 | } | 76 | return s; |
4656 | 130 | 77 | } | |
4657 | 131 | typedef Modem Interface; | 78 | |
4658 | 132 | 79 | typedef Manager Interface; | |
4659 | 133 | typedef std::tuple<std::string, core::dbus::types::Variant> ArgumentType; | 80 | typedef std::tuple<core::dbus::types::ObjectPath, std::map<std::string, std::string>> ArgumentType; |
4660 | 134 | }; | 81 | }; |
4661 | 135 | 82 | ||
4662 | 136 | struct Properties | 83 | struct ModemRemoved |
4663 | 137 | { | 84 | { |
4664 | 138 | struct Powered | 85 | static const std::string& name() |
4665 | 139 | { | 86 | { |
4666 | 140 | static const std::string& name() | 87 | static const std::string s{"ModemRemoved"}; |
4667 | 141 | { | 88 | return s; |
4668 | 142 | static const std::string s{"Powered"}; | 89 | } |
4669 | 143 | return s; | 90 | |
4670 | 144 | } | 91 | typedef Manager Interface; |
4671 | 145 | 92 | typedef core::dbus::types::ObjectPath ArgumentType; | |
4672 | 146 | typedef Modem Interface; | 93 | }; |
4673 | 147 | typedef bool ValueType; | 94 | |
4674 | 148 | static const bool readable = true; | 95 | struct Modem |
4675 | 149 | static const bool writable = true; | 96 | { |
4676 | 150 | }; | 97 | static const std::string& name() |
4677 | 151 | 98 | { | |
4678 | 152 | struct Online | 99 | static const std::string s{"org.ofono.Modem"}; |
4679 | 153 | { | 100 | return s; |
4680 | 154 | static const std::string& name() | 101 | } |
4400 | 155 | { | ||
4401 | 156 | static const std::string s{"Online"}; | ||
4402 | 157 | return s; | ||
4403 | 158 | } | ||
4404 | 159 | |||
4405 | 160 | typedef Modem Interface; | ||
4406 | 161 | typedef bool ValueType; | ||
4407 | 162 | static const bool readable = true; | ||
4408 | 163 | static const bool writable = true; | ||
4409 | 164 | }; | ||
4410 | 165 | |||
4411 | 166 | struct Lockdown | ||
4412 | 167 | { | ||
4413 | 168 | static const std::string& name() | ||
4414 | 169 | { | ||
4415 | 170 | static const std::string s{"Lockdown"}; | ||
4416 | 171 | return s; | ||
4417 | 172 | } | ||
4418 | 173 | |||
4419 | 174 | typedef Modem Interface; | ||
4420 | 175 | typedef bool ValueType; | ||
4421 | 176 | static const bool readable = true; | ||
4422 | 177 | static const bool writable = true; | ||
4423 | 178 | }; | ||
4424 | 179 | |||
4425 | 180 | struct Name | ||
4426 | 181 | { | ||
4427 | 182 | static const std::string& name() | ||
4428 | 183 | { | ||
4429 | 184 | static const std::string s{"Name"}; | ||
4430 | 185 | return s; | ||
4431 | 186 | } | ||
4432 | 187 | |||
4433 | 188 | typedef Modem Interface; | ||
4434 | 189 | typedef std::string ValueType; | ||
4435 | 190 | static const bool readable = true; | ||
4436 | 191 | static const bool writable = false; | ||
4437 | 192 | }; | ||
4438 | 193 | |||
4439 | 194 | struct Manufacturer | ||
4440 | 195 | { | ||
4441 | 196 | static const std::string& name() | ||
4442 | 197 | { | ||
4443 | 198 | static const std::string s{"Manufacturer"}; | ||
4444 | 199 | return s; | ||
4445 | 200 | } | ||
4446 | 201 | |||
4447 | 202 | typedef Modem Interface; | ||
4448 | 203 | typedef std::string ValueType; | ||
4449 | 204 | static const bool readable = true; | ||
4450 | 205 | static const bool writable = false; | ||
4451 | 206 | }; | ||
4452 | 207 | |||
4453 | 208 | struct Model | ||
4454 | 209 | { | ||
4455 | 210 | static const std::string& name() | ||
4456 | 211 | { | ||
4457 | 212 | static const std::string s{"Model"}; | ||
4458 | 213 | return s; | ||
4459 | 214 | } | ||
4460 | 215 | |||
4461 | 216 | typedef Modem Interface; | ||
4462 | 217 | typedef std::string ValueType; | ||
4463 | 218 | static const bool readable = true; | ||
4464 | 219 | static const bool writable = false; | ||
4465 | 220 | }; | ||
4466 | 221 | |||
4467 | 222 | struct Revision | ||
4468 | 223 | { | ||
4469 | 224 | static const std::string& name() | ||
4470 | 225 | { | ||
4471 | 226 | static const std::string s{"Revision"}; | ||
4472 | 227 | return s; | ||
4473 | 228 | } | ||
4474 | 229 | |||
4475 | 230 | typedef Modem Interface; | ||
4476 | 231 | typedef std::string ValueType; | ||
4477 | 232 | static const bool readable = true; | ||
4478 | 233 | static const bool writable = false; | ||
4479 | 234 | }; | ||
4480 | 235 | |||
4481 | 236 | struct Serial | ||
4482 | 237 | { | ||
4483 | 238 | static const std::string& name() | ||
4484 | 239 | { | ||
4485 | 240 | static const std::string s{"Serial"}; | ||
4486 | 241 | return s; | ||
4487 | 242 | } | ||
4488 | 243 | |||
4489 | 244 | typedef Modem Interface; | ||
4490 | 245 | typedef std::string ValueType; | ||
4491 | 246 | static const bool readable = true; | ||
4492 | 247 | static const bool writable = false; | ||
4493 | 248 | }; | ||
4494 | 249 | |||
4495 | 250 | struct Features | ||
4496 | 251 | { | ||
4497 | 252 | static constexpr const char* net{"net"}; | ||
4498 | 253 | static constexpr const char* rat{"rat"}; | ||
4499 | 254 | static constexpr const char* cbs{"cbs"}; | ||
4500 | 255 | static constexpr const char* sms{"sms"}; | ||
4501 | 256 | static constexpr const char* sim{"sim"}; | ||
4502 | 257 | static constexpr const char* stk{"stk"}; | ||
4503 | 258 | static constexpr const char* ussd{"ussd"}; | ||
4504 | 259 | static constexpr const char* gprs{"gprs"}; | ||
4505 | 260 | static constexpr const char* tty{"tty"}; | ||
4506 | 261 | static constexpr const char* gps{"gps"}; | ||
4507 | 262 | |||
4508 | 263 | static const std::string& name() | ||
4509 | 264 | { | ||
4510 | 265 | static const std::string s{"Features"}; | ||
4511 | 266 | return s; | ||
4512 | 267 | } | ||
4513 | 268 | |||
4514 | 269 | typedef Modem Interface; | ||
4515 | 270 | typedef std::vector<std::string> ValueType; | ||
4516 | 271 | static const bool readable = true; | ||
4517 | 272 | static const bool writable = false; | ||
4518 | 273 | }; | ||
4519 | 274 | |||
4520 | 275 | struct Interfaces | ||
4521 | 276 | { | ||
4522 | 277 | static constexpr const char* assisted_satellite_navigation | ||
4523 | 278 | { | ||
4524 | 279 | "org.ofono.AssistedSatelliteNavigation" | ||
4525 | 280 | }; | ||
4526 | 281 | static constexpr const char* audio_settings | ||
4527 | 282 | { | ||
4528 | 283 | "org.ofono.AudioSettings" | ||
4529 | 284 | }; | ||
4530 | 285 | static constexpr const char* call_barring | ||
4531 | 286 | { | ||
4532 | 287 | "org.ofono.CallBarring" | ||
4533 | 288 | }; | ||
4534 | 289 | static constexpr const char* call_forwarding | ||
4535 | 290 | { | ||
4536 | 291 | "org.ofono.CallForwarding" | ||
4537 | 292 | }; | ||
4538 | 293 | static constexpr const char* call_meter | ||
4539 | 294 | { | ||
4540 | 295 | "org.ofono.CallMeter" | ||
4541 | 296 | }; | ||
4542 | 297 | static constexpr const char* call_settings | ||
4543 | 298 | { | ||
4544 | 299 | "org.ofono.CallSettings" | ||
4545 | 300 | }; | ||
4546 | 301 | static constexpr const char* call_volume | ||
4547 | 302 | { | ||
4548 | 303 | "org.ofono.CallVolume" | ||
4549 | 304 | }; | ||
4550 | 305 | static constexpr const char* cell_broadcast | ||
4551 | 306 | { | ||
4552 | 307 | "org.ofono.CellBroadcast" | ||
4553 | 308 | }; | ||
4554 | 309 | static constexpr const char* hands_free | ||
4555 | 310 | { | ||
4556 | 311 | "org.ofono.Handsfree" | ||
4557 | 312 | }; | ||
4558 | 313 | static constexpr const char* location_reporting | ||
4559 | 314 | { | ||
4560 | 315 | "org.ofono.LocationReporting" | ||
4561 | 316 | }; | ||
4562 | 317 | static constexpr const char* message_manager | ||
4563 | 318 | { | ||
4564 | 319 | "org.ofono.MessageManager" | ||
4565 | 320 | }; | ||
4566 | 321 | static constexpr const char* message_waiting | ||
4567 | 322 | { | ||
4568 | 323 | "org.ofono.MessageWaiting" | ||
4569 | 324 | }; | ||
4570 | 325 | static constexpr const char* network_registration | ||
4571 | 326 | { | ||
4572 | 327 | "org.ofono.NetworkRegistration" | ||
4573 | 328 | }; | ||
4574 | 329 | static constexpr const char* phonebook | ||
4575 | 330 | { | ||
4576 | 331 | "org.ofono.Phonebook" | ||
4577 | 332 | }; | ||
4578 | 333 | static constexpr const char* push_notification | ||
4579 | 334 | { | ||
4580 | 335 | "org.ofono.PushNotification" | ||
4581 | 336 | }; | ||
4582 | 337 | static constexpr const char* radio_settings | ||
4583 | 338 | { | ||
4584 | 339 | "org.ofono.RadioSettings" | ||
4585 | 340 | }; | ||
4586 | 341 | static constexpr const char* sim_manager | ||
4587 | 342 | { | ||
4588 | 343 | "org.ofono.SimManager" | ||
4589 | 344 | }; | ||
4590 | 345 | static constexpr const char* smart_messaging | ||
4591 | 346 | { | ||
4592 | 347 | "org.ofono.SmartMessaging" | ||
4593 | 348 | }; | ||
4594 | 349 | static constexpr const char* sim_toolkit | ||
4595 | 350 | { | ||
4596 | 351 | "org.ofono.SimToolkit" | ||
4597 | 352 | }; | ||
4598 | 353 | static constexpr const char* supplementary_services | ||
4599 | 354 | { | ||
4600 | 355 | "org.ofono.SupplementaryServices" | ||
4601 | 356 | }; | ||
4602 | 357 | static constexpr const char* text_telephony | ||
4603 | 358 | { | ||
4604 | 359 | "org.ofono.TextTelephony" | ||
4605 | 360 | }; | ||
4606 | 361 | static constexpr const char* voice_call_manager | ||
4607 | 362 | { | ||
4608 | 363 | "org.ofono.VoiceCallManager" | ||
4609 | 364 | }; | ||
4610 | 365 | |||
4611 | 366 | static const std::string& name() | ||
4612 | 367 | { | ||
4613 | 368 | static const std::string s{"Interfaces"}; | ||
4614 | 369 | return s; | ||
4615 | 370 | } | ||
4616 | 371 | |||
4617 | 372 | typedef Modem Interface; | ||
4618 | 373 | typedef std::vector<std::string> ValueType; | ||
4619 | 374 | static const bool readable = true; | ||
4620 | 375 | static const bool writable = false; | ||
4621 | 376 | }; | ||
4622 | 377 | |||
4623 | 378 | struct Type | ||
4624 | 379 | { | ||
4625 | 380 | static constexpr const char* test{"test"}; | ||
4626 | 381 | static constexpr const char* hfp{"hfp"}; | ||
4627 | 382 | static constexpr const char* sap{"sap"}; | ||
4628 | 383 | static constexpr const char* hardware{"hardware"}; | ||
4629 | 384 | |||
4630 | 385 | static const std::string& name() | ||
4631 | 386 | { | ||
4632 | 387 | static const std::string s{"Type"}; | ||
4633 | 388 | return s; | ||
4634 | 389 | } | ||
4635 | 390 | |||
4636 | 391 | typedef Modem Interface; | ||
4637 | 392 | typedef std::string ValueType; | ||
4638 | 393 | static const bool readable = true; | ||
4639 | 394 | static const bool writable = false; | ||
4640 | 395 | }; | ||
4641 | 396 | }; | ||
4642 | 397 | |||
4643 | 398 | struct NetworkRegistration | ||
4644 | 399 | { | ||
4645 | 400 | static const std::string& name() | ||
4646 | 401 | { | ||
4647 | 402 | static const std::string s{"org.ofono.NetworkRegistration"}; | ||
4648 | 403 | return s; | ||
4649 | 404 | } | ||
4681 | 405 | 102 | ||
4682 | 406 | struct GetProperties | 103 | struct GetProperties |
4683 | 407 | { | 104 | { |
4684 | @@ -411,7 +108,7 @@ | |||
4685 | 411 | return s; | 108 | return s; |
4686 | 412 | } | 109 | } |
4687 | 413 | 110 | ||
4689 | 414 | typedef NetworkRegistration Interface; | 111 | typedef Modem Interface; |
4690 | 415 | typedef std::map<std::string, core::dbus::types::Variant> ValueType; | 112 | typedef std::map<std::string, core::dbus::types::Variant> ValueType; |
4691 | 416 | 113 | ||
4692 | 417 | static std::chrono::milliseconds default_timeout() | 114 | static std::chrono::milliseconds default_timeout() |
4693 | @@ -427,229 +124,498 @@ | |||
4694 | 427 | return "PropertyChanged"; | 124 | return "PropertyChanged"; |
4695 | 428 | } | 125 | } |
4696 | 429 | 126 | ||
4698 | 430 | typedef NetworkRegistration Interface; | 127 | typedef Modem Interface; |
4699 | 431 | 128 | ||
4700 | 432 | typedef std::tuple<std::string, core::dbus::types::Variant> ArgumentType; | 129 | typedef std::tuple<std::string, core::dbus::types::Variant> ArgumentType; |
4701 | 433 | }; | 130 | }; |
4702 | 434 | 131 | ||
4888 | 435 | struct Status | 132 | struct Properties |
4889 | 436 | { | 133 | { |
4890 | 437 | enum class Value | 134 | struct Powered |
4891 | 438 | { | 135 | { |
4892 | 439 | unregistered, | 136 | static const std::string& name() |
4893 | 440 | registered, | 137 | { |
4894 | 441 | searching, | 138 | static const std::string s{"Powered"}; |
4895 | 442 | denied, | 139 | return s; |
4896 | 443 | unknown, | 140 | } |
4897 | 444 | roaming | 141 | |
4898 | 445 | }; | 142 | typedef Modem Interface; |
4899 | 446 | 143 | typedef bool ValueType; | |
4900 | 447 | static constexpr const char* unregistered | 144 | static const bool readable = true; |
4901 | 448 | { | 145 | static const bool writable = true; |
4902 | 449 | "unregistered" | 146 | }; |
4903 | 450 | }; | 147 | |
4904 | 451 | static constexpr const char* registered | 148 | struct Online |
4905 | 452 | { | 149 | { |
4906 | 453 | "registered" | 150 | static const std::string& name() |
4907 | 454 | }; | 151 | { |
4908 | 455 | static constexpr const char* searching | 152 | static const std::string s{"Online"}; |
4909 | 456 | { | 153 | return s; |
4910 | 457 | "searching" | 154 | } |
4911 | 458 | }; | 155 | |
4912 | 459 | static constexpr const char* denied | 156 | typedef Modem Interface; |
4913 | 460 | { | 157 | typedef bool ValueType; |
4914 | 461 | "denied" | 158 | static const bool readable = true; |
4915 | 462 | }; | 159 | static const bool writable = true; |
4916 | 463 | static constexpr const char* unknown | 160 | }; |
4917 | 464 | { | 161 | |
4918 | 465 | "unknown" | 162 | struct Lockdown |
4919 | 466 | }; | 163 | { |
4920 | 467 | static constexpr const char* roaming | 164 | static const std::string& name() |
4921 | 468 | { | 165 | { |
4922 | 469 | "roaming" | 166 | static const std::string s{"Lockdown"}; |
4923 | 470 | }; | 167 | return s; |
4924 | 471 | 168 | } | |
4925 | 472 | static const char* value_to_string(Value value) | 169 | |
4926 | 473 | { | 170 | typedef Modem Interface; |
4927 | 474 | switch (value) | 171 | typedef bool ValueType; |
4928 | 475 | { | 172 | static const bool readable = true; |
4929 | 476 | case Value::unregistered: return unregistered; | 173 | static const bool writable = true; |
4930 | 477 | case Value::registered: return registered; | 174 | }; |
4931 | 478 | case Value::searching: return searching; | 175 | |
4932 | 479 | case Value::denied: return denied; | 176 | struct Name |
4933 | 480 | case Value::unknown: return unknown; | 177 | { |
4934 | 481 | case Value::roaming: return roaming; | 178 | static const std::string& name() |
4935 | 482 | } | 179 | { |
4936 | 483 | 180 | static const std::string s{"Name"}; | |
4937 | 484 | return nullptr; | 181 | return s; |
4938 | 485 | } | 182 | } |
4939 | 486 | 183 | ||
4940 | 487 | static const std::string& name() | 184 | typedef Modem Interface; |
4941 | 488 | { | 185 | typedef std::string ValueType; |
4942 | 489 | static const std::string s{"Status"}; | 186 | static const bool readable = true; |
4943 | 490 | return s; | 187 | static const bool writable = false; |
4944 | 491 | } | 188 | }; |
4945 | 492 | 189 | ||
4946 | 493 | typedef NetworkRegistration Interface; | 190 | struct Manufacturer |
4947 | 494 | typedef std::string ValueType; | 191 | { |
4948 | 495 | static const bool readable = true; | 192 | static const std::string& name() |
4949 | 496 | static const bool writable = false; | 193 | { |
4950 | 497 | }; | 194 | static const std::string s{"Manufacturer"}; |
4951 | 498 | 195 | return s; | |
4952 | 499 | struct LocationAreaCode | 196 | } |
4953 | 500 | { | 197 | |
4954 | 501 | static const std::string& name() | 198 | typedef Modem Interface; |
4955 | 502 | { | 199 | typedef std::string ValueType; |
4956 | 503 | static const std::string s{"LocationAreaCode"}; | 200 | static const bool readable = true; |
4957 | 504 | return s; | 201 | static const bool writable = false; |
4958 | 505 | } | 202 | }; |
4959 | 506 | 203 | ||
4960 | 507 | typedef NetworkRegistration Interface; | 204 | struct Model |
4961 | 508 | typedef std::uint16_t ValueType; | 205 | { |
4962 | 509 | static const bool readable = true; | 206 | static const std::string& name() |
4963 | 510 | static const bool writable = false; | 207 | { |
4964 | 511 | }; | 208 | static const std::string s{"Model"}; |
4965 | 512 | 209 | return s; | |
4966 | 513 | struct CellId | 210 | } |
4967 | 514 | { | 211 | |
4968 | 515 | static const std::string& name() | 212 | typedef Modem Interface; |
4969 | 516 | { | 213 | typedef std::string ValueType; |
4970 | 517 | static const std::string s{"CellId"}; | 214 | static const bool readable = true; |
4971 | 518 | return s; | 215 | static const bool writable = false; |
4972 | 519 | } | 216 | }; |
4973 | 520 | 217 | ||
4974 | 521 | typedef NetworkRegistration Interface; | 218 | struct Revision |
4975 | 522 | typedef std::uint32_t ValueType; | 219 | { |
4976 | 523 | static const bool readable = true; | 220 | static const std::string& name() |
4977 | 524 | static const bool writable = false; | 221 | { |
4978 | 525 | }; | 222 | static const std::string s{"Revision"}; |
4979 | 526 | 223 | return s; | |
4980 | 527 | struct MobileCountryCode | 224 | } |
4981 | 528 | { | 225 | |
4982 | 529 | static const std::string& name() | 226 | typedef Modem Interface; |
4983 | 530 | { | 227 | typedef std::string ValueType; |
4984 | 531 | static const std::string s{"MobileCountryCode"}; | 228 | static const bool readable = true; |
4985 | 532 | return s; | 229 | static const bool writable = false; |
4986 | 533 | } | 230 | }; |
4987 | 534 | 231 | ||
4988 | 535 | typedef NetworkRegistration Interface; | 232 | struct Serial |
4989 | 536 | typedef std::string ValueType; | 233 | { |
4990 | 537 | static const bool readable = true; | 234 | static const std::string& name() |
4991 | 538 | static const bool writable = false; | 235 | { |
4992 | 539 | }; | 236 | static const std::string s{"Serial"}; |
4993 | 540 | 237 | return s; | |
4994 | 541 | struct MobileNetworkCode | 238 | } |
4995 | 542 | { | 239 | |
4996 | 543 | static const std::string& name() | 240 | typedef Modem Interface; |
4997 | 544 | { | 241 | typedef std::string ValueType; |
4998 | 545 | static const std::string s{"MobileNetworkCode"}; | 242 | static const bool readable = true; |
4999 | 546 | return s; | 243 | static const bool writable = false; |
5000 | 547 | } | 244 | }; |
4816 | 548 | |||
4817 | 549 | typedef NetworkRegistration Interface; | ||
4818 | 550 | typedef std::string ValueType; | ||
4819 | 551 | static const bool readable = true; | ||
4820 | 552 | static const bool writable = false; | ||
4821 | 553 | }; | ||
4822 | 554 | |||
4823 | 555 | struct Technology | ||
4824 | 556 | { | ||
4825 | 557 | static const char* gsm() { return "gsm"; } | ||
4826 | 558 | static const char* edge() { return "edge"; } | ||
4827 | 559 | static const char* umts() { return "umts"; } | ||
4828 | 560 | static const char* hspa() { return "hspa"; } | ||
4829 | 561 | static const char* lte() { return "lte"; } | ||
4830 | 562 | |||
4831 | 563 | static const std::string& name() | ||
4832 | 564 | { | ||
4833 | 565 | static const std::string s{"Technology"}; | ||
4834 | 566 | return s; | ||
4835 | 567 | } | ||
4836 | 568 | |||
4837 | 569 | typedef NetworkRegistration Interface; | ||
4838 | 570 | typedef std::string ValueType; | ||
4839 | 571 | static const bool readable = true; | ||
4840 | 572 | static const bool writable = false; | ||
4841 | 573 | }; | ||
4842 | 574 | |||
4843 | 575 | struct Strength | ||
4844 | 576 | { | ||
4845 | 577 | static const std::string& name() | ||
4846 | 578 | { | ||
4847 | 579 | static const std::string s{"Strength"}; | ||
4848 | 580 | return s; | ||
4849 | 581 | } | ||
4850 | 582 | |||
4851 | 583 | typedef NetworkRegistration Interface; | ||
4852 | 584 | typedef std::int8_t ValueType; | ||
4853 | 585 | static const bool readable = true; | ||
4854 | 586 | static const bool writable = false; | ||
4855 | 587 | }; | ||
4856 | 588 | |||
4857 | 589 | NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object) | ||
4858 | 590 | : object(object), | ||
4859 | 591 | signals | ||
4860 | 592 | { | ||
4861 | 593 | object->get_signal<PropertyChanged>() | ||
4862 | 594 | } | ||
4863 | 595 | { | ||
4864 | 596 | } | ||
4865 | 597 | |||
4866 | 598 | // Calling this function might fail. However, we do not throw and only log | ||
4867 | 599 | // the issue for later forensics. | ||
4868 | 600 | bool refresh_properties() const | ||
4869 | 601 | { | ||
4870 | 602 | auto result = object->invoke_method_synchronously<GetProperties, GetProperties::ValueType>(); | ||
4871 | 603 | |||
4872 | 604 | if (result.is_error()) | ||
4873 | 605 | { | ||
4874 | 606 | LOG(WARNING) << "Could not refresh properties for org::Ofono::Modem::NetworkRegistration: " << result.error().print(); | ||
4875 | 607 | return false; | ||
4876 | 608 | } | ||
4877 | 609 | |||
4878 | 610 | properties = result.value(); | ||
4879 | 611 | return true; | ||
4880 | 612 | } | ||
4881 | 613 | |||
4882 | 614 | template<typename Property> | ||
4883 | 615 | typename Property::ValueType get(bool refresh = true) const | ||
4884 | 616 | { | ||
4885 | 617 | if (refresh) | ||
4886 | 618 | { | ||
4887 | 619 | if (not refresh_properties()) |
PASSED: Continuous integration, rev:184 jenkins. qa.ubuntu. com/job/ location- service- ci/362/ jenkins. qa.ubuntu. com/job/ location- service- vivid-amd64- ci/34 jenkins. qa.ubuntu. com/job/ location- service- vivid-armhf- ci/34 jenkins. qa.ubuntu. com/job/ location- service- vivid-armhf- ci/34/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ location- service- vivid-i386- ci/34
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/location- service- ci/362/ rebuild
http://