Merge lp:~thomas-voss/location-service/unify-source-code-formatting into lp:location-service/trunk
- unify-source-code-formatting
- Merge into trunk
Proposed by
Thomas Voß
Status: | Needs review |
---|---|
Proposed branch: | lp:~thomas-voss/location-service/unify-source-code-formatting |
Merge into: | lp:location-service/trunk |
Prerequisite: | lp:~thomas-voss/location-service/add-documentation-and-tooling |
Diff against target: |
9479 lines (+2308/-2558) 103 files modified
_clang-format (+1/-1) include/location_service/com/ubuntu/location/accuracy.h (+4/-5) include/location_service/com/ubuntu/location/codec.h (+33/-33) include/location_service/com/ubuntu/location/configuration.h (+1/-1) include/location_service/com/ubuntu/location/connectivity/bounded_integer.h (+8/-10) include/location_service/com/ubuntu/location/connectivity/manager.h (+0/-1) include/location_service/com/ubuntu/location/connectivity/radio_cell.h (+69/-84) include/location_service/com/ubuntu/location/connectivity/wireless_network.h (+10/-10) include/location_service/com/ubuntu/location/criteria.h (+5/-5) include/location_service/com/ubuntu/location/default_provider_selection_policy.h (+1/-1) include/location_service/com/ubuntu/location/logging.h (+0/-1) include/location_service/com/ubuntu/location/optional.h (+1/-1) include/location_service/com/ubuntu/location/provider.h (+9/-9) include/location_service/com/ubuntu/location/provider_factory.h (+2/-2) include/location_service/com/ubuntu/location/provider_selection.h (+3/-3) include/location_service/com/ubuntu/location/provider_selection_policy.h (+2/-2) include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h (+9/-10) include/location_service/com/ubuntu/location/providers/geoclue/provider.h (+2/-2) include/location_service/com/ubuntu/location/providers/remote/interface.h (+14/-29) include/location_service/com/ubuntu/location/providers/remote/skeleton.h (+6/-2) include/location_service/com/ubuntu/location/providers/remote/stub.h (+6/-2) include/location_service/com/ubuntu/location/providers/skyhook/provider.h (+3/-3) include/location_service/com/ubuntu/location/proxy_provider.h (+1/-1) include/location_service/com/ubuntu/location/service/configuration.h (+2/-2) include/location_service/com/ubuntu/location/service/default_permission_manager.h (+4/-4) include/location_service/com/ubuntu/location/service/interface.h (+15/-27) include/location_service/com/ubuntu/location/service/permission_manager.h (+1/-1) include/location_service/com/ubuntu/location/service/session/implementation.h (+2/-2) include/location_service/com/ubuntu/location/service/session/interface.h (+1/-1) include/location_service/com/ubuntu/location/service/session/stub.h (+2/-2) include/location_service/com/ubuntu/location/service/skeleton.h (+10/-12) include/location_service/com/ubuntu/location/service/stub.h (+3/-3) include/location_service/com/ubuntu/location/space_vehicle.h (+26/-27) include/location_service/com/ubuntu/location/units/units.h (+3/-4) include/location_service/com/ubuntu/location/update.h (+3/-4) include/location_service/com/ubuntu/location/wgs84/altitude.h (+1/-1) include/location_service/com/ubuntu/location/wgs84/coordinate.h (+10/-10) include/location_service/com/ubuntu/location/wgs84/latitude.h (+1/-1) include/location_service/com/ubuntu/location/wgs84/longitude.h (+1/-1) src/location_service/com/ubuntu/location/boost_ptree_settings.cpp (+1/-1) src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp (+82/-125) src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h (+6/-6) src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp (+41/-61) src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h (+2/-2) src/location_service/com/ubuntu/location/connectivity/manager.cpp (+48/-14) src/location_service/com/ubuntu/location/connectivity/nm.h (+25/-34) src/location_service/com/ubuntu/location/connectivity/ofono.h (+539/-599) src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp (+97/-105) src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.h (+19/-11) src/location_service/com/ubuntu/location/connectivity/radio_cell.cpp (+29/-18) src/location_service/com/ubuntu/location/connectivity/wireless_network.cpp (+9/-3) src/location_service/com/ubuntu/location/criteria.cpp (+8/-5) src/location_service/com/ubuntu/location/default_permission_manager.cpp (+2/-2) src/location_service/com/ubuntu/location/default_provider_selection_policy.cpp (+23/-27) src/location_service/com/ubuntu/location/engine.cpp (+56/-63) src/location_service/com/ubuntu/location/engine.h (+26/-44) src/location_service/com/ubuntu/location/non_selecting_provider_selection_policy.cpp (+11/-13) src/location_service/com/ubuntu/location/position.cpp (+13/-13) src/location_service/com/ubuntu/location/provider.cpp (+2/-2) src/location_service/com/ubuntu/location/provider_factory.cpp (+5/-7) src/location_service/com/ubuntu/location/providers/config.cpp (+13/-23) src/location_service/com/ubuntu/location/providers/dummy/provider.cpp (+14/-27) src/location_service/com/ubuntu/location/providers/dummy/provider.h (+29/-57) src/location_service/com/ubuntu/location/providers/geoclue/provider.cpp (+36/-38) src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp (+70/-83) src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h (+24/-20) src/location_service/com/ubuntu/location/providers/gps/hardware_abstraction_layer.h (+0/-1) src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h (+23/-8) src/location_service/com/ubuntu/location/providers/gps/null_gps_xtra_downloader.h (+18/-2) src/location_service/com/ubuntu/location/providers/gps/provider.cpp (+10/-11) src/location_service/com/ubuntu/location/providers/gps/provider.h (+3/-3) src/location_service/com/ubuntu/location/providers/remote/provider.cpp (+92/-105) src/location_service/com/ubuntu/location/providers/skyhook/provider.cpp (+40/-43) src/location_service/com/ubuntu/location/proxy_provider.cpp (+3/-5) src/location_service/com/ubuntu/location/satellite_based_positioning_state.cpp (+14/-19) src/location_service/com/ubuntu/location/service/daemon.cpp (+83/-86) src/location_service/com/ubuntu/location/service/daemon.h (+13/-19) 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/default_configuration.cpp (+0/-1) src/location_service/com/ubuntu/location/service/default_configuration.h (+1/-1) src/location_service/com/ubuntu/location/service/demultiplexing_reporter.cpp (+6/-7) src/location_service/com/ubuntu/location/service/demultiplexing_reporter.h (+12/-2) src/location_service/com/ubuntu/location/service/harvester.cpp (+4/-4) src/location_service/com/ubuntu/location/service/harvester.h (+0/-1) src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp (+39/-46) src/location_service/com/ubuntu/location/service/ichnaea_reporter.h (+25/-24) src/location_service/com/ubuntu/location/service/implementation.cpp (+20/-35) src/location_service/com/ubuntu/location/service/implementation.h (+1/-1) src/location_service/com/ubuntu/location/service/program_options.h (+30/-27) src/location_service/com/ubuntu/location/service/provider_daemon.cpp (+17/-25) src/location_service/com/ubuntu/location/service/provider_daemon_main.cpp (+4/-4) src/location_service/com/ubuntu/location/service/runtime_tests.cpp (+22/-16) src/location_service/com/ubuntu/location/service/session/implementation.cpp (+27/-31) src/location_service/com/ubuntu/location/service/session/interface_p.h (+21/-41) src/location_service/com/ubuntu/location/service/session/skeleton.cpp (+82/-66) src/location_service/com/ubuntu/location/service/session/stub.cpp (+65/-50) src/location_service/com/ubuntu/location/service/skeleton.cpp (+62/-86) src/location_service/com/ubuntu/location/service/stub.cpp (+5/-5) src/location_service/com/ubuntu/location/service/trust_store_permission_manager.cpp (+20/-24) src/location_service/com/ubuntu/location/service/trust_store_permission_manager.h (+2/-2) src/location_service/com/ubuntu/location/settings.h (+17/-11) src/location_service/com/ubuntu/location/wifi_and_cell_reporting_state.cpp (+14/-19) |
To merge this branch: | bzr merge lp:~thomas-voss/location-service/unify-source-code-formatting |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Ubuntu Phablet Team | Pending | ||
Review via email: mp+248335@code.launchpad.net |
Commit message
Unify source code formatting.
Description of the change
Unify source code formatting.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Unmerged revisions
- 172. By Thomas Voß
-
Unify source code formatting.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '_clang-format' |
2 | --- _clang-format 2015-02-03 09:10:02 +0000 |
3 | +++ _clang-format 2015-02-03 09:10:02 +0000 |
4 | @@ -5,7 +5,7 @@ |
5 | AlignEscapedNewlinesLeft: false |
6 | AlignTrailingComments: true |
7 | AllowAllParametersOfDeclarationOnNextLine: true |
8 | -AllowShortBlocksOnASingleLine: false |
9 | +AllowShortBlocksOnASingleLine: true |
10 | AllowShortIfStatementsOnASingleLine: false |
11 | AllowShortLoopsOnASingleLine: false |
12 | AllowShortFunctionsOnASingleLine: All |
13 | |
14 | === modified file 'include/location_service/com/ubuntu/location/accuracy.h' |
15 | --- include/location_service/com/ubuntu/location/accuracy.h 2013-05-28 14:41:06 +0000 |
16 | +++ include/location_service/com/ubuntu/location/accuracy.h 2015-02-03 09:10:02 +0000 |
17 | @@ -34,12 +34,12 @@ |
18 | postalcode, |
19 | street, |
20 | detailed, |
21 | - |
22 | + |
23 | best = detailed, |
24 | worst = country |
25 | }; |
26 | |
27 | -template<typename T> |
28 | +template <typename T> |
29 | struct AccuracyTraits |
30 | { |
31 | static AccuracyLevel classify(const T& instance); |
32 | @@ -47,7 +47,7 @@ |
33 | static T worst(); |
34 | }; |
35 | |
36 | -template<typename T> |
37 | +template <typename T> |
38 | struct Accuracy |
39 | { |
40 | typedef typename T::Unit Unit; |
41 | @@ -64,13 +64,12 @@ |
42 | T value; |
43 | }; |
44 | |
45 | -template<typename T> |
46 | +template <typename T> |
47 | inline std::ostream& operator<<(std::ostream& out, const Accuracy<T>& update) |
48 | { |
49 | out << "Accuracy(" << update.value << ")"; |
50 | return out; |
51 | } |
52 | - |
53 | } |
54 | } |
55 | } |
56 | |
57 | === modified file 'include/location_service/com/ubuntu/location/codec.h' |
58 | --- include/location_service/com/ubuntu/location/codec.h 2014-09-12 15:04:21 +0000 |
59 | +++ include/location_service/com/ubuntu/location/codec.h 2015-02-03 09:10:02 +0000 |
60 | @@ -38,7 +38,7 @@ |
61 | { |
62 | namespace helper |
63 | { |
64 | -template<typename T> |
65 | +template <typename T> |
66 | struct TypeMapper<com::ubuntu::location::units::Quantity<T>> |
67 | { |
68 | constexpr static ArgumentType type_value() |
69 | @@ -63,7 +63,7 @@ |
70 | }; |
71 | } |
72 | |
73 | -template<typename T> |
74 | +template <typename T> |
75 | struct Codec<com::ubuntu::location::Optional<T>> |
76 | { |
77 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Optional<T>& in) |
78 | @@ -83,14 +83,15 @@ |
79 | typename com::ubuntu::location::Optional<T>::value_type value; |
80 | Codec<typename com::ubuntu::location::Optional<T>::value_type>::decode_argument(reader, value); |
81 | in = value; |
82 | - } else |
83 | + } |
84 | + else |
85 | { |
86 | in.reset(); |
87 | } |
88 | } |
89 | }; |
90 | |
91 | -template<typename T> |
92 | +template <typename T> |
93 | struct Codec<com::ubuntu::location::units::Quantity<T>> |
94 | { |
95 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::units::Quantity<T>& in) |
96 | @@ -106,8 +107,8 @@ |
97 | } |
98 | }; |
99 | |
100 | -template<typename T, typename U> |
101 | -struct Codec<com::ubuntu::location::wgs84::Coordinate<T,U>> |
102 | +template <typename T, typename U> |
103 | +struct Codec<com::ubuntu::location::wgs84::Coordinate<T, U>> |
104 | { |
105 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::wgs84::Coordinate<T, U>& in) |
106 | { |
107 | @@ -120,7 +121,7 @@ |
108 | } |
109 | }; |
110 | |
111 | -template<> |
112 | +template <> |
113 | struct Codec<com::ubuntu::location::Position> |
114 | { |
115 | typedef com::ubuntu::location::Position::Accuracy::Horizontal HorizontalAccuracy; |
116 | @@ -147,10 +148,9 @@ |
117 | } |
118 | }; |
119 | |
120 | - |
121 | namespace helper |
122 | { |
123 | -template<> |
124 | +template <> |
125 | struct TypeMapper<com::ubuntu::location::SpaceVehicle::Key> |
126 | { |
127 | constexpr static ArgumentType type_value() |
128 | @@ -169,12 +169,12 @@ |
129 | static std::string signature() |
130 | { |
131 | static const std::string s = |
132 | - helper::TypeMapper<std::uint32_t>::signature() + |
133 | - helper::TypeMapper<std::uint32_t>::signature(); |
134 | + helper::TypeMapper<std::uint32_t>::signature() + |
135 | + helper::TypeMapper<std::uint32_t>::signature(); |
136 | return s; |
137 | } |
138 | }; |
139 | -template<> |
140 | +template <> |
141 | struct TypeMapper<com::ubuntu::location::SpaceVehicle> |
142 | { |
143 | constexpr static ArgumentType type_value() |
144 | @@ -194,20 +194,20 @@ |
145 | { |
146 | std::string s = |
147 | DBUS_STRUCT_BEGIN_CHAR_AS_STRING + |
148 | - helper::TypeMapper<com::ubuntu::location::SpaceVehicle::Key>::signature() + |
149 | - helper::TypeMapper<float>::signature() + |
150 | - helper::TypeMapper<bool>::signature() + |
151 | - helper::TypeMapper<bool>::signature() + |
152 | - helper::TypeMapper<bool>::signature() + |
153 | - helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + |
154 | - helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + |
155 | + helper::TypeMapper<com::ubuntu::location::SpaceVehicle::Key>::signature() + |
156 | + helper::TypeMapper<float>::signature() + |
157 | + helper::TypeMapper<bool>::signature() + |
158 | + helper::TypeMapper<bool>::signature() + |
159 | + helper::TypeMapper<bool>::signature() + |
160 | + helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + |
161 | + helper::TypeMapper<com::ubuntu::location::units::Quantity<com::ubuntu::location::units::PlaneAngle>>::signature() + |
162 | DBUS_STRUCT_END_CHAR_AS_STRING; |
163 | return s; |
164 | } |
165 | }; |
166 | } |
167 | |
168 | -template<> |
169 | +template <> |
170 | struct Codec<com::ubuntu::location::SpaceVehicle::Key> |
171 | { |
172 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle::Key& in) |
173 | @@ -223,7 +223,7 @@ |
174 | } |
175 | }; |
176 | |
177 | -template<> |
178 | +template <> |
179 | struct Codec<com::ubuntu::location::SpaceVehicle> |
180 | { |
181 | inline static void encode_argument(Message::Writer& writer, const com::ubuntu::location::SpaceVehicle& in) |
182 | @@ -257,7 +257,7 @@ |
183 | |
184 | namespace helper |
185 | { |
186 | -template<> |
187 | +template <> |
188 | struct TypeMapper<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>> |
189 | { |
190 | constexpr static ArgumentType type_value() |
191 | @@ -280,7 +280,7 @@ |
192 | } |
193 | }; |
194 | } |
195 | -template<> |
196 | +template <> |
197 | struct Codec<std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>> |
198 | { |
199 | inline static void encode_argument(Message::Writer& writer, const std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& arg) |
200 | @@ -288,7 +288,7 @@ |
201 | types::Signature signature(helper::TypeMapper<com::ubuntu::location::SpaceVehicle>::signature()); |
202 | auto sub = writer.open_array(signature); |
203 | |
204 | - for(const auto& element : arg) |
205 | + for (const auto& element : arg) |
206 | { |
207 | Codec<com::ubuntu::location::SpaceVehicle>::encode_argument(sub, element.second); |
208 | } |
209 | @@ -308,7 +308,7 @@ |
210 | } |
211 | }; |
212 | |
213 | -template<> |
214 | +template <> |
215 | struct Codec<com::ubuntu::location::Criteria> |
216 | { |
217 | typedef com::ubuntu::location::units::Quantity<com::ubuntu::location::units::Length> HorizontalAccuracy; |
218 | @@ -343,7 +343,7 @@ |
219 | } |
220 | }; |
221 | |
222 | -template<> |
223 | +template <> |
224 | struct Codec<com::ubuntu::location::Provider::Features> |
225 | { |
226 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Provider::Features& in) |
227 | @@ -357,7 +357,7 @@ |
228 | } |
229 | }; |
230 | |
231 | -template<> |
232 | +template <> |
233 | struct Codec<com::ubuntu::location::Provider::Requirements> |
234 | { |
235 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Provider::Requirements& in) |
236 | @@ -371,7 +371,7 @@ |
237 | } |
238 | }; |
239 | |
240 | -template<> |
241 | +template <> |
242 | struct Codec<com::ubuntu::location::WifiAndCellIdReportingState> |
243 | { |
244 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::WifiAndCellIdReportingState& in) |
245 | @@ -387,7 +387,7 @@ |
246 | |
247 | namespace helper |
248 | { |
249 | -template<typename T> |
250 | +template <typename T> |
251 | struct TypeMapper<com::ubuntu::location::Update<T>> |
252 | { |
253 | constexpr static ArgumentType type_value() |
254 | @@ -406,14 +406,14 @@ |
255 | static std::string signature() |
256 | { |
257 | static const std::string s = |
258 | - helper::TypeMapper<T>::signature() + |
259 | - helper::TypeMapper<uint64_t>::signature(); |
260 | + helper::TypeMapper<T>::signature() + |
261 | + helper::TypeMapper<uint64_t>::signature(); |
262 | return s; |
263 | } |
264 | }; |
265 | } |
266 | |
267 | -template<typename T> |
268 | +template <typename T> |
269 | struct Codec<com::ubuntu::location::Update<T>> |
270 | { |
271 | static void encode_argument(Message::Writer& writer, const com::ubuntu::location::Update<T>& in) |
272 | @@ -426,7 +426,7 @@ |
273 | { |
274 | Codec<T>::decode_argument(reader, in.value); |
275 | in.when = com::ubuntu::location::Clock::Timestamp(com::ubuntu::location::Clock::Duration(reader.pop_int64())); |
276 | - } |
277 | + } |
278 | }; |
279 | } |
280 | } |
281 | |
282 | === modified file 'include/location_service/com/ubuntu/location/configuration.h' |
283 | --- include/location_service/com/ubuntu/location/configuration.h 2013-05-29 06:04:02 +0000 |
284 | +++ include/location_service/com/ubuntu/location/configuration.h 2015-02-03 09:10:02 +0000 |
285 | @@ -31,4 +31,4 @@ |
286 | } |
287 | } |
288 | |
289 | -#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONFIGURATION_H_ |
290 | \ No newline at end of file |
291 | +#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONFIGURATION_H_ |
292 | \ No newline at end of file |
293 | |
294 | === modified file 'include/location_service/com/ubuntu/location/connectivity/bounded_integer.h' |
295 | --- include/location_service/com/ubuntu/location/connectivity/bounded_integer.h 2014-06-10 11:53:01 +0000 |
296 | +++ include/location_service/com/ubuntu/location/connectivity/bounded_integer.h 2015-02-03 09:10:02 +0000 |
297 | @@ -33,7 +33,7 @@ |
298 | * @brief A helper class to handle bounded integer values, with an optional domain |
299 | * for tagging domain-specific types. |
300 | */ |
301 | -template<typename Tag, int min, int max, int inv = min-1> |
302 | +template <typename Tag, int min, int max, int inv = min - 1> |
303 | class BoundedInteger |
304 | { |
305 | public: |
306 | @@ -79,16 +79,14 @@ |
307 | // Capping to [0,1] |
308 | percent = std::min<float>(1., std::max<float>(0., percent)); |
309 | |
310 | - return BoundedInteger<Tag, min, max, inv> |
311 | - { |
312 | - static_cast<int>(minimum() + percent * range()) |
313 | - }; |
314 | + return BoundedInteger<Tag, min, max, inv>{ |
315 | + static_cast<int>(minimum() + percent * range())}; |
316 | } |
317 | |
318 | /** |
319 | * @brief Constructs an invalid instance. |
320 | */ |
321 | - inline BoundedInteger() : value(min-1) |
322 | + inline BoundedInteger() : value(min - 1) |
323 | { |
324 | } |
325 | |
326 | @@ -101,8 +99,8 @@ |
327 | { |
328 | if (value < min || value > max) |
329 | throw std::runtime_error( |
330 | - std::to_string(value) + " is not in " + "[" + |
331 | - std::to_string(min) + ", " + std::to_string(max) + "]"); |
332 | + std::to_string(value) + " is not in " + "[" + |
333 | + std::to_string(min) + ", " + std::to_string(max) + "]"); |
334 | } |
335 | |
336 | /** |
337 | @@ -170,8 +168,8 @@ |
338 | { |
339 | if (new_value < min || new_value > max) |
340 | throw std::runtime_error( |
341 | - std::to_string(new_value) + " is not in " + "[" + |
342 | - std::to_string(min) + ", " + std::to_string(max) + "]"); |
343 | + std::to_string(new_value) + " is not in " + "[" + |
344 | + std::to_string(min) + ", " + std::to_string(max) + "]"); |
345 | |
346 | value = new_value; |
347 | } |
348 | |
349 | === modified file 'include/location_service/com/ubuntu/location/connectivity/manager.h' |
350 | --- include/location_service/com/ubuntu/location/connectivity/manager.h 2014-07-10 16:44:26 +0000 |
351 | +++ include/location_service/com/ubuntu/location/connectivity/manager.h 2015-02-03 09:10:02 +0000 |
352 | @@ -154,7 +154,6 @@ |
353 | */ |
354 | virtual const core::Property<bool>& is_wwan_hardware_enabled() const = 0; |
355 | |
356 | - |
357 | /** |
358 | * @brief Returns a getable/observable property that describes the characteristics |
359 | * of the active network connection. |
360 | |
361 | === modified file 'include/location_service/com/ubuntu/location/connectivity/radio_cell.h' |
362 | --- include/location_service/com/ubuntu/location/connectivity/radio_cell.h 2014-06-10 11:53:01 +0000 |
363 | +++ include/location_service/com/ubuntu/location/connectivity/radio_cell.h 2015-02-03 09:10:02 +0000 |
364 | @@ -50,35 +50,53 @@ |
365 | }; |
366 | |
367 | /** @cond */ |
368 | - struct Mcc {}; |
369 | - struct Mnc {}; |
370 | - struct Lac {}; |
371 | - struct Id {}; |
372 | - struct Psc {}; |
373 | - struct Pid {}; |
374 | - struct Rss {}; |
375 | - struct Asu {}; |
376 | - struct Ta {}; |
377 | + struct Mcc |
378 | + { |
379 | + }; |
380 | + struct Mnc |
381 | + { |
382 | + }; |
383 | + struct Lac |
384 | + { |
385 | + }; |
386 | + struct Id |
387 | + { |
388 | + }; |
389 | + struct Psc |
390 | + { |
391 | + }; |
392 | + struct Pid |
393 | + { |
394 | + }; |
395 | + struct Rss |
396 | + { |
397 | + }; |
398 | + struct Asu |
399 | + { |
400 | + }; |
401 | + struct Ta |
402 | + { |
403 | + }; |
404 | |
405 | - template<int min, int max, int invalid = min-1> |
406 | + template <int min, int max, int invalid = min - 1> |
407 | using MobileCountryCode = BoundedInteger<Mcc, min, max, invalid>; |
408 | - template<int min, int max, int invalid = min-1> |
409 | + template <int min, int max, int invalid = min - 1> |
410 | using MobileNetworkCode = BoundedInteger<Mnc, min, max, invalid>; |
411 | - template<int min, int max, int invalid = min-1> |
412 | + template <int min, int max, int invalid = min - 1> |
413 | using LocationAreaCode = BoundedInteger<Lac, min, max, invalid>; |
414 | - template<int min, int max, int invalid = min-1> |
415 | + template <int min, int max, int invalid = min - 1> |
416 | using TrackingAreaCode = BoundedInteger<Lac, min, max, invalid>; |
417 | - template<int min, int max, int invalid = min-1> |
418 | + template <int min, int max, int invalid = min - 1> |
419 | using CellId = BoundedInteger<Id, min, max, invalid>; |
420 | - template<int min, int max, int invalid = min-1> |
421 | + template <int min, int max, int invalid = min - 1> |
422 | using PrimaryScramblingCode = BoundedInteger<Psc, min, max, invalid>; |
423 | - template<int min, int max, int invalid = min-1> |
424 | + template <int min, int max, int invalid = min - 1> |
425 | using PhysicalId = BoundedInteger<Pid, min, max, invalid>; |
426 | - template<int min, int max, int invalid = min-1> |
427 | + template <int min, int max, int invalid = min - 1> |
428 | using ReceivedSignalStrength = BoundedInteger<Rss, min, max, invalid>; |
429 | - template<int min, int max, int invalid = min-1> |
430 | + template <int min, int max, int invalid = min - 1> |
431 | using ArbitraryStrengthUnit = BoundedInteger<Asu, min, max, invalid>; |
432 | - template<int min, int max, int invalid = min-1> |
433 | + template <int min, int max, int invalid = min - 1> |
434 | using TimingAdvance = BoundedInteger<Ta, min, max, invalid>; |
435 | /** @endcond */ |
436 | |
437 | @@ -86,41 +104,31 @@ |
438 | struct Gsm |
439 | { |
440 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ |
441 | - typedef MobileCountryCode |
442 | - < |
443 | + typedef MobileCountryCode< |
444 | 0, |
445 | 999, |
446 | - std::numeric_limits<int>::max() |
447 | - > MCC; |
448 | + std::numeric_limits<int>::max()> MCC; |
449 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ |
450 | - typedef MobileNetworkCode |
451 | - < |
452 | + typedef MobileNetworkCode< |
453 | 0, |
454 | 999, |
455 | - std::numeric_limits<int>::max() |
456 | - > MNC; |
457 | + std::numeric_limits<int>::max()> MNC; |
458 | /** 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ |
459 | - typedef LocationAreaCode |
460 | - < |
461 | + typedef LocationAreaCode< |
462 | 0, |
463 | 65535, |
464 | - std::numeric_limits<int>::max() |
465 | - > LAC; |
466 | + std::numeric_limits<int>::max()> LAC; |
467 | /** 16-bit GSM Cell Identity described in TS 27.007, 0..65535, INT_MAX if unknown */ |
468 | - typedef CellId |
469 | - < |
470 | + typedef CellId< |
471 | 0, |
472 | 65535, |
473 | - std::numeric_limits<int>::max() |
474 | - > ID; |
475 | + std::numeric_limits<int>::max()> ID; |
476 | |
477 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ |
478 | - typedef ArbitraryStrengthUnit |
479 | - < |
480 | + typedef ArbitraryStrengthUnit< |
481 | 0, |
482 | 31, |
483 | - 99 |
484 | - > SignalStrength; |
485 | + 99> SignalStrength; |
486 | |
487 | MCC mobile_country_code; |
488 | MNC mobile_network_code; |
489 | @@ -133,40 +141,30 @@ |
490 | struct Umts |
491 | { |
492 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ |
493 | - typedef MobileCountryCode |
494 | - < |
495 | + typedef MobileCountryCode< |
496 | 0, |
497 | 999, |
498 | - std::numeric_limits<int>::max() |
499 | - > MCC; |
500 | + std::numeric_limits<int>::max()> MCC; |
501 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ |
502 | - typedef MobileNetworkCode |
503 | - < |
504 | + typedef MobileNetworkCode< |
505 | 0, |
506 | 999, |
507 | - std::numeric_limits<int>::max() |
508 | - > MNC; |
509 | + std::numeric_limits<int>::max()> MNC; |
510 | /** 16-bit Location Area Code, 0..65535, INT_MAX if unknown */ |
511 | - typedef LocationAreaCode |
512 | - < |
513 | + typedef LocationAreaCode< |
514 | 0, |
515 | 65535, |
516 | - std::numeric_limits<int>::max() |
517 | - > LAC; |
518 | + std::numeric_limits<int>::max()> LAC; |
519 | /** 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ |
520 | - typedef CellId |
521 | - < |
522 | + typedef CellId< |
523 | 0, |
524 | 268435455, |
525 | - std::numeric_limits<int>::max() |
526 | - > ID; |
527 | + std::numeric_limits<int>::max()> ID; |
528 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ |
529 | - typedef ArbitraryStrengthUnit |
530 | - < |
531 | + typedef ArbitraryStrengthUnit< |
532 | 0, |
533 | 31, |
534 | - 99 |
535 | - > SignalStrength; |
536 | + 99> SignalStrength; |
537 | |
538 | MCC mobile_country_code; |
539 | MNC mobile_network_code; |
540 | @@ -179,47 +177,35 @@ |
541 | struct Lte |
542 | { |
543 | /** 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */ |
544 | - typedef MobileCountryCode |
545 | - < |
546 | + typedef MobileCountryCode< |
547 | 0, |
548 | 999, |
549 | - std::numeric_limits<int>::max() |
550 | - > MCC; |
551 | + std::numeric_limits<int>::max()> MCC; |
552 | /** 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */ |
553 | - typedef MobileNetworkCode |
554 | - < |
555 | + typedef MobileNetworkCode< |
556 | 0, |
557 | 999, |
558 | - std::numeric_limits<int>::max() |
559 | - > MNC; |
560 | + std::numeric_limits<int>::max()> MNC; |
561 | /** 16-bit Tracking Area Code, 0..65535, INT_MAX if unknown */ |
562 | - typedef TrackingAreaCode |
563 | - < |
564 | + typedef TrackingAreaCode< |
565 | 0, |
566 | 65535, |
567 | - std::numeric_limits<int>::max() |
568 | - > TAC; |
569 | + std::numeric_limits<int>::max()> TAC; |
570 | /** 28-bit Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */ |
571 | - typedef CellId |
572 | - < |
573 | + typedef CellId< |
574 | 0, |
575 | 268435455, |
576 | - std::numeric_limits<int>::max() |
577 | - > ID; |
578 | + std::numeric_limits<int>::max()> ID; |
579 | /** Physical cell id, 0..503, INT_MAX if unknown */ |
580 | - typedef PhysicalId |
581 | - < |
582 | + typedef PhysicalId< |
583 | 0, |
584 | 503, |
585 | - std::numeric_limits<int>::max() |
586 | - > PID; |
587 | + std::numeric_limits<int>::max()> PID; |
588 | /** Valid values are (0-31, 99) as defined in TS 27.007 8.5 */ |
589 | - typedef ArbitraryStrengthUnit |
590 | - < |
591 | + typedef ArbitraryStrengthUnit< |
592 | 0, |
593 | 31, |
594 | - 99 |
595 | - > SignalStrength; |
596 | + 99> SignalStrength; |
597 | |
598 | MCC mobile_country_code; |
599 | MNC mobile_network_code; |
600 | @@ -280,4 +266,3 @@ |
601 | } |
602 | |
603 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CONNECTIVITY_RADIO_CELL_H_ |
604 | - |
605 | |
606 | === modified file 'include/location_service/com/ubuntu/location/connectivity/wireless_network.h' |
607 | --- include/location_service/com/ubuntu/location/connectivity/wireless_network.h 2014-06-10 09:08:10 +0000 |
608 | +++ include/location_service/com/ubuntu/location/connectivity/wireless_network.h 2015-02-03 09:10:02 +0000 |
609 | @@ -52,27 +52,27 @@ |
610 | struct Tag |
611 | { |
612 | /** @brief Tags a frequency measurement for a wireless network. */ |
613 | - struct Frequency {}; |
614 | + struct Frequency |
615 | + { |
616 | + }; |
617 | /** @brief Tags the signal strength of a wireless network. */ |
618 | - struct SignalStrength {}; |
619 | + struct SignalStrength |
620 | + { |
621 | + }; |
622 | }; |
623 | /** @endcond */ |
624 | |
625 | /** Frequency that an individual AP operates on. */ |
626 | - typedef BoundedInteger |
627 | - < |
628 | + typedef BoundedInteger< |
629 | Tag::Frequency, |
630 | 2412, |
631 | - 5825 |
632 | - > Frequency; |
633 | + 5825> Frequency; |
634 | |
635 | /** Strength of signal for an individual AP. */ |
636 | - typedef BoundedInteger |
637 | - < |
638 | + typedef BoundedInteger< |
639 | Tag::SignalStrength, |
640 | 0, |
641 | - 100 |
642 | - > SignalStrength; |
643 | + 100> SignalStrength; |
644 | |
645 | /** @cond */ |
646 | WirelessNetwork() = default; |
647 | |
648 | === modified file 'include/location_service/com/ubuntu/location/criteria.h' |
649 | --- include/location_service/com/ubuntu/location/criteria.h 2014-01-12 18:03:12 +0000 |
650 | +++ include/location_service/com/ubuntu/location/criteria.h 2015-02-03 09:10:02 +0000 |
651 | @@ -42,18 +42,18 @@ |
652 | |
653 | struct Requires |
654 | { |
655 | - bool position = true; ///< The client needs position measurements. |
656 | + bool position = true; ///< The client needs position measurements. |
657 | bool altitude = false; ///< The client needs altitude measurements. |
658 | bool velocity = false; ///< The client needs velocity measurments. |
659 | - bool heading = false; ///< The client needs heading measurements. |
660 | + bool heading = false; ///< The client needs heading measurements. |
661 | } requires = Requires{}; |
662 | |
663 | struct Accuracy |
664 | { |
665 | units::Quantity<units::Length> horizontal = 3000 * units::Meters; ///< The client requires measurements of at least this horizontal accuracy. |
666 | - Optional<units::Quantity<units::Length>> vertical; ///< The client requires measurements of at least this vertical accuracy. |
667 | - Optional<units::Quantity<units::Velocity>> velocity; ///< The client requires measurements of at least this velocity accuracy. |
668 | - Optional<units::Quantity<units::PlaneAngle>> heading; ///< The client requires measurements of at least this heading accuracy. |
669 | + Optional<units::Quantity<units::Length>> vertical; ///< The client requires measurements of at least this vertical accuracy. |
670 | + Optional<units::Quantity<units::Velocity>> velocity; ///< The client requires measurements of at least this velocity accuracy. |
671 | + Optional<units::Quantity<units::PlaneAngle>> heading; ///< The client requires measurements of at least this heading accuracy. |
672 | } accuracy = Accuracy{}; |
673 | }; |
674 | |
675 | |
676 | === modified file 'include/location_service/com/ubuntu/location/default_provider_selection_policy.h' |
677 | --- include/location_service/com/ubuntu/location/default_provider_selection_policy.h 2013-12-14 09:10:29 +0000 |
678 | +++ include/location_service/com/ubuntu/location/default_provider_selection_policy.h 2015-02-03 09:10:02 +0000 |
679 | @@ -31,7 +31,7 @@ |
680 | public: |
681 | DefaultProviderSelectionPolicy(); |
682 | ~DefaultProviderSelectionPolicy() noexcept; |
683 | - |
684 | + |
685 | ProviderSelection determine_provider_selection_for_criteria( |
686 | const Criteria& criteria, |
687 | const ProviderEnumerator& enumerator); |
688 | |
689 | === modified file 'include/location_service/com/ubuntu/location/logging.h' |
690 | --- include/location_service/com/ubuntu/location/logging.h 2014-06-20 07:40:34 +0000 |
691 | +++ include/location_service/com/ubuntu/location/logging.h 2015-02-03 09:10:02 +0000 |
692 | @@ -22,4 +22,3 @@ |
693 | #include <glog/vlog_is_on.h> |
694 | |
695 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_LOGGING_H_ |
696 | - |
697 | |
698 | === modified file 'include/location_service/com/ubuntu/location/optional.h' |
699 | --- include/location_service/com/ubuntu/location/optional.h 2013-12-12 14:36:32 +0000 |
700 | +++ include/location_service/com/ubuntu/location/optional.h 2015-02-03 09:10:02 +0000 |
701 | @@ -26,7 +26,7 @@ |
702 | { |
703 | namespace location |
704 | { |
705 | -template<typename T> |
706 | +template <typename T> |
707 | using Optional = boost::optional<T>; |
708 | } |
709 | } |
710 | |
711 | === modified file 'include/location_service/com/ubuntu/location/provider.h' |
712 | --- include/location_service/com/ubuntu/location/provider.h 2015-01-21 20:13:28 +0000 |
713 | +++ include/location_service/com/ubuntu/location/provider.h 2015-02-03 09:10:02 +0000 |
714 | @@ -52,21 +52,21 @@ |
715 | */ |
716 | enum class Features : std::size_t |
717 | { |
718 | - none = 0, ///< The provider does not support any feature. |
719 | + none = 0, ///< The provider does not support any feature. |
720 | position = 1 << 0, ///< The provider features position updates. |
721 | velocity = 1 << 1, ///< The provider features velocity updates. |
722 | - heading = 1 << 2 ///< The provider features heading updates. |
723 | - }; |
724 | + heading = 1 << 2 ///< The provider features heading updates. |
725 | + }; |
726 | |
727 | /** |
728 | * @brief Enumerates the requirements of a provider implementation. |
729 | */ |
730 | enum class Requirements : std::size_t |
731 | { |
732 | - none = 0, ///< The provider does not require anything. |
733 | - satellites = 1 << 0, ///< The provider requires satellites to be visible. |
734 | - cell_network = 1 << 1, ///< The provider requires a cell-network to work correctly. |
735 | - data_network = 1 << 2, ///< The provider requires a data-network to work correctly. |
736 | + none = 0, ///< The provider does not require anything. |
737 | + satellites = 1 << 0, ///< The provider requires satellites to be visible. |
738 | + cell_network = 1 << 1, ///< The provider requires a cell-network to work correctly. |
739 | + data_network = 1 << 2, ///< The provider requires a data-network to work correctly. |
740 | monetary_spending = 1 << 3 ///< Using the provider results in monetary cost. |
741 | }; |
742 | |
743 | @@ -80,11 +80,11 @@ |
744 | class Controller |
745 | { |
746 | public: |
747 | - typedef std::shared_ptr<Controller> Ptr; |
748 | + typedef std::shared_ptr<Controller> Ptr; |
749 | |
750 | virtual ~Controller() = default; |
751 | Controller(const Controller&) = delete; |
752 | - Controller& operator=(const Controller&) = delete; |
753 | + Controller& operator=(const Controller&) = delete; |
754 | |
755 | /** |
756 | * @brief disable switches the provider to a disabled state, such that subsequent |
757 | |
758 | === modified file 'include/location_service/com/ubuntu/location/provider_factory.h' |
759 | --- include/location_service/com/ubuntu/location/provider_factory.h 2014-10-27 21:58:16 +0000 |
760 | +++ include/location_service/com/ubuntu/location/provider_factory.h 2015-02-03 09:10:02 +0000 |
761 | @@ -37,7 +37,7 @@ |
762 | |
763 | class ProviderFactory |
764 | { |
765 | - public: |
766 | +public: |
767 | typedef com::ubuntu::location::Configuration Configuration; |
768 | typedef std::function<Provider::Ptr(const Configuration&)> Factory; |
769 | |
770 | @@ -56,7 +56,7 @@ |
771 | |
772 | void enumerate(const std::function<void(const std::string&, const Factory&)>& enumerator); |
773 | |
774 | - private: |
775 | +private: |
776 | ProviderFactory() = default; |
777 | ~ProviderFactory() = default; |
778 | |
779 | |
780 | === modified file 'include/location_service/com/ubuntu/location/provider_selection.h' |
781 | --- include/location_service/com/ubuntu/location/provider_selection.h 2013-12-14 09:10:29 +0000 |
782 | +++ include/location_service/com/ubuntu/location/provider_selection.h 2015-02-03 09:10:02 +0000 |
783 | @@ -38,7 +38,7 @@ |
784 | flags = flags | Provider::Features::position; |
785 | if (heading_updates_provider) |
786 | flags = flags | Provider::Features::heading; |
787 | - if(velocity_updates_provider) |
788 | + if (velocity_updates_provider) |
789 | flags = flags | Provider::Features::velocity; |
790 | |
791 | return flags; |
792 | @@ -52,8 +52,8 @@ |
793 | inline bool operator==(const ProviderSelection& lhs, const ProviderSelection& rhs) |
794 | { |
795 | return lhs.position_updates_provider == rhs.position_updates_provider && |
796 | - lhs.heading_updates_provider == rhs.heading_updates_provider && |
797 | - lhs.velocity_updates_provider == rhs.velocity_updates_provider; |
798 | + lhs.heading_updates_provider == rhs.heading_updates_provider && |
799 | + lhs.velocity_updates_provider == rhs.velocity_updates_provider; |
800 | } |
801 | } |
802 | } |
803 | |
804 | === modified file 'include/location_service/com/ubuntu/location/provider_selection_policy.h' |
805 | --- include/location_service/com/ubuntu/location/provider_selection_policy.h 2014-06-20 07:40:34 +0000 |
806 | +++ include/location_service/com/ubuntu/location/provider_selection_policy.h 2015-02-03 09:10:02 +0000 |
807 | @@ -44,8 +44,8 @@ |
808 | virtual ~ProviderSelectionPolicy() = default; |
809 | |
810 | virtual ProviderSelection determine_provider_selection_for_criteria( |
811 | - const Criteria& criteria, |
812 | - const ProviderEnumerator& enumerator) = 0; |
813 | + const Criteria& criteria, |
814 | + const ProviderEnumerator& enumerator) = 0; |
815 | |
816 | protected: |
817 | ProviderSelectionPolicy() = default; |
818 | |
819 | === modified file 'include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h' |
820 | --- include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h 2014-02-03 13:52:21 +0000 |
821 | +++ include/location_service/com/ubuntu/location/providers/geoclue/geoclue.h 2015-02-03 09:10:02 +0000 |
822 | @@ -44,12 +44,11 @@ |
823 | friend std::ostream& operator<<(std::ostream& out, const Status& status) |
824 | { |
825 | static std::map<Status, std::string> lut = |
826 | - { |
827 | - {Status::error, "error"}, |
828 | - {Status::unavailable, "unavailable"}, |
829 | - {Status::acquiring, "acquiring"}, |
830 | - {Status::available, "available"} |
831 | - }; |
832 | + { |
833 | + {Status::error, "error"}, |
834 | + {Status::unavailable, "unavailable"}, |
835 | + {Status::acquiring, "acquiring"}, |
836 | + {Status::available, "available"}}; |
837 | |
838 | return out << lut[status]; |
839 | } |
840 | @@ -211,7 +210,7 @@ |
841 | { |
842 | namespace traits |
843 | { |
844 | -template<> |
845 | +template <> |
846 | struct Service<org::freedesktop::Geoclue> |
847 | { |
848 | inline static const std::string& interface_name() |
849 | @@ -221,7 +220,7 @@ |
850 | } |
851 | }; |
852 | |
853 | -template<> |
854 | +template <> |
855 | struct Service<org::freedesktop::Geoclue::Address> |
856 | { |
857 | inline static const std::string& interface_name() |
858 | @@ -231,7 +230,7 @@ |
859 | } |
860 | }; |
861 | |
862 | -template<> |
863 | +template <> |
864 | struct Service<org::freedesktop::Geoclue::Position> |
865 | { |
866 | inline static const std::string& interface_name() |
867 | @@ -241,7 +240,7 @@ |
868 | } |
869 | }; |
870 | |
871 | -template<> |
872 | +template <> |
873 | struct Service<org::freedesktop::Geoclue::Velocity> |
874 | { |
875 | inline static const std::string& interface_name() |
876 | |
877 | === modified file 'include/location_service/com/ubuntu/location/providers/geoclue/provider.h' |
878 | --- include/location_service/com/ubuntu/location/providers/geoclue/provider.h 2013-12-10 09:42:54 +0000 |
879 | +++ include/location_service/com/ubuntu/location/providers/geoclue/provider.h 2015-02-03 09:10:02 +0000 |
880 | @@ -33,7 +33,7 @@ |
881 | { |
882 | class Provider : public com::ubuntu::location::Provider |
883 | { |
884 | - public: |
885 | +public: |
886 | static Provider::Ptr create_instance(const ProviderFactory::Configuration&); |
887 | |
888 | struct Configuration |
889 | @@ -61,7 +61,7 @@ |
890 | virtual void start_heading_updates(); |
891 | virtual void stop_heading_updates(); |
892 | |
893 | - private: |
894 | +private: |
895 | struct Private; |
896 | std::unique_ptr<Private> d; |
897 | }; |
898 | |
899 | === modified file 'include/location_service/com/ubuntu/location/providers/remote/interface.h' |
900 | --- include/location_service/com/ubuntu/location/providers/remote/interface.h 2015-01-21 20:04:56 +0000 |
901 | +++ include/location_service/com/ubuntu/location/providers/remote/interface.h 2015-02-03 09:10:02 +0000 |
902 | @@ -100,8 +100,7 @@ |
903 | // com::ubuntu::remote::Interface on it. |
904 | Skeleton(const core::dbus::Object::Ptr& object) |
905 | : object{object}, |
906 | - properties |
907 | - { |
908 | + properties{ |
909 | object->get_property<Properties::HasPosition>(), |
910 | object->get_property<Properties::HasVelocity>(), |
911 | object->get_property<Properties::HasHeading>(), |
912 | @@ -111,14 +110,11 @@ |
913 | object->get_property<Properties::RequiresMonetarySpending>(), |
914 | object->get_property<Properties::ArePositionUpdatesRunning>(), |
915 | object->get_property<Properties::AreHeadingUpdatesRunning>(), |
916 | - object->get_property<Properties::AreVelocityUpdatesRunning>() |
917 | - }, |
918 | - signals |
919 | - { |
920 | + object->get_property<Properties::AreVelocityUpdatesRunning>()}, |
921 | + signals{ |
922 | object->get_signal<Signals::PositionChanged>(), |
923 | object->get_signal<Signals::HeadingChanged>(), |
924 | - object->get_signal<Signals::VelocityChanged>() |
925 | - } |
926 | + object->get_signal<Signals::VelocityChanged>()} |
927 | { |
928 | } |
929 | |
930 | @@ -143,18 +139,15 @@ |
931 | { |
932 | std::shared_ptr<core::dbus::Signal< |
933 | Signals::PositionChanged, |
934 | - Signals::PositionChanged::ArgumentType |
935 | - >> position_changed; |
936 | + Signals::PositionChanged::ArgumentType>> position_changed; |
937 | |
938 | std::shared_ptr<core::dbus::Signal< |
939 | Signals::HeadingChanged, |
940 | - Signals::HeadingChanged::ArgumentType |
941 | - >> heading_changed; |
942 | + Signals::HeadingChanged::ArgumentType>> heading_changed; |
943 | |
944 | std::shared_ptr<core::dbus::Signal< |
945 | Signals::VelocityChanged, |
946 | - Signals::VelocityChanged::ArgumentType |
947 | - >> velocity_changed; |
948 | + Signals::VelocityChanged::ArgumentType>> velocity_changed; |
949 | } signals; |
950 | }; |
951 | |
952 | @@ -164,8 +157,7 @@ |
953 | // com::ubuntu::remote::Interface on it. |
954 | Stub(const core::dbus::Object::Ptr& object) |
955 | : object{object}, |
956 | - properties |
957 | - { |
958 | + properties{ |
959 | object->get_property<Properties::HasPosition>(), |
960 | object->get_property<Properties::HasVelocity>(), |
961 | object->get_property<Properties::HasHeading>(), |
962 | @@ -175,14 +167,11 @@ |
963 | object->get_property<Properties::RequiresMonetarySpending>(), |
964 | object->get_property<Properties::ArePositionUpdatesRunning>(), |
965 | object->get_property<Properties::AreHeadingUpdatesRunning>(), |
966 | - object->get_property<Properties::AreVelocityUpdatesRunning>() |
967 | - }, |
968 | - signals |
969 | - { |
970 | + object->get_property<Properties::AreVelocityUpdatesRunning>()}, |
971 | + signals{ |
972 | object->get_signal<Signals::PositionChanged>(), |
973 | object->get_signal<Signals::HeadingChanged>(), |
974 | - object->get_signal<Signals::VelocityChanged>() |
975 | - } |
976 | + object->get_signal<Signals::VelocityChanged>()} |
977 | { |
978 | } |
979 | |
980 | @@ -207,21 +196,17 @@ |
981 | { |
982 | std::shared_ptr<core::dbus::Signal< |
983 | Signals::PositionChanged, |
984 | - Signals::PositionChanged::ArgumentType |
985 | - >> position_changed; |
986 | + Signals::PositionChanged::ArgumentType>> position_changed; |
987 | |
988 | std::shared_ptr<core::dbus::Signal< |
989 | Signals::HeadingChanged, |
990 | - Signals::HeadingChanged::ArgumentType |
991 | - >> heading_changed; |
992 | + Signals::HeadingChanged::ArgumentType>> heading_changed; |
993 | |
994 | std::shared_ptr<core::dbus::Signal< |
995 | Signals::VelocityChanged, |
996 | - Signals::VelocityChanged::ArgumentType |
997 | - >> velocity_changed; |
998 | + Signals::VelocityChanged::ArgumentType>> velocity_changed; |
999 | } signals; |
1000 | }; |
1001 | - |
1002 | }; |
1003 | } |
1004 | } |
1005 | |
1006 | === modified file 'include/location_service/com/ubuntu/location/providers/remote/skeleton.h' |
1007 | --- include/location_service/com/ubuntu/location/providers/remote/skeleton.h 2014-09-12 13:11:42 +0000 |
1008 | +++ include/location_service/com/ubuntu/location/providers/remote/skeleton.h 2015-02-03 09:10:02 +0000 |
1009 | @@ -20,10 +20,14 @@ |
1010 | |
1011 | #include <com/ubuntu/location/provider.h> |
1012 | |
1013 | -namespace core { namespace dbus { |
1014 | +namespace core |
1015 | +{ |
1016 | +namespace dbus |
1017 | +{ |
1018 | class Bus; |
1019 | class Object; |
1020 | -}} |
1021 | +} |
1022 | +} |
1023 | |
1024 | namespace com |
1025 | { |
1026 | |
1027 | === modified file 'include/location_service/com/ubuntu/location/providers/remote/stub.h' |
1028 | --- include/location_service/com/ubuntu/location/providers/remote/stub.h 2014-09-12 13:11:42 +0000 |
1029 | +++ include/location_service/com/ubuntu/location/providers/remote/stub.h 2015-02-03 09:10:02 +0000 |
1030 | @@ -20,10 +20,14 @@ |
1031 | |
1032 | #include <com/ubuntu/location/provider.h> |
1033 | |
1034 | -namespace core { namespace dbus { |
1035 | +namespace core |
1036 | +{ |
1037 | +namespace dbus |
1038 | +{ |
1039 | class Bus; |
1040 | class Object; |
1041 | -}} |
1042 | +} |
1043 | +} |
1044 | |
1045 | namespace com |
1046 | { |
1047 | |
1048 | === modified file 'include/location_service/com/ubuntu/location/providers/skyhook/provider.h' |
1049 | --- include/location_service/com/ubuntu/location/providers/skyhook/provider.h 2013-12-10 09:42:54 +0000 |
1050 | +++ include/location_service/com/ubuntu/location/providers/skyhook/provider.h 2015-02-03 09:10:02 +0000 |
1051 | @@ -35,9 +35,9 @@ |
1052 | { |
1053 | class Provider : public com::ubuntu::location::Provider |
1054 | { |
1055 | - public: |
1056 | +public: |
1057 | static Provider::Ptr create_instance(const ProviderFactory::Configuration& config); |
1058 | - |
1059 | + |
1060 | static const Provider::FeatureFlags& default_feature_flags(); |
1061 | static const Provider::RequirementFlags& default_requirement_flags(); |
1062 | |
1063 | @@ -68,7 +68,7 @@ |
1064 | virtual void start_heading_updates(); |
1065 | virtual void stop_heading_updates(); |
1066 | |
1067 | - private: |
1068 | +private: |
1069 | struct Private; |
1070 | std::unique_ptr<Private> d; |
1071 | }; |
1072 | |
1073 | === modified file 'include/location_service/com/ubuntu/location/proxy_provider.h' |
1074 | --- include/location_service/com/ubuntu/location/proxy_provider.h 2014-06-20 07:40:34 +0000 |
1075 | +++ include/location_service/com/ubuntu/location/proxy_provider.h 2015-02-03 09:10:02 +0000 |
1076 | @@ -46,7 +46,7 @@ |
1077 | |
1078 | virtual void start_heading_updates(); |
1079 | virtual void stop_heading_updates(); |
1080 | - |
1081 | + |
1082 | private: |
1083 | ProviderSelection providers; |
1084 | |
1085 | |
1086 | === modified file 'include/location_service/com/ubuntu/location/service/configuration.h' |
1087 | --- include/location_service/com/ubuntu/location/service/configuration.h 2014-11-14 11:33:05 +0000 |
1088 | +++ include/location_service/com/ubuntu/location/service/configuration.h 2015-02-03 09:10:02 +0000 |
1089 | @@ -42,9 +42,9 @@ |
1090 | Configuration& operator=(const Configuration&) = delete; |
1091 | |
1092 | virtual std::shared_ptr<Engine> the_engine( |
1093 | - const std::set<Provider::Ptr>& provider_set, |
1094 | + const std::set<Provider::Ptr>& provider_set, |
1095 | const ProviderSelectionPolicy::Ptr& provider_selection_policy) = 0; |
1096 | - |
1097 | + |
1098 | virtual ProviderSelectionPolicy::Ptr the_provider_selection_policy() = 0; |
1099 | virtual std::set<Provider::Ptr> the_provider_set() = 0; |
1100 | virtual PermissionManager::Ptr the_permission_manager() = 0; |
1101 | |
1102 | === modified file 'include/location_service/com/ubuntu/location/service/default_permission_manager.h' |
1103 | --- include/location_service/com/ubuntu/location/service/default_permission_manager.h 2013-12-10 09:42:54 +0000 |
1104 | +++ include/location_service/com/ubuntu/location/service/default_permission_manager.h 2015-02-03 09:10:02 +0000 |
1105 | @@ -33,17 +33,17 @@ |
1106 | { |
1107 | class DefaultPermissionManager : public PermissionManager |
1108 | { |
1109 | - public: |
1110 | +public: |
1111 | typedef std::shared_ptr<DefaultPermissionManager> Ptr; |
1112 | |
1113 | DefaultPermissionManager(); |
1114 | ~DefaultPermissionManager() noexcept; |
1115 | - |
1116 | + |
1117 | Result check_permission_for_credentials( |
1118 | - const Criteria&, |
1119 | + const Criteria&, |
1120 | const Credentials& credentials); |
1121 | |
1122 | - private: |
1123 | +private: |
1124 | pid_t pid; |
1125 | uid_t uid; |
1126 | }; |
1127 | |
1128 | === modified file 'include/location_service/com/ubuntu/location/service/interface.h' |
1129 | --- include/location_service/com/ubuntu/location/service/interface.h 2014-08-01 15:59:25 +0000 |
1130 | +++ include/location_service/com/ubuntu/location/service/interface.h 2015-02-03 09:10:02 +0000 |
1131 | @@ -45,7 +45,7 @@ |
1132 | */ |
1133 | class Interface |
1134 | { |
1135 | - protected: |
1136 | +protected: |
1137 | struct Errors |
1138 | { |
1139 | struct InsufficientPermissions |
1140 | @@ -70,10 +70,8 @@ |
1141 | |
1142 | inline static const std::string& name() |
1143 | { |
1144 | - static const std::string s |
1145 | - { |
1146 | - "CreateSessionForCriteria" |
1147 | - }; |
1148 | + static const std::string s{ |
1149 | + "CreateSessionForCriteria"}; |
1150 | return s; |
1151 | } |
1152 | |
1153 | @@ -91,10 +89,8 @@ |
1154 | { |
1155 | inline static const std::string& name() |
1156 | { |
1157 | - static const std::string s |
1158 | - { |
1159 | - "DoesSatelliteBasedPositioning" |
1160 | - }; |
1161 | + static const std::string s{ |
1162 | + "DoesSatelliteBasedPositioning"}; |
1163 | return s; |
1164 | } |
1165 | |
1166 | @@ -108,10 +104,8 @@ |
1167 | { |
1168 | inline static const std::string& name() |
1169 | { |
1170 | - static const std::string s |
1171 | - { |
1172 | - "DoesReportCellAndWifiIds" |
1173 | - }; |
1174 | + static const std::string s{ |
1175 | + "DoesReportCellAndWifiIds"}; |
1176 | return s; |
1177 | } |
1178 | |
1179 | @@ -125,10 +119,8 @@ |
1180 | { |
1181 | inline static const std::string& name() |
1182 | { |
1183 | - static const std::string s |
1184 | - { |
1185 | - "IsOnline" |
1186 | - }; |
1187 | + static const std::string s{ |
1188 | + "IsOnline"}; |
1189 | return s; |
1190 | } |
1191 | |
1192 | @@ -142,10 +134,8 @@ |
1193 | { |
1194 | inline static const std::string& name() |
1195 | { |
1196 | - static const std::string s |
1197 | - { |
1198 | - "VisibleSpaceVehicles" |
1199 | - }; |
1200 | + static const std::string s{ |
1201 | + "VisibleSpaceVehicles"}; |
1202 | return s; |
1203 | } |
1204 | |
1205 | @@ -159,7 +149,7 @@ |
1206 | |
1207 | Interface() = default; |
1208 | |
1209 | - public: |
1210 | +public: |
1211 | typedef std::shared_ptr<Interface> Ptr; |
1212 | |
1213 | /** |
1214 | @@ -222,15 +212,13 @@ |
1215 | { |
1216 | namespace traits |
1217 | { |
1218 | -template<> |
1219 | +template <> |
1220 | struct Service<com::ubuntu::location::service::Interface> |
1221 | { |
1222 | static const std::string& interface_name() |
1223 | { |
1224 | - static const std::string s |
1225 | - { |
1226 | - "com.ubuntu.location.Service" |
1227 | - }; |
1228 | + static const std::string s{ |
1229 | + "com.ubuntu.location.Service"}; |
1230 | return s; |
1231 | } |
1232 | }; |
1233 | |
1234 | === modified file 'include/location_service/com/ubuntu/location/service/permission_manager.h' |
1235 | --- include/location_service/com/ubuntu/location/service/permission_manager.h 2014-06-23 04:57:59 +0000 |
1236 | +++ include/location_service/com/ubuntu/location/service/permission_manager.h 2015-02-03 09:10:02 +0000 |
1237 | @@ -70,7 +70,7 @@ |
1238 | virtual Result check_permission_for_credentials( |
1239 | const Criteria& criteria, |
1240 | const Credentials& credentials) = 0; |
1241 | - |
1242 | + |
1243 | protected: |
1244 | PermissionManager() = default; |
1245 | }; |
1246 | |
1247 | === modified file 'include/location_service/com/ubuntu/location/service/session/implementation.h' |
1248 | --- include/location_service/com/ubuntu/location/service/session/implementation.h 2014-02-03 13:52:21 +0000 |
1249 | +++ include/location_service/com/ubuntu/location/service/session/implementation.h 2015-02-03 09:10:02 +0000 |
1250 | @@ -36,7 +36,7 @@ |
1251 | { |
1252 | class Implementation : public Interface |
1253 | { |
1254 | - public: |
1255 | +public: |
1256 | Implementation(const Provider::Ptr& provider); |
1257 | Implementation(const Implementation&) = delete; |
1258 | virtual ~Implementation() noexcept; |
1259 | @@ -51,7 +51,7 @@ |
1260 | virtual void start_heading_updates(); |
1261 | virtual void stop_heading_updates() noexcept; |
1262 | |
1263 | - private: |
1264 | +private: |
1265 | struct Private; |
1266 | std::unique_ptr<Private> d; |
1267 | }; |
1268 | |
1269 | === modified file 'include/location_service/com/ubuntu/location/service/session/interface.h' |
1270 | --- include/location_service/com/ubuntu/location/service/session/interface.h 2014-05-19 09:55:25 +0000 |
1271 | +++ include/location_service/com/ubuntu/location/service/session/interface.h 2015-02-03 09:10:02 +0000 |
1272 | @@ -114,7 +114,7 @@ |
1273 | */ |
1274 | virtual Updates& updates(); |
1275 | |
1276 | -protected: |
1277 | +protected: |
1278 | Interface(); |
1279 | |
1280 | private: |
1281 | |
1282 | === modified file 'include/location_service/com/ubuntu/location/service/session/stub.h' |
1283 | --- include/location_service/com/ubuntu/location/service/session/stub.h 2014-02-03 13:52:21 +0000 |
1284 | +++ include/location_service/com/ubuntu/location/service/session/stub.h 2015-02-03 09:10:02 +0000 |
1285 | @@ -42,7 +42,7 @@ |
1286 | { |
1287 | class Stub : public core::dbus::Stub<Interface> |
1288 | { |
1289 | - public: |
1290 | +public: |
1291 | Stub( |
1292 | const core::dbus::Bus::Ptr& bus, |
1293 | const core::dbus::types::ObjectPath& session_path); |
1294 | @@ -61,7 +61,7 @@ |
1295 | virtual void start_heading_updates(); |
1296 | virtual void stop_heading_updates() noexcept; |
1297 | |
1298 | - private: |
1299 | +private: |
1300 | struct Private; |
1301 | std::unique_ptr<Private> d; |
1302 | }; |
1303 | |
1304 | === modified file 'include/location_service/com/ubuntu/location/service/skeleton.h' |
1305 | --- include/location_service/com/ubuntu/location/service/skeleton.h 2014-08-11 10:21:08 +0000 |
1306 | +++ include/location_service/com/ubuntu/location/service/skeleton.h 2015-02-03 09:10:02 +0000 |
1307 | @@ -38,8 +38,8 @@ |
1308 | namespace service |
1309 | { |
1310 | class Skeleton |
1311 | - : public core::dbus::Skeleton<com::ubuntu::location::service::Interface>, |
1312 | - public std::enable_shared_from_this<Skeleton> |
1313 | + : public core::dbus::Skeleton<com::ubuntu::location::service::Interface>, |
1314 | + public std::enable_shared_from_this<Skeleton> |
1315 | { |
1316 | public: |
1317 | typedef std::shared_ptr<Skeleton> Ptr; |
1318 | @@ -123,8 +123,8 @@ |
1319 | // Tries to register the given session under the given path in the session store. |
1320 | // Returns true iff the session has been added to the store. |
1321 | bool add_to_session_store_for_path( |
1322 | - const core::dbus::types::ObjectPath& path, |
1323 | - const session::Interface::Ptr& session); |
1324 | + const core::dbus::types::ObjectPath& path, |
1325 | + const session::Interface::Ptr& session); |
1326 | |
1327 | // Called whenever the value of the respective property changes. |
1328 | void on_does_satellite_based_positioning_changed(bool value); |
1329 | @@ -138,19 +138,17 @@ |
1330 | // The skeleton object representing com.ubuntu.location.service.Interface on the bus. |
1331 | core::dbus::Object::Ptr object; |
1332 | // We emit property changes manually. |
1333 | - core::dbus::Signal |
1334 | - < |
1335 | + core::dbus::Signal< |
1336 | core::dbus::interfaces::Properties::Signals::PropertiesChanged, |
1337 | - core::dbus::interfaces::Properties::Signals::PropertiesChanged::ArgumentType |
1338 | - >::Ptr properties_changed; |
1339 | + core::dbus::interfaces::Properties::Signals::PropertiesChanged::ArgumentType>::Ptr properties_changed; |
1340 | |
1341 | // DBus properties as exposed on the bus for com.ubuntu.location.service.Interface |
1342 | struct |
1343 | { |
1344 | - std::shared_ptr< core::dbus::Property<Interface::Properties::DoesSatelliteBasedPositioning> > does_satellite_based_positioning; |
1345 | - std::shared_ptr< core::dbus::Property<Interface::Properties::DoesReportCellAndWifiIds> > does_report_cell_and_wifi_ids; |
1346 | - std::shared_ptr< core::dbus::Property<Interface::Properties::IsOnline> > is_online; |
1347 | - std::shared_ptr< core::dbus::Property<Interface::Properties::VisibleSpaceVehicles> > visible_space_vehicles; |
1348 | + std::shared_ptr<core::dbus::Property<Interface::Properties::DoesSatelliteBasedPositioning>> does_satellite_based_positioning; |
1349 | + std::shared_ptr<core::dbus::Property<Interface::Properties::DoesReportCellAndWifiIds>> does_report_cell_and_wifi_ids; |
1350 | + std::shared_ptr<core::dbus::Property<Interface::Properties::IsOnline>> is_online; |
1351 | + std::shared_ptr<core::dbus::Property<Interface::Properties::VisibleSpaceVehicles>> visible_space_vehicles; |
1352 | } properties; |
1353 | // We sign up to property changes here, to be able to report them to the bus |
1354 | struct |
1355 | |
1356 | === modified file 'include/location_service/com/ubuntu/location/service/stub.h' |
1357 | --- include/location_service/com/ubuntu/location/service/stub.h 2014-02-03 13:52:21 +0000 |
1358 | +++ include/location_service/com/ubuntu/location/service/stub.h 2015-02-03 09:10:02 +0000 |
1359 | @@ -33,7 +33,7 @@ |
1360 | { |
1361 | class Stub : public core::dbus::Stub<Interface> |
1362 | { |
1363 | - public: |
1364 | +public: |
1365 | Stub(const dbus::Bus::Ptr& connection); |
1366 | Stub(const Stub&) = delete; |
1367 | Stub& operator=(const Stub&) = delete; |
1368 | @@ -42,10 +42,10 @@ |
1369 | session::Interface::Ptr create_session_for_criteria(const Criteria& criteria); |
1370 | core::Property<bool>& does_satellite_based_positioning(); |
1371 | core::Property<bool>& does_report_cell_and_wifi_ids(); |
1372 | - core::Property<bool>& is_online(); |
1373 | + core::Property<bool>& is_online(); |
1374 | core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles(); |
1375 | |
1376 | - private: |
1377 | +private: |
1378 | struct Private; |
1379 | std::unique_ptr<Private> d; |
1380 | }; |
1381 | |
1382 | === modified file 'include/location_service/com/ubuntu/location/space_vehicle.h' |
1383 | --- include/location_service/com/ubuntu/location/space_vehicle.h 2014-05-20 07:26:03 +0000 |
1384 | +++ include/location_service/com/ubuntu/location/space_vehicle.h 2015-02-03 09:10:02 +0000 |
1385 | @@ -39,20 +39,20 @@ |
1386 | enum class Type |
1387 | { |
1388 | unknown, ///< Unknown (and thus invalid) type. |
1389 | - beidou, ///< People's Republic of China's regional system, currently limited to Asia and the West Pacific |
1390 | + beidou, ///< People's Republic of China's regional system, currently limited to Asia and the West Pacific |
1391 | 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). |
1392 | glonass, ///< Russia's global navigation system. Fully operational worldwide. |
1393 | - gps, ///< Fully operational worldwide. |
1394 | + gps, ///< Fully operational worldwide. |
1395 | compass, ///< People's Republic of China's global system, planned to be operational by 2020. |
1396 | - irnss, ///< India's regional navigation system, planned to be operational by 2014, covering India and Northern Indian Ocean. |
1397 | - qzss ///< Japanese regional system covering Asia and Oceania. |
1398 | - }; |
1399 | + irnss, ///< India's regional navigation system, planned to be operational by 2014, covering India and Northern Indian Ocean. |
1400 | + qzss ///< Japanese regional system covering Asia and Oceania. |
1401 | + }; |
1402 | |
1403 | /** @brief Uniquely identifies a space vehicle, given its type and its id. */ |
1404 | struct Key |
1405 | { |
1406 | Type type = Type::unknown; ///< The positioning system this vehicle belongs to. |
1407 | - Id id = 0; ///< Unique id of the space vehicle. |
1408 | + Id id = 0; ///< Unique id of the space vehicle. |
1409 | |
1410 | inline bool operator==(const SpaceVehicle::Key& rhs) const |
1411 | { |
1412 | @@ -71,11 +71,11 @@ |
1413 | inline bool operator==(const SpaceVehicle& rhs) const |
1414 | { |
1415 | return key == rhs.key && |
1416 | - has_almanac_data == rhs.has_almanac_data && |
1417 | - has_ephimeris_data == rhs.has_ephimeris_data && |
1418 | - used_in_fix == rhs.used_in_fix && |
1419 | - units::roughly_equals(azimuth, rhs.azimuth) && |
1420 | - units::roughly_equals(elevation, rhs.elevation); |
1421 | + has_almanac_data == rhs.has_almanac_data && |
1422 | + has_ephimeris_data == rhs.has_ephimeris_data && |
1423 | + used_in_fix == rhs.used_in_fix && |
1424 | + units::roughly_equals(azimuth, rhs.azimuth) && |
1425 | + units::roughly_equals(elevation, rhs.elevation); |
1426 | } |
1427 | |
1428 | inline bool operator<(const SpaceVehicle& rhs) const |
1429 | @@ -83,28 +83,27 @@ |
1430 | return key < rhs.key; |
1431 | } |
1432 | |
1433 | - Key key; ///< Unique key identifying an instance. |
1434 | + Key key; ///< Unique key identifying an instance. |
1435 | float snr = -std::numeric_limits<float>::max(); ///< Signal to noise ratio; |
1436 | - bool has_almanac_data = false; ///< Almanac data available for this vehicle. |
1437 | - bool has_ephimeris_data = false; ///< Ephimeris data is available for this vehicle. |
1438 | - bool used_in_fix = false; ///< This vehicle has been used to obtain a fix. |
1439 | - units::Quantity<units::PlaneAngle> azimuth; ///< Azimuth of SV. |
1440 | - units::Quantity<units::PlaneAngle> elevation; ///< Elevation of SV. |
1441 | + bool has_almanac_data = false; ///< Almanac data available for this vehicle. |
1442 | + bool has_ephimeris_data = false; ///< Ephimeris data is available for this vehicle. |
1443 | + bool used_in_fix = false; ///< This vehicle has been used to obtain a fix. |
1444 | + units::Quantity<units::PlaneAngle> azimuth; ///< Azimuth of SV. |
1445 | + units::Quantity<units::PlaneAngle> elevation; ///< Elevation of SV. |
1446 | }; |
1447 | |
1448 | inline std::ostream& operator<<(std::ostream& out, const SpaceVehicle& sv) |
1449 | { |
1450 | static const std::map<SpaceVehicle::Type, std::string> lut = |
1451 | - { |
1452 | - {SpaceVehicle::Type::unknown, "unknown"}, |
1453 | - {SpaceVehicle::Type::beidou, "beidou"}, |
1454 | - {SpaceVehicle::Type::galileo, "galileo"}, |
1455 | - {SpaceVehicle::Type::glonass, "glonass"}, |
1456 | - {SpaceVehicle::Type::gps, "gps"}, |
1457 | - {SpaceVehicle::Type::compass, "compass"}, |
1458 | - {SpaceVehicle::Type::irnss, "irnss"}, |
1459 | - {SpaceVehicle::Type::qzss, "qzss" } |
1460 | - }; |
1461 | + { |
1462 | + {SpaceVehicle::Type::unknown, "unknown"}, |
1463 | + {SpaceVehicle::Type::beidou, "beidou"}, |
1464 | + {SpaceVehicle::Type::galileo, "galileo"}, |
1465 | + {SpaceVehicle::Type::glonass, "glonass"}, |
1466 | + {SpaceVehicle::Type::gps, "gps"}, |
1467 | + {SpaceVehicle::Type::compass, "compass"}, |
1468 | + {SpaceVehicle::Type::irnss, "irnss"}, |
1469 | + {SpaceVehicle::Type::qzss, "qzss"}}; |
1470 | return out << "(" |
1471 | << "type: " << lut.at(sv.key.type) << ", " |
1472 | << "prn: " << sv.key.id << ", " |
1473 | |
1474 | === modified file 'include/location_service/com/ubuntu/location/units/units.h' |
1475 | --- include/location_service/com/ubuntu/location/units/units.h 2013-12-10 09:42:54 +0000 |
1476 | +++ include/location_service/com/ubuntu/location/units/units.h 2015-02-03 09:10:02 +0000 |
1477 | @@ -49,7 +49,7 @@ |
1478 | static const Velocity MeterPerSecond; |
1479 | static const Velocity MetersPerSecond; |
1480 | |
1481 | -template<typename Unit> |
1482 | +template <typename Unit> |
1483 | using Quantity = boost::units::quantity<Unit, double>; |
1484 | |
1485 | typedef boost::units::si::dimensionless Dimensionless; |
1486 | @@ -58,10 +58,10 @@ |
1487 | using boost::units::cos; |
1488 | using boost::units::atan2; |
1489 | |
1490 | -template<typename Unit> |
1491 | +template <typename Unit> |
1492 | inline bool roughly_equals(const Quantity<Unit>& lhs, const Quantity<Unit>& rhs) |
1493 | { |
1494 | - return std::fabs(lhs.value()-rhs.value()) <= std::numeric_limits<double>::epsilon(); |
1495 | + return std::fabs(lhs.value() - rhs.value()) <= std::numeric_limits<double>::epsilon(); |
1496 | } |
1497 | } |
1498 | } |
1499 | @@ -69,4 +69,3 @@ |
1500 | } |
1501 | |
1502 | #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_UNITS_UNITS_H_ |
1503 | - |
1504 | |
1505 | === modified file 'include/location_service/com/ubuntu/location/update.h' |
1506 | --- include/location_service/com/ubuntu/location/update.h 2013-12-10 09:42:54 +0000 |
1507 | +++ include/location_service/com/ubuntu/location/update.h 2015-02-03 09:10:02 +0000 |
1508 | @@ -32,7 +32,7 @@ |
1509 | * @brief Templated class that wraps a value and timestamp. |
1510 | * @tparam T The contained value. |
1511 | */ |
1512 | -template<typename T> |
1513 | +template <typename T> |
1514 | struct Update |
1515 | { |
1516 | /** |
1517 | @@ -41,7 +41,7 @@ |
1518 | * @param [in] when The timestamp when the value was measured. |
1519 | */ |
1520 | inline Update(const T& value = T{}, |
1521 | - const Clock::Timestamp& when = Clock::now()) |
1522 | + const Clock::Timestamp& when = Clock::now()) |
1523 | : value{value}, when{when} |
1524 | { |
1525 | } |
1526 | @@ -78,13 +78,12 @@ |
1527 | * @param out The stream to write to. |
1528 | * @param update The value to be printed. |
1529 | */ |
1530 | -template<typename T> |
1531 | +template <typename T> |
1532 | inline std::ostream& operator<<(std::ostream& out, const Update<T>& update) |
1533 | { |
1534 | out << "Update(" << update.value << ", " << update.when.time_since_epoch().count() << ")"; |
1535 | return out; |
1536 | } |
1537 | - |
1538 | } |
1539 | } |
1540 | } |
1541 | |
1542 | === modified file 'include/location_service/com/ubuntu/location/wgs84/altitude.h' |
1543 | --- include/location_service/com/ubuntu/location/wgs84/altitude.h 2013-12-10 09:42:54 +0000 |
1544 | +++ include/location_service/com/ubuntu/location/wgs84/altitude.h 2015-02-03 09:10:02 +0000 |
1545 | @@ -35,7 +35,7 @@ |
1546 | } |
1547 | typedef Coordinate<tag::Altitude, units::Length> Altitude; |
1548 | |
1549 | -template<> |
1550 | +template <> |
1551 | struct CoordinateTraits<Altitude> |
1552 | { |
1553 | static void check_and_throw_if_invalid(const typename Altitude::Quantity&) {} |
1554 | |
1555 | === modified file 'include/location_service/com/ubuntu/location/wgs84/coordinate.h' |
1556 | --- include/location_service/com/ubuntu/location/wgs84/coordinate.h 2013-12-12 14:36:32 +0000 |
1557 | +++ include/location_service/com/ubuntu/location/wgs84/coordinate.h 2015-02-03 09:10:02 +0000 |
1558 | @@ -30,7 +30,7 @@ |
1559 | { |
1560 | namespace wgs84 |
1561 | { |
1562 | -template<typename Coordinate> |
1563 | +template <typename Coordinate> |
1564 | struct CoordinateTraits |
1565 | { |
1566 | static void check_and_throw_if_invalid(const typename Coordinate::Quantity& coordinate) |
1567 | @@ -38,7 +38,7 @@ |
1568 | } |
1569 | }; |
1570 | |
1571 | -template<typename Tag, typename UnitType> |
1572 | +template <typename Tag, typename UnitType> |
1573 | class Coordinate |
1574 | { |
1575 | public: |
1576 | @@ -48,15 +48,15 @@ |
1577 | explicit Coordinate(const Quantity& value = Quantity()) |
1578 | : value(value) |
1579 | { |
1580 | - CoordinateTraits<Coordinate<Tag,UnitType>>::check_and_throw_if_invalid(value); |
1581 | + CoordinateTraits<Coordinate<Tag, UnitType>>::check_and_throw_if_invalid(value); |
1582 | } |
1583 | |
1584 | - bool operator==(const Coordinate<Tag,UnitType>& rhs) const |
1585 | + bool operator==(const Coordinate<Tag, UnitType>& rhs) const |
1586 | { |
1587 | return value == rhs.value; |
1588 | } |
1589 | |
1590 | - bool operator!=(const Coordinate<Tag,UnitType>& rhs) const |
1591 | + bool operator!=(const Coordinate<Tag, UnitType>& rhs) const |
1592 | { |
1593 | return value != rhs.value; |
1594 | } |
1595 | @@ -64,14 +64,14 @@ |
1596 | Quantity value; |
1597 | }; |
1598 | |
1599 | -template<typename T, typename U> |
1600 | -Coordinate<T,U> operator-(const Coordinate<T,U>& lhs, const Coordinate<T,U>& rhs) |
1601 | +template <typename T, typename U> |
1602 | +Coordinate<T, U> operator-(const Coordinate<T, U>& lhs, const Coordinate<T, U>& rhs) |
1603 | { |
1604 | - return Coordinate<T,U> {rhs.value - lhs.value}; |
1605 | + return Coordinate<T, U>{rhs.value - lhs.value}; |
1606 | } |
1607 | |
1608 | -template<typename T, typename U> |
1609 | -std::ostream& operator<<(std::ostream& out, const Coordinate<T,U>& coord) |
1610 | +template <typename T, typename U> |
1611 | +std::ostream& operator<<(std::ostream& out, const Coordinate<T, U>& coord) |
1612 | { |
1613 | out << "Coordinate(" << coord.value << ")"; |
1614 | return out; |
1615 | |
1616 | === modified file 'include/location_service/com/ubuntu/location/wgs84/latitude.h' |
1617 | --- include/location_service/com/ubuntu/location/wgs84/latitude.h 2013-12-10 09:42:54 +0000 |
1618 | +++ include/location_service/com/ubuntu/location/wgs84/latitude.h 2015-02-03 09:10:02 +0000 |
1619 | @@ -37,7 +37,7 @@ |
1620 | } |
1621 | typedef Coordinate<tag::Latitude, units::PlaneAngle> Latitude; |
1622 | |
1623 | -template<> |
1624 | +template <> |
1625 | struct CoordinateTraits<Latitude> |
1626 | { |
1627 | static double min() |
1628 | |
1629 | === modified file 'include/location_service/com/ubuntu/location/wgs84/longitude.h' |
1630 | --- include/location_service/com/ubuntu/location/wgs84/longitude.h 2013-12-10 09:42:54 +0000 |
1631 | +++ include/location_service/com/ubuntu/location/wgs84/longitude.h 2015-02-03 09:10:02 +0000 |
1632 | @@ -37,7 +37,7 @@ |
1633 | } |
1634 | typedef Coordinate<tag::Longitude, units::PlaneAngle> Longitude; |
1635 | |
1636 | -template<> |
1637 | +template <> |
1638 | struct CoordinateTraits<Longitude> |
1639 | { |
1640 | static double min() |
1641 | |
1642 | === modified file 'src/location_service/com/ubuntu/location/boost_ptree_settings.cpp' |
1643 | --- src/location_service/com/ubuntu/location/boost_ptree_settings.cpp 2015-01-14 13:41:54 +0000 |
1644 | +++ src/location_service/com/ubuntu/location/boost_ptree_settings.cpp 2015-02-03 09:10:02 +0000 |
1645 | @@ -52,7 +52,7 @@ |
1646 | |
1647 | // Returns true iff a value is known for the given key. |
1648 | bool location::BoostPtreeSettings::has_value_for_key(const std::string& key) const |
1649 | -{ |
1650 | +{ |
1651 | return tree.count(key) > 0; |
1652 | } |
1653 | |
1654 | |
1655 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp' |
1656 | --- src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp 2014-11-10 12:31:47 +0000 |
1657 | +++ src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.cpp 2015-02-03 09:10:02 +0000 |
1658 | @@ -25,14 +25,15 @@ |
1659 | // We use this for debugging purposes. |
1660 | const bool also_apply_cell_change_heuristics_to_gsm_cells = |
1661 | core::posix::this_process::env::get( |
1662 | - "COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_FOR_GSM_TOO", |
1663 | - "false") == "true"; |
1664 | + "COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_FOR_GSM_TOO", |
1665 | + "false") == "true"; |
1666 | |
1667 | std::int64_t timeout_in_seconds() |
1668 | { |
1669 | auto value = core::posix::this_process::env::get("COM_UBUNTU_LOCATION_CONNECTIVITY_DATA_CELL_TIMEOUT", "60"); |
1670 | std::stringstream ss(value); |
1671 | - std::uint64_t result; ss >> result; |
1672 | + std::uint64_t result; |
1673 | + ss >> result; |
1674 | |
1675 | return result; |
1676 | } |
1677 | @@ -50,37 +51,25 @@ |
1678 | |
1679 | const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type>& detail::CachedRadioCell::type_lut() |
1680 | { |
1681 | - static const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type> lut |
1682 | - { |
1683 | - { |
1684 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology::gsm(), |
1685 | - com::ubuntu::location::connectivity::RadioCell::Type::gsm |
1686 | - }, |
1687 | - { |
1688 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology::lte(), |
1689 | - com::ubuntu::location::connectivity::RadioCell::Type::lte |
1690 | - }, |
1691 | - { |
1692 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology::umts(), |
1693 | - com::ubuntu::location::connectivity::RadioCell::Type::umts |
1694 | - }, |
1695 | - { |
1696 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology::edge(), |
1697 | - com::ubuntu::location::connectivity::RadioCell::Type::gsm |
1698 | - }, |
1699 | - { |
1700 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology::hspa(), |
1701 | - com::ubuntu::location::connectivity::RadioCell::Type::umts |
1702 | - }, |
1703 | - {std::string(), com::ubuntu::location::connectivity::RadioCell::Type::unknown} |
1704 | - }; |
1705 | + static const std::map<std::string, com::ubuntu::location::connectivity::RadioCell::Type> lut{ |
1706 | + {org::Ofono::Manager::Modem::NetworkRegistration::Technology::gsm(), |
1707 | + com::ubuntu::location::connectivity::RadioCell::Type::gsm}, |
1708 | + {org::Ofono::Manager::Modem::NetworkRegistration::Technology::lte(), |
1709 | + com::ubuntu::location::connectivity::RadioCell::Type::lte}, |
1710 | + {org::Ofono::Manager::Modem::NetworkRegistration::Technology::umts(), |
1711 | + com::ubuntu::location::connectivity::RadioCell::Type::umts}, |
1712 | + {org::Ofono::Manager::Modem::NetworkRegistration::Technology::edge(), |
1713 | + com::ubuntu::location::connectivity::RadioCell::Type::gsm}, |
1714 | + {org::Ofono::Manager::Modem::NetworkRegistration::Technology::hspa(), |
1715 | + com::ubuntu::location::connectivity::RadioCell::Type::umts}, |
1716 | + {std::string(), com::ubuntu::location::connectivity::RadioCell::Type::unknown}}; |
1717 | |
1718 | return lut; |
1719 | } |
1720 | |
1721 | detail::CachedRadioCell::CellChangeHeuristics::CellChangeHeuristics( |
1722 | - boost::asio::io_service& io_service, |
1723 | - bool needed) |
1724 | + boost::asio::io_service& io_service, |
1725 | + bool needed) |
1726 | : needed(needed), |
1727 | io_service(io_service), |
1728 | invalidation_timer(io_service), |
1729 | @@ -89,7 +78,7 @@ |
1730 | } |
1731 | |
1732 | detail::CachedRadioCell::CachedRadioCell(const org::Ofono::Manager::Modem& modem, boost::asio::io_service& io_service) |
1733 | - : RadioCell(), |
1734 | + : RadioCell(), |
1735 | cell_change_heuristics(io_service, is_running_on_problematic_modem_firmware(modem)), |
1736 | roaming(false), |
1737 | radio_type(Type::gsm), |
1738 | @@ -100,9 +89,9 @@ |
1739 | radio_type = query_technology(); |
1740 | |
1741 | connections.network_registration_properties_changed = modem.network_registration.signals.property_changed->connect([this](const std::tuple<std::string, core::dbus::types::Variant>& tuple) |
1742 | - { |
1743 | + { |
1744 | on_network_registration_property_changed(tuple); |
1745 | - }); |
1746 | + }); |
1747 | |
1748 | if (not is_registered_or_roaming(status)) |
1749 | return; |
1750 | @@ -116,47 +105,41 @@ |
1751 | auto cell_id = query_cid(); |
1752 | auto strength = query_strength(); |
1753 | |
1754 | - switch(radio_type) |
1755 | + switch (radio_type) |
1756 | { |
1757 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1758 | { |
1759 | - com::ubuntu::location::connectivity::RadioCell::Gsm gsm |
1760 | - { |
1761 | + com::ubuntu::location::connectivity::RadioCell::Gsm gsm{ |
1762 | com::ubuntu::location::connectivity::RadioCell::Gsm::MCC{mcc}, |
1763 | com::ubuntu::location::connectivity::RadioCell::Gsm::MNC{mnc}, |
1764 | com::ubuntu::location::connectivity::RadioCell::Gsm::LAC{lac}, |
1765 | com::ubuntu::location::connectivity::RadioCell::Gsm::ID{cell_id}, |
1766 | - com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(strength/100.f) |
1767 | - }; |
1768 | + com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(strength / 100.f)}; |
1769 | VLOG(1) << gsm; |
1770 | detail.gsm = gsm; |
1771 | break; |
1772 | } |
1773 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
1774 | { |
1775 | - com::ubuntu::location::connectivity::RadioCell::Lte lte |
1776 | - { |
1777 | + com::ubuntu::location::connectivity::RadioCell::Lte lte{ |
1778 | com::ubuntu::location::connectivity::RadioCell::Lte::MCC{mcc}, |
1779 | com::ubuntu::location::connectivity::RadioCell::Lte::MNC{mnc}, |
1780 | com::ubuntu::location::connectivity::RadioCell::Lte::TAC{lac}, |
1781 | com::ubuntu::location::connectivity::RadioCell::Lte::ID{cell_id}, |
1782 | com::ubuntu::location::connectivity::RadioCell::Lte::PID{}, |
1783 | - com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(strength/100.f) |
1784 | - }; |
1785 | + com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(strength / 100.f)}; |
1786 | VLOG(1) << lte; |
1787 | detail.lte = lte; |
1788 | break; |
1789 | } |
1790 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
1791 | { |
1792 | - com::ubuntu::location::connectivity::RadioCell::Umts umts |
1793 | - { |
1794 | + com::ubuntu::location::connectivity::RadioCell::Umts umts{ |
1795 | com::ubuntu::location::connectivity::RadioCell::Umts::MCC{mcc}, |
1796 | com::ubuntu::location::connectivity::RadioCell::Umts::MNC{mnc}, |
1797 | com::ubuntu::location::connectivity::RadioCell::Umts::LAC{lac}, |
1798 | com::ubuntu::location::connectivity::RadioCell::Umts::ID{cell_id}, |
1799 | - com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(strength/100.f) |
1800 | - }; |
1801 | + com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(strength / 100.f)}; |
1802 | VLOG(1) << umts; |
1803 | detail.umts = umts; |
1804 | break; |
1805 | @@ -233,8 +216,7 @@ |
1806 | did_cell_identity_change = true; |
1807 | |
1808 | auto value = variant.as< |
1809 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology::ValueType |
1810 | - >(); |
1811 | + org::Ofono::Manager::Modem::NetworkRegistration::Technology::ValueType>(); |
1812 | |
1813 | auto it = type_lut().find(value); |
1814 | |
1815 | @@ -253,10 +235,10 @@ |
1816 | if (radio_type == it->second) |
1817 | return; |
1818 | |
1819 | - switch(radio_type) |
1820 | + switch (radio_type) |
1821 | { |
1822 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1823 | - switch(it->second) |
1824 | + switch (it->second) |
1825 | { |
1826 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
1827 | detail.umts.location_area_code = detail.gsm.location_area_code; |
1828 | @@ -277,7 +259,7 @@ |
1829 | } |
1830 | break; |
1831 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
1832 | - switch(it->second) |
1833 | + switch (it->second) |
1834 | { |
1835 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1836 | detail.gsm.location_area_code = detail.umts.location_area_code; |
1837 | @@ -298,7 +280,7 @@ |
1838 | } |
1839 | break; |
1840 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
1841 | - switch(it->second) |
1842 | + switch (it->second) |
1843 | { |
1844 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1845 | detail.gsm.location_area_code = detail.lte.tracking_area_code; |
1846 | @@ -334,10 +316,9 @@ |
1847 | did_cell_identity_change = true; |
1848 | |
1849 | auto value = variant.as< |
1850 | - org::Ofono::Manager::Modem::NetworkRegistration::CellId::ValueType |
1851 | - >(); |
1852 | + org::Ofono::Manager::Modem::NetworkRegistration::CellId::ValueType>(); |
1853 | |
1854 | - switch(radio_type) |
1855 | + switch (radio_type) |
1856 | { |
1857 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1858 | detail.gsm.id.set(value); |
1859 | @@ -364,9 +345,8 @@ |
1860 | did_cell_identity_change = true; |
1861 | |
1862 | auto value = variant.as< |
1863 | - org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode::ValueType |
1864 | - >(); |
1865 | - switch(radio_type) |
1866 | + org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode::ValueType>(); |
1867 | + switch (radio_type) |
1868 | { |
1869 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1870 | detail.gsm.location_area_code.set(value); |
1871 | @@ -392,15 +372,13 @@ |
1872 | { |
1873 | did_cell_identity_change = true; |
1874 | |
1875 | - std::stringstream ss |
1876 | - { |
1877 | + std::stringstream ss{ |
1878 | variant.as< |
1879 | - org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode::ValueType |
1880 | - >() |
1881 | - }; |
1882 | - int value{-1}; ss >> value; |
1883 | + org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode::ValueType>()}; |
1884 | + int value{-1}; |
1885 | + ss >> value; |
1886 | |
1887 | - switch(radio_type) |
1888 | + switch (radio_type) |
1889 | { |
1890 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1891 | detail.gsm.mobile_country_code.set(value); |
1892 | @@ -426,15 +404,13 @@ |
1893 | { |
1894 | did_cell_identity_change = true; |
1895 | |
1896 | - std::stringstream ss |
1897 | - { |
1898 | + std::stringstream ss{ |
1899 | variant.as< |
1900 | - org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode::ValueType |
1901 | - >() |
1902 | - }; |
1903 | - int value{-1}; ss >> value; |
1904 | + org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode::ValueType>()}; |
1905 | + int value{-1}; |
1906 | + ss >> value; |
1907 | |
1908 | - switch(radio_type) |
1909 | + switch (radio_type) |
1910 | { |
1911 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1912 | detail.gsm.mobile_network_code.set(value); |
1913 | @@ -459,24 +435,20 @@ |
1914 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::Strength::name()) |
1915 | { |
1916 | auto value = variant.as< |
1917 | - org::Ofono::Manager::Modem::NetworkRegistration::Strength::ValueType |
1918 | - >(); |
1919 | + org::Ofono::Manager::Modem::NetworkRegistration::Strength::ValueType>(); |
1920 | |
1921 | - switch(radio_type) |
1922 | + switch (radio_type) |
1923 | { |
1924 | case com::ubuntu::location::connectivity::RadioCell::Type::gsm: |
1925 | - detail.gsm.strength |
1926 | - = com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(value/100.f); |
1927 | + detail.gsm.strength = com::ubuntu::location::connectivity::RadioCell::Gsm::SignalStrength::from_percent(value / 100.f); |
1928 | VLOG(1) << detail.gsm; |
1929 | break; |
1930 | case com::ubuntu::location::connectivity::RadioCell::Type::umts: |
1931 | - detail.umts.strength |
1932 | - = com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(value/100.f); |
1933 | + detail.umts.strength = com::ubuntu::location::connectivity::RadioCell::Umts::SignalStrength::from_percent(value / 100.f); |
1934 | VLOG(1) << detail.umts; |
1935 | break; |
1936 | case com::ubuntu::location::connectivity::RadioCell::Type::lte: |
1937 | - detail.lte.strength |
1938 | - = com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(value/100.f); |
1939 | + detail.lte.strength = com::ubuntu::location::connectivity::RadioCell::Lte::SignalStrength::from_percent(value / 100.f); |
1940 | VLOG(1) << detail.lte; |
1941 | break; |
1942 | default: |
1943 | @@ -490,8 +462,8 @@ |
1944 | if (key == org::Ofono::Manager::Modem::NetworkRegistration::Status::name()) |
1945 | { |
1946 | roaming = |
1947 | - variant.as<org::Ofono::Manager::Modem::NetworkRegistration::Status::ValueType>() == |
1948 | - org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming; |
1949 | + variant.as<org::Ofono::Manager::Modem::NetworkRegistration::Status::ValueType>() == |
1950 | + org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming; |
1951 | } |
1952 | |
1953 | if (did_cell_identity_change) |
1954 | @@ -514,10 +486,10 @@ |
1955 | |
1956 | cell_change_heuristics.invalidation_timer.expires_from_now(timeout); |
1957 | cell_change_heuristics.invalidation_timer.async_wait([this](boost::system::error_code ec) |
1958 | - { |
1959 | + { |
1960 | if (not ec) |
1961 | cell_change_heuristics.valid = false; |
1962 | - }); |
1963 | + }); |
1964 | |
1965 | cell_change_heuristics.valid = is_cell_details_valid(); |
1966 | } |
1967 | @@ -527,10 +499,8 @@ |
1968 | org::Ofono::Manager::Modem::NetworkRegistration::Status::Value detail::CachedRadioCell::query_status() |
1969 | { |
1970 | auto status = |
1971 | - modem.network_registration.get |
1972 | - < |
1973 | - org::Ofono::Manager::Modem::NetworkRegistration::Status |
1974 | - >(); |
1975 | + modem.network_registration.get< |
1976 | + org::Ofono::Manager::Modem::NetworkRegistration::Status>(); |
1977 | |
1978 | if (status == org::Ofono::Manager::Modem::NetworkRegistration::Status::unregistered) |
1979 | return org::Ofono::Manager::Modem::NetworkRegistration::Status::Value::unregistered; |
1980 | @@ -560,9 +530,8 @@ |
1981 | com::ubuntu::location::connectivity::RadioCell::Type detail::CachedRadioCell::query_technology() |
1982 | { |
1983 | auto technology = |
1984 | - modem.network_registration.get< |
1985 | - org::Ofono::Manager::Modem::NetworkRegistration::Technology |
1986 | - >(); |
1987 | + modem.network_registration.get< |
1988 | + org::Ofono::Manager::Modem::NetworkRegistration::Technology>(); |
1989 | |
1990 | auto it = type_lut().find(technology); |
1991 | |
1992 | @@ -575,56 +544,44 @@ |
1993 | // Queries the cell id from the Ofono NetworkRegistration. |
1994 | int detail::CachedRadioCell::query_cid() |
1995 | { |
1996 | - return modem.network_registration.get |
1997 | - < |
1998 | - org::Ofono::Manager::Modem::NetworkRegistration::CellId |
1999 | - >(); |
2000 | + return modem.network_registration.get< |
2001 | + org::Ofono::Manager::Modem::NetworkRegistration::CellId>(); |
2002 | } |
2003 | |
2004 | // Queries the location area code from the Ofono NetworkRegistration. |
2005 | std::uint16_t detail::CachedRadioCell::query_lac() |
2006 | { |
2007 | - return modem.network_registration.get |
2008 | - < |
2009 | - org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode |
2010 | - >(); |
2011 | + return modem.network_registration.get< |
2012 | + org::Ofono::Manager::Modem::NetworkRegistration::LocationAreaCode>(); |
2013 | } |
2014 | |
2015 | // Queries the mobile network code from the Ofono NetworkRegistration. |
2016 | int detail::CachedRadioCell::query_mnc() |
2017 | { |
2018 | - std::stringstream ssmnc |
2019 | - { |
2020 | - modem.network_registration.get |
2021 | - < |
2022 | - org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode |
2023 | - >() |
2024 | - }; |
2025 | - int mnc{0}; ssmnc >> mnc; |
2026 | + std::stringstream ssmnc{ |
2027 | + modem.network_registration.get< |
2028 | + org::Ofono::Manager::Modem::NetworkRegistration::MobileNetworkCode>()}; |
2029 | + int mnc{0}; |
2030 | + ssmnc >> mnc; |
2031 | return mnc; |
2032 | } |
2033 | |
2034 | // Queries the mobile country code from the Ofono NetworkRegistration. |
2035 | int detail::CachedRadioCell::query_mcc() |
2036 | { |
2037 | - std::stringstream ssmcc |
2038 | - { |
2039 | - modem.network_registration.get |
2040 | - < |
2041 | - org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode |
2042 | - >() |
2043 | - }; |
2044 | - int mcc{0}; ssmcc >> mcc; |
2045 | + std::stringstream ssmcc{ |
2046 | + modem.network_registration.get< |
2047 | + org::Ofono::Manager::Modem::NetworkRegistration::MobileCountryCode>()}; |
2048 | + int mcc{0}; |
2049 | + ssmcc >> mcc; |
2050 | return mcc; |
2051 | } |
2052 | |
2053 | // Queries the signal strength from the Ofono NetworkRegistration. |
2054 | std::int8_t detail::CachedRadioCell::query_strength() |
2055 | { |
2056 | - return modem.network_registration.get |
2057 | - < |
2058 | - org::Ofono::Manager::Modem::NetworkRegistration::Strength |
2059 | - >(); |
2060 | + return modem.network_registration.get< |
2061 | + org::Ofono::Manager::Modem::NetworkRegistration::Strength>(); |
2062 | } |
2063 | |
2064 | // Returns true iff status is either roaming or registered. |
2065 | @@ -637,7 +594,7 @@ |
2066 | // Returns true iff all the parts of the cell are populated with valid values. |
2067 | bool detail::CachedRadioCell::is_cell_details_valid() |
2068 | { |
2069 | - switch(radio_type) |
2070 | + switch (radio_type) |
2071 | { |
2072 | case com::ubuntu::location::connectivity::RadioCell::Type::unknown: |
2073 | return false; |
2074 | @@ -655,11 +612,11 @@ |
2075 | // Retuns true iff the GSM cell details are valid. |
2076 | bool detail::CachedRadioCell::is_gsm_valid() |
2077 | { |
2078 | - return gsm().mobile_country_code.is_valid() && |
2079 | - gsm().mobile_network_code.is_valid() && |
2080 | - gsm().location_area_code.is_valid() && |
2081 | - gsm().id.is_valid() && |
2082 | - gsm().strength.is_valid(); |
2083 | + return gsm().mobile_country_code.is_valid() && |
2084 | + gsm().mobile_network_code.is_valid() && |
2085 | + gsm().location_area_code.is_valid() && |
2086 | + gsm().id.is_valid() && |
2087 | + gsm().strength.is_valid(); |
2088 | } |
2089 | |
2090 | // Returns true iff the Umts cell details are valid. |
2091 | |
2092 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h' |
2093 | --- src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h 2014-10-13 12:38:40 +0000 |
2094 | +++ src/location_service/com/ubuntu/location/connectivity/cached_radio_cell.h 2015-02-03 09:10:02 +0000 |
2095 | @@ -86,7 +86,7 @@ |
2096 | // Property to indicate whether the current cell is |
2097 | // still valid according to the cell change heuristics. |
2098 | core::Property<bool> valid; |
2099 | - } cell_change_heuristics; |
2100 | + } cell_change_heuristics; |
2101 | // Executes the cell change heuristics if precondition is met. |
2102 | void execute_cell_change_heuristics_if_appropriate(); |
2103 | |
2104 | @@ -123,15 +123,15 @@ |
2105 | // Encapsulates all event connections that have to be cut on destruction. |
2106 | struct |
2107 | { |
2108 | - core::dbus::Signal |
2109 | - < |
2110 | + core::dbus::Signal< |
2111 | org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged, |
2112 | - org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged::ArgumentType |
2113 | - >::SubscriptionToken network_registration_properties_changed; |
2114 | + org::Ofono::Manager::Modem::NetworkRegistration::PropertyChanged::ArgumentType>::SubscriptionToken network_registration_properties_changed; |
2115 | } connections; |
2116 | |
2117 | // Marks the unset type in a variant. |
2118 | - struct None {}; |
2119 | + struct None |
2120 | + { |
2121 | + }; |
2122 | |
2123 | // Our custom variant handling the different known cell identity details. |
2124 | union Detail |
2125 | |
2126 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp' |
2127 | --- src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp 2014-08-14 20:33:37 +0000 |
2128 | +++ src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.cpp 2015-02-03 09:10:02 +0000 |
2129 | @@ -30,10 +30,8 @@ |
2130 | com::ubuntu::location::connectivity::WirelessNetwork::Mode |
2131 | wifi_mode_from_ap_mode(org::freedesktop::NetworkManager::AccessPoint::Mode::ValueType value) |
2132 | { |
2133 | - com::ubuntu::location::connectivity::WirelessNetwork::Mode mode |
2134 | - { |
2135 | - com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown |
2136 | - }; |
2137 | + com::ubuntu::location::connectivity::WirelessNetwork::Mode mode{ |
2138 | + com::ubuntu::location::connectivity::WirelessNetwork::Mode::unknown}; |
2139 | |
2140 | switch (value) |
2141 | { |
2142 | @@ -83,85 +81,67 @@ |
2143 | } |
2144 | |
2145 | detail::CachedWirelessNetwork::CachedWirelessNetwork( |
2146 | - const org::freedesktop::NetworkManager::Device& device, |
2147 | - const org::freedesktop::NetworkManager::AccessPoint& ap) |
2148 | + const org::freedesktop::NetworkManager::Device& device, |
2149 | + const org::freedesktop::NetworkManager::AccessPoint& ap) |
2150 | : device_(device), |
2151 | access_point_(ap) |
2152 | { |
2153 | - last_seen_ = std::chrono::system_clock::time_point |
2154 | - { |
2155 | - std::chrono::system_clock::duration{access_point_.last_seen->get()} |
2156 | - }; |
2157 | + last_seen_ = std::chrono::system_clock::time_point{ |
2158 | + std::chrono::system_clock::duration{access_point_.last_seen->get()}}; |
2159 | |
2160 | bssid_ = access_point_.hw_address->get(); |
2161 | ssid_ = utf8_ssid_to_string(access_point_.ssid->get()); |
2162 | mode_ = wifi_mode_from_ap_mode(access_point_.mode->get()); |
2163 | - frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency |
2164 | - { |
2165 | - static_cast<int>(access_point_.frequency->get()) |
2166 | - }; |
2167 | - signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength |
2168 | - { |
2169 | - static_cast<int>(access_point_.strength->get()) |
2170 | - }; |
2171 | + frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency{ |
2172 | + static_cast<int>(access_point_.frequency->get())}; |
2173 | + signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength{ |
2174 | + static_cast<int>(access_point_.strength->get())}; |
2175 | |
2176 | // Wire up all the connections |
2177 | access_point_.properties_changed->connect([this](const std::map<std::string, core::dbus::types::Variant>& dict) |
2178 | - { |
2179 | + { |
2180 | on_access_point_properties_changed(dict); |
2181 | - }); |
2182 | + }); |
2183 | } |
2184 | |
2185 | void detail::CachedWirelessNetwork::on_access_point_properties_changed(const std::map<std::string, core::dbus::types::Variant>& dict) |
2186 | { |
2187 | // We route by string |
2188 | - static const std::unordered_map<std::string, std::function<void(CachedWirelessNetwork&, const core::dbus::types::Variant&)> > lut |
2189 | - { |
2190 | - { |
2191 | - org::freedesktop::NetworkManager::AccessPoint::HwAddress::name(), |
2192 | - [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2193 | - { |
2194 | + static const std::unordered_map<std::string, std::function<void(CachedWirelessNetwork&, const core::dbus::types::Variant&)>> lut{ |
2195 | + {org::freedesktop::NetworkManager::AccessPoint::HwAddress::name(), |
2196 | + [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2197 | + { |
2198 | thiz.bssid_ = value.as<org::freedesktop::NetworkManager::AccessPoint::HwAddress::ValueType>(); |
2199 | - } |
2200 | - }, |
2201 | - { |
2202 | - org::freedesktop::NetworkManager::AccessPoint::Ssid::name(), |
2203 | - [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2204 | - { |
2205 | + }}, |
2206 | + {org::freedesktop::NetworkManager::AccessPoint::Ssid::name(), |
2207 | + [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2208 | + { |
2209 | thiz.ssid_ = utf8_ssid_to_string(value.as<org::freedesktop::NetworkManager::AccessPoint::Ssid::ValueType>()); |
2210 | - } |
2211 | - }, |
2212 | - { |
2213 | - org::freedesktop::NetworkManager::AccessPoint::Strength::name(), |
2214 | - [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2215 | - { |
2216 | + }}, |
2217 | + {org::freedesktop::NetworkManager::AccessPoint::Strength::name(), |
2218 | + [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2219 | + { |
2220 | thiz.signal_strength_ = com::ubuntu::location::connectivity::WirelessNetwork::SignalStrength |
2221 | { |
2222 | value.as<org::freedesktop::NetworkManager::AccessPoint::Strength::ValueType>() |
2223 | }; |
2224 | - } |
2225 | - }, |
2226 | - { |
2227 | - org::freedesktop::NetworkManager::AccessPoint::Frequency::name(), |
2228 | - [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2229 | - { |
2230 | + }}, |
2231 | + {org::freedesktop::NetworkManager::AccessPoint::Frequency::name(), |
2232 | + [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2233 | + { |
2234 | thiz.frequency_ = com::ubuntu::location::connectivity::WirelessNetwork::Frequency |
2235 | { |
2236 | static_cast<int>(value.as<org::freedesktop::NetworkManager::AccessPoint::Frequency::ValueType>()) |
2237 | }; |
2238 | - } |
2239 | - }, |
2240 | - { |
2241 | - org::freedesktop::NetworkManager::AccessPoint::Mode::name(), |
2242 | - [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2243 | - { |
2244 | + }}, |
2245 | + {org::freedesktop::NetworkManager::AccessPoint::Mode::name(), |
2246 | + [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2247 | + { |
2248 | thiz.mode_ = wifi_mode_from_ap_mode(value.as<org::freedesktop::NetworkManager::AccessPoint::Mode::ValueType>()); |
2249 | - } |
2250 | - }, |
2251 | - { |
2252 | - org::freedesktop::NetworkManager::AccessPoint::LastSeen::name(), |
2253 | - [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2254 | - { |
2255 | + }}, |
2256 | + {org::freedesktop::NetworkManager::AccessPoint::LastSeen::name(), |
2257 | + [](CachedWirelessNetwork& thiz, const core::dbus::types::Variant& value) |
2258 | + { |
2259 | thiz.last_seen_ = std::chrono::system_clock::time_point |
2260 | { |
2261 | std::chrono::system_clock::duration |
2262 | @@ -169,9 +149,7 @@ |
2263 | value.as<org::freedesktop::NetworkManager::AccessPoint::LastSeen::ValueType>() |
2264 | } |
2265 | }; |
2266 | - } |
2267 | - } |
2268 | - }; |
2269 | + }}}; |
2270 | |
2271 | for (const auto& pair : dict) |
2272 | { |
2273 | @@ -182,8 +160,10 @@ |
2274 | // log the issue for later analysis. |
2275 | try |
2276 | { |
2277 | - if (lut.count(pair.first) > 0) lut.at(pair.first)(*this, pair.second); |
2278 | - } catch (...) |
2279 | + if (lut.count(pair.first) > 0) |
2280 | + lut.at(pair.first)(*this, pair.second); |
2281 | + } |
2282 | + catch (...) |
2283 | { |
2284 | VLOG(1) << "Exception while updating state for property change: " << pair.first; |
2285 | } |
2286 | |
2287 | === modified file 'src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h' |
2288 | --- src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h 2014-08-14 20:25:22 +0000 |
2289 | +++ src/location_service/com/ubuntu/location/connectivity/cached_wireless_network.h 2015-02-03 09:10:02 +0000 |
2290 | @@ -38,8 +38,8 @@ |
2291 | // it belongs to. Please note that the caching nature of the class ensures that |
2292 | // ap and device stubs are kept alive. |
2293 | CachedWirelessNetwork( |
2294 | - const org::freedesktop::NetworkManager::Device& device, |
2295 | - const org::freedesktop::NetworkManager::AccessPoint& ap); |
2296 | + const org::freedesktop::NetworkManager::Device& device, |
2297 | + const org::freedesktop::NetworkManager::AccessPoint& ap); |
2298 | |
2299 | // Timestamp when the network became visible. |
2300 | const core::Property<std::chrono::system_clock::time_point>& last_seen() const override; |
2301 | |
2302 | === modified file 'src/location_service/com/ubuntu/location/connectivity/manager.cpp' |
2303 | --- src/location_service/com/ubuntu/location/connectivity/manager.cpp 2014-10-02 06:59:46 +0000 |
2304 | +++ src/location_service/com/ubuntu/location/connectivity/manager.cpp 2015-02-03 09:10:02 +0000 |
2305 | @@ -24,14 +24,30 @@ |
2306 | { |
2307 | switch (state) |
2308 | { |
2309 | - case State::unknown: out << "State::unknown"; break; |
2310 | - case State::asleep: out << "State::asleep"; break; |
2311 | - case State::disconnected: out << "State::disconnected"; break; |
2312 | - case State::disconnecting: out << "State::disconnecting"; break; |
2313 | - case State::connecting: out << "State::connecting"; break; |
2314 | - case State::connected_local: out << "State::connected_local"; break; |
2315 | - case State::connected_site: out << "State::connected_site"; break; |
2316 | - case State::connected_global: out << "State::connected_global"; break; |
2317 | + case State::unknown: |
2318 | + out << "State::unknown"; |
2319 | + break; |
2320 | + case State::asleep: |
2321 | + out << "State::asleep"; |
2322 | + break; |
2323 | + case State::disconnected: |
2324 | + out << "State::disconnected"; |
2325 | + break; |
2326 | + case State::disconnecting: |
2327 | + out << "State::disconnecting"; |
2328 | + break; |
2329 | + case State::connecting: |
2330 | + out << "State::connecting"; |
2331 | + break; |
2332 | + case State::connected_local: |
2333 | + out << "State::connected_local"; |
2334 | + break; |
2335 | + case State::connected_site: |
2336 | + out << "State::connected_site"; |
2337 | + break; |
2338 | + case State::connected_global: |
2339 | + out << "State::connected_global"; |
2340 | + break; |
2341 | } |
2342 | |
2343 | return out; |
2344 | @@ -54,17 +70,35 @@ |
2345 | out << "["; |
2346 | |
2347 | if ((characteristics & connectivity::Characteristics::connection_goes_via_wifi) != connectivity::Characteristics::none) |
2348 | - { out << "connection_goes_via_wifi"; first = false; } |
2349 | + { |
2350 | + out << "connection_goes_via_wifi"; |
2351 | + first = false; |
2352 | + } |
2353 | if ((characteristics & connectivity::Characteristics::connection_goes_via_wwan) != connectivity::Characteristics::none) |
2354 | - { out << (first ? "" : ", ") << "connection_goes_via_wwan"; first = false; } |
2355 | + { |
2356 | + out << (first ? "" : ", ") << "connection_goes_via_wwan"; |
2357 | + first = false; |
2358 | + } |
2359 | if ((characteristics & connectivity::Characteristics::connection_is_roaming) != connectivity::Characteristics::none) |
2360 | - { out << (first ? "" : ", ") << "connection_is_roaming"; first = false; } |
2361 | + { |
2362 | + out << (first ? "" : ", ") << "connection_is_roaming"; |
2363 | + first = false; |
2364 | + } |
2365 | if ((characteristics & connectivity::Characteristics::connection_has_monetary_costs) != connectivity::Characteristics::none) |
2366 | - { out << (first ? "" : ", ") << "connection_has_monetary_costs"; first = false; } |
2367 | + { |
2368 | + out << (first ? "" : ", ") << "connection_has_monetary_costs"; |
2369 | + first = false; |
2370 | + } |
2371 | if ((characteristics & connectivity::Characteristics::connection_is_bandwith_limited) != connectivity::Characteristics::none) |
2372 | - { out << (first ? "" : ", ") << "connection_is_bandwidth_limited"; first = false; } |
2373 | + { |
2374 | + out << (first ? "" : ", ") << "connection_is_bandwidth_limited"; |
2375 | + first = false; |
2376 | + } |
2377 | if ((characteristics & connectivity::Characteristics::connection_is_volume_limited) != connectivity::Characteristics::none) |
2378 | - { out << (first ? "" : ", ") << "connection_is_volume_limited"; first = false; } |
2379 | + { |
2380 | + out << (first ? "" : ", ") << "connection_is_volume_limited"; |
2381 | + first = false; |
2382 | + } |
2383 | |
2384 | out << "]"; |
2385 | return out; |
2386 | |
2387 | === modified file 'src/location_service/com/ubuntu/location/connectivity/nm.h' |
2388 | --- src/location_service/com/ubuntu/location/connectivity/nm.h 2014-08-22 10:49:52 +0000 |
2389 | +++ src/location_service/com/ubuntu/location/connectivity/nm.h 2015-02-03 09:10:02 +0000 |
2390 | @@ -296,12 +296,10 @@ |
2391 | : service(service), |
2392 | object(object), |
2393 | device_type(object->get_property<DeviceType>()), |
2394 | - signals |
2395 | - { |
2396 | + signals{ |
2397 | object->get_signal<Wireless::Signals::ScanDone>(), |
2398 | object->get_signal<Wireless::Signals::AccessPointAdded>(), |
2399 | - object->get_signal<Wireless::Signals::AccessPointRemoved>() |
2400 | - } |
2401 | + object->get_signal<Wireless::Signals::AccessPointRemoved>()} |
2402 | { |
2403 | } |
2404 | |
2405 | @@ -384,10 +382,8 @@ |
2406 | const std::shared_ptr<core::dbus::Object>& object) |
2407 | : service{service}, |
2408 | object{object}, |
2409 | - properties |
2410 | - { |
2411 | - object->get_property<Properties::Devices>() |
2412 | - } |
2413 | + properties{ |
2414 | + object->get_property<Properties::Devices>()} |
2415 | { |
2416 | } |
2417 | |
2418 | @@ -403,7 +399,7 @@ |
2419 | std::shared_ptr<core::dbus::Object> object; |
2420 | struct |
2421 | { |
2422 | - std::shared_ptr<core::dbus::Property<Properties::Devices> > devices; |
2423 | + std::shared_ptr<core::dbus::Property<Properties::Devices>> devices; |
2424 | } properties; |
2425 | }; |
2426 | |
2427 | @@ -605,33 +601,28 @@ |
2428 | NetworkManager(const core::dbus::Bus::Ptr& bus) |
2429 | : service(core::dbus::Service::use_service<NetworkManager>(bus)), |
2430 | object(service->object_for_path(core::dbus::types::ObjectPath("/org/freedesktop/NetworkManager"))), |
2431 | - properties |
2432 | - { |
2433 | + properties{ |
2434 | object->get_property<Properties::Connectivity>(), |
2435 | object->get_property<Properties::PrimaryConnection>(), |
2436 | object->get_property<Properties::State>(), |
2437 | object->get_property<Properties::WirelessEnabled>(), |
2438 | object->get_property<Properties::WirelessHardwareEnabled>(), |
2439 | object->get_property<Properties::WwanEnabled>(), |
2440 | - object->get_property<Properties::WwanHardwareEnabled>() |
2441 | - }, |
2442 | - signals |
2443 | - { |
2444 | + object->get_property<Properties::WwanHardwareEnabled>()}, |
2445 | + signals{ |
2446 | object->get_signal<Signals::DeviceAdded>(), |
2447 | object->get_signal<Signals::DeviceRemoved>(), |
2448 | object->get_signal<Signals::PropertiesChanged>(), |
2449 | - object->get_signal<Signals::StateChanged>() |
2450 | - } |
2451 | + object->get_signal<Signals::StateChanged>()} |
2452 | { |
2453 | } |
2454 | |
2455 | void for_each_device(const std::function<void(const core::dbus::types::ObjectPath&)>& f) |
2456 | { |
2457 | auto result = |
2458 | - object->transact_method< |
2459 | - NetworkManager::GetDevices, |
2460 | - std::vector<core::dbus::types::ObjectPath> |
2461 | - >(); |
2462 | + object->transact_method< |
2463 | + NetworkManager::GetDevices, |
2464 | + std::vector<core::dbus::types::ObjectPath>>(); |
2465 | |
2466 | if (result.is_error()) |
2467 | throw std::runtime_error(result.error().print()); |
2468 | @@ -648,9 +639,9 @@ |
2469 | std::vector<Device> get_devices() |
2470 | { |
2471 | auto result = |
2472 | - object->invoke_method_synchronously< |
2473 | - NetworkManager::GetDevices, |
2474 | - std::vector<core::dbus::types::ObjectPath>>(); |
2475 | + object->invoke_method_synchronously< |
2476 | + NetworkManager::GetDevices, |
2477 | + std::vector<core::dbus::types::ObjectPath>>(); |
2478 | |
2479 | if (result.is_error()) |
2480 | throw std::runtime_error(result.error().print()); |
2481 | @@ -659,9 +650,9 @@ |
2482 | for (const auto& path : result.value()) |
2483 | { |
2484 | devices.emplace_back( |
2485 | - Device( |
2486 | - service, |
2487 | - service->object_for_path(path))); |
2488 | + Device( |
2489 | + service, |
2490 | + service->object_for_path(path))); |
2491 | } |
2492 | |
2493 | return devices; |
2494 | @@ -672,13 +663,13 @@ |
2495 | |
2496 | struct |
2497 | { |
2498 | - std::shared_ptr<core::dbus::Property<Properties::Connectivity> > connectivity; |
2499 | - std::shared_ptr<core::dbus::Property<Properties::PrimaryConnection> > primary_connection; |
2500 | - std::shared_ptr<core::dbus::Property<Properties::State> > state; |
2501 | - std::shared_ptr<core::dbus::Property<Properties::WirelessEnabled> > is_wifi_enabled; |
2502 | - std::shared_ptr<core::dbus::Property<Properties::WirelessHardwareEnabled> > is_wifi_hardware_enabled; |
2503 | - std::shared_ptr<core::dbus::Property<Properties::WwanEnabled> > is_wwan_enabled; |
2504 | - std::shared_ptr<core::dbus::Property<Properties::WwanHardwareEnabled> > is_wwan_hardware_enabled; |
2505 | + std::shared_ptr<core::dbus::Property<Properties::Connectivity>> connectivity; |
2506 | + std::shared_ptr<core::dbus::Property<Properties::PrimaryConnection>> primary_connection; |
2507 | + std::shared_ptr<core::dbus::Property<Properties::State>> state; |
2508 | + std::shared_ptr<core::dbus::Property<Properties::WirelessEnabled>> is_wifi_enabled; |
2509 | + std::shared_ptr<core::dbus::Property<Properties::WirelessHardwareEnabled>> is_wifi_hardware_enabled; |
2510 | + std::shared_ptr<core::dbus::Property<Properties::WwanEnabled>> is_wwan_enabled; |
2511 | + std::shared_ptr<core::dbus::Property<Properties::WwanHardwareEnabled>> is_wwan_hardware_enabled; |
2512 | } properties; |
2513 | struct |
2514 | { |
2515 | |
2516 | === modified file 'src/location_service/com/ubuntu/location/connectivity/ofono.h' |
2517 | --- src/location_service/com/ubuntu/location/connectivity/ofono.h 2015-01-06 12:35:02 +0000 |
2518 | +++ src/location_service/com/ubuntu/location/connectivity/ofono.h 2015-02-03 09:10:02 +0000 |
2519 | @@ -36,84 +36,33 @@ |
2520 | { |
2521 | struct Ofono |
2522 | { |
2523 | -static const std::string& name() |
2524 | -{ |
2525 | - static const std::string s{"org.ofono"}; |
2526 | - return s; |
2527 | -} |
2528 | -struct Manager |
2529 | -{ |
2530 | - typedef std::shared_ptr<Manager> Ptr; |
2531 | - |
2532 | static const std::string& name() |
2533 | { |
2534 | - static const std::string s{"org.ofono.Manager"}; |
2535 | + static const std::string s{"org.ofono"}; |
2536 | return s; |
2537 | } |
2538 | - |
2539 | - struct GetModems |
2540 | - { |
2541 | - static const std::string& name() |
2542 | - { |
2543 | - static const std::string s{"GetModems"}; |
2544 | - return s; |
2545 | - } |
2546 | - |
2547 | - typedef Manager Interface; |
2548 | - typedef std::vector< |
2549 | - core::dbus::types::Struct< |
2550 | - core::dbus::types::ObjectPath |
2551 | - > |
2552 | - > ResultType; |
2553 | - |
2554 | - static std::chrono::milliseconds default_timeout() |
2555 | - { |
2556 | - return std::chrono::seconds{1}; |
2557 | - } |
2558 | - }; |
2559 | - |
2560 | - struct ModemAdded |
2561 | - { |
2562 | - static const std::string& name() |
2563 | - { |
2564 | - static const std::string s{"ModemAdded"}; |
2565 | - return s; |
2566 | - } |
2567 | - |
2568 | - typedef Manager Interface; |
2569 | - typedef std::tuple<core::dbus::types::ObjectPath, std::map<std::string, std::string>> ArgumentType; |
2570 | - }; |
2571 | - |
2572 | - struct ModemRemoved |
2573 | - { |
2574 | - static const std::string& name() |
2575 | - { |
2576 | - static const std::string s{"ModemRemoved"}; |
2577 | - return s; |
2578 | - } |
2579 | - |
2580 | - typedef Manager Interface; |
2581 | - typedef core::dbus::types::ObjectPath ArgumentType; |
2582 | - }; |
2583 | - |
2584 | - struct Modem |
2585 | - { |
2586 | - static const std::string& name() |
2587 | - { |
2588 | - static const std::string s{"org.ofono.Modem"}; |
2589 | - return s; |
2590 | - } |
2591 | - |
2592 | - struct GetProperties |
2593 | + struct Manager |
2594 | + { |
2595 | + typedef std::shared_ptr<Manager> Ptr; |
2596 | + |
2597 | + static const std::string& name() |
2598 | + { |
2599 | + static const std::string s{"org.ofono.Manager"}; |
2600 | + return s; |
2601 | + } |
2602 | + |
2603 | + struct GetModems |
2604 | { |
2605 | static const std::string& name() |
2606 | { |
2607 | - static const std::string s{"GetProperties"}; |
2608 | + static const std::string s{"GetModems"}; |
2609 | return s; |
2610 | } |
2611 | |
2612 | - typedef Modem Interface; |
2613 | - typedef std::map<std::string, core::dbus::types::Variant> ValueType; |
2614 | + typedef Manager Interface; |
2615 | + typedef std::vector< |
2616 | + core::dbus::types::Struct< |
2617 | + core::dbus::types::ObjectPath>> ResultType; |
2618 | |
2619 | static std::chrono::milliseconds default_timeout() |
2620 | { |
2621 | @@ -121,287 +70,37 @@ |
2622 | } |
2623 | }; |
2624 | |
2625 | - struct PropertyChanged |
2626 | - { |
2627 | - inline static std::string name() |
2628 | - { |
2629 | - return "PropertyChanged"; |
2630 | - } |
2631 | - |
2632 | - typedef Modem Interface; |
2633 | - |
2634 | - typedef std::tuple<std::string, core::dbus::types::Variant> ArgumentType; |
2635 | - }; |
2636 | - |
2637 | - struct Properties |
2638 | - { |
2639 | - struct Powered |
2640 | - { |
2641 | - static const std::string& name() |
2642 | - { |
2643 | - static const std::string s{"Powered"}; |
2644 | - return s; |
2645 | - } |
2646 | - |
2647 | - typedef Modem Interface; |
2648 | - typedef bool ValueType; |
2649 | - static const bool readable = true; |
2650 | - static const bool writable = true; |
2651 | - }; |
2652 | - |
2653 | - struct Online |
2654 | - { |
2655 | - static const std::string& name() |
2656 | - { |
2657 | - static const std::string s{"Online"}; |
2658 | - return s; |
2659 | - } |
2660 | - |
2661 | - typedef Modem Interface; |
2662 | - typedef bool ValueType; |
2663 | - static const bool readable = true; |
2664 | - static const bool writable = true; |
2665 | - }; |
2666 | - |
2667 | - struct Lockdown |
2668 | - { |
2669 | - static const std::string& name() |
2670 | - { |
2671 | - static const std::string s{"Lockdown"}; |
2672 | - return s; |
2673 | - } |
2674 | - |
2675 | - typedef Modem Interface; |
2676 | - typedef bool ValueType; |
2677 | - static const bool readable = true; |
2678 | - static const bool writable = true; |
2679 | - }; |
2680 | - |
2681 | - struct Name |
2682 | - { |
2683 | - static const std::string& name() |
2684 | - { |
2685 | - static const std::string s{"Name"}; |
2686 | - return s; |
2687 | - } |
2688 | - |
2689 | - typedef Modem Interface; |
2690 | - typedef std::string ValueType; |
2691 | - static const bool readable = true; |
2692 | - static const bool writable = false; |
2693 | - }; |
2694 | - |
2695 | - struct Manufacturer |
2696 | - { |
2697 | - static const std::string& name() |
2698 | - { |
2699 | - static const std::string s{"Manufacturer"}; |
2700 | - return s; |
2701 | - } |
2702 | - |
2703 | - typedef Modem Interface; |
2704 | - typedef std::string ValueType; |
2705 | - static const bool readable = true; |
2706 | - static const bool writable = false; |
2707 | - }; |
2708 | - |
2709 | - struct Model |
2710 | - { |
2711 | - static const std::string& name() |
2712 | - { |
2713 | - static const std::string s{"Model"}; |
2714 | - return s; |
2715 | - } |
2716 | - |
2717 | - typedef Modem Interface; |
2718 | - typedef std::string ValueType; |
2719 | - static const bool readable = true; |
2720 | - static const bool writable = false; |
2721 | - }; |
2722 | - |
2723 | - struct Revision |
2724 | - { |
2725 | - static const std::string& name() |
2726 | - { |
2727 | - static const std::string s{"Revision"}; |
2728 | - return s; |
2729 | - } |
2730 | - |
2731 | - typedef Modem Interface; |
2732 | - typedef std::string ValueType; |
2733 | - static const bool readable = true; |
2734 | - static const bool writable = false; |
2735 | - }; |
2736 | - |
2737 | - struct Serial |
2738 | - { |
2739 | - static const std::string& name() |
2740 | - { |
2741 | - static const std::string s{"Serial"}; |
2742 | - return s; |
2743 | - } |
2744 | - |
2745 | - typedef Modem Interface; |
2746 | - typedef std::string ValueType; |
2747 | - static const bool readable = true; |
2748 | - static const bool writable = false; |
2749 | - }; |
2750 | - |
2751 | - struct Features |
2752 | - { |
2753 | - static constexpr const char* net{"net"}; |
2754 | - static constexpr const char* rat{"rat"}; |
2755 | - static constexpr const char* cbs{"cbs"}; |
2756 | - static constexpr const char* sms{"sms"}; |
2757 | - static constexpr const char* sim{"sim"}; |
2758 | - static constexpr const char* stk{"stk"}; |
2759 | - static constexpr const char* ussd{"ussd"}; |
2760 | - static constexpr const char* gprs{"gprs"}; |
2761 | - static constexpr const char* tty{"tty"}; |
2762 | - static constexpr const char* gps{"gps"}; |
2763 | - |
2764 | - static const std::string& name() |
2765 | - { |
2766 | - static const std::string s{"Features"}; |
2767 | - return s; |
2768 | - } |
2769 | - |
2770 | - typedef Modem Interface; |
2771 | - typedef std::vector<std::string> ValueType; |
2772 | - static const bool readable = true; |
2773 | - static const bool writable = false; |
2774 | - }; |
2775 | - |
2776 | - struct Interfaces |
2777 | - { |
2778 | - static constexpr const char* assisted_satellite_navigation |
2779 | - { |
2780 | - "org.ofono.AssistedSatelliteNavigation" |
2781 | - }; |
2782 | - static constexpr const char* audio_settings |
2783 | - { |
2784 | - "org.ofono.AudioSettings" |
2785 | - }; |
2786 | - static constexpr const char* call_barring |
2787 | - { |
2788 | - "org.ofono.CallBarring" |
2789 | - }; |
2790 | - static constexpr const char* call_forwarding |
2791 | - { |
2792 | - "org.ofono.CallForwarding" |
2793 | - }; |
2794 | - static constexpr const char* call_meter |
2795 | - { |
2796 | - "org.ofono.CallMeter" |
2797 | - }; |
2798 | - static constexpr const char* call_settings |
2799 | - { |
2800 | - "org.ofono.CallSettings" |
2801 | - }; |
2802 | - static constexpr const char* call_volume |
2803 | - { |
2804 | - "org.ofono.CallVolume" |
2805 | - }; |
2806 | - static constexpr const char* cell_broadcast |
2807 | - { |
2808 | - "org.ofono.CellBroadcast" |
2809 | - }; |
2810 | - static constexpr const char* hands_free |
2811 | - { |
2812 | - "org.ofono.Handsfree" |
2813 | - }; |
2814 | - static constexpr const char* location_reporting |
2815 | - { |
2816 | - "org.ofono.LocationReporting" |
2817 | - }; |
2818 | - static constexpr const char* message_manager |
2819 | - { |
2820 | - "org.ofono.MessageManager" |
2821 | - }; |
2822 | - static constexpr const char* message_waiting |
2823 | - { |
2824 | - "org.ofono.MessageWaiting" |
2825 | - }; |
2826 | - static constexpr const char* network_registration |
2827 | - { |
2828 | - "org.ofono.NetworkRegistration" |
2829 | - }; |
2830 | - static constexpr const char* phonebook |
2831 | - { |
2832 | - "org.ofono.Phonebook" |
2833 | - }; |
2834 | - static constexpr const char* push_notification |
2835 | - { |
2836 | - "org.ofono.PushNotification" |
2837 | - }; |
2838 | - static constexpr const char* radio_settings |
2839 | - { |
2840 | - "org.ofono.RadioSettings" |
2841 | - }; |
2842 | - static constexpr const char* sim_manager |
2843 | - { |
2844 | - "org.ofono.SimManager" |
2845 | - }; |
2846 | - static constexpr const char* smart_messaging |
2847 | - { |
2848 | - "org.ofono.SmartMessaging" |
2849 | - }; |
2850 | - static constexpr const char* sim_toolkit |
2851 | - { |
2852 | - "org.ofono.SimToolkit" |
2853 | - }; |
2854 | - static constexpr const char* supplementary_services |
2855 | - { |
2856 | - "org.ofono.SupplementaryServices" |
2857 | - }; |
2858 | - static constexpr const char* text_telephony |
2859 | - { |
2860 | - "org.ofono.TextTelephony" |
2861 | - }; |
2862 | - static constexpr const char* voice_call_manager |
2863 | - { |
2864 | - "org.ofono.VoiceCallManager" |
2865 | - }; |
2866 | - |
2867 | - static const std::string& name() |
2868 | - { |
2869 | - static const std::string s{"Interfaces"}; |
2870 | - return s; |
2871 | - } |
2872 | - |
2873 | - typedef Modem Interface; |
2874 | - typedef std::vector<std::string> ValueType; |
2875 | - static const bool readable = true; |
2876 | - static const bool writable = false; |
2877 | - }; |
2878 | - |
2879 | - struct Type |
2880 | - { |
2881 | - static constexpr const char* test{"test"}; |
2882 | - static constexpr const char* hfp{"hfp"}; |
2883 | - static constexpr const char* sap{"sap"}; |
2884 | - static constexpr const char* hardware{"hardware"}; |
2885 | - |
2886 | - static const std::string& name() |
2887 | - { |
2888 | - static const std::string s{"Type"}; |
2889 | - return s; |
2890 | - } |
2891 | - |
2892 | - typedef Modem Interface; |
2893 | - typedef std::string ValueType; |
2894 | - static const bool readable = true; |
2895 | - static const bool writable = false; |
2896 | - }; |
2897 | - }; |
2898 | - |
2899 | - struct NetworkRegistration |
2900 | - { |
2901 | - static const std::string& name() |
2902 | - { |
2903 | - static const std::string s{"org.ofono.NetworkRegistration"}; |
2904 | - return s; |
2905 | - } |
2906 | + struct ModemAdded |
2907 | + { |
2908 | + static const std::string& name() |
2909 | + { |
2910 | + static const std::string s{"ModemAdded"}; |
2911 | + return s; |
2912 | + } |
2913 | + |
2914 | + typedef Manager Interface; |
2915 | + typedef std::tuple<core::dbus::types::ObjectPath, std::map<std::string, std::string>> ArgumentType; |
2916 | + }; |
2917 | + |
2918 | + struct ModemRemoved |
2919 | + { |
2920 | + static const std::string& name() |
2921 | + { |
2922 | + static const std::string s{"ModemRemoved"}; |
2923 | + return s; |
2924 | + } |
2925 | + |
2926 | + typedef Manager Interface; |
2927 | + typedef core::dbus::types::ObjectPath ArgumentType; |
2928 | + }; |
2929 | + |
2930 | + struct Modem |
2931 | + { |
2932 | + static const std::string& name() |
2933 | + { |
2934 | + static const std::string s{"org.ofono.Modem"}; |
2935 | + return s; |
2936 | + } |
2937 | |
2938 | struct GetProperties |
2939 | { |
2940 | @@ -411,7 +110,7 @@ |
2941 | return s; |
2942 | } |
2943 | |
2944 | - typedef NetworkRegistration Interface; |
2945 | + typedef Modem Interface; |
2946 | typedef std::map<std::string, core::dbus::types::Variant> ValueType; |
2947 | |
2948 | static std::chrono::milliseconds default_timeout() |
2949 | @@ -427,229 +126,514 @@ |
2950 | return "PropertyChanged"; |
2951 | } |
2952 | |
2953 | - typedef NetworkRegistration Interface; |
2954 | + typedef Modem Interface; |
2955 | |
2956 | typedef std::tuple<std::string, core::dbus::types::Variant> ArgumentType; |
2957 | }; |
2958 | |
2959 | - struct Status |
2960 | - { |
2961 | - enum class Value |
2962 | - { |
2963 | - unregistered, |
2964 | - registered, |
2965 | - searching, |
2966 | - denied, |
2967 | - unknown, |
2968 | - roaming |
2969 | - }; |
2970 | - |
2971 | - static constexpr const char* unregistered |
2972 | - { |
2973 | - "unregistered" |
2974 | - }; |
2975 | - static constexpr const char* registered |
2976 | - { |
2977 | - "registered" |
2978 | - }; |
2979 | - static constexpr const char* searching |
2980 | - { |
2981 | - "searching" |
2982 | - }; |
2983 | - static constexpr const char* denied |
2984 | - { |
2985 | - "denied" |
2986 | - }; |
2987 | - static constexpr const char* unknown |
2988 | - { |
2989 | - "unknown" |
2990 | - }; |
2991 | - static constexpr const char* roaming |
2992 | - { |
2993 | - "roaming" |
2994 | - }; |
2995 | - |
2996 | - static const char* value_to_string(Value value) |
2997 | - { |
2998 | - switch (value) |
2999 | - { |
3000 | - case Value::unregistered: return unregistered; |
3001 | - case Value::registered: return registered; |
3002 | - case Value::searching: return searching; |
3003 | - case Value::denied: return denied; |
3004 | - case Value::unknown: return unknown; |
3005 | - case Value::roaming: return roaming; |
3006 | - } |
3007 | - |
3008 | - return nullptr; |
3009 | - } |
3010 | - |
3011 | - static const std::string& name() |
3012 | - { |
3013 | - static const std::string s{"Status"}; |
3014 | - return s; |
3015 | - } |
3016 | - |
3017 | - typedef NetworkRegistration Interface; |
3018 | - typedef std::string ValueType; |
3019 | - static const bool readable = true; |
3020 | - static const bool writable = false; |
3021 | - }; |
3022 | - |
3023 | - struct LocationAreaCode |
3024 | - { |
3025 | - static const std::string& name() |
3026 | - { |
3027 | - static const std::string s{"LocationAreaCode"}; |
3028 | - return s; |
3029 | - } |
3030 | - |
3031 | - typedef NetworkRegistration Interface; |
3032 | - typedef std::uint16_t ValueType; |
3033 | - static const bool readable = true; |
3034 | - static const bool writable = false; |
3035 | - }; |
3036 | - |
3037 | - struct CellId |
3038 | - { |
3039 | - static const std::string& name() |
3040 | - { |
3041 | - static const std::string s{"CellId"}; |
3042 | - return s; |
3043 | - } |
3044 | - |
3045 | - typedef NetworkRegistration Interface; |
3046 | - typedef std::uint32_t ValueType; |
3047 | - static const bool readable = true; |
3048 | - static const bool writable = false; |
3049 | - }; |
3050 | - |
3051 | - struct MobileCountryCode |
3052 | - { |
3053 | - static const std::string& name() |
3054 | - { |
3055 | - static const std::string s{"MobileCountryCode"}; |
3056 | - return s; |
3057 | - } |
3058 | - |
3059 | - typedef NetworkRegistration Interface; |
3060 | - typedef std::string ValueType; |
3061 | - static const bool readable = true; |
3062 | - static const bool writable = false; |
3063 | - }; |
3064 | - |
3065 | - struct MobileNetworkCode |
3066 | - { |
3067 | - static const std::string& name() |
3068 | - { |
3069 | - static const std::string s{"MobileNetworkCode"}; |
3070 | - return s; |
3071 | - } |
3072 | - |
3073 | - typedef NetworkRegistration Interface; |
3074 | - typedef std::string ValueType; |
3075 | - static const bool readable = true; |
3076 | - static const bool writable = false; |
3077 | - }; |
3078 | - |
3079 | - struct Technology |
3080 | - { |
3081 | - static const char* gsm() { return "gsm"; } |
3082 | - static const char* edge() { return "edge"; } |
3083 | - static const char* umts() { return "umts"; } |
3084 | - static const char* hspa() { return "hspa"; } |
3085 | - static const char* lte() { return "lte"; } |
3086 | - |
3087 | - static const std::string& name() |
3088 | - { |
3089 | - static const std::string s{"Technology"}; |
3090 | - return s; |
3091 | - } |
3092 | - |
3093 | - typedef NetworkRegistration Interface; |
3094 | - typedef std::string ValueType; |
3095 | - static const bool readable = true; |
3096 | - static const bool writable = false; |
3097 | - }; |
3098 | - |
3099 | - struct Strength |
3100 | - { |
3101 | - static const std::string& name() |
3102 | - { |
3103 | - static const std::string s{"Strength"}; |
3104 | - return s; |
3105 | - } |
3106 | - |
3107 | - typedef NetworkRegistration Interface; |
3108 | - typedef std::int8_t ValueType; |
3109 | - static const bool readable = true; |
3110 | - static const bool writable = false; |
3111 | - }; |
3112 | - |
3113 | - NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object) |
3114 | - : object(object), |
3115 | - signals |
3116 | - { |
3117 | - object->get_signal<PropertyChanged>() |
3118 | - } |
3119 | - { |
3120 | - } |
3121 | - |
3122 | - // Calling this function might fail. However, we do not throw and only log |
3123 | - // the issue for later forensics. |
3124 | - bool refresh_properties() const |
3125 | - { |
3126 | - auto result = object->invoke_method_synchronously<GetProperties, GetProperties::ValueType>(); |
3127 | - |
3128 | - if (result.is_error()) |
3129 | - { |
3130 | - LOG(WARNING) << "Could not refresh properties for org::Ofono::Modem::NetworkRegistration: " << result.error().print(); |
3131 | - return false; |
3132 | - } |
3133 | - |
3134 | - properties = result.value(); |
3135 | - return true; |
3136 | - } |
3137 | - |
3138 | - template<typename Property> |
3139 | - typename Property::ValueType get(bool refresh = true) const |
3140 | - { |
3141 | - if (refresh) |
3142 | - { |
3143 | - if (not refresh_properties()) |
3144 | + struct Properties |
3145 | + { |
3146 | + struct Powered |
3147 | + { |
3148 | + static const std::string& name() |
3149 | + { |
3150 | + static const std::string s{"Powered"}; |
3151 | + return s; |
3152 | + } |
3153 | + |
3154 | + typedef Modem Interface; |
3155 | + typedef bool ValueType; |
3156 | + static const bool readable = true; |
3157 | + static const bool writable = true; |
3158 | + }; |
3159 | + |
3160 | + struct Online |
3161 | + { |
3162 | + static const std::string& name() |
3163 | + { |
3164 | + static const std::string s{"Online"}; |
3165 | + return s; |
3166 | + } |
3167 | + |
3168 | + typedef Modem Interface; |
3169 | + typedef bool ValueType; |
3170 | + static const bool readable = true; |
3171 | + static const bool writable = true; |
3172 | + }; |
3173 | + |
3174 | + struct Lockdown |
3175 | + { |
3176 | + static const std::string& name() |
3177 | + { |
3178 | + static const std::string s{"Lockdown"}; |
3179 | + return s; |
3180 | + } |
3181 | + |
3182 | + typedef Modem Interface; |
3183 | + typedef bool ValueType; |
3184 | + static const bool readable = true; |
3185 | + static const bool writable = true; |
3186 | + }; |
3187 | + |
3188 | + struct Name |
3189 | + { |
3190 | + static const std::string& name() |
3191 | + { |
3192 | + static const std::string s{"Name"}; |
3193 | + return s; |
3194 | + } |
3195 | + |
3196 | + typedef Modem Interface; |
3197 | + typedef std::string ValueType; |
3198 | + static const bool readable = true; |
3199 | + static const bool writable = false; |
3200 | + }; |
3201 | + |
3202 | + struct Manufacturer |
3203 | + { |
3204 | + static const std::string& name() |
3205 | + { |
3206 | + static const std::string s{"Manufacturer"}; |
3207 | + return s; |
3208 | + } |
3209 | + |
3210 | + typedef Modem Interface; |
3211 | + typedef std::string ValueType; |
3212 | + static const bool readable = true; |
3213 | + static const bool writable = false; |
3214 | + }; |
3215 | + |
3216 | + struct Model |
3217 | + { |
3218 | + static const std::string& name() |
3219 | + { |
3220 | + static const std::string s{"Model"}; |
3221 | + return s; |
3222 | + } |
3223 | + |
3224 | + typedef Modem Interface; |
3225 | + typedef std::string ValueType; |
3226 | + static const bool readable = true; |
3227 | + static const bool writable = false; |
3228 | + }; |
3229 | + |
3230 | + struct Revision |
3231 | + { |
3232 | + static const std::string& name() |
3233 | + { |
3234 | + static const std::string s{"Revision"}; |
3235 | + return s; |
3236 | + } |
3237 | + |
3238 | + typedef Modem Interface; |
3239 | + typedef std::string ValueType; |
3240 | + static const bool readable = true; |
3241 | + static const bool writable = false; |
3242 | + }; |
3243 | + |
3244 | + struct Serial |
3245 | + { |
3246 | + static const std::string& name() |
3247 | + { |
3248 | + static const std::string s{"Serial"}; |
3249 | + return s; |
3250 | + } |
3251 | + |
3252 | + typedef Modem Interface; |
3253 | + typedef std::string ValueType; |
3254 | + static const bool readable = true; |
3255 | + static const bool writable = false; |
3256 | + }; |
3257 | + |
3258 | + struct Features |
3259 | + { |
3260 | + static constexpr const char* net{"net"}; |
3261 | + static constexpr const char* rat{"rat"}; |
3262 | + static constexpr const char* cbs{"cbs"}; |
3263 | + static constexpr const char* sms{"sms"}; |
3264 | + static constexpr const char* sim{"sim"}; |
3265 | + static constexpr const char* stk{"stk"}; |
3266 | + static constexpr const char* ussd{"ussd"}; |
3267 | + static constexpr const char* gprs{"gprs"}; |
3268 | + static constexpr const char* tty{"tty"}; |
3269 | + static constexpr const char* gps{"gps"}; |
3270 | + |
3271 | + static const std::string& name() |
3272 | + { |
3273 | + static const std::string s{"Features"}; |
3274 | + return s; |
3275 | + } |
3276 | + |
3277 | + typedef Modem Interface; |
3278 | + typedef std::vector<std::string> ValueType; |
3279 | + static const bool readable = true; |
3280 | + static const bool writable = false; |
3281 | + }; |
3282 | + |
3283 | + struct Interfaces |
3284 | + { |
3285 | + static constexpr const char* assisted_satellite_navigation{ |
3286 | + "org.ofono.AssistedSatelliteNavigation"}; |
3287 | + static constexpr const char* audio_settings{ |
3288 | + "org.ofono.AudioSettings"}; |
3289 | + static constexpr const char* call_barring{ |
3290 | + "org.ofono.CallBarring"}; |
3291 | + static constexpr const char* call_forwarding{ |
3292 | + "org.ofono.CallForwarding"}; |
3293 | + static constexpr const char* call_meter{ |
3294 | + "org.ofono.CallMeter"}; |
3295 | + static constexpr const char* call_settings{ |
3296 | + "org.ofono.CallSettings"}; |
3297 | + static constexpr const char* call_volume{ |
3298 | + "org.ofono.CallVolume"}; |
3299 | + static constexpr const char* cell_broadcast{ |
3300 | + "org.ofono.CellBroadcast"}; |
3301 | + static constexpr const char* hands_free{ |
3302 | + "org.ofono.Handsfree"}; |
3303 | + static constexpr const char* location_reporting{ |
3304 | + "org.ofono.LocationReporting"}; |
3305 | + static constexpr const char* message_manager{ |
3306 | + "org.ofono.MessageManager"}; |
3307 | + static constexpr const char* message_waiting{ |
3308 | + "org.ofono.MessageWaiting"}; |
3309 | + static constexpr const char* network_registration{ |
3310 | + "org.ofono.NetworkRegistration"}; |
3311 | + static constexpr const char* phonebook{ |
3312 | + "org.ofono.Phonebook"}; |
3313 | + static constexpr const char* push_notification{ |
3314 | + "org.ofono.PushNotification"}; |
3315 | + static constexpr const char* radio_settings{ |
3316 | + "org.ofono.RadioSettings"}; |
3317 | + static constexpr const char* sim_manager{ |
3318 | + "org.ofono.SimManager"}; |
3319 | + static constexpr const char* smart_messaging{ |
3320 | + "org.ofono.SmartMessaging"}; |
3321 | + static constexpr const char* sim_toolkit{ |
3322 | + "org.ofono.SimToolkit"}; |
3323 | + static constexpr const char* supplementary_services{ |
3324 | + "org.ofono.SupplementaryServices"}; |
3325 | + static constexpr const char* text_telephony{ |
3326 | + "org.ofono.TextTelephony"}; |
3327 | + static constexpr const char* voice_call_manager{ |
3328 | + "org.ofono.VoiceCallManager"}; |
3329 | + |
3330 | + static const std::string& name() |
3331 | + { |
3332 | + static const std::string s{"Interfaces"}; |
3333 | + return s; |
3334 | + } |
3335 | + |
3336 | + typedef Modem Interface; |
3337 | + typedef std::vector<std::string> ValueType; |
3338 | + static const bool readable = true; |
3339 | + static const bool writable = false; |
3340 | + }; |
3341 | + |
3342 | + struct Type |
3343 | + { |
3344 | + static constexpr const char* test{"test"}; |
3345 | + static constexpr const char* hfp{"hfp"}; |
3346 | + static constexpr const char* sap{"sap"}; |
3347 | + static constexpr const char* hardware{"hardware"}; |
3348 | + |
3349 | + static const std::string& name() |
3350 | + { |
3351 | + static const std::string s{"Type"}; |
3352 | + return s; |
3353 | + } |
3354 | + |
3355 | + typedef Modem Interface; |
3356 | + typedef std::string ValueType; |
3357 | + static const bool readable = true; |
3358 | + static const bool writable = false; |
3359 | + }; |
3360 | + }; |
3361 | + |
3362 | + struct NetworkRegistration |
3363 | + { |
3364 | + static const std::string& name() |
3365 | + { |
3366 | + static const std::string s{"org.ofono.NetworkRegistration"}; |
3367 | + return s; |
3368 | + } |
3369 | + |
3370 | + struct GetProperties |
3371 | + { |
3372 | + static const std::string& name() |
3373 | + { |
3374 | + static const std::string s{"GetProperties"}; |
3375 | + return s; |
3376 | + } |
3377 | + |
3378 | + typedef NetworkRegistration Interface; |
3379 | + typedef std::map<std::string, core::dbus::types::Variant> ValueType; |
3380 | + |
3381 | + static std::chrono::milliseconds default_timeout() |
3382 | + { |
3383 | + return std::chrono::seconds{1}; |
3384 | + } |
3385 | + }; |
3386 | + |
3387 | + struct PropertyChanged |
3388 | + { |
3389 | + inline static std::string name() |
3390 | + { |
3391 | + return "PropertyChanged"; |
3392 | + } |
3393 | + |
3394 | + typedef NetworkRegistration Interface; |
3395 | + |
3396 | + typedef std::tuple<std::string, core::dbus::types::Variant> ArgumentType; |
3397 | + }; |
3398 | + |
3399 | + struct Status |
3400 | + { |
3401 | + enum class Value |
3402 | + { |
3403 | + unregistered, |
3404 | + registered, |
3405 | + searching, |
3406 | + denied, |
3407 | + unknown, |
3408 | + roaming |
3409 | + }; |
3410 | + |
3411 | + static constexpr const char* unregistered{ |
3412 | + "unregistered"}; |
3413 | + static constexpr const char* registered{ |
3414 | + "registered"}; |
3415 | + static constexpr const char* searching{ |
3416 | + "searching"}; |
3417 | + static constexpr const char* denied{ |
3418 | + "denied"}; |
3419 | + static constexpr const char* unknown{ |
3420 | + "unknown"}; |
3421 | + static constexpr const char* roaming{ |
3422 | + "roaming"}; |
3423 | + |
3424 | + static const char* value_to_string(Value value) |
3425 | + { |
3426 | + switch (value) |
3427 | + { |
3428 | + case Value::unregistered: |
3429 | + return unregistered; |
3430 | + case Value::registered: |
3431 | + return registered; |
3432 | + case Value::searching: |
3433 | + return searching; |
3434 | + case Value::denied: |
3435 | + return denied; |
3436 | + case Value::unknown: |
3437 | + return unknown; |
3438 | + case Value::roaming: |
3439 | + return roaming; |
3440 | + } |
3441 | + |
3442 | + return nullptr; |
3443 | + } |
3444 | + |
3445 | + static const std::string& name() |
3446 | + { |
3447 | + static const std::string s{"Status"}; |
3448 | + return s; |
3449 | + } |
3450 | + |
3451 | + typedef NetworkRegistration Interface; |
3452 | + typedef std::string ValueType; |
3453 | + static const bool readable = true; |
3454 | + static const bool writable = false; |
3455 | + }; |
3456 | + |
3457 | + struct LocationAreaCode |
3458 | + { |
3459 | + static const std::string& name() |
3460 | + { |
3461 | + static const std::string s{"LocationAreaCode"}; |
3462 | + return s; |
3463 | + } |
3464 | + |
3465 | + typedef NetworkRegistration Interface; |
3466 | + typedef std::uint16_t ValueType; |
3467 | + static const bool readable = true; |
3468 | + static const bool writable = false; |
3469 | + }; |
3470 | + |
3471 | + struct CellId |
3472 | + { |
3473 | + static const std::string& name() |
3474 | + { |
3475 | + static const std::string s{"CellId"}; |
3476 | + return s; |
3477 | + } |
3478 | + |
3479 | + typedef NetworkRegistration Interface; |
3480 | + typedef std::uint32_t ValueType; |
3481 | + static const bool readable = true; |
3482 | + static const bool writable = false; |
3483 | + }; |
3484 | + |
3485 | + struct MobileCountryCode |
3486 | + { |
3487 | + static const std::string& name() |
3488 | + { |
3489 | + static const std::string s{"MobileCountryCode"}; |
3490 | + return s; |
3491 | + } |
3492 | + |
3493 | + typedef NetworkRegistration Interface; |
3494 | + typedef std::string ValueType; |
3495 | + static const bool readable = true; |
3496 | + static const bool writable = false; |
3497 | + }; |
3498 | + |
3499 | + struct MobileNetworkCode |
3500 | + { |
3501 | + static const std::string& name() |
3502 | + { |
3503 | + static const std::string s{"MobileNetworkCode"}; |
3504 | + return s; |
3505 | + } |
3506 | + |
3507 | + typedef NetworkRegistration Interface; |
3508 | + typedef std::string ValueType; |
3509 | + static const bool readable = true; |
3510 | + static const bool writable = false; |
3511 | + }; |
3512 | + |
3513 | + struct Technology |
3514 | + { |
3515 | + static const char* gsm() { return "gsm"; } |
3516 | + static const char* edge() { return "edge"; } |
3517 | + static const char* umts() { return "umts"; } |
3518 | + static const char* hspa() { return "hspa"; } |
3519 | + static const char* lte() { return "lte"; } |
3520 | + |
3521 | + static const std::string& name() |
3522 | + { |
3523 | + static const std::string s{"Technology"}; |
3524 | + return s; |
3525 | + } |
3526 | + |
3527 | + typedef NetworkRegistration Interface; |
3528 | + typedef std::string ValueType; |
3529 | + static const bool readable = true; |
3530 | + static const bool writable = false; |
3531 | + }; |
3532 | + |
3533 | + struct Strength |
3534 | + { |
3535 | + static const std::string& name() |
3536 | + { |
3537 | + static const std::string s{"Strength"}; |
3538 | + return s; |
3539 | + } |
3540 | + |
3541 | + typedef NetworkRegistration Interface; |
3542 | + typedef std::int8_t ValueType; |
3543 | + static const bool readable = true; |
3544 | + static const bool writable = false; |
3545 | + }; |
3546 | + |
3547 | + NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object) |
3548 | + : object(object), |
3549 | + signals{ |
3550 | + object->get_signal<PropertyChanged>()} |
3551 | + { |
3552 | + } |
3553 | + |
3554 | + // Calling this function might fail. However, we do not throw and only log |
3555 | + // the issue for later forensics. |
3556 | + bool refresh_properties() const |
3557 | + { |
3558 | + auto result = object->invoke_method_synchronously<GetProperties, GetProperties::ValueType>(); |
3559 | + |
3560 | + if (result.is_error()) |
3561 | + { |
3562 | + LOG(WARNING) << "Could not refresh properties for org::Ofono::Modem::NetworkRegistration: " << result.error().print(); |
3563 | + return false; |
3564 | + } |
3565 | + |
3566 | + properties = result.value(); |
3567 | + return true; |
3568 | + } |
3569 | + |
3570 | + template <typename Property> |
3571 | + typename Property::ValueType get(bool refresh = true) const |
3572 | + { |
3573 | + if (refresh) |
3574 | + { |
3575 | + if (not refresh_properties()) |
3576 | + return typename Property::ValueType{}; |
3577 | + } |
3578 | + |
3579 | + auto it = properties.find(Property::name()); |
3580 | + |
3581 | + if (it == properties.end()) |
3582 | + { |
3583 | + VLOG(1) << "Could not find property for name " << Property::name(); |
3584 | return typename Property::ValueType{}; |
3585 | + } |
3586 | + |
3587 | + return it->second.template as<typename Property::ValueType>(); |
3588 | } |
3589 | |
3590 | - auto it = properties.find(Property::name()); |
3591 | + std::shared_ptr<core::dbus::Object> object; |
3592 | + mutable GetProperties::ValueType properties; |
3593 | |
3594 | - if (it == properties.end()) |
3595 | + struct |
3596 | { |
3597 | - VLOG(1) << "Could not find property for name " << Property::name(); |
3598 | - return typename Property::ValueType{}; |
3599 | - } |
3600 | + core::dbus::Signal<PropertyChanged, PropertyChanged::ArgumentType>::Ptr property_changed; |
3601 | + } signals; |
3602 | + }; |
3603 | |
3604 | - return it->second.template as<typename Property::ValueType>(); |
3605 | + Modem(const std::shared_ptr<core::dbus::Service>& service, |
3606 | + const std::shared_ptr<core::dbus::Object>& object) |
3607 | + : service(service), |
3608 | + object(object), |
3609 | + signals{ |
3610 | + object->get_signal<PropertyChanged>()}, |
3611 | + network_registration{object} |
3612 | + { |
3613 | } |
3614 | |
3615 | + std::shared_ptr<core::dbus::Service> service; |
3616 | std::shared_ptr<core::dbus::Object> object; |
3617 | - mutable GetProperties::ValueType properties; |
3618 | |
3619 | struct |
3620 | { |
3621 | core::dbus::Signal<PropertyChanged, PropertyChanged::ArgumentType>::Ptr property_changed; |
3622 | } signals; |
3623 | + |
3624 | + NetworkRegistration network_registration; |
3625 | }; |
3626 | |
3627 | - Modem(const std::shared_ptr<core::dbus::Service>& service, |
3628 | - const std::shared_ptr<core::dbus::Object>& object) |
3629 | - : service(service), |
3630 | - object(object), |
3631 | - signals |
3632 | - { |
3633 | - object->get_signal<PropertyChanged>() |
3634 | - }, |
3635 | - network_registration{object} |
3636 | - { |
3637 | + Manager(const core::dbus::Bus::Ptr& bus) |
3638 | + : service(core::dbus::Service::use_service<org::Ofono>(bus)), |
3639 | + object(service->object_for_path(core::dbus::types::ObjectPath("/"))), |
3640 | + signals{ |
3641 | + object->get_signal<ModemAdded>(), |
3642 | + object->get_signal<ModemRemoved>()} |
3643 | + { |
3644 | + } |
3645 | + |
3646 | + Modem modem_for_path(const core::dbus::types::ObjectPath& path) const |
3647 | + { |
3648 | + return Modem{ |
3649 | + service, |
3650 | + service->object_for_path(path)}; |
3651 | + } |
3652 | + |
3653 | + void for_each_modem(const std::function<void(const core::dbus::types::ObjectPath&)>& functor) const |
3654 | + { |
3655 | + auto result = object->invoke_method_synchronously<GetModems, GetModems::ResultType>(); |
3656 | + |
3657 | + if (result.is_error()) |
3658 | + throw std::runtime_error(result.error().print()); |
3659 | + |
3660 | + for (const auto& element : result.value()) |
3661 | + { |
3662 | + functor(element.value); |
3663 | + } |
3664 | } |
3665 | |
3666 | std::shared_ptr<core::dbus::Service> service; |
3667 | @@ -657,54 +641,10 @@ |
3668 | |
3669 | struct |
3670 | { |
3671 | - core::dbus::Signal<PropertyChanged, PropertyChanged::ArgumentType>::Ptr property_changed; |
3672 | + std::shared_ptr<core::dbus::Signal<ModemAdded, ModemAdded::ArgumentType>> modem_added; |
3673 | + std::shared_ptr<core::dbus::Signal<ModemRemoved, ModemRemoved::ArgumentType>> modem_removed; |
3674 | } signals; |
3675 | - |
3676 | - NetworkRegistration network_registration; |
3677 | }; |
3678 | - |
3679 | - Manager(const core::dbus::Bus::Ptr& bus) |
3680 | - : service(core::dbus::Service::use_service<org::Ofono>(bus)), |
3681 | - object(service->object_for_path(core::dbus::types::ObjectPath("/"))), |
3682 | - signals |
3683 | - { |
3684 | - object->get_signal<ModemAdded>(), |
3685 | - object->get_signal<ModemRemoved>() |
3686 | - } |
3687 | - { |
3688 | - } |
3689 | - |
3690 | - Modem modem_for_path(const core::dbus::types::ObjectPath& path) const |
3691 | - { |
3692 | - return Modem |
3693 | - { |
3694 | - service, |
3695 | - service->object_for_path(path) |
3696 | - }; |
3697 | - } |
3698 | - |
3699 | - void for_each_modem(const std::function<void(const core::dbus::types::ObjectPath&)>& functor) const |
3700 | - { |
3701 | - auto result = object->invoke_method_synchronously<GetModems, GetModems::ResultType>(); |
3702 | - |
3703 | - if (result.is_error()) |
3704 | - throw std::runtime_error(result.error().print()); |
3705 | - |
3706 | - for (const auto& element : result.value()) |
3707 | - { |
3708 | - functor(element.value); |
3709 | - } |
3710 | - } |
3711 | - |
3712 | - std::shared_ptr<core::dbus::Service> service; |
3713 | - std::shared_ptr<core::dbus::Object> object; |
3714 | - |
3715 | - struct |
3716 | - { |
3717 | - std::shared_ptr<core::dbus::Signal<ModemAdded, ModemAdded::ArgumentType>> modem_added; |
3718 | - std::shared_ptr<core::dbus::Signal<ModemRemoved, ModemRemoved::ArgumentType>> modem_removed; |
3719 | - } signals; |
3720 | -}; |
3721 | }; |
3722 | } |
3723 | |
3724 | |
3725 | === modified file 'src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp' |
3726 | --- src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp 2015-01-06 12:35:02 +0000 |
3727 | +++ src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp 2015-02-03 09:10:02 +0000 |
3728 | @@ -28,10 +28,8 @@ |
3729 | { |
3730 | connectivity::State from_nm_property(std::uint32_t value) |
3731 | { |
3732 | - return connectivity::State |
3733 | - { |
3734 | - static_cast<connectivity::State>(value) |
3735 | - }; |
3736 | + return connectivity::State{ |
3737 | + static_cast<connectivity::State>(value)}; |
3738 | } |
3739 | |
3740 | connectivity::Characteristics all_characteristics() |
3741 | @@ -140,17 +138,17 @@ |
3742 | // For that, we setup watching of registration changes and initialize |
3743 | // the instance later on. |
3744 | modem_manager_watcher = bus_daemon->make_service_watcher( |
3745 | - org::Ofono::name(), |
3746 | - core::dbus::DBus::WatchMode::registration); |
3747 | + org::Ofono::name(), |
3748 | + core::dbus::DBus::WatchMode::registration); |
3749 | |
3750 | modem_manager_watcher->service_registered().connect([this]() |
3751 | - { |
3752 | + { |
3753 | VLOG(1) << org::Ofono::name() << " got registered on the bus."; |
3754 | dispatcher.service.post([this]() |
3755 | { |
3756 | setup_radio_stack_access(); |
3757 | }); |
3758 | - }); |
3759 | + }); |
3760 | } |
3761 | |
3762 | try |
3763 | @@ -164,17 +162,17 @@ |
3764 | // For that, we setup watching of registration changes and initialize |
3765 | // the instance later on. |
3766 | network_manager_watcher = bus_daemon->make_service_watcher( |
3767 | - xdg::NetworkManager::name(), |
3768 | - core::dbus::DBus::WatchMode::registration); |
3769 | + xdg::NetworkManager::name(), |
3770 | + core::dbus::DBus::WatchMode::registration); |
3771 | |
3772 | network_manager_watcher->service_registered().connect([this]() |
3773 | - { |
3774 | + { |
3775 | VLOG(1) << xdg::NetworkManager::name() << " got registered on the bus."; |
3776 | dispatcher.service.post([this]() |
3777 | { |
3778 | setup_network_stack_access(); |
3779 | }); |
3780 | - }); |
3781 | + }); |
3782 | } |
3783 | } |
3784 | |
3785 | @@ -191,7 +189,7 @@ |
3786 | modem_manager.reset(new org::Ofono::Manager(bus)); |
3787 | |
3788 | modem_manager->for_each_modem([this](const core::dbus::types::ObjectPath& path) |
3789 | - { |
3790 | + { |
3791 | try |
3792 | { |
3793 | on_modem_added(path); |
3794 | @@ -200,10 +198,10 @@ |
3795 | { |
3796 | VLOG(1) << "Exception while creating connected radio cell: " << e.what(); |
3797 | } |
3798 | - }); |
3799 | + }); |
3800 | |
3801 | modem_manager->signals.modem_added->connect([this](const org::Ofono::Manager::ModemAdded::ArgumentType& arg) |
3802 | - { |
3803 | + { |
3804 | try |
3805 | { |
3806 | on_modem_added(std::get<0>(arg)); |
3807 | @@ -212,10 +210,10 @@ |
3808 | { |
3809 | VLOG(1) << "Exception while adding modem: " << e.what(); |
3810 | } |
3811 | - }); |
3812 | + }); |
3813 | |
3814 | modem_manager->signals.modem_removed->connect([this](const core::dbus::types::ObjectPath& path) |
3815 | - { |
3816 | + { |
3817 | try |
3818 | { |
3819 | on_modem_removed(path); |
3820 | @@ -224,7 +222,7 @@ |
3821 | { |
3822 | VLOG(1) << "Exception while removing modem: " << e.what(); |
3823 | } |
3824 | - }); |
3825 | + }); |
3826 | } |
3827 | |
3828 | void connectivity::OfonoNmConnectivityManager::Private::on_modem_added(const core::dbus::types::ObjectPath& path) |
3829 | @@ -244,7 +242,7 @@ |
3830 | |
3831 | // We first wire up to property changes here. |
3832 | modem_result.first->second.signals.property_changed->connect([this, path](const std::tuple<std::string, core::dbus::types::Variant>& tuple) |
3833 | - { |
3834 | + { |
3835 | const auto& key = std::get<0>(tuple); VLOG(10) << "Property changed for modem: " << key; |
3836 | |
3837 | if (org::Ofono::Manager::Modem::Properties::Interfaces::name() == key) |
3838 | @@ -256,13 +254,13 @@ |
3839 | on_modem_interfaces_changed(path, interfaces); |
3840 | }); |
3841 | } |
3842 | - }); |
3843 | + }); |
3844 | |
3845 | // And update our cache of registered cells. |
3846 | auto cell_result = cached.cells.insert( |
3847 | - std::make_pair( |
3848 | - modem.object->path(), |
3849 | - std::make_shared<detail::CachedRadioCell>(modem, dispatcher.service))); |
3850 | + std::make_pair( |
3851 | + modem.object->path(), |
3852 | + std::make_shared<detail::CachedRadioCell>(modem, dispatcher.service))); |
3853 | |
3854 | if (not cell_result.second) |
3855 | return; |
3856 | @@ -272,7 +270,7 @@ |
3857 | |
3858 | // We account for a cell becoming invalid and report it as report. |
3859 | cell_result.first->second->is_valid().changed().connect([this, wp](bool valid) |
3860 | - { |
3861 | + { |
3862 | VLOG(10) << "Validity of cell changed: " << std::boolalpha << valid << std::endl; |
3863 | |
3864 | auto sp = wp.lock(); |
3865 | @@ -284,7 +282,7 @@ |
3866 | signals.connected_cell_added(sp); |
3867 | else |
3868 | signals.connected_cell_removed(sp); |
3869 | - }); |
3870 | + }); |
3871 | |
3872 | // Cool, we have reached here, updated all our caches and created a connected radio cell. |
3873 | // We are thus good to go and release the lock manually prior to announcing the new cell |
3874 | @@ -320,12 +318,13 @@ |
3875 | } |
3876 | // Inform customers of the registered cell being removed, without |
3877 | // the lock on the cache being held. |
3878 | - if (cell) signals.connected_cell_removed(cell); |
3879 | + if (cell) |
3880 | + signals.connected_cell_removed(cell); |
3881 | } |
3882 | |
3883 | void connectivity::OfonoNmConnectivityManager::Private::on_modem_interfaces_changed( |
3884 | - const core::dbus::types::ObjectPath& path, |
3885 | - const std::vector<std::string>& interfaces) |
3886 | + const core::dbus::types::ObjectPath& path, |
3887 | + const std::vector<std::string>& interfaces) |
3888 | { |
3889 | std::unique_lock<std::mutex> ul(cached.guard); |
3890 | |
3891 | @@ -340,9 +339,9 @@ |
3892 | const bool has_cell_for_modem = itt != cached.cells.end(); |
3893 | |
3894 | auto it = std::find( |
3895 | - interfaces.begin(), |
3896 | - interfaces.end(), |
3897 | - std::string{org::Ofono::Manager::Modem::Properties::Interfaces::network_registration}); |
3898 | + interfaces.begin(), |
3899 | + interfaces.end(), |
3900 | + std::string{org::Ofono::Manager::Modem::Properties::Interfaces::network_registration}); |
3901 | const bool modem_has_network_registration = it != interfaces.end(); |
3902 | |
3903 | if (has_cell_for_modem and not modem_has_network_registration) |
3904 | @@ -354,11 +353,13 @@ |
3905 | |
3906 | // Cache is up to date now and we announce the removal of the cell |
3907 | // to API customers, with the lock on the cache not being held. |
3908 | - ul.unlock(); signals.connected_cell_removed(cell); |
3909 | - } else if (not has_cell_for_modem and modem_has_network_registration) |
3910 | + ul.unlock(); |
3911 | + signals.connected_cell_removed(cell); |
3912 | + } |
3913 | + else if (not has_cell_for_modem and modem_has_network_registration) |
3914 | { |
3915 | dispatcher.service.post([this, path]() |
3916 | - { |
3917 | + { |
3918 | std::unique_lock<std::mutex> ul(cached.guard); |
3919 | |
3920 | auto itm = cached.modems.find(path); |
3921 | @@ -395,7 +396,7 @@ |
3922 | // Cache is up to date now and we announce the new cell to |
3923 | // API customers, with the lock on the cache not being held. |
3924 | ul.unlock(); signals.connected_cell_added(cell); |
3925 | - }); |
3926 | + }); |
3927 | } |
3928 | } |
3929 | |
3930 | @@ -404,20 +405,20 @@ |
3931 | network_manager.reset(new xdg::NetworkManager(bus)); |
3932 | |
3933 | network_manager->for_each_device([this](const core::dbus::types::ObjectPath& device_path) |
3934 | - { |
3935 | + { |
3936 | std::unique_lock<std::mutex> ul{cached.guard}; |
3937 | on_device_added(device_path, ul); |
3938 | - }); |
3939 | + }); |
3940 | |
3941 | // Query the initial connectivity state |
3942 | state.set(from_nm_property(network_manager->properties.state->get())); |
3943 | // Determine the initial connection characteristics |
3944 | active_connection_characteristics.set( |
3945 | - characteristics_for_connection( |
3946 | - network_manager->properties.primary_connection->get())); |
3947 | + characteristics_for_connection( |
3948 | + network_manager->properties.primary_connection->get())); |
3949 | |
3950 | network_manager->signals.device_added->connect([this](const core::dbus::types::ObjectPath& path) |
3951 | - { |
3952 | + { |
3953 | // We dispatch determining the connection characteristics to unblock |
3954 | // the bus here. |
3955 | dispatcher.service.post([this, path]() |
3956 | @@ -425,10 +426,10 @@ |
3957 | std::unique_lock<std::mutex> ul{cached.guard}; |
3958 | on_device_added(path, ul); |
3959 | }); |
3960 | - }); |
3961 | + }); |
3962 | |
3963 | network_manager->signals.device_removed->connect([this](const core::dbus::types::ObjectPath& path) |
3964 | - { |
3965 | + { |
3966 | // We dispatch determining the connection characteristics to unblock |
3967 | // the bus here. |
3968 | dispatcher.service.post([this, path]() |
3969 | @@ -436,11 +437,11 @@ |
3970 | std::unique_lock<std::mutex> ul{cached.guard}; |
3971 | on_device_removed(path, ul); |
3972 | }); |
3973 | - }); |
3974 | + }); |
3975 | |
3976 | // And we wire up to property changes here |
3977 | network_manager->signals.properties_changed->connect([this](const std::map<std::string, core::dbus::types::Variant>& dict) |
3978 | - { |
3979 | + { |
3980 | for (const auto& pair : dict) |
3981 | { |
3982 | VLOG(1) << "Property has changed: " << std::endl |
3983 | @@ -468,12 +469,12 @@ |
3984 | }); |
3985 | } |
3986 | } |
3987 | - }); |
3988 | + }); |
3989 | |
3990 | network_manager->signals.state_changed->connect([this](std::uint32_t s) |
3991 | - { |
3992 | + { |
3993 | state.set(from_nm_property(s)); |
3994 | - }); |
3995 | + }); |
3996 | |
3997 | // Read initial properties. |
3998 | cached.is_wifi_enabled.set(network_manager->properties.is_wifi_enabled.get()); |
3999 | @@ -482,29 +483,29 @@ |
4000 | cached.is_wwan_hardware_enabled.set(network_manager->properties.is_wwan_hardware_enabled.get()); |
4001 | // And connect to changed signals. |
4002 | network_manager->properties.is_wifi_enabled->changed().connect([this](bool value) |
4003 | - { |
4004 | + { |
4005 | cached.is_wifi_enabled = value; |
4006 | - }); |
4007 | + }); |
4008 | |
4009 | network_manager->properties.is_wifi_hardware_enabled->changed().connect([this](bool value) |
4010 | - { |
4011 | + { |
4012 | cached.is_wifi_hardware_enabled = value; |
4013 | - }); |
4014 | + }); |
4015 | |
4016 | network_manager->properties.is_wwan_enabled->changed().connect([this](bool value) |
4017 | - { |
4018 | + { |
4019 | cached.is_wwan_enabled = value; |
4020 | - }); |
4021 | + }); |
4022 | |
4023 | network_manager->properties.is_wwan_hardware_enabled->changed().connect([this](bool value) |
4024 | - { |
4025 | + { |
4026 | cached.is_wwan_hardware_enabled = value; |
4027 | - }); |
4028 | + }); |
4029 | } |
4030 | |
4031 | void connectivity::OfonoNmConnectivityManager::Private::on_device_added( |
4032 | - const core::dbus::types::ObjectPath& device_path, |
4033 | - std::unique_lock<std::mutex>& ul) |
4034 | + const core::dbus::types::ObjectPath& device_path, |
4035 | + std::unique_lock<std::mutex>& ul) |
4036 | { |
4037 | if (cached.wireless_devices.count(device_path) > 0) |
4038 | return; |
4039 | @@ -519,7 +520,7 @@ |
4040 | |
4041 | // Iterate over all currently known wifis |
4042 | it->second.for_each_access_point([this, device_path, &ul](const core::dbus::types::ObjectPath& path) |
4043 | - { |
4044 | + { |
4045 | try |
4046 | { |
4047 | on_access_point_added(path, device_path, ul); |
4048 | @@ -528,15 +529,15 @@ |
4049 | { |
4050 | VLOG(1) << "Error while creating ap/wifi: " << e.what(); |
4051 | } |
4052 | - }); |
4053 | + }); |
4054 | |
4055 | it->second.signals.scan_done->connect([this]() |
4056 | - { |
4057 | + { |
4058 | signals.wireless_network_scan_finished(); |
4059 | - }); |
4060 | + }); |
4061 | |
4062 | it->second.signals.ap_added->connect([this, device_path](const core::dbus::types::ObjectPath& path) |
4063 | - { |
4064 | + { |
4065 | try |
4066 | { |
4067 | std::unique_lock<std::mutex> ul{cached.guard}; |
4068 | @@ -546,10 +547,10 @@ |
4069 | { |
4070 | VLOG(1) << "Error while creating ap/wifi: " << e.what(); |
4071 | } |
4072 | - }); |
4073 | + }); |
4074 | |
4075 | it->second.signals.ap_removed->connect([this](const core::dbus::types::ObjectPath& path) |
4076 | - { |
4077 | + { |
4078 | try |
4079 | { |
4080 | std::unique_lock<std::mutex> ul{cached.guard}; |
4081 | @@ -559,21 +560,21 @@ |
4082 | { |
4083 | VLOG(1) << "Error while removing ap/wifi: " << e.what(); |
4084 | } |
4085 | - }); |
4086 | + }); |
4087 | } |
4088 | } |
4089 | |
4090 | void connectivity::OfonoNmConnectivityManager::Private::on_device_removed( |
4091 | - const core::dbus::types::ObjectPath& path, |
4092 | - std::unique_lock<std::mutex>&) |
4093 | + const core::dbus::types::ObjectPath& path, |
4094 | + std::unique_lock<std::mutex>&) |
4095 | { |
4096 | cached.wireless_devices.erase(path); |
4097 | } |
4098 | |
4099 | void connectivity::OfonoNmConnectivityManager::Private::on_access_point_added( |
4100 | - const core::dbus::types::ObjectPath& ap_path, |
4101 | - const core::dbus::types::ObjectPath& device_path, |
4102 | - std::unique_lock<std::mutex>& ul) |
4103 | + const core::dbus::types::ObjectPath& ap_path, |
4104 | + const core::dbus::types::ObjectPath& device_path, |
4105 | + std::unique_lock<std::mutex>& ul) |
4106 | { |
4107 | // Let's see if we have a device known for the path. We return early |
4108 | // if we do not know about the device. |
4109 | @@ -581,22 +582,21 @@ |
4110 | if (itd == cached.wireless_devices.end()) |
4111 | return; |
4112 | |
4113 | - xdg::NetworkManager::AccessPoint ap |
4114 | - { |
4115 | - network_manager->service->add_object_for_path(ap_path) |
4116 | - }; |
4117 | + xdg::NetworkManager::AccessPoint ap{ |
4118 | + network_manager->service->add_object_for_path(ap_path)}; |
4119 | |
4120 | auto wifi = std::make_shared<detail::CachedWirelessNetwork>(itd->second, ap); |
4121 | cached.wifis[ap_path] = wifi; |
4122 | |
4123 | // Let API consumers know that an AP appeared. The lock on the cache is |
4124 | // not held to prevent from deadlocks. |
4125 | - ul.unlock(); signals.wireless_network_added(wifi); |
4126 | + ul.unlock(); |
4127 | + signals.wireless_network_added(wifi); |
4128 | } |
4129 | |
4130 | void connectivity::OfonoNmConnectivityManager::Private::on_access_point_removed( |
4131 | - const core::dbus::types::ObjectPath& ap_path, |
4132 | - std::unique_lock<std::mutex>& ul) |
4133 | + const core::dbus::types::ObjectPath& ap_path, |
4134 | + std::unique_lock<std::mutex>& ul) |
4135 | { |
4136 | // Let's see if we know about the wifi. We return early if not. |
4137 | auto itw = cached.wifis.find(ap_path); |
4138 | @@ -610,21 +610,18 @@ |
4139 | |
4140 | // Let API consumers know that an AP disappeared. The lock on the cache is |
4141 | // not held to prevent from deadlocks. |
4142 | - ul.unlock(); signals.wireless_network_removed(wifi); |
4143 | + ul.unlock(); |
4144 | + signals.wireless_network_removed(wifi); |
4145 | } |
4146 | |
4147 | connectivity::Characteristics connectivity::OfonoNmConnectivityManager::Private::characteristics_for_connection(const core::dbus::types::ObjectPath& path) |
4148 | { |
4149 | - xdg::NetworkManager::ActiveConnection ac |
4150 | - { |
4151 | + xdg::NetworkManager::ActiveConnection ac{ |
4152 | network_manager->service, |
4153 | - network_manager->service->object_for_path(path) |
4154 | - }; |
4155 | + network_manager->service->object_for_path(path)}; |
4156 | |
4157 | - connectivity::Characteristics characteristics |
4158 | - { |
4159 | - connectivity::Characteristics::none |
4160 | - }; |
4161 | + connectivity::Characteristics characteristics{ |
4162 | + connectivity::Characteristics::none}; |
4163 | |
4164 | // We try to enumerate all devices, and might fail if the active connection |
4165 | // went away under our feet. For that, we simply catch all possible exceptions |
4166 | @@ -632,7 +629,7 @@ |
4167 | try |
4168 | { |
4169 | ac.enumerate_devices([this, &characteristics](const core::dbus::types::ObjectPath& path) |
4170 | - { |
4171 | + { |
4172 | xdg::NetworkManager::Device::Type type{xdg::NetworkManager::Device::Type::unknown}; |
4173 | { |
4174 | // We only consider cached devices and do not reach out to enumerate all of the devices |
4175 | @@ -678,8 +675,9 @@ |
4176 | characteristics = characteristics | connectivity::Characteristics::connection_goes_via_wifi; |
4177 | } |
4178 | |
4179 | - }); |
4180 | - } catch(...) |
4181 | + }); |
4182 | + } |
4183 | + catch (...) |
4184 | { |
4185 | // Empty on purpose. |
4186 | } |
4187 | @@ -703,10 +701,10 @@ |
4188 | { |
4189 | system_bus->install_executor(executor); |
4190 | |
4191 | - worker_thread = std::move(std::thread |
4192 | - { |
4193 | - [this]() { system_bus->run(); } |
4194 | - }); |
4195 | + worker_thread = std::move(std::thread{ |
4196 | + [this]() |
4197 | + { system_bus->run(); |
4198 | + }}); |
4199 | } |
4200 | |
4201 | ~Runtime() |
4202 | @@ -729,24 +727,18 @@ |
4203 | { |
4204 | try |
4205 | { |
4206 | - static const std::shared_ptr<connectivity::Manager> instance |
4207 | - { |
4208 | - new connectivity::OfonoNmConnectivityManager |
4209 | - { |
4210 | - Runtime::instance().system_bus |
4211 | - } |
4212 | - }; |
4213 | + static const std::shared_ptr<connectivity::Manager> instance{ |
4214 | + new connectivity::OfonoNmConnectivityManager{ |
4215 | + Runtime::instance().system_bus}}; |
4216 | |
4217 | return instance; |
4218 | } |
4219 | - catch(...) |
4220 | + catch (...) |
4221 | { |
4222 | } |
4223 | |
4224 | - static const std::shared_ptr<connectivity::Manager> dummy_instance |
4225 | - { |
4226 | - new dummy::ConnectivityManager{} |
4227 | - }; |
4228 | + static const std::shared_ptr<connectivity::Manager> dummy_instance{ |
4229 | + new dummy::ConnectivityManager{}}; |
4230 | |
4231 | return dummy_instance; |
4232 | } |
4233 | |
4234 | === modified file 'src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.h' |
4235 | --- src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.h 2014-11-10 20:12:56 +0000 |
4236 | +++ src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.h 2015-02-03 09:10:02 +0000 |
4237 | @@ -51,7 +51,14 @@ |
4238 | |
4239 | namespace dbus = core::dbus; |
4240 | |
4241 | -namespace com { namespace ubuntu { namespace location { namespace connectivity { |
4242 | +namespace com |
4243 | +{ |
4244 | +namespace ubuntu |
4245 | +{ |
4246 | +namespace location |
4247 | +{ |
4248 | +namespace connectivity |
4249 | +{ |
4250 | struct OfonoNmConnectivityManager : public com::ubuntu::location::connectivity::Manager |
4251 | { |
4252 | // Creates an instance of the manager, resolving services on the given bus. |
4253 | @@ -98,7 +105,7 @@ |
4254 | void on_device_removed(const core::dbus::types::ObjectPath& device_path, std::unique_lock<std::mutex>& ul); |
4255 | void on_access_point_added(const core::dbus::types::ObjectPath& ap_path, const core::dbus::types::ObjectPath& device_path, std::unique_lock<std::mutex>& ul); |
4256 | void on_access_point_removed(const core::dbus::types::ObjectPath& ap_path, std::unique_lock<std::mutex>& ul); |
4257 | - com::ubuntu::location::connectivity::Characteristics characteristics_for_connection(const core::dbus::types::ObjectPath& path); |
4258 | + com::ubuntu::location::connectivity::Characteristics characteristics_for_connection(const core::dbus::types::ObjectPath& path); |
4259 | |
4260 | core::dbus::Bus::Ptr bus; |
4261 | std::shared_ptr<core::dbus::DBus> bus_daemon; |
4262 | @@ -118,16 +125,14 @@ |
4263 | boost::asio::io_service service; |
4264 | |
4265 | // We keep the io_service object alive until someone stops it. |
4266 | - boost::asio::io_service::work keep_alive |
4267 | - { |
4268 | - service |
4269 | - }; |
4270 | + boost::asio::io_service::work keep_alive{ |
4271 | + service}; |
4272 | |
4273 | // And a dedicated worker thread. |
4274 | - std::thread worker |
4275 | - { |
4276 | - [this]() { service.run(); } |
4277 | - }; |
4278 | + std::thread worker{ |
4279 | + [this]() |
4280 | + { service.run(); |
4281 | + }}; |
4282 | } dispatcher; |
4283 | |
4284 | struct |
4285 | @@ -162,6 +167,9 @@ |
4286 | core::Property<com::ubuntu::location::connectivity::Characteristics> active_connection_characteristics; |
4287 | } d; |
4288 | }; |
4289 | -}}}} |
4290 | +} |
4291 | +} |
4292 | +} |
4293 | +} |
4294 | |
4295 | #endif // OFONO_NM_CONNECTIVITY_MANAGER_H_ |
4296 | |
4297 | === modified file 'src/location_service/com/ubuntu/location/connectivity/radio_cell.cpp' |
4298 | --- src/location_service/com/ubuntu/location/connectivity/radio_cell.cpp 2014-06-10 11:53:01 +0000 |
4299 | +++ src/location_service/com/ubuntu/location/connectivity/radio_cell.cpp 2015-02-03 09:10:02 +0000 |
4300 | @@ -45,10 +45,10 @@ |
4301 | bool location::connectivity::operator==(const location::connectivity::RadioCell::Umts& lhs, const location::connectivity::RadioCell::Umts& rhs) |
4302 | { |
4303 | return lhs.mobile_country_code == rhs.mobile_country_code && |
4304 | - lhs.mobile_network_code == rhs.mobile_network_code && |
4305 | - lhs.location_area_code == rhs.location_area_code && |
4306 | - lhs.id == rhs.id && |
4307 | - lhs.strength == rhs.strength; |
4308 | + lhs.mobile_network_code == rhs.mobile_network_code && |
4309 | + lhs.location_area_code == rhs.location_area_code && |
4310 | + lhs.id == rhs.id && |
4311 | + lhs.strength == rhs.strength; |
4312 | } |
4313 | |
4314 | std::ostream& location::connectivity::operator<<(std::ostream& out, const location::connectivity::RadioCell::Umts& umts) |
4315 | @@ -67,11 +67,11 @@ |
4316 | const location::connectivity::RadioCell::Lte& rhs) |
4317 | { |
4318 | return lhs.mobile_country_code == rhs.mobile_country_code && |
4319 | - lhs.mobile_network_code == rhs.mobile_network_code && |
4320 | - lhs.tracking_area_code == rhs.tracking_area_code && |
4321 | - lhs.id == rhs.id && |
4322 | - lhs.physical_id == rhs.physical_id && |
4323 | - lhs.strength == rhs.strength; |
4324 | + lhs.mobile_network_code == rhs.mobile_network_code && |
4325 | + lhs.tracking_area_code == rhs.tracking_area_code && |
4326 | + lhs.id == rhs.id && |
4327 | + lhs.physical_id == rhs.physical_id && |
4328 | + lhs.strength == rhs.strength; |
4329 | } |
4330 | |
4331 | std::ostream& location::connectivity::operator<<(std::ostream& out, const location::connectivity::RadioCell::Lte& lte) |
4332 | @@ -93,12 +93,16 @@ |
4333 | if (lhs.type() != rhs.type()) |
4334 | return false; |
4335 | |
4336 | - switch(lhs.type()) |
4337 | + switch (lhs.type()) |
4338 | { |
4339 | - case location::connectivity::RadioCell::Type::gsm: return lhs.gsm() == rhs.gsm(); |
4340 | - case location::connectivity::RadioCell::Type::umts: return lhs.umts() == rhs.umts(); |
4341 | - case location::connectivity::RadioCell::Type::lte: return lhs.lte() == rhs.lte(); |
4342 | - default: return true; |
4343 | + case location::connectivity::RadioCell::Type::gsm: |
4344 | + return lhs.gsm() == rhs.gsm(); |
4345 | + case location::connectivity::RadioCell::Type::umts: |
4346 | + return lhs.umts() == rhs.umts(); |
4347 | + case location::connectivity::RadioCell::Type::lte: |
4348 | + return lhs.lte() == rhs.lte(); |
4349 | + default: |
4350 | + return true; |
4351 | } |
4352 | |
4353 | return false; |
4354 | @@ -108,10 +112,17 @@ |
4355 | { |
4356 | switch (cell.type()) |
4357 | { |
4358 | - case location::connectivity::RadioCell::Type::gsm: out << "gsm" << cell.gsm(); break; |
4359 | - case location::connectivity::RadioCell::Type::umts: out << "umts" << cell.umts(); break; |
4360 | - case location::connectivity::RadioCell::Type::lte: out << "lte" << cell.lte(); break; |
4361 | - case location::connectivity::RadioCell::Type::unknown: break; |
4362 | + case location::connectivity::RadioCell::Type::gsm: |
4363 | + out << "gsm" << cell.gsm(); |
4364 | + break; |
4365 | + case location::connectivity::RadioCell::Type::umts: |
4366 | + out << "umts" << cell.umts(); |
4367 | + break; |
4368 | + case location::connectivity::RadioCell::Type::lte: |
4369 | + out << "lte" << cell.lte(); |
4370 | + break; |
4371 | + case location::connectivity::RadioCell::Type::unknown: |
4372 | + break; |
4373 | } |
4374 | |
4375 | return out; |
4376 | |
4377 | === modified file 'src/location_service/com/ubuntu/location/connectivity/wireless_network.cpp' |
4378 | --- src/location_service/com/ubuntu/location/connectivity/wireless_network.cpp 2014-06-12 06:51:01 +0000 |
4379 | +++ src/location_service/com/ubuntu/location/connectivity/wireless_network.cpp 2015-02-03 09:10:02 +0000 |
4380 | @@ -26,9 +26,15 @@ |
4381 | { |
4382 | switch (mode) |
4383 | { |
4384 | - case location::connectivity::WirelessNetwork::Mode::unknown: out << "Mode::unknown"; break; |
4385 | - case location::connectivity::WirelessNetwork::Mode::adhoc: out << "Mode::adhoc"; break; |
4386 | - case location::connectivity::WirelessNetwork::Mode::infrastructure: out << "Mode::infrastructure"; break; |
4387 | + case location::connectivity::WirelessNetwork::Mode::unknown: |
4388 | + out << "Mode::unknown"; |
4389 | + break; |
4390 | + case location::connectivity::WirelessNetwork::Mode::adhoc: |
4391 | + out << "Mode::adhoc"; |
4392 | + break; |
4393 | + case location::connectivity::WirelessNetwork::Mode::infrastructure: |
4394 | + out << "Mode::infrastructure"; |
4395 | + break; |
4396 | } |
4397 | |
4398 | return out; |
4399 | |
4400 | === modified file 'src/location_service/com/ubuntu/location/criteria.cpp' |
4401 | --- src/location_service/com/ubuntu/location/criteria.cpp 2014-01-12 18:03:12 +0000 |
4402 | +++ src/location_service/com/ubuntu/location/criteria.cpp 2015-02-03 09:10:02 +0000 |
4403 | @@ -49,8 +49,8 @@ |
4404 | } |
4405 | |
4406 | com::ubuntu::location::Criteria com::ubuntu::location::operator+( |
4407 | - const com::ubuntu::location::Criteria& lhs, |
4408 | - const com::ubuntu::location::Criteria& rhs) |
4409 | + const com::ubuntu::location::Criteria& lhs, |
4410 | + const com::ubuntu::location::Criteria& rhs) |
4411 | { |
4412 | Criteria result{lhs}; |
4413 | |
4414 | @@ -68,7 +68,8 @@ |
4415 | { |
4416 | result.accuracy.vertical = rhs.accuracy.vertical; |
4417 | } |
4418 | - } else |
4419 | + } |
4420 | + else |
4421 | { |
4422 | result.accuracy.vertical = rhs.accuracy.vertical; |
4423 | } |
4424 | @@ -79,7 +80,8 @@ |
4425 | { |
4426 | result.accuracy.velocity = rhs.accuracy.velocity; |
4427 | } |
4428 | - } else |
4429 | + } |
4430 | + else |
4431 | { |
4432 | result.accuracy.velocity = rhs.accuracy.velocity; |
4433 | } |
4434 | @@ -90,7 +92,8 @@ |
4435 | { |
4436 | result.accuracy.heading = rhs.accuracy.heading; |
4437 | } |
4438 | - } else |
4439 | + } |
4440 | + else |
4441 | { |
4442 | result.accuracy.heading = rhs.accuracy.heading; |
4443 | } |
4444 | |
4445 | === modified file 'src/location_service/com/ubuntu/location/default_permission_manager.cpp' |
4446 | --- src/location_service/com/ubuntu/location/default_permission_manager.cpp 2013-12-10 09:42:54 +0000 |
4447 | +++ src/location_service/com/ubuntu/location/default_permission_manager.cpp 2015-02-03 09:10:02 +0000 |
4448 | @@ -20,8 +20,8 @@ |
4449 | namespace cul = com::ubuntu::location; |
4450 | |
4451 | cul::DefaultPermissionManager::DefaultPermissionManager() |
4452 | - : pid(getpid()), |
4453 | - uid(getuid()) |
4454 | + : pid(getpid()), |
4455 | + uid(getuid()) |
4456 | { |
4457 | } |
4458 | |
4459 | |
4460 | === modified file 'src/location_service/com/ubuntu/location/default_provider_selection_policy.cpp' |
4461 | --- src/location_service/com/ubuntu/location/default_provider_selection_policy.cpp 2014-06-20 07:40:34 +0000 |
4462 | +++ src/location_service/com/ubuntu/location/default_provider_selection_policy.cpp 2015-02-03 09:10:02 +0000 |
4463 | @@ -28,10 +28,8 @@ |
4464 | NullProvider() = default; |
4465 | }; |
4466 | |
4467 | -std::shared_ptr<cul::Provider> null_provider_instance |
4468 | -{ |
4469 | - new NullProvider{} |
4470 | -}; |
4471 | +std::shared_ptr<cul::Provider> null_provider_instance{ |
4472 | + new NullProvider{}}; |
4473 | } |
4474 | |
4475 | const cul::Provider::Ptr& cul::ProviderSelectionPolicy::null_provider() |
4476 | @@ -47,32 +45,30 @@ |
4477 | { |
4478 | } |
4479 | |
4480 | -cul::ProviderSelection |
4481 | +cul::ProviderSelection |
4482 | cul::DefaultProviderSelectionPolicy::determine_provider_selection_for_criteria( |
4483 | const cul::Criteria& criteria, |
4484 | const cul::ProviderEnumerator& enumerator) |
4485 | { |
4486 | - ProviderSelection selection |
4487 | - { |
4488 | + ProviderSelection selection{ |
4489 | determine_position_updates_provider(criteria, enumerator), |
4490 | determine_heading_updates_provider(criteria, enumerator), |
4491 | - determine_velocity_updates_provider(criteria, enumerator) |
4492 | - }; |
4493 | - |
4494 | + determine_velocity_updates_provider(criteria, enumerator)}; |
4495 | + |
4496 | return selection; |
4497 | } |
4498 | |
4499 | -cul::Provider::Ptr |
4500 | +cul::Provider::Ptr |
4501 | cul::DefaultProviderSelectionPolicy::determine_position_updates_provider( |
4502 | const cul::Criteria& criteria, |
4503 | const cul::ProviderEnumerator& enumerator) |
4504 | { |
4505 | - auto less = |
4506 | - [](const Provider::Ptr& lhs, const Provider::Ptr& rhs) |
4507 | - { |
4508 | + auto less = |
4509 | + [](const Provider::Ptr& lhs, const Provider::Ptr& rhs) |
4510 | + { |
4511 | return |
4512 | lhs->state_controller()->are_position_updates_running() && !rhs->state_controller()->are_position_updates_running(); |
4513 | - }; |
4514 | + }; |
4515 | |
4516 | std::set< |
4517 | Provider::Ptr, |
4518 | @@ -92,14 +88,14 @@ |
4519 | const cul::Criteria& criteria, |
4520 | const cul::ProviderEnumerator& enumerator) |
4521 | { |
4522 | - auto less = |
4523 | - [](const Provider::Ptr& lhs, const Provider::Ptr& rhs) |
4524 | - { |
4525 | + auto less = |
4526 | + [](const Provider::Ptr& lhs, const Provider::Ptr& rhs) |
4527 | + { |
4528 | return lhs->state_controller()->are_heading_updates_running() && !rhs->state_controller()->are_heading_updates_running(); |
4529 | - }; |
4530 | - |
4531 | + }; |
4532 | + |
4533 | std::set< |
4534 | - Provider::Ptr, |
4535 | + Provider::Ptr, |
4536 | std::function<bool(const Provider::Ptr&, const Provider::Ptr&)>> matching_providers(less); |
4537 | |
4538 | enumerator.for_each_provider( |
4539 | @@ -116,14 +112,14 @@ |
4540 | const cul::Criteria& criteria, |
4541 | const cul::ProviderEnumerator& enumerator) |
4542 | { |
4543 | - auto less = |
4544 | - [](const Provider::Ptr& lhs, const Provider::Ptr& rhs) |
4545 | - { |
4546 | + auto less = |
4547 | + [](const Provider::Ptr& lhs, const Provider::Ptr& rhs) |
4548 | + { |
4549 | return lhs->state_controller()->are_velocity_updates_running() && !rhs->state_controller()->are_velocity_updates_running(); |
4550 | - }; |
4551 | - |
4552 | + }; |
4553 | + |
4554 | std::set< |
4555 | - Provider::Ptr, |
4556 | + Provider::Ptr, |
4557 | std::function<bool(const Provider::Ptr&, const Provider::Ptr&)>> matching_providers(less); |
4558 | |
4559 | enumerator.for_each_provider( |
4560 | |
4561 | === modified file 'src/location_service/com/ubuntu/location/engine.cpp' |
4562 | --- src/location_service/com/ubuntu/location/engine.cpp 2015-01-25 12:44:20 +0000 |
4563 | +++ src/location_service/com/ubuntu/location/engine.cpp 2015-02-03 09:10:02 +0000 |
4564 | @@ -32,22 +32,20 @@ |
4565 | |
4566 | cul::Engine::Engine(const cul::ProviderSelectionPolicy::Ptr& provider_selection_policy, |
4567 | const cul::Settings::Ptr& settings) |
4568 | - : provider_selection_policy(provider_selection_policy), |
4569 | - settings(settings) |
4570 | + : provider_selection_policy(provider_selection_policy), |
4571 | + settings(settings) |
4572 | { |
4573 | - if (!provider_selection_policy) throw std::runtime_error |
4574 | - { |
4575 | - "Cannot construct an engine given a null ProviderSelectionPolicy" |
4576 | - }; |
4577 | + if (!provider_selection_policy) |
4578 | + throw std::runtime_error{ |
4579 | + "Cannot construct an engine given a null ProviderSelectionPolicy"}; |
4580 | |
4581 | - if (!settings) throw std::runtime_error |
4582 | - { |
4583 | - "Cannot construct an engine given a null Settings instance" |
4584 | - }; |
4585 | + if (!settings) |
4586 | + throw std::runtime_error{ |
4587 | + "Cannot construct an engine given a null Settings instance"}; |
4588 | |
4589 | // Setup behavior in case of configuration changes. |
4590 | configuration.satellite_based_positioning_state.changed().connect([this](const SatelliteBasedPositioningState& state) |
4591 | - { |
4592 | + { |
4593 | for_each_provider([this, state](const Provider::Ptr& provider) |
4594 | { |
4595 | if (provider->requires(cul::Provider::Requirements::satellites)) |
4596 | @@ -65,10 +63,10 @@ |
4597 | } |
4598 | } |
4599 | }); |
4600 | - }); |
4601 | + }); |
4602 | |
4603 | configuration.engine_state.changed().connect([this](const Engine::Status& status) |
4604 | - { |
4605 | + { |
4606 | for_each_provider([this, status](const Provider::Ptr& provider) |
4607 | { |
4608 | switch (status) |
4609 | @@ -87,37 +85,37 @@ |
4610 | break; |
4611 | } |
4612 | }); |
4613 | - }); |
4614 | + }); |
4615 | |
4616 | configuration.engine_state = |
4617 | - settings->get_enum_for_key<Engine::Status>( |
4618 | - Configuration::Keys::engine_state, |
4619 | - Configuration::Defaults::engine_state); |
4620 | + settings->get_enum_for_key<Engine::Status>( |
4621 | + Configuration::Keys::engine_state, |
4622 | + Configuration::Defaults::engine_state); |
4623 | |
4624 | configuration.satellite_based_positioning_state = |
4625 | - settings->get_enum_for_key<SatelliteBasedPositioningState>( |
4626 | - Configuration::Keys::satellite_based_positioning_state, |
4627 | - Configuration::Defaults::satellite_based_positioning_state); |
4628 | + settings->get_enum_for_key<SatelliteBasedPositioningState>( |
4629 | + Configuration::Keys::satellite_based_positioning_state, |
4630 | + Configuration::Defaults::satellite_based_positioning_state); |
4631 | |
4632 | configuration.wifi_and_cell_id_reporting_state = |
4633 | - settings->get_enum_for_key<WifiAndCellIdReportingState>( |
4634 | - Configuration::Keys::wifi_and_cell_id_reporting_state, |
4635 | - Configuration::Defaults::wifi_and_cell_id_reporting_state); |
4636 | + settings->get_enum_for_key<WifiAndCellIdReportingState>( |
4637 | + Configuration::Keys::wifi_and_cell_id_reporting_state, |
4638 | + Configuration::Defaults::wifi_and_cell_id_reporting_state); |
4639 | |
4640 | configuration.engine_state.changed().connect([this](const Engine::Status& status) |
4641 | - { |
4642 | + { |
4643 | Engine::settings->set_enum_for_key<Engine::Status>(Configuration::Keys::engine_state, status); |
4644 | - }); |
4645 | + }); |
4646 | |
4647 | configuration.satellite_based_positioning_state.changed().connect([this](SatelliteBasedPositioningState state) |
4648 | - { |
4649 | + { |
4650 | Engine::settings->set_enum_for_key<SatelliteBasedPositioningState>(Configuration::Keys::satellite_based_positioning_state, state); |
4651 | - }); |
4652 | + }); |
4653 | |
4654 | configuration.wifi_and_cell_id_reporting_state.changed().connect([this](WifiAndCellIdReportingState state) |
4655 | - { |
4656 | + { |
4657 | Engine::settings->set_enum_for_key<WifiAndCellIdReportingState>(Configuration::Keys::wifi_and_cell_id_reporting_state, state); |
4658 | - }); |
4659 | + }); |
4660 | } |
4661 | |
4662 | cul::Engine::~Engine() |
4663 | @@ -135,11 +133,11 @@ |
4664 | configuration.wifi_and_cell_id_reporting_state); |
4665 | |
4666 | for_each_provider([](const Provider::Ptr& provider) |
4667 | - { |
4668 | + { |
4669 | provider->state_controller()->stop_position_updates(); |
4670 | provider->state_controller()->stop_heading_updates(); |
4671 | provider->state_controller()->stop_velocity_updates(); |
4672 | - }); |
4673 | + }); |
4674 | } |
4675 | |
4676 | cul::ProviderSelection cul::Engine::determine_provider_selection_for_criteria(const cul::Criteria& criteria) |
4677 | @@ -167,28 +165,28 @@ |
4678 | // We wire up changes in the engine's configuration to the respective slots |
4679 | // of the provider. |
4680 | auto cp = updates.reference_location.changed().connect([provider](const cul::Update<cul::Position>& pos) |
4681 | - { |
4682 | + { |
4683 | provider->on_reference_location_updated(pos); |
4684 | - }); |
4685 | + }); |
4686 | |
4687 | auto cv = updates.reference_velocity.changed().connect([provider](const cul::Update<cul::Velocity>& velocity) |
4688 | - { |
4689 | + { |
4690 | provider->on_reference_velocity_updated(velocity); |
4691 | - }); |
4692 | + }); |
4693 | |
4694 | auto ch = updates.reference_heading.changed().connect([provider](const cul::Update<cul::Heading>& heading) |
4695 | - { |
4696 | + { |
4697 | provider->on_reference_heading_updated(heading); |
4698 | - }); |
4699 | + }); |
4700 | |
4701 | auto cr = configuration.wifi_and_cell_id_reporting_state.changed().connect([provider](cul::WifiAndCellIdReportingState state) |
4702 | - { |
4703 | + { |
4704 | provider->on_wifi_and_cell_reporting_state_changed(state); |
4705 | - }); |
4706 | + }); |
4707 | |
4708 | // And do the reverse: Satellite visibility updates are funneled via the engine's configuration. |
4709 | auto cs = provider->updates().svs.connect([this](const cul::Update<std::set<cul::SpaceVehicle>>& src) |
4710 | - { |
4711 | + { |
4712 | updates.visible_space_vehicles.update([src](std::map<cul::SpaceVehicle::Key, cul::SpaceVehicle>& dest) |
4713 | { |
4714 | for(auto& sv : src.value) |
4715 | @@ -198,14 +196,14 @@ |
4716 | |
4717 | return true; |
4718 | }); |
4719 | - }); |
4720 | + }); |
4721 | |
4722 | // We are a bit dumb and just take any position update as new reference. |
4723 | // We should come up with a better heuristic here. |
4724 | auto cpr = provider->updates().position.connect([this](const cul::Update<cul::Position>& src) |
4725 | - { |
4726 | + { |
4727 | updates.reference_location = src; |
4728 | - }); |
4729 | + }); |
4730 | |
4731 | std::lock_guard<std::mutex> lg(guard); |
4732 | providers.emplace(provider, std::move(ProviderConnections{cp, ch, cv, cr, cs, cpr})); |
4733 | @@ -231,7 +229,7 @@ |
4734 | { |
4735 | enumerator(provider.first); |
4736 | } |
4737 | - catch(const std::exception& e) |
4738 | + catch (const std::exception& e) |
4739 | { |
4740 | VLOG(1) << e.what(); |
4741 | } |
4742 | @@ -240,7 +238,7 @@ |
4743 | |
4744 | namespace std |
4745 | { |
4746 | -template<> |
4747 | +template <> |
4748 | struct hash<cul::Engine::Status> |
4749 | { |
4750 | std::size_t operator()(const cul::Engine::Status& s) const |
4751 | @@ -253,17 +251,13 @@ |
4752 | |
4753 | std::ostream& cul::operator<<(std::ostream& out, cul::Engine::Status state) |
4754 | { |
4755 | - static constexpr const char* the_unknown_state |
4756 | - { |
4757 | - "Engine::Status::unknown" |
4758 | - }; |
4759 | + static constexpr const char* the_unknown_state{ |
4760 | + "Engine::Status::unknown"}; |
4761 | |
4762 | - static const std::unordered_map<location::Engine::Status, std::string> lut |
4763 | - { |
4764 | + static const std::unordered_map<location::Engine::Status, std::string> lut{ |
4765 | {cul::Engine::Status::off, "Engine::Status::off"}, |
4766 | {cul::Engine::Status::on, "Engine::Status::on"}, |
4767 | - {cul::Engine::Status::active, "Engine::Status::active"} |
4768 | - }; |
4769 | + {cul::Engine::Status::active, "Engine::Status::active"}}; |
4770 | |
4771 | auto it = lut.find(state); |
4772 | if (it != lut.end()) |
4773 | @@ -277,22 +271,21 @@ |
4774 | /** @brief Parses the status from the given stream. */ |
4775 | std::istream& cul::operator>>(std::istream& in, cul::Engine::Status& state) |
4776 | { |
4777 | - static const std::unordered_map<std::string, cul::Engine::Status> lut |
4778 | - { |
4779 | + static const std::unordered_map<std::string, cul::Engine::Status> lut{ |
4780 | {"Engine::Status::off", cul::Engine::Status::off}, |
4781 | {"Engine::Status::on", cul::Engine::Status::on}, |
4782 | - {"Engine::Status::active", cul::Engine::Status::active} |
4783 | - }; |
4784 | + {"Engine::Status::active", cul::Engine::Status::active}}; |
4785 | |
4786 | - std::string s; in >> s; |
4787 | + std::string s; |
4788 | + in >> s; |
4789 | auto it = lut.find(s); |
4790 | if (it != lut.end()) |
4791 | state = it->second; |
4792 | - else throw std::runtime_error |
4793 | - { |
4794 | - "cul::operator>>(std::istream&, Engine::Status&): " |
4795 | - "Could not resolve state " + s |
4796 | - }; |
4797 | + else |
4798 | + throw std::runtime_error{ |
4799 | + "cul::operator>>(std::istream&, Engine::Status&): " |
4800 | + "Could not resolve state " + |
4801 | + s}; |
4802 | |
4803 | return in; |
4804 | } |
4805 | |
4806 | === modified file 'src/location_service/com/ubuntu/location/engine.h' |
4807 | --- src/location_service/com/ubuntu/location/engine.h 2015-01-14 13:41:54 +0000 |
4808 | +++ src/location_service/com/ubuntu/location/engine.h 2015-02-03 09:10:02 +0000 |
4809 | @@ -55,8 +55,8 @@ |
4810 | */ |
4811 | enum class Status |
4812 | { |
4813 | - off, ///< The engine is currently offline. |
4814 | - on, ///< The engine and providers are powered on but not navigating. |
4815 | + off, ///< The engine is currently offline. |
4816 | + on, ///< The engine and providers are powered on but not navigating. |
4817 | active ///< The engine and providers are powered on and navigating. |
4818 | }; |
4819 | |
4820 | @@ -69,56 +69,38 @@ |
4821 | struct Keys |
4822 | { |
4823 | /** Key for persisting the SatelliteBasedPositioningState */ |
4824 | - static constexpr const char* satellite_based_positioning_state |
4825 | - { |
4826 | - "Engine::SatelliteBasedPositioningState" |
4827 | - }; |
4828 | + static constexpr const char* satellite_based_positioning_state{ |
4829 | + "Engine::SatelliteBasedPositioningState"}; |
4830 | /** Key for persisting the WifiAndCellIdReportingState */ |
4831 | - static constexpr const char* wifi_and_cell_id_reporting_state |
4832 | - { |
4833 | - "Engine::WifiAndCellIdReportingState" |
4834 | - }; |
4835 | + static constexpr const char* wifi_and_cell_id_reporting_state{ |
4836 | + "Engine::WifiAndCellIdReportingState"}; |
4837 | /** Key for persisting the Engine::Status */ |
4838 | - static constexpr const char* engine_state |
4839 | - { |
4840 | - "Engine::State" |
4841 | - }; |
4842 | + static constexpr const char* engine_state{ |
4843 | + "Engine::State"}; |
4844 | }; |
4845 | |
4846 | /** Default values go here. */ |
4847 | struct Defaults |
4848 | { |
4849 | - static constexpr const SatelliteBasedPositioningState satellite_based_positioning_state |
4850 | - { |
4851 | - SatelliteBasedPositioningState::on |
4852 | - }; |
4853 | - |
4854 | - static constexpr const WifiAndCellIdReportingState wifi_and_cell_id_reporting_state |
4855 | - { |
4856 | - WifiAndCellIdReportingState::off |
4857 | - }; |
4858 | - |
4859 | - static constexpr const Engine::Status engine_state |
4860 | - { |
4861 | - Engine::Status::on |
4862 | - }; |
4863 | - }; |
4864 | - |
4865 | - /** Setable/getable/observable property for the satellite based positioning state. */ |
4866 | - core::Property<SatelliteBasedPositioningState> satellite_based_positioning_state |
4867 | - { |
4868 | - Defaults::satellite_based_positioning_state |
4869 | - }; |
4870 | - /** Setable/getable/observable property for the satellite based positioning state. */ |
4871 | - core::Property<WifiAndCellIdReportingState> wifi_and_cell_id_reporting_state |
4872 | - { |
4873 | - Defaults::wifi_and_cell_id_reporting_state |
4874 | - }; |
4875 | + static constexpr const SatelliteBasedPositioningState satellite_based_positioning_state{ |
4876 | + SatelliteBasedPositioningState::on}; |
4877 | + |
4878 | + static constexpr const WifiAndCellIdReportingState wifi_and_cell_id_reporting_state{ |
4879 | + WifiAndCellIdReportingState::off}; |
4880 | + |
4881 | + static constexpr const Engine::Status engine_state{ |
4882 | + Engine::Status::on}; |
4883 | + }; |
4884 | + |
4885 | + /** Setable/getable/observable property for the satellite based positioning state. */ |
4886 | + core::Property<SatelliteBasedPositioningState> satellite_based_positioning_state{ |
4887 | + Defaults::satellite_based_positioning_state}; |
4888 | + /** Setable/getable/observable property for the satellite based positioning state. */ |
4889 | + core::Property<WifiAndCellIdReportingState> wifi_and_cell_id_reporting_state{ |
4890 | + Defaults::wifi_and_cell_id_reporting_state}; |
4891 | /** Setable/getable/observable property for the overall engine state. */ |
4892 | - core::Property<Engine::Status> engine_state |
4893 | - { |
4894 | - Defaults::engine_state |
4895 | - }; |
4896 | + core::Property<Engine::Status> engine_state{ |
4897 | + Defaults::engine_state}; |
4898 | }; |
4899 | |
4900 | /** @brief Summarizes all updates delivered via the engine. */ |
4901 | |
4902 | === modified file 'src/location_service/com/ubuntu/location/non_selecting_provider_selection_policy.cpp' |
4903 | --- src/location_service/com/ubuntu/location/non_selecting_provider_selection_policy.cpp 2014-10-28 18:28:29 +0000 |
4904 | +++ src/location_service/com/ubuntu/location/non_selecting_provider_selection_policy.cpp 2015-02-03 09:10:02 +0000 |
4905 | @@ -52,21 +52,20 @@ |
4906 | for (auto provider : BagOfProviders::providers) |
4907 | { |
4908 | connections.push_back(provider->updates().position.connect([this](const location::Update<location::Position>& update) |
4909 | - { |
4910 | + { |
4911 | mutable_updates().position(update); |
4912 | - })); |
4913 | + })); |
4914 | |
4915 | connections.push_back(provider->updates().heading.connect([this](const location::Update<location::Heading>& update) |
4916 | - { |
4917 | + { |
4918 | mutable_updates().heading(update); |
4919 | - })); |
4920 | + })); |
4921 | |
4922 | connections.push_back(provider->updates().velocity.connect([this](const location::Update<location::Velocity>& update) |
4923 | - { |
4924 | + { |
4925 | mutable_updates().velocity(update); |
4926 | - })); |
4927 | + })); |
4928 | } |
4929 | - |
4930 | } |
4931 | |
4932 | // We always match :) |
4933 | @@ -142,21 +141,20 @@ |
4934 | } |
4935 | |
4936 | location::ProviderSelection location::NonSelectingProviderSelectionPolicy::determine_provider_selection_for_criteria( |
4937 | - const location::Criteria&, |
4938 | - const location::ProviderEnumerator& enumerator) |
4939 | + const location::Criteria&, |
4940 | + const location::ProviderEnumerator& enumerator) |
4941 | { |
4942 | // We put all providers in a set. |
4943 | std::set<location::Provider::Ptr> bag; |
4944 | enumerator.for_each_provider([&bag](const location::Provider::Ptr& provider) |
4945 | - { |
4946 | + { |
4947 | bag.insert(provider); |
4948 | - }); |
4949 | + }); |
4950 | |
4951 | auto bag_of_providers = std::make_shared<BagOfProviders>(bag); |
4952 | |
4953 | // Our bag of providers is responsible for delivering position/heading/velocity updates. |
4954 | - return location::ProviderSelection |
4955 | - { |
4956 | + return location::ProviderSelection{ |
4957 | bag_of_providers, // position |
4958 | bag_of_providers, // heading |
4959 | bag_of_providers // velocity |
4960 | |
4961 | === modified file 'src/location_service/com/ubuntu/location/position.cpp' |
4962 | --- src/location_service/com/ubuntu/location/position.cpp 2014-06-17 08:06:08 +0000 |
4963 | +++ src/location_service/com/ubuntu/location/position.cpp 2015-02-03 09:10:02 +0000 |
4964 | @@ -23,17 +23,17 @@ |
4965 | namespace cul = com::ubuntu::location; |
4966 | |
4967 | cul::Position::Position( |
4968 | - const cul::wgs84::Latitude& latitude, |
4969 | - const cul::wgs84::Longitude& longitude) |
4970 | + const cul::wgs84::Latitude& latitude, |
4971 | + const cul::wgs84::Longitude& longitude) |
4972 | : latitude(latitude), |
4973 | longitude(longitude) |
4974 | { |
4975 | } |
4976 | |
4977 | cul::Position::Position( |
4978 | - const cul::wgs84::Latitude& latitude, |
4979 | - const cul::wgs84::Longitude& longitude, |
4980 | - const cul::wgs84::Altitude& altitude) |
4981 | + const cul::wgs84::Latitude& latitude, |
4982 | + const cul::wgs84::Longitude& longitude, |
4983 | + const cul::wgs84::Altitude& altitude) |
4984 | : latitude(latitude), |
4985 | longitude(longitude), |
4986 | altitude(altitude) |
4987 | @@ -62,10 +62,10 @@ |
4988 | bool cul::Position::operator==(const cul::Position& rhs) const |
4989 | { |
4990 | return latitude == rhs.latitude && |
4991 | - longitude == rhs.longitude && |
4992 | - altitude == rhs.altitude && |
4993 | - accuracy.horizontal == rhs.accuracy.horizontal && |
4994 | - accuracy.vertical == rhs.accuracy.vertical; |
4995 | + longitude == rhs.longitude && |
4996 | + altitude == rhs.altitude && |
4997 | + accuracy.horizontal == rhs.accuracy.horizontal && |
4998 | + accuracy.vertical == rhs.accuracy.vertical; |
4999 | } |
5000 |
The diff has been truncated for viewing.
PASSED: Continuous integration, rev:172 jenkins. qa.ubuntu. com/job/ location- service- ci/347/ jenkins. qa.ubuntu. com/job/ location- service- vivid-amd64- ci/19 jenkins. qa.ubuntu. com/job/ location- service- vivid-armhf- ci/19 jenkins. qa.ubuntu. com/job/ location- service- vivid-armhf- ci/19/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ location- service- vivid-i386- ci/19
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/347/ rebuild
http://