Merge lp:~thomas-voss/platform-api/add-rotation-vector-sensor into lp:platform-api

Proposed by Thomas Voß
Status: Needs review
Proposed branch: lp:~thomas-voss/platform-api/add-rotation-vector-sensor
Merge into: lp:platform-api
Prerequisite: lp:~gerboland/platform-api/add-magnetic-gyro-sensors
Diff against target: 1997 lines (+1459/-40)
34 files modified
CMakeLists.txt (+1/-1)
TODO.txt (+1/-0)
android/default/default_ubuntu_application_sensor.cpp (+210/-0)
android/hybris/Android.mk (+4/-0)
android/hybris/ubuntu_application_gps_for_hybris.cpp (+75/-3)
android/include/private/application/sensors/events.h (+30/-0)
debian/changelog (+6/-0)
include/ubuntu/application/location/CMakeLists.txt (+2/-0)
include/ubuntu/application/location/service.h (+23/-0)
include/ubuntu/application/location/space_vehicle.h (+148/-0)
include/ubuntu/application/location/space_vehicle_update.h (+81/-0)
include/ubuntu/application/sensors/CMakeLists.txt (+1/-0)
include/ubuntu/application/sensors/event/CMakeLists.txt (+1/-0)
include/ubuntu/application/sensors/event/rotation_vector.h (+83/-0)
include/ubuntu/application/sensors/rotation_vector.h (+144/-0)
include/ubuntu/hardware/gps.h (+70/-28)
src/ubuntu/application/base_module.h (+1/-1)
src/ubuntu/application/common/application/location/CMakeLists.txt (+2/-0)
src/ubuntu/application/common/application/location/instance.h (+30/-1)
src/ubuntu/application/common/application/location/service.cpp (+8/-0)
src/ubuntu/application/common/application/location/space_vehicle.cpp (+70/-0)
src/ubuntu/application/common/application/location/space_vehicle_p.h (+40/-0)
src/ubuntu/application/common/application/location/space_vehicle_update.cpp (+44/-0)
src/ubuntu/application/common/application/location/space_vehicle_update_p.h (+41/-0)
src/ubuntu/application/desktop/module_version.h (+1/-1)
src/ubuntu/application/desktop/ubuntu_application_sensors_desktop.cpp (+97/-0)
src/ubuntu/application/testbackend/module_version.h (+1/-1)
src/ubuntu/application/testbackend/test_stubs.cpp (+70/-0)
src/ubuntu/application/testbackend/ubuntu_application_sensors.cpp (+105/-0)
src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp (+18/-0)
src/ubuntu/application/touch/module_version.h (+1/-1)
src/ubuntu/application/ubuntu_application_api.cpp (+32/-1)
src/ubuntu/hardware/tests/test_gps_api.cpp (+6/-2)
src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp (+12/-0)
To merge this branch: bzr merge lp:~thomas-voss/platform-api/add-rotation-vector-sensor
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+290405@code.launchpad.net

Commit message

Export a fusioned RotationVector sensor that mangles readings from the accelerometer/magnetometer/gyroscope to determine the device's rotation in space.

Description of the change

Export a fusioned RotationVector sensor that mangles readings from the accelerometer/magnetometer/gyroscope to determine the device's rotation in space.

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

[ CI Train Bot ]
* debian/libubuntu-platform-hardware-api3.symbols: update to released
  version.
[ Simon Fels ]
* Workaround API break in Android GPS hardware abstraction API on MTK
  platforms. Each device which need this workaround has to add
[ Thomas Voß ]
* Expose performance boosting capabilities of the underlying
  HW/drivers.

326. By Thomas Voß

Adjust function signatures to match header file.

327. By Thomas Voß

Adjust function signatures on Android side.

328. By Thomas Voß

Install newly added headers.

329. By Thomas Voß

Add missing symbols to top-level platform api so.

330. By Thomas Voß

Add missing include.

331. By Thomas Voß

Adjust macro invocation.

332. By Thomas Voß

Add functions for subscribing to satellite visibility updates.

333. By Thomas Voß

Fix initialization of rotation vector.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

333. By Thomas Voß

Fix initialization of rotation vector.

332. By Thomas Voß

Add functions for subscribing to satellite visibility updates.

331. By Thomas Voß

Adjust macro invocation.

330. By Thomas Voß

Add missing include.

329. By Thomas Voß

Add missing symbols to top-level platform api so.

328. By Thomas Voß

Install newly added headers.

327. By Thomas Voß

Adjust function signatures on Android side.

326. By Thomas Voß

Adjust function signatures to match header file.

325. By Thomas Voß

[ CI Train Bot ]
* debian/libubuntu-platform-hardware-api3.symbols: update to released
  version.
[ Simon Fels ]
* Workaround API break in Android GPS hardware abstraction API on MTK
  platforms. Each device which need this workaround has to add
[ Thomas Voß ]
* Expose performance boosting capabilities of the underlying
  HW/drivers.

324. By Thomas Voß

Fix FTBFS.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-03-25 23:01:58 +0000
3+++ CMakeLists.txt 2016-04-04 06:59:39 +0000
4@@ -3,7 +3,7 @@
5 project(ubuntu-platform-api)
6
7 set(UBUNTU_PLATFORM_API_VERSION_MAJOR 3)
8-set(UBUNTU_PLATFORM_API_VERSION_MINOR 0)
9+set(UBUNTU_PLATFORM_API_VERSION_MINOR 1)
10 set(UBUNTU_PLATFORM_API_VERSION_PATCH 0)
11
12 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
13
14=== modified file 'TODO.txt'
15--- TODO.txt 2013-02-06 21:20:59 +0000
16+++ TODO.txt 2016-04-04 06:59:39 +0000
17@@ -5,3 +5,4 @@
18 * Review headers to know which ones should not be exported by the package
19 * Make sure the package is lintian free
20 * Get the -headers package to be arch all, not used for now due restriction at Launchpad PPA
21+* Wake up jenkins :)
22
23=== modified file 'android/default/default_ubuntu_application_sensor.cpp'
24--- android/default/default_ubuntu_application_sensor.cpp 2016-04-04 06:59:39 +0000
25+++ android/default/default_ubuntu_application_sensor.cpp 2016-04-04 06:59:39 +0000
26@@ -23,6 +23,7 @@
27 #include <ubuntu/application/sensors/orientation.h>
28 #include <ubuntu/application/sensors/gyroscope.h>
29 #include <ubuntu/application/sensors/magnetic.h>
30+#include <ubuntu/application/sensors/rotation_vector.h>
31
32 #include <private/application/sensors/sensor.h>
33 #include <private/application/sensors/sensor_listener.h>
34@@ -158,6 +159,24 @@
35
36 break;
37 }
38+
39+ case ubuntu::application::sensors::sensor_type_rotation_vector:
40+ {
41+ if (!on_rotation_vector_event)
42+ return;
43+
44+ ubuntu::application::sensors::RotationVectorEvent ev(
45+ reading->timestamp,
46+ reading->vector[0],
47+ reading->vector[1],
48+ reading->vector[2]
49+ );
50+
51+ on_rotation_vector_event(
52+ &ev, this->context
53+ );
54+ break;
55+ }
56 }
57 }
58
59@@ -167,6 +186,7 @@
60 on_orientation_event_cb on_orientation_event;
61 on_gyroscope_event_cb on_gyroscope_event;
62 on_magnetic_event_cb on_magnetic_event;
63+ on_rotation_vector_event_cb on_rotation_vector_event;
64 void *context;
65 };
66
67@@ -176,12 +196,14 @@
68 ubuntu::application::sensors::Sensor::Ptr light;
69 ubuntu::application::sensors::Sensor::Ptr gyroscope;
70 ubuntu::application::sensors::Sensor::Ptr magnetic;
71+ubuntu::application::sensors::Sensor::Ptr rotation_vector;
72 ubuntu::application::sensors::SensorListener::Ptr orientation_listener;
73 ubuntu::application::sensors::SensorListener::Ptr accelerometer_listener;
74 ubuntu::application::sensors::SensorListener::Ptr proximity_listener;
75 ubuntu::application::sensors::SensorListener::Ptr light_listener;
76 ubuntu::application::sensors::SensorListener::Ptr gyroscope_listener;
77 ubuntu::application::sensors::SensorListener::Ptr magnetic_listener;
78+ubuntu::application::sensors::SensorListener::Ptr rotation_vector_listener;
79 }
80
81 static int32_t toHz(int32_t microseconds)
82@@ -1267,3 +1289,191 @@
83
84 return U_STATUS_SUCCESS;
85 }
86+
87+/*
88+ * Gyroscopic Sensor
89+ */
90+
91+UASensorsRotationVector*
92+ua_sensors_rotation_vector_new()
93+{
94+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
95+ rotation_vector =
96+ ubuntu::application::sensors::SensorService::sensor_for_type(
97+ ubuntu::application::sensors::sensor_type_rotation_vector);
98+
99+ return rotation_vector.get();
100+}
101+
102+UStatus
103+ua_sensors_rotation_vector_enable(
104+ UASensorsRotationVector* sensor)
105+{
106+ if (sensor == NULL)
107+ return U_STATUS_ERROR;
108+
109+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
110+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
111+
112+ s->enable();
113+
114+ return U_STATUS_SUCCESS;
115+}
116+
117+UStatus
118+ua_sensors_rotation_vector_disable(
119+ UASensorsRotationVector* sensor)
120+{
121+ if (sensor == NULL)
122+ return U_STATUS_ERROR;
123+
124+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
125+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
126+ s->disable();
127+
128+ return U_STATUS_SUCCESS;
129+}
130+
131+uint32_t
132+ua_sensors_rotation_vector_get_min_delay(
133+ UASensorsRotationVector* sensor)
134+{
135+ if (sensor == NULL)
136+ return -1;
137+
138+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
139+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
140+ return toHz(s->min_delay());
141+}
142+
143+UStatus
144+ua_sensors_rotation_vector_get_min_value(
145+ UASensorsRotationVector* sensor,
146+ float* value)
147+{
148+ if (sensor == NULL || value == NULL)
149+ return U_STATUS_ERROR;
150+
151+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
152+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
153+ *value = s->min_value();
154+
155+ return U_STATUS_SUCCESS;
156+}
157+
158+UStatus
159+ua_sensors_rotation_vector_get_max_value(
160+ UASensorsRotationVector* sensor,
161+ float* value)
162+{
163+ if (sensor == NULL || value == NULL)
164+ return U_STATUS_ERROR;
165+
166+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
167+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
168+ *value = s->max_value();
169+
170+ return U_STATUS_SUCCESS;
171+}
172+
173+UStatus
174+ua_sensors_rotation_vector_get_resolution(
175+ UASensorsRotationVector* sensor,
176+ float* value)
177+{
178+ if (sensor == NULL || value == NULL)
179+ return U_STATUS_ERROR;
180+
181+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
182+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
183+ *value = s->resolution();
184+
185+ return U_STATUS_SUCCESS;
186+}
187+
188+void
189+ua_sensors_rotation_vector_set_reading_cb(
190+ UASensorsRotationVector* sensor,
191+ on_rotation_vector_event_cb cb,
192+ void *ctx)
193+{
194+ if (sensor == NULL)
195+ return;
196+
197+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
198+
199+ SensorListener<ubuntu::application::sensors::sensor_type_rotation_vector>* sl
200+ = new SensorListener<ubuntu::application::sensors::sensor_type_rotation_vector>();
201+
202+ sl->on_rotation_vector_event = cb;
203+ sl->context = ctx;
204+
205+ rotation_vector_listener = sl;
206+ s->register_listener(rotation_vector_listener);
207+}
208+
209+UStatus
210+ua_sensors_rotation_vector_set_event_rate(
211+ UASensorsRotationVector* sensor,
212+ uint32_t rate)
213+{
214+ if (sensor == NULL)
215+ return U_STATUS_ERROR;
216+
217+ ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
218+ auto s = static_cast<ubuntu::application::sensors::Sensor*>(sensor);
219+ if (!s->set_event_rate(rate))
220+ return U_STATUS_ERROR;
221+
222+ return U_STATUS_SUCCESS;
223+}
224+
225+uint64_t
226+uas_rotation_vector_event_get_timestamp(
227+ UASRotationVectorEvent* event)
228+{
229+ auto ev = static_cast<ubuntu::application::sensors::RotationVectorEvent*>(event);
230+ return ev->get_timestamp();
231+}
232+
233+UStatus
234+uas_rotation_vector_event_get_x_axis(
235+ UASRotationVectorEvent* event,
236+ float* value)
237+{
238+ if (event == NULL || value == NULL)
239+ return U_STATUS_ERROR;
240+
241+ auto ev = static_cast<ubuntu::application::sensors::RotationVectorEvent*>(event);
242+ *value = ev->get_x_rotation();
243+
244+ return U_STATUS_SUCCESS;
245+}
246+
247+UStatus
248+uas_rotation_vector_event_get_y_axis(
249+ UASRotationVectorEvent* event,
250+ float* value)
251+{
252+ if (event == NULL || value == NULL)
253+ return U_STATUS_ERROR;
254+
255+ auto ev = static_cast<ubuntu::application::sensors::RotationVectorEvent*>(event);
256+ *value = ev->get_y_rotation();
257+
258+ return U_STATUS_SUCCESS;
259+}
260+
261+UStatus
262+uas_rotation_vector_event_get_z_axis(
263+ UASRotationVectorEvent* event,
264+ float* value)
265+{
266+ if (event == NULL || value == NULL)
267+ return U_STATUS_ERROR;
268+
269+ auto ev = static_cast<ubuntu::application::sensors::RotationVectorEvent*>(event);
270+ *value = ev->get_z_rotation();
271+
272+ return U_STATUS_SUCCESS;
273+}
274
275=== modified file 'android/hybris/Android.mk'
276--- android/hybris/Android.mk 2016-02-03 10:00:56 +0000
277+++ android/hybris/Android.mk 2016-04-04 06:59:39 +0000
278@@ -13,6 +13,10 @@
279 -DANDROID_VERSION_MINOR=$(ANDROID_VERSION_MINOR) \
280 -DANDROID_VERSION_PATCH=$(ANDROID_VERSION_PATCH)
281
282+ifeq ($(BOARD_HAS_SUPPORT_FOR_ADDITIONAL_SATELLITE_NETWORKS),true)
283+ LOCAL_CFLAGS += -DBOARD_HAS_SUPPORT_FOR_ADDITIONAL_SATELLITE_NETWORKS
284+endif
285+
286 UPAPI_PATH := $(LOCAL_PATH)/../../
287
288 LOCAL_CFLAGS += -std=gnu++0x
289
290=== modified file 'android/hybris/ubuntu_application_gps_for_hybris.cpp'
291--- android/hybris/ubuntu_application_gps_for_hybris.cpp 2016-02-02 09:04:07 +0000
292+++ android/hybris/ubuntu_application_gps_for_hybris.cpp 2016-04-04 06:59:39 +0000
293@@ -39,6 +39,7 @@
294 void delete_aiding_data(UHardwareGpsAidingData flags);
295
296 void set_server_for_type(UHardwareGpsAGpsType type, const char* hostname, uint16_t port);
297+ void set_set_id(UHardwareGpsAgpsSetIdType type, const char* id);
298 void set_reference_location(UHardwareGpsAGpsRefLocation* location, size_t size_of_struct);
299
300 void notify_connection_is_open(const char* apn);
301@@ -77,8 +78,25 @@
302
303 namespace
304 {
305+namespace bits
306+{
307+// is_set determines if bit is set in the bitset over
308+// a unique_integral
309+bool is_set(uint32_t bit, const uint32_t* it, const uint32_t* itE)
310+{
311+ static const uint32_t bits_per_element = sizeof(uint32_t) * 8;
312+
313+ uint32_t element_count = itE - it;
314+ uint32_t idx = bit / (element_count * bits_per_element);
315+
316+ if (idx >= element_count)
317+ return false;
318+
319+ return *(it + idx) & (1 << (bit % bits_per_element));
320+}
321+}
322+
323 UHardwareGps hybris_gps_instance = NULL;
324-}
325
326 static void location_callback(GpsLocation* location)
327 {
328@@ -142,7 +160,6 @@
329 hybris_gps_instance->request_utc_time_cb(hybris_gps_instance->context);
330 }
331
332-
333 typedef struct
334 {
335 void (*func)(void *);
336@@ -254,7 +271,7 @@
337 agps_request_ref_location,
338 create_thread_callback,
339 };
340-
341+}
342
343 UHardwareGps_::UHardwareGps_(UHardwareGpsParams* params)
344 : gps_interface(NULL),
345@@ -371,6 +388,12 @@
346 agps_interface->set_server(type, hostname, port);
347 }
348
349+void UHardwareGps_::set_set_id(UHardwareGpsAgpsSetIdType type, const char* id)
350+{
351+ if (agps_ril_interface && agps_ril_interface->set_set_id)
352+ agps_ril_interface->set_set_id(static_cast<AGpsSetIDType>(type), id);
353+}
354+
355 void UHardwareGps_::set_reference_location(UHardwareGpsAGpsRefLocation* location, size_t size_of_struct)
356 {
357 AGpsRefLocation ref_loc;
358@@ -483,6 +506,14 @@
359 self->set_server_for_type(type, hostname, port);
360 }
361
362+void u_hardware_gps_agps_set_set_id(
363+ UHardwareGps self,
364+ UHardwareGpsAgpsSetIdType type,
365+ const char* set_id)
366+{
367+ self->set_set_id(type, set_id);
368+}
369+
370 void u_hardware_gps_agps_set_reference_location(
371 UHardwareGps self,
372 UHardwareGpsAGpsRefLocation *location,
373@@ -521,3 +552,44 @@
374 {
375 self->inject_xtra_data(data, length);
376 }
377+
378+void u_hardware_gps_sv_status_enumerate_svs(UHardwareGpsSvStatus* status, UHardwareGpsSvEnumerator enumerator, void* cookie)
379+{
380+ GpsSvStatus* s = reinterpret_cast<GpsSvStatus*>(status);
381+
382+#if defined(BOARD_HAS_SUPPORT_FOR_ADDITIONAL_SATELLITE_NETWORKS)
383+ const unsigned int element_count = 8;
384+ const uint32_t* am = &s->almanac_mask[0];
385+ const uint32_t* em = &s->ephemeris_mask[0];
386+ const uint32_t* uifm = &s->used_in_fix_mask[0];
387+#else
388+ const unsigned int element_count = 1;
389+ const uint32_t* am = &s->almanac_mask;
390+ const uint32_t* em = &s->ephemeris_mask;
391+ const uint32_t* uifm = &s->used_in_fix_mask;
392+#endif
393+
394+ for (int i = 0; i < s->num_svs; i++)
395+ {
396+ UHardwareGpsSvInfo info; ::memset(&info, 0, sizeof(info));
397+ info.prn = s->sv_list[i].prn;
398+ info.snr = s->sv_list[i].snr;
399+ info.elevation = s->sv_list[i].elevation;
400+ info.azimuth = s->sv_list[i].azimuth;
401+
402+ // PRN is in the range of [1, 32], adjusting it to make sure we
403+ // can use it for bitfield flag testing operations.
404+ int prn = s->sv_list[i].prn - 1;
405+ if (prn < 0)
406+ continue;
407+
408+ if (bits::is_set(prn, am, am + element_count))
409+ info.flags |= U_HARDWARE_GPS_SV_INFO_FLAG_HAS_ALMANAC;
410+ if (bits::is_set(prn, em, em + element_count))
411+ info.flags |= U_HARDWARE_GPS_SV_INFO_FLAG_HAS_EPHEMERIS;
412+ if (bits::is_set(prn, uifm, uifm + element_count))
413+ info.flags |= U_HARDWARE_GPS_SV_INFO_FLAG_USED_IN_FIX;
414+
415+ enumerator(&info, cookie);
416+ }
417+}
418
419=== modified file 'android/include/private/application/sensors/events.h'
420--- android/include/private/application/sensors/events.h 2016-04-04 06:59:39 +0000
421+++ android/include/private/application/sensors/events.h 2016-04-04 06:59:39 +0000
422@@ -193,6 +193,36 @@
423 MagneticEvent(const MagneticEvent&) = delete;
424 MagneticEvent& operator=(const MagneticEvent&) = delete;
425 };
426+
427+class RotationVectorEvent
428+{
429+public:
430+ RotationVectorEvent(uint64_t timestamp, float x, float y, float z)
431+ : timestamp(timestamp),
432+ x(x),
433+ y(y),
434+ z(z)
435+ {}
436+
437+ uint64_t get_timestamp() const
438+ {
439+ return this->timestamp;
440+ }
441+
442+ float get_x_rotation() const { return this->x; }
443+ float get_y_rotation() const { return this->y; }
444+ float get_z_rotation() const { return this->z; }
445+
446+private:
447+ uint64_t timestamp;
448+ float x;
449+ float y;
450+ float z;
451+
452+protected:
453+ RotationVectorEvent(const RotationVectorEvent&) = delete;
454+ RotationVectorEvent& operator=(const RotationVectorEvent&) = delete;
455+};
456 }
457 }
458 }
459
460=== modified file 'debian/changelog'
461--- debian/changelog 2016-02-03 10:00:59 +0000
462+++ debian/changelog 2016-04-04 06:59:39 +0000
463@@ -1,3 +1,9 @@
464+platform-api (3.1.0) UNRELEASED; urgency=medium
465+
466+ * Add functions for subscribing to satellite visibility updates.
467+
468+ -- Thomas Voß <thomas.voss@canonical.com> Fri, 04 Dec 2015 16:25:53 +0100
469+
470 platform-api (3.0.1+16.04.20160203-0ubuntu1) xenial; urgency=medium
471
472 [ CI Train Bot ]
473
474=== modified file 'include/ubuntu/application/location/CMakeLists.txt'
475--- include/ubuntu/application/location/CMakeLists.txt 2013-08-22 05:00:52 +0000
476+++ include/ubuntu/application/location/CMakeLists.txt 2016-04-04 06:59:39 +0000
477@@ -6,6 +6,8 @@
478 position_update.h
479 service.h
480 session.h
481+ space_vehicle.h
482+ space_vehicle_update.h
483 velocity_update.h
484 )
485
486
487=== modified file 'include/ubuntu/application/location/service.h'
488--- include/ubuntu/application/location/service.h 2014-09-15 20:35:52 +0000
489+++ include/ubuntu/application/location/service.h 2016-04-04 06:59:39 +0000
490@@ -23,6 +23,7 @@
491
492 #include <ubuntu/application/location/controller.h>
493 #include <ubuntu/application/location/session.h>
494+#include <ubuntu/application/location/space_vehicle_update.h>
495
496 #ifdef __cplusplus
497 extern "C"
498@@ -83,6 +84,28 @@
499 typedef UbuntuApplicationLocationServiceError UALocationServiceError;
500
501 /**
502+ * \brief Callback type that is invoked for updates to the visibility of space vehicles.
503+ * \ingroup location_service
504+ */
505+ typedef void (*UALocationServiceSpaceVehicleUpdateHandler)(
506+ UALocationSpaceVehicleUpdate *update,
507+ void *context);
508+
509+ /**
510+ * \brief Installs an app-specific handler for updates to the visibility of space vehicles.
511+ * \ingroup location_service
512+ * \param[in] handler The space-vehicle visibiility updates handler.
513+ * \param[in] context Application-specific, may be null.
514+ *
515+ * A space vehicle handler can be reset by calling this function with:
516+ * ua_location_service_set_space_vehicle_handler(NULL, NULL);
517+ */
518+ UBUNTU_DLL_PUBLIC void
519+ ua_location_service_set_space_vehicle_update_handler(
520+ UALocationServiceSpaceVehicleUpdateHandler handler,
521+ void *context);
522+
523+ /**
524 * \brief Creates a new session with the location service for low positional accuracy requirements.
525 * \ingroup location_service
526 * \returns A new session or NULL if the requirements cannot be
527
528=== added file 'include/ubuntu/application/location/space_vehicle.h'
529--- include/ubuntu/application/location/space_vehicle.h 1970-01-01 00:00:00 +0000
530+++ include/ubuntu/application/location/space_vehicle.h 2016-04-04 06:59:39 +0000
531@@ -0,0 +1,148 @@
532+/*
533+ * Copyright © 2015 Canonical Ltd.
534+ *
535+ * This program is free software: you can redistribute it and/or modify
536+ * it under the terms of the GNU Lesser General Public License version 3 as
537+ * published by the Free Software Foundation.
538+ *
539+ * This program is distributed in the hope that it will be useful,
540+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
541+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
542+ * GNU Lesser General Public License for more details.
543+ *
544+ * You should have received a copy of the GNU Lesser General Public License
545+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
546+ *
547+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
548+ */
549+
550+#ifndef UBUNTU_APPLICATION_LOCATION_SPACE_VEHICLE_H_
551+#define UBUNTU_APPLICATION_LOCATION_SPACE_VEHICLE_H_
552+
553+#include <ubuntu/visibility.h>
554+
555+#include <stdbool.h>
556+#include <stdint.h>
557+
558+#ifdef __cplusplus
559+extern "C"
560+{
561+#endif
562+
563+ /**
564+ * \brief Enumerates all known satellite-positioning systems and associated vehicle types.
565+ * \ingroup location_service
566+ */
567+ typedef enum
568+ {
569+ UA_LOCATION_SPACE_VEHICLE_TYPE_UNKNOWN, /**< Unknown type. */
570+ UA_LOCATION_SPACE_VEHICLE_TYPE_BEIDOU, /**< People's Republic of China's regional system, currently limited to Asia and the West Pacific */
571+ UA_LOCATION_SPACE_VEHICLE_TYPE_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). */
572+ UA_LOCATION_SPACE_VEHICLE_TYPE_GLONASS, /**< Russia's global navigation system. Fully operational worldwide. */
573+ UA_LOCATION_SPACE_VEHICLE_TYPE_GPS, /**< Fully operational worldwide. */
574+ UA_LOCATION_SPACE_VEHICLE_TYPE_COMPASS, /**< People's Republic of China's global system, planned to be operational by 2020. */
575+ UA_LOCATION_SPACE_VEHICLE_TYPE_IRNSS, /**< India's regional navigation system, planned to be operational by 2014, covering India and Northern Indian Ocean. */
576+ UA_LOCATION_SPACE_VEHICLE_TYPE_QZSS /**< Japanese regional system covering Asia and Oceania. */
577+ } UbuntuApplicationLocationSpaceVehicleType;
578+
579+ typedef UbuntuApplicationLocationSpaceVehicleType UALocationSpaceVehicleType;
580+
581+ /**
582+ * \brief Opaque type describing a space vehicle.
583+ * \ingroup location_service
584+ */
585+ typedef struct UbuntuApplicationLocationSpaceVehicle UALocationSpaceVehicle;
586+
587+ /**
588+ * \brief Increments the reference count of the update instance.
589+ * \ingroup location_service
590+ * \param[in] vehicle The vehicle instance to increment the reference count for.
591+ */
592+ UBUNTU_DLL_PUBLIC void
593+ ua_location_space_vehicle_ref(
594+ UALocationSpaceVehicle *vehicle);
595+
596+ /**
597+ * \brief Decrements the reference count of the vehicle instance.
598+ * \ingroup location_service
599+ * \param[in] vehicle The vehicle instance to decrement the reference count for.
600+ */
601+ UBUNTU_DLL_PUBLIC void
602+ ua_location_space_vehicle_unref(
603+ UALocationSpaceVehicle *vehicle);
604+
605+ /**
606+ * \brief Queries the type of the space vehicle.
607+ * \ingroup location_service
608+ */
609+ UBUNTU_DLL_PUBLIC UALocationSpaceVehicleType
610+ ua_location_space_vehicle_get_type(
611+ UALocationSpaceVehicle *vehicle);
612+
613+ /**
614+ * \brief Queries the unique numeric id of the vehicle instance.
615+ * \ingroup location_service
616+ * \param[in] vehicle The vehicle instance to query the id for.
617+ */
618+ UBUNTU_DLL_PUBLIC uint32_t
619+ ua_location_space_vehicle_get_id(
620+ UALocationSpaceVehicle *vehicle);
621+
622+ /**
623+ * \brief Queries the signal-to-noise ratio for measurements received from the vehicle instance.
624+ * \ingroup location_service
625+ * \param[in] vehicle The vehicle to query the snr for.
626+ */
627+ UBUNTU_DLL_PUBLIC float
628+ ua_location_space_vehicle_get_snr(
629+ UALocationSpaceVehicle *vehicle);
630+
631+ /**
632+ * \brief Queries whether we have almanac data for the vehicle available.
633+ * \ingroup location_service
634+ * \param[in] vehicle The vehicle to query.
635+ */
636+ UBUNTU_DLL_PUBLIC bool
637+ ua_location_space_vehicle_has_almanac_data(
638+ UALocationSpaceVehicle *vehicle);
639+
640+ /**
641+ * \brief Queries whether we have ephimeris data for the vehicle available.
642+ * \ingroup location_service
643+ * \param[in] vehicle The vehicle to query.
644+ */
645+ UBUNTU_DLL_PUBLIC bool
646+ ua_location_space_vehicle_has_ephimeris_data(
647+ UALocationSpaceVehicle *vehicle);
648+
649+ /**
650+ * \brief Queries whether the vehicle is used in caluclating the fix.
651+ * \ingroup location_service
652+ * \param[in] vehicle The vehicle to query.
653+ */
654+ UBUNTU_DLL_PUBLIC bool
655+ ua_location_space_vehicle_is_used_in_fix(
656+ UALocationSpaceVehicle *vehicle);
657+
658+ /**
659+ * \brief Queries the azimuth of the vehicle in [rad].
660+ * \ingroup location_service
661+ * \param[in] vehicle The vehicle to query.
662+ */
663+ UBUNTU_DLL_PUBLIC float
664+ ua_location_space_vehicle_azimuth_in_radians(
665+ UALocationSpaceVehicle *vehicle);
666+
667+ /**
668+ * \brief Queries the elevation of the vehicle in [rad].
669+ * \ingroup location_service
670+ * \param[in] vehicle The vehicle to query.
671+ */
672+ UBUNTU_DLL_PUBLIC float
673+ ua_location_space_vehicle_elevation_in_radians(
674+ UALocationSpaceVehicle *vehicle);
675+#ifdef __cplusplus
676+}
677+#endif
678+
679+#endif // UBUNTU_APPLICATION_LOCATION_SPACE_VEHICLE_H_
680
681=== added file 'include/ubuntu/application/location/space_vehicle_update.h'
682--- include/ubuntu/application/location/space_vehicle_update.h 1970-01-01 00:00:00 +0000
683+++ include/ubuntu/application/location/space_vehicle_update.h 2016-04-04 06:59:39 +0000
684@@ -0,0 +1,81 @@
685+/*
686+ * Copyright © 2015 Canonical Ltd.
687+ *
688+ * This program is free software: you can redistribute it and/or modify
689+ * it under the terms of the GNU Lesser General Public License version 3 as
690+ * published by the Free Software Foundation.
691+ *
692+ * This program is distributed in the hope that it will be useful,
693+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
694+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
695+ * GNU Lesser General Public License for more details.
696+ *
697+ * You should have received a copy of the GNU Lesser General Public License
698+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
699+ *
700+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
701+ */
702+
703+#ifndef UBUNTU_APPLICATION_LOCATION_SPACE_VEHICLE_UPDATE_H_
704+#define UBUNTU_APPLICATION_LOCATION_SPACE_VEHICLE_UPDATE_H_
705+
706+#include <ubuntu/visibility.h>
707+
708+#include <ubuntu/application/location/space_vehicle.h>
709+
710+#include <stdbool.h>
711+#include <stdint.h>
712+
713+#ifdef __cplusplus
714+extern "C"
715+{
716+#endif
717+
718+ /**
719+ * \brief Opaque type encapsulating an update to visibility of space vehicles.
720+ * \ingroup location_service
721+ */
722+ typedef struct UbuntuApplicationLocationSpaceVehicleUpdate UALocationSpaceVehicleUpdate;
723+
724+ /**
725+ * \brief Increments the reference count of the update instance.
726+ * \ingroup location_service
727+ * \param[in] update The update instance to increment the reference count for.
728+ */
729+ UBUNTU_DLL_PUBLIC void
730+ ua_location_space_vehicle_update_ref(
731+ UALocationSpaceVehicleUpdate *update);
732+
733+ /**
734+ * \brief Decrements the reference count of the update instance.
735+ * \ingroup location_service
736+ * \param[in] update The update instance to decrement the reference count for.
737+ */
738+ UBUNTU_DLL_PUBLIC void
739+ ua_location_space_vehicle_update_unref(
740+ UALocationSpaceVehicleUpdate *update);
741+
742+ /**
743+ * \brief Queries the number of space vehicles contained within this update.
744+ * \ingroup location_service
745+ * \param[in] update The update instance to be queried.
746+ */
747+ UBUNTU_DLL_PUBLIC uint32_t
748+ ua_location_space_vehicle_update_get_size(
749+ UALocationSpaceVehicleUpdate *update);
750+
751+ /**
752+ * \brief Queries the vehicle at index idx. Returns null if idx exceeds bounds.
753+ * \ingroup location_service
754+ * \param[in] idx The index, has to satisfy 0 <= idx < ua_location_space_vehicle_update_get_size.
755+ * \param[in] update The update instance to be queried.
756+ */
757+ UBUNTU_DLL_PUBLIC UALocationSpaceVehicle*
758+ ua_location_space_vehicle_update_at(
759+ uint32_t idx,
760+ UALocationSpaceVehicleUpdate* update);
761+#ifdef __cplusplus
762+}
763+#endif
764+
765+#endif // UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_
766
767=== modified file 'include/ubuntu/application/sensors/CMakeLists.txt'
768--- include/ubuntu/application/sensors/CMakeLists.txt 2016-04-04 06:59:39 +0000
769+++ include/ubuntu/application/sensors/CMakeLists.txt 2016-04-04 06:59:39 +0000
770@@ -7,6 +7,7 @@
771 proximity.h
772 haptic.h
773 orientation.h
774+ rotation_vector.h
775 )
776
777 install(
778
779=== modified file 'include/ubuntu/application/sensors/event/CMakeLists.txt'
780--- include/ubuntu/application/sensors/event/CMakeLists.txt 2016-04-04 06:59:39 +0000
781+++ include/ubuntu/application/sensors/event/CMakeLists.txt 2016-04-04 06:59:39 +0000
782@@ -6,6 +6,7 @@
783 magnetic.h
784 proximity.h
785 orientation.h
786+ rotation_vector.h
787 )
788
789 install(
790
791=== added file 'include/ubuntu/application/sensors/event/rotation_vector.h'
792--- include/ubuntu/application/sensors/event/rotation_vector.h 1970-01-01 00:00:00 +0000
793+++ include/ubuntu/application/sensors/event/rotation_vector.h 2016-04-04 06:59:39 +0000
794@@ -0,0 +1,83 @@
795+/*
796+ * Copyright (C) 2015 Canonical, Ltd.
797+ *
798+ * This program is free software: you can redistribute it and/or modify it under
799+ * the terms of the GNU Lesser General Public License version 3, as published by
800+ * the Free Software Foundation.
801+ *
802+ * This program is distributed in the hope that it will be useful, but WITHOUT
803+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
804+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
805+ * Lesser General Public License for more details.
806+ *
807+ * You should have received a copy of the GNU Lesser General Public License
808+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
809+ *
810+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
811+ */
812+
813+#ifndef UBUNTU_APPLICATION_SENSORS_ROTATION_VECTOR_EVENT_H_
814+#define UBUNTU_APPLICATION_SENSORS_ROTATION_VECTOR_EVENT_H_
815+
816+#include <ubuntu/visibility.h>
817+
818+#include <stdint.h>
819+
820+#ifdef __cplusplus
821+extern "C" {
822+#endif
823+
824+ /**
825+ * \brief Opaque type describing a rotation vector reading.
826+ * \ingroup sensor_access
827+ */
828+ typedef void UASRotationVectorEvent;
829+
830+ /**
831+ * \brief Query the timestamp of the sensor reading.
832+ * \ingroup sensor_access
833+ * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock.
834+ * \param[in] event The reading to be queried.
835+ */
836+ UBUNTU_DLL_PUBLIC uint64_t
837+ uas_rotation_vector_event_get_timestamp(
838+ UASRotationVectorEvent* event);
839+
840+ /**
841+ * \brief Query the x component of the rotation vector.
842+ * \ingroup sensor_access
843+ * \returns The rotation vector's x component.
844+ * \param[in] event The reading to be queried.
845+ */
846+ UBUNTU_DLL_PUBLIC UStatus
847+ uas_rotation_vector_event_get_x_axis(
848+ UASRotationVectorEvent* event,
849+ float* value);
850+
851+ /**
852+ * \brief Query the y component of the rotation vector.
853+ * \ingroup sensor_access
854+ * \returns The rotation vector's y component.
855+ * \param[in] event The reading to be queried.
856+ */
857+ UBUNTU_DLL_PUBLIC UStatus
858+ uas_rotation_vector_event_get_y_axis(
859+ UASRotationVectorEvent* event,
860+ float* value);
861+
862+ /**
863+ * \brief Query the z component of the rotation vector.
864+ * \ingroup sensor_access
865+ * \returns The rotation vector's z component.
866+ * \param[in] event The reading to be queried.
867+ */
868+ UBUNTU_DLL_PUBLIC UStatus
869+ uas_rotation_vector_event_get_z_axis(
870+ UASRotationVectorEvent* event,
871+ float* value);
872+
873+#ifdef __cplusplus
874+}
875+#endif
876+
877+#endif // UBUNTU_APPLICATION_SENSORS_ROTATION_VECTOR_EVENT_H_
878
879=== added file 'include/ubuntu/application/sensors/rotation_vector.h'
880--- include/ubuntu/application/sensors/rotation_vector.h 1970-01-01 00:00:00 +0000
881+++ include/ubuntu/application/sensors/rotation_vector.h 2016-04-04 06:59:39 +0000
882@@ -0,0 +1,144 @@
883+/*
884+ * Copyright (C) 2015 Canonical, Ltd.
885+ *
886+ * This program is free software: you can redistribute it and/or modify it under
887+ * the terms of the GNU Lesser General Public License version 3, as published by
888+ * the Free Software Foundation.
889+ *
890+ * This program is distributed in the hope that it will be useful, but WITHOUT
891+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
892+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
893+ * Lesser General Public License for more details.
894+ *
895+ * You should have received a copy of the GNU Lesser General Public License
896+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
897+ *
898+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
899+ */
900+
901+#ifndef UBUNTU_APPLICATION_SENSORS_ROTATION_VECTOR_H_
902+#define UBUNTU_APPLICATION_SENSORS_ROTATION_VECTOR_H_
903+
904+#include <ubuntu/status.h>
905+#include <ubuntu/visibility.h>
906+
907+#include <ubuntu/application/sensors/event/rotation_vector.h>
908+
909+#ifdef __cplusplus
910+extern "C" {
911+#endif
912+
913+ /**
914+ * \brief Opaque type that models the virtual rotation vector sensor.
915+ * \ingroup sensor_access
916+ */
917+ typedef void UASensorsRotationVector;
918+
919+ /**
920+ * \brief Callback type used by applications to subscribe to rotation vector events.
921+ * \ingroup sensor_access
922+ */
923+ typedef void (*on_rotation_vector_event_cb)(UASRotationVectorEvent* event,
924+ void* context);
925+
926+ /**
927+ * \brief Create a new object for accessing the gyroscopic sensor.
928+ * \ingroup sensor_access
929+ * \returns A new instance or NULL in case of errors.
930+ */
931+ UBUNTU_DLL_PUBLIC UASensorsRotationVector*
932+ ua_sensors_rotation_vector_new();
933+
934+ /**
935+ * \brief Enables the supplied rotation_vector sensor.
936+ * \ingroup sensor_access
937+ * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
938+ * \param[in] sensor The sensor instance to be enabled.
939+ */
940+ UBUNTU_DLL_PUBLIC UStatus
941+ ua_sensors_rotation_vector_enable(
942+ UASensorsRotationVector* sensor);
943+
944+ /**
945+ * \brief Disables the supplied rotation vector sensor.
946+ * \ingroup sensor_access
947+ * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
948+ * \param[in] sensor The sensor instance to be disabled.
949+ */
950+ UBUNTU_DLL_PUBLIC UStatus
951+ ua_sensors_rotation_vector_disable(
952+ UASensorsRotationVector* sensor);
953+
954+ /**
955+ * \brief Queries the minimum delay between two readings for the supplied sensor.
956+ * \ingroup sensor_access
957+ * \returns The minimum delay between two readings in [ms].
958+ * \param[in] sensor The sensor instance to be queried.
959+ */
960+ UBUNTU_DLL_PUBLIC uint32_t
961+ ua_sensors_rotation_vector_get_min_delay(
962+ UASensorsRotationVector* sensor);
963+
964+ /**
965+ * \brief Queries the minimum value that can be reported by the sensor.
966+ * \ingroup sensor_access
967+ * \returns The minimum value that can be reported by the sensor.
968+ * \param[in] sensor The sensor instance to be queried.
969+ */
970+ UBUNTU_DLL_PUBLIC UStatus
971+ ua_sensors_rotation_vector_get_min_value(
972+ UASensorsRotationVector* sensor,
973+ float* value);
974+
975+ /**
976+ * \brief Queries the maximum value that can be reported by the sensor.
977+ * \ingroup sensor_access
978+ * \returns The maximum value that can be reported by the sensor.
979+ * \param[in] sensor The sensor instance to be queried.
980+ */
981+ UBUNTU_DLL_PUBLIC UStatus
982+ ua_sensors_rotation_vector_get_max_value(
983+ UASensorsRotationVector* sensor,
984+ float* value);
985+
986+ /**
987+ * \brief Queries the numeric resolution supported by the sensor
988+ * \ingroup sensor_access
989+ * \returns The numeric resolution supported by the sensor.
990+ * \param[in] sensor The sensor instance to be queried.
991+ */
992+ UBUNTU_DLL_PUBLIC UStatus
993+ ua_sensors_rotation_vector_get_resolution(
994+ UASensorsRotationVector* sensor,
995+ float* value);
996+
997+ /**
998+ * \brief Set the callback to be invoked whenever a new sensor reading is available.
999+ * \ingroup sensor_access
1000+ * \param[in] sensor The sensor instance to associate the callback with.
1001+ * \param[in] cb The callback to be invoked.
1002+ * \param[in] ctx The context supplied to the callback invocation.
1003+ */
1004+ UBUNTU_DLL_PUBLIC void
1005+ ua_sensors_rotation_vector_set_reading_cb(
1006+ UASensorsRotationVector* sensor,
1007+ on_rotation_vector_event_cb cb,
1008+ void *ctx);
1009+
1010+ /**
1011+ * \brief Set the sensor event delivery rate in nanoseconds..
1012+ * \ingroup sensor_access
1013+ * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
1014+ * \param[in] sensor The sensor instance to be modified.
1015+ * \param[in] rate The new event delivery rate.
1016+ */
1017+ UBUNTU_DLL_PUBLIC UStatus
1018+ ua_sensors_rotation_vector_set_event_rate(
1019+ UASensorsRotationVector* sensor,
1020+ uint32_t rate);
1021+
1022+#ifdef __cplusplus
1023+}
1024+#endif
1025+
1026+#endif // UBUNTU_APPLICATION_SENSORS_ROTATION_VECTOR_H_
1027
1028=== modified file 'include/ubuntu/hardware/gps.h'
1029--- include/ubuntu/hardware/gps.h 2014-05-14 16:55:19 +0000
1030+++ include/ubuntu/hardware/gps.h 2016-04-04 06:59:39 +0000
1031@@ -141,6 +141,19 @@
1032 };
1033
1034 /**
1035+ * Known AGPS set id types
1036+ * \ingroup gps_access
1037+ */
1038+typedef enum
1039+{
1040+ U_HARDWARE_GPS_AGPS_SETID_TYPE_NONE = 0,
1041+ U_HARDWARE_GPS_AGPS_SETID_TYPE_IMSI = 1,
1042+ U_HARDWARE_GPS_AGPS_SETID_TYPE_MSISDN = 2
1043+} UbuntuHardwareGpsAgpsSetIdType;
1044+
1045+typedef UbuntuHardwareGpsAgpsSetIdType UHardwareGpsAgpsSetIdType;
1046+
1047+/**
1048 * Known positioning modes
1049 * \ingroup gps_access
1050 */
1051@@ -180,6 +193,19 @@
1052 U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED = 5
1053 };
1054
1055+typedef enum
1056+{
1057+ /** The respective space vehicle has almanac data available. */
1058+ U_HARDWARE_GPS_SV_INFO_FLAG_HAS_ALMANAC = 1 << 0,
1059+ /** The respective space vehicle has ephemeris data available. */
1060+ U_HARDWARE_GPS_SV_INFO_FLAG_HAS_EPHEMERIS = 1 << 1,
1061+ /** The respective satellite is used in calculating the current position estimate. */
1062+ U_HARDWARE_GPS_SV_INFO_FLAG_USED_IN_FIX = 1 << 2
1063+} UbuntuHardwareGpsSvInfoFlags;
1064+
1065+/** Bundles together flags describing a visible space vehicle. */
1066+typedef UbuntuHardwareGpsSvInfoFlags UHardwareGpsSvInfoFlags;
1067+
1068 /** Flags used to specify which aiding data to delete
1069 when calling delete_aiding_data(). */
1070 typedef uint16_t UHardwareGpsAidingData;
1071@@ -203,6 +229,24 @@
1072 #define U_HARDWARE_GPS_AGPS_TYPE_SUPL 1
1073 #define U_HARDWARE_GPS_AGPS_TYPE_C2K 2
1074
1075+/** Known AGPS set id request types. */
1076+typedef enum
1077+{
1078+ U_HARDWARE_GPS_AGPS_REQUEST_SETID_IMSI = 1,
1079+ U_HARDWARE_GPS_AGPS_REQUEST_SETID_MSISDN = 2
1080+} UbuntuHardwareGpsAgpsRequestSetIdType;
1081+
1082+typedef UbuntuHardwareGpsAgpsRequestSetIdType UHardwareGpsAgpsRequestSetIdType;
1083+
1084+/** Known AGPS reference location request types. */
1085+typedef enum
1086+{
1087+ U_HARDWARE_GPS_AGPS_REQUEST_REFLOC_CELLID = 1,
1088+ U_HARDWARE_GPS_AGPS_REQUEST_REFLOC_MAC = 2
1089+} UbuntuHardwareGpsAgpsRequestRefLocType;
1090+
1091+typedef UbuntuHardwareGpsAgpsRequestRefLocType UHardwareGpsAgpsRequestRefLocType;
1092+
1093 /** Known types for AGps reference locations. */
1094 /** A GSM cell ID. */
1095 #define U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_GSM_CELLID 1
1096@@ -255,12 +299,12 @@
1097 * \ingroup gps_access
1098 */
1099 typedef struct {
1100- /** set to sizeof(UHardwareGpsSvInfo) */
1101- size_t size;
1102 /** Pseudo-random number for the SV. */
1103 int prn;
1104 /** Signal to noise ratio. */
1105 float snr;
1106+ /** Describes ephimeris/almanac/used in fix, contains U_HARDWARE_GPS_SV_INFO_* */
1107+ uint32_t flags;
1108 /** Elevation of SV in degrees. */
1109 float elevation;
1110 /** Azimuth of SV in degrees. */
1111@@ -271,32 +315,19 @@
1112 * Represents SV (Space Vehicle) status.
1113 * \ingroup gps_access
1114 */
1115-typedef struct {
1116- /** set to sizeof(GpsSvStatus) */
1117- size_t size;
1118-
1119- /** Number of SVs currently visible. */
1120- int num_svs;
1121-
1122- /** Contains an array of SV information. */
1123- UHardwareGpsSvInfo sv_list[U_HARDWARE_GPS_MAX_SVS];
1124-
1125- /** Represents a bit mask indicating which SVs
1126- * have ephemeris data.
1127- */
1128- uint32_t ephemeris_mask;
1129-
1130- /** Represents a bit mask indicating which SVs
1131- * have almanac data.
1132- */
1133- uint32_t almanac_mask;
1134-
1135- /**
1136- * Represents a bit mask indicating which SVs
1137- * were used for computing the most recent position fix.
1138- */
1139- uint32_t used_in_fix_mask;
1140-} UHardwareGpsSvStatus;
1141+typedef struct UbuntuHardwareGpsSvStatus UHardwareGpsSvStatus;
1142+
1143+/**
1144+ * Invoked for every satellite that is part of a space vehicle visibility update.
1145+ * \ingroup gps_access
1146+ */
1147+typedef void(*UHardwareGpsSvEnumerator)(UHardwareGpsSvInfo*, void*);
1148+
1149+/**
1150+ * @brief u_hardware_gps_sv_status_enumerate_svs invokes enumerator for all space vehicles in status.
1151+ * \ingroup gps_access
1152+ */
1153+UBUNTU_DLL_PUBLIC void u_hardware_gps_sv_status_enumerate_svs(UHardwareGpsSvStatus*, UHardwareGpsSvEnumerator enumerator, void*);
1154
1155 /**
1156 * Represents the status of AGPS.
1157@@ -500,6 +531,17 @@
1158 UHardwareGpsLocation location);
1159
1160 /**
1161+ * \brief Injects set id information into the GPS chipset.
1162+ * \param self The instance to apply the change to.
1163+ * \param type The type of the set_id.
1164+ * \param set_id The set_id.
1165+ */
1166+UBUNTU_DLL_PUBLIC void
1167+u_hardware_gps_agps_set_set_id(
1168+ UHardwareGps self,
1169+ UHardwareGpsAgpsSetIdType type,
1170+ const char* set_id);
1171+/**
1172 * \brief Informs the GPS chipset about wifi ap's or radio cells to be used in AGPS calls.
1173 * \param self The instance to inform.
1174 * \param location The reference location, that is a wifi ap or a radio cell.
1175
1176=== modified file 'src/ubuntu/application/base_module.h'
1177--- src/ubuntu/application/base_module.h 2015-03-25 23:13:33 +0000
1178+++ src/ubuntu/application/base_module.h 2016-04-04 06:59:39 +0000
1179@@ -28,7 +28,7 @@
1180 */
1181
1182 #define API_VERSION_MAJOR "3"
1183-#define API_VERSION_MINOR "0"
1184+#define API_VERSION_MINOR "1"
1185 #define API_VERSION_PATCH "0"
1186 #define SO_SUFFIX ".so." API_VERSION_MAJOR "." API_VERSION_MINOR "." API_VERSION_PATCH
1187
1188
1189=== modified file 'src/ubuntu/application/common/application/location/CMakeLists.txt'
1190--- src/ubuntu/application/common/application/location/CMakeLists.txt 2014-02-13 09:45:21 +0000
1191+++ src/ubuntu/application/common/application/location/CMakeLists.txt 2016-04-04 06:59:39 +0000
1192@@ -20,6 +20,8 @@
1193
1194 heading_update.cpp
1195 position_update.cpp
1196+ space_vehicle.cpp
1197+ space_vehicle_update.cpp
1198 velocity_update.cpp
1199 )
1200
1201
1202=== modified file 'src/ubuntu/application/common/application/location/instance.h'
1203--- src/ubuntu/application/common/application/location/instance.h 2014-08-12 08:23:11 +0000
1204+++ src/ubuntu/application/common/application/location/instance.h 2016-04-04 06:59:39 +0000
1205@@ -22,6 +22,9 @@
1206 #include "ubuntu/visibility.h"
1207
1208 #include "ubuntu/application/location/controller.h"
1209+#include "ubuntu/application/location/service.h"
1210+
1211+#include "space_vehicle_update_p.h"
1212
1213 #include <com/ubuntu/location/service/stub.h>
1214
1215@@ -52,6 +55,14 @@
1216 changed_handler_context = context;
1217 }
1218
1219+ void set_space_vehicle_update_handler_with_context(
1220+ UALocationServiceSpaceVehicleUpdateHandler handler,
1221+ void* context)
1222+ {
1223+ space_vehicle_update_handler = handler;
1224+ space_vehicle_update_handler_context = context;
1225+ }
1226+
1227 private:
1228 Instance()
1229 : bus(std::make_shared<core::dbus::Bus>(core::dbus::WellKnownBus::system)),
1230@@ -97,11 +108,24 @@
1231 // And notify change handler if one is set.
1232 if (changed_handler)
1233 changed_handler(cached_state_flags, changed_handler_context);
1234+ }),
1235+ service->visible_space_vehicles().changed().connect([this](const std::map<com::ubuntu::location::SpaceVehicle::Key, com::ubuntu::location::SpaceVehicle>& update)
1236+ {
1237+ if (space_vehicle_update_handler)
1238+ {
1239+ std::vector<com::ubuntu::location::SpaceVehicle> svs;
1240+ for (const auto& pair: update) svs.push_back(pair.second);
1241+ auto upd = new UALocationSpaceVehicleUpdate{svs};
1242+ space_vehicle_update_handler(upd, space_vehicle_update_handler_context);
1243+ upd->unref();
1244+ }
1245 })
1246 },
1247 cached_state_flags{0},
1248 changed_handler{nullptr},
1249- changed_handler_context{nullptr}
1250+ changed_handler_context{nullptr},
1251+ space_vehicle_update_handler{nullptr},
1252+ space_vehicle_update_handler_context{nullptr}
1253 {
1254 bus->install_executor(executor);
1255 worker = std::move(std::thread([&]() { bus->run(); }));
1256@@ -132,12 +156,17 @@
1257 {
1258 core::ScopedConnection on_does_satellite_based_positioning_changed;
1259 core::ScopedConnection on_is_online_changed;
1260+ core::ScopedConnection on_space_vehicles_updated;
1261 } connections;
1262
1263 // All change-handler specifics go here.
1264 UALocationServiceStatusFlags cached_state_flags;
1265+
1266 UALocationServiceStatusChangedHandler changed_handler;
1267 void* changed_handler_context;
1268+
1269+ UALocationServiceSpaceVehicleUpdateHandler space_vehicle_update_handler;
1270+ void* space_vehicle_update_handler_context;
1271 };
1272
1273 #endif // INSTANCE_H_
1274
1275=== modified file 'src/ubuntu/application/common/application/location/service.cpp'
1276--- src/ubuntu/application/common/application/location/service.cpp 2014-09-15 20:35:52 +0000
1277+++ src/ubuntu/application/common/application/location/service.cpp 2016-04-04 06:59:39 +0000
1278@@ -31,6 +31,14 @@
1279 namespace cul = com::ubuntu::location;
1280 namespace culs = com::ubuntu::location::service;
1281
1282+void
1283+ua_location_service_set_space_vehicle_update_handler(
1284+ UALocationServiceSpaceVehicleUpdateHandler handler,
1285+ void *context)
1286+{
1287+ Instance::instance().set_space_vehicle_update_handler_with_context(handler, context);
1288+}
1289+
1290 UALocationServiceSession*
1291 ua_location_service_create_session_for_low_accuracy(
1292 UALocationServiceRequirementsFlags /*flags*/)
1293
1294=== added file 'src/ubuntu/application/common/application/location/space_vehicle.cpp'
1295--- src/ubuntu/application/common/application/location/space_vehicle.cpp 1970-01-01 00:00:00 +0000
1296+++ src/ubuntu/application/common/application/location/space_vehicle.cpp 2016-04-04 06:59:39 +0000
1297@@ -0,0 +1,70 @@
1298+/*
1299+ * Copyright © 2015 Canonical Ltd.
1300+ *
1301+ * This program is free software: you can redistribute it and/or modify
1302+ * it under the terms of the GNU Lesser General Public License version 3 as
1303+ * published by the Free Software Foundation.
1304+ *
1305+ * This program is distributed in the hope that it will be useful,
1306+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1307+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1308+ * GNU Lesser General Public License for more details.
1309+ *
1310+ * You should have received a copy of the GNU Lesser General Public License
1311+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1312+ *
1313+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1314+ */
1315+
1316+#include "space_vehicle_p.h"
1317+
1318+void ua_location_space_vehicle_ref(UALocationSpaceVehicle *vehicle)
1319+{
1320+ vehicle->ref();
1321+}
1322+
1323+void ua_location_space_vehicle_unref(UALocationSpaceVehicle *vehicle)
1324+{
1325+ vehicle->unref();
1326+}
1327+
1328+UALocationSpaceVehicleType ua_location_space_vehicle_get_type(UALocationSpaceVehicle *vehicle)
1329+{
1330+ return static_cast<UALocationSpaceVehicleType>(vehicle->sv.key.type);
1331+}
1332+
1333+uint32_t ua_location_space_vehicle_get_id(UALocationSpaceVehicle *vehicle)
1334+{
1335+ return vehicle->sv.key.id;
1336+}
1337+
1338+float ua_location_space_vehicle_get_snr(UALocationSpaceVehicle *vehicle)
1339+{
1340+ return vehicle->sv.snr;
1341+}
1342+
1343+bool ua_location_space_vehicle_has_almanac_data(UALocationSpaceVehicle *vehicle)
1344+{
1345+ return vehicle->sv.has_almanac_data;
1346+}
1347+
1348+bool ua_location_space_vehicle_has_ephimeris_data(UALocationSpaceVehicle *vehicle)
1349+{
1350+ return vehicle->sv.has_ephimeris_data;
1351+}
1352+
1353+bool ua_location_space_vehicle_is_used_in_fix(UALocationSpaceVehicle *vehicle)
1354+{
1355+ return vehicle->sv.used_in_fix;
1356+}
1357+
1358+float ua_location_space_vehicle_azimuth_in_radians(UALocationSpaceVehicle *vehicle)
1359+{
1360+ return vehicle->sv.azimuth.value();
1361+}
1362+
1363+float ua_location_space_vehicle_elevation_in_radians(UALocationSpaceVehicle *vehicle)
1364+{
1365+ return vehicle->sv.elevation.value();
1366+}
1367+
1368
1369=== added file 'src/ubuntu/application/common/application/location/space_vehicle_p.h'
1370--- src/ubuntu/application/common/application/location/space_vehicle_p.h 1970-01-01 00:00:00 +0000
1371+++ src/ubuntu/application/common/application/location/space_vehicle_p.h 2016-04-04 06:59:39 +0000
1372@@ -0,0 +1,40 @@
1373+/*
1374+ * Copyright (C) 2015 Canonical Ltd
1375+ *
1376+ * This program is free software: you can redistribute it and/or modify
1377+ * it under the terms of the GNU Lesser General Public License version 3 as
1378+ * published by the Free Software Foundation.
1379+ *
1380+ * This program is distributed in the hope that it will be useful,
1381+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1382+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1383+ * GNU Lesser General Public License for more details.
1384+ *
1385+ * You should have received a copy of the GNU Lesser General Public License
1386+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1387+ *
1388+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
1389+ */
1390+
1391+#ifndef SPACE_VEHICLE_PRIVATE_H_
1392+#define SPACE_VEHICLE_PRIVATE_H_
1393+
1394+#include "ubuntu/application/location/space_vehicle.h"
1395+
1396+#include "ref_counted.h"
1397+
1398+#include <com/ubuntu/location/space_vehicle.h>
1399+
1400+namespace cul = com::ubuntu::location;
1401+
1402+struct UbuntuApplicationLocationSpaceVehicle : public detail::RefCounted
1403+{
1404+ UbuntuApplicationLocationSpaceVehicle(const cul::SpaceVehicle& sv) : sv(sv)
1405+ {
1406+ }
1407+
1408+ cul::SpaceVehicle sv;
1409+};
1410+
1411+#endif // SPACE_VEHICLE_PRIVATE_H_
1412+
1413
1414=== added file 'src/ubuntu/application/common/application/location/space_vehicle_update.cpp'
1415--- src/ubuntu/application/common/application/location/space_vehicle_update.cpp 1970-01-01 00:00:00 +0000
1416+++ src/ubuntu/application/common/application/location/space_vehicle_update.cpp 2016-04-04 06:59:39 +0000
1417@@ -0,0 +1,44 @@
1418+/*
1419+ * Copyright © 2015 Canonical Ltd.
1420+ *
1421+ * This program is free software: you can redistribute it and/or modify
1422+ * it under the terms of the GNU Lesser General Public License version 3 as
1423+ * published by the Free Software Foundation.
1424+ *
1425+ * This program is distributed in the hope that it will be useful,
1426+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1427+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1428+ * GNU Lesser General Public License for more details.
1429+ *
1430+ * You should have received a copy of the GNU Lesser General Public License
1431+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1432+ *
1433+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1434+ */
1435+
1436+#include "space_vehicle_p.h"
1437+#include "space_vehicle_update_p.h"
1438+
1439+void ua_location_space_vehicle_update_ref(UALocationSpaceVehicleUpdate *update)
1440+{
1441+ update->ref();
1442+}
1443+
1444+void ua_location_space_vehicle_update_unref(UALocationSpaceVehicleUpdate *update)
1445+{
1446+ update->unref();
1447+}
1448+
1449+uint32_t ua_location_space_vehicle_update_get_size(UALocationSpaceVehicleUpdate *update)
1450+{
1451+ return update->svs.size();
1452+}
1453+
1454+UALocationSpaceVehicle* ua_location_space_vehicle_update_at(uint32_t idx, UALocationSpaceVehicleUpdate* update)
1455+{
1456+ if (idx >= update->svs.size())
1457+ return nullptr;
1458+
1459+ return new UbuntuApplicationLocationSpaceVehicle{update->svs[idx]};
1460+}
1461+
1462
1463=== added file 'src/ubuntu/application/common/application/location/space_vehicle_update_p.h'
1464--- src/ubuntu/application/common/application/location/space_vehicle_update_p.h 1970-01-01 00:00:00 +0000
1465+++ src/ubuntu/application/common/application/location/space_vehicle_update_p.h 2016-04-04 06:59:39 +0000
1466@@ -0,0 +1,41 @@
1467+/*
1468+ * Copyright (C) 2015 Canonical Ltd
1469+ *
1470+ * This program is free software: you can redistribute it and/or modify
1471+ * it under the terms of the GNU Lesser General Public License version 3 as
1472+ * published by the Free Software Foundation.
1473+ *
1474+ * This program is distributed in the hope that it will be useful,
1475+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1476+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1477+ * GNU Lesser General Public License for more details.
1478+ *
1479+ * You should have received a copy of the GNU Lesser General Public License
1480+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1481+ *
1482+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
1483+ */
1484+
1485+#ifndef SPACE_VEHICLE_UPDATE_PRIVATE_H_
1486+#define SPACE_VEHICLE_UPDATE_PRIVATE_H_
1487+
1488+#include "ubuntu/application/location/space_vehicle_update.h"
1489+
1490+#include "ref_counted.h"
1491+
1492+#include <com/ubuntu/location/space_vehicle.h>
1493+
1494+#include <vector>
1495+
1496+namespace cul = com::ubuntu::location;
1497+
1498+struct UbuntuApplicationLocationSpaceVehicleUpdate : public detail::RefCounted
1499+{
1500+ UbuntuApplicationLocationSpaceVehicleUpdate(const std::vector<cul::SpaceVehicle>& svs) : svs(svs)
1501+ {
1502+ }
1503+
1504+ std::vector<cul::SpaceVehicle> svs;
1505+};
1506+
1507+#endif // SPACE_VEHICLE_UPDATE_PRIVATE_H_
1508
1509=== modified file 'src/ubuntu/application/desktop/module_version.h'
1510--- src/ubuntu/application/desktop/module_version.h 2015-06-17 21:21:53 +0000
1511+++ src/ubuntu/application/desktop/module_version.h 2016-04-04 06:59:39 +0000
1512@@ -1,3 +1,3 @@
1513 #define MODULE_VERSION_MAJOR 3
1514-#define MODULE_VERSION_MINOR 0
1515+#define MODULE_VERSION_MINOR 1
1516 #define MODULE_VERSION_PATCH 0
1517
1518=== modified file 'src/ubuntu/application/desktop/ubuntu_application_sensors_desktop.cpp'
1519--- src/ubuntu/application/desktop/ubuntu_application_sensors_desktop.cpp 2016-04-04 06:59:39 +0000
1520+++ src/ubuntu/application/desktop/ubuntu_application_sensors_desktop.cpp 2016-04-04 06:59:39 +0000
1521@@ -22,6 +22,7 @@
1522 #include <ubuntu/application/sensors/orientation.h>
1523 #include <ubuntu/application/sensors/gyroscope.h>
1524 #include <ubuntu/application/sensors/magnetic.h>
1525+#include <ubuntu/application/sensors/rotation_vector.h>
1526
1527 #include <stddef.h>
1528
1529@@ -558,3 +559,99 @@
1530
1531 return U_STATUS_SUCCESS;
1532 }
1533+
1534+// Gyroscope Sensor
1535+UASensorsRotationVector* ua_sensors_rotation_vector_new()
1536+{
1537+ return NULL;
1538+}
1539+
1540+UStatus ua_sensors_rotation_vector_enable(UASensorsRotationVector*)
1541+{
1542+ return (UStatus) 0;
1543+}
1544+
1545+UStatus ua_sensors_rotation_vector_disable(UASensorsRotationVector*)
1546+{
1547+ return (UStatus) 0;
1548+}
1549+
1550+uint32_t ua_sensors_rotation_vector_get_min_delay(UASensorsRotationVector*)
1551+{
1552+ return 0;
1553+}
1554+
1555+UStatus ua_sensors_rotation_vector_get_min_value(UASensorsRotationVector*, float* value)
1556+{
1557+ if (!value)
1558+ return U_STATUS_ERROR;
1559+
1560+ *value = 0.f;
1561+
1562+ return U_STATUS_SUCCESS;
1563+}
1564+
1565+UStatus ua_sensors_rotation_vector_get_max_value(UASensorsRotationVector*, float* value)
1566+{
1567+ if (!value)
1568+ return U_STATUS_ERROR;
1569+
1570+ *value = 0.f;
1571+
1572+ return U_STATUS_SUCCESS;
1573+}
1574+
1575+UStatus ua_sensors_rotation_vector_get_resolution(UASensorsRotationVector*, float* value)
1576+{
1577+ if (!value)
1578+ return U_STATUS_ERROR;
1579+
1580+ *value = 0.f;
1581+
1582+ return U_STATUS_SUCCESS;
1583+}
1584+
1585+void ua_sensors_rotation_vector_set_reading_cb(UASensorsRotationVector*, on_rotation_vector_event_cb, void *)
1586+{
1587+}
1588+
1589+UStatus ua_sensors_rotation_vector_set_event_rate(UASensorsRotationVector*, uint32_t)
1590+{
1591+ return U_STATUS_SUCCESS;
1592+}
1593+
1594+// RotationVector Sensor Event
1595+uint64_t uas_rotation_vector_event_get_timestamp(UASRotationVectorEvent*)
1596+{
1597+ return 0;
1598+}
1599+
1600+UStatus uas_rotation_vector_event_get_x_axis(UASRotationVectorEvent*, float* value)
1601+{
1602+ if (!value)
1603+ return U_STATUS_ERROR;
1604+
1605+ *value = 0.f;
1606+
1607+ return U_STATUS_SUCCESS;
1608+}
1609+
1610+UStatus uas_rotation_vector_event_get_y_axis(UASRotationVectorEvent*, float* value)
1611+{
1612+ if (!value)
1613+ return U_STATUS_ERROR;
1614+
1615+ *value = 0.f;
1616+
1617+ return U_STATUS_SUCCESS;
1618+}
1619+
1620+UStatus uas_rotation_vector_event_get_z_axis(UASRotationVectorEvent*, float* value)
1621+{
1622+ if (!value)
1623+ return U_STATUS_ERROR;
1624+
1625+ *value = 0.f;
1626+
1627+ return U_STATUS_SUCCESS;
1628+}
1629
1630=== modified file 'src/ubuntu/application/testbackend/module_version.h'
1631--- src/ubuntu/application/testbackend/module_version.h 2015-03-25 23:01:58 +0000
1632+++ src/ubuntu/application/testbackend/module_version.h 2016-04-04 06:59:39 +0000
1633@@ -1,3 +1,3 @@
1634 #define MODULE_VERSION_MAJOR 3
1635-#define MODULE_VERSION_MINOR 0
1636+#define MODULE_VERSION_MINOR 1
1637 #define MODULE_VERSION_PATCH 0
1638
1639=== modified file 'src/ubuntu/application/testbackend/test_stubs.cpp'
1640--- src/ubuntu/application/testbackend/test_stubs.cpp 2015-09-29 12:21:55 +0000
1641+++ src/ubuntu/application/testbackend/test_stubs.cpp 2016-04-04 06:59:39 +0000
1642@@ -149,6 +149,10 @@
1643 }
1644
1645 // Location
1646+void ua_location_service_set_space_vehicle_update_handler(UALocationServiceSpaceVehicleUpdateHandler, void*)
1647+{
1648+}
1649+
1650 void ua_location_service_controller_ref(UALocationServiceController*)
1651 {
1652 }
1653@@ -317,6 +321,72 @@
1654 return 0;
1655 }
1656
1657+void ua_location_space_vehicle_update_ref(UALocationSpaceVehicleUpdate*)
1658+{
1659+}
1660+
1661+void ua_location_space_vehicle_update_unref(UALocationSpaceVehicleUpdate*)
1662+{
1663+}
1664+
1665+uint32_t ua_location_space_vehicle_update_get_size(UALocationSpaceVehicleUpdate*)
1666+{
1667+ return 0;
1668+}
1669+
1670+UALocationSpaceVehicle* ua_location_space_vehicle_update_at(uint32_t, UALocationSpaceVehicleUpdate*)
1671+{
1672+ return nullptr;
1673+}
1674+
1675+void ua_location_space_vehicle_ref(UALocationSpaceVehicle*)
1676+{
1677+}
1678+
1679+void ua_location_space_vehicle_unref(UALocationSpaceVehicle*)
1680+{
1681+}
1682+
1683+UALocationSpaceVehicleType ua_location_space_vehicle_get_type(UALocationSpaceVehicle*)
1684+{
1685+ return UA_LOCATION_SPACE_VEHICLE_TYPE_UNKNOWN;
1686+}
1687+
1688+uint32_t ua_location_space_vehicle_get_id(UALocationSpaceVehicle*)
1689+{
1690+ return 42;
1691+}
1692+
1693+float ua_location_space_vehicle_get_snr(UALocationSpaceVehicle*)
1694+{
1695+ return 0;
1696+}
1697+
1698+bool ua_location_space_vehicle_has_almanac_data(UALocationSpaceVehicle*)
1699+{
1700+ return false;
1701+}
1702+
1703+bool ua_location_space_vehicle_has_ephimeris_data(UALocationSpaceVehicle*)
1704+{
1705+ return false;
1706+}
1707+
1708+bool ua_location_space_vehicle_is_used_in_fix(UALocationSpaceVehicle*)
1709+{
1710+ return false;
1711+}
1712+
1713+float ua_location_space_vehicle_azimuth_in_radians(UALocationSpaceVehicle*)
1714+{
1715+ return 0;
1716+}
1717+
1718+float ua_location_space_vehicle_elevation_in_radians(UALocationSpaceVehicle*)
1719+{
1720+ return 45;
1721+}
1722+
1723 // URL Dispatcher
1724
1725 UAUrlDispatcherSession* ua_url_dispatcher_session()
1726
1727=== modified file 'src/ubuntu/application/testbackend/ubuntu_application_sensors.cpp'
1728--- src/ubuntu/application/testbackend/ubuntu_application_sensors.cpp 2016-04-04 06:59:39 +0000
1729+++ src/ubuntu/application/testbackend/ubuntu_application_sensors.cpp 2016-04-04 06:59:39 +0000
1730@@ -29,6 +29,7 @@
1731 #include <ubuntu/application/sensors/haptic.h>
1732 #include <ubuntu/application/sensors/gyroscope.h>
1733 #include <ubuntu/application/sensors/magnetic.h>
1734+#include <ubuntu/application/sensors/rotation_vector.h>
1735
1736 #include <cstddef>
1737 #include <cstdlib>
1738@@ -1078,3 +1079,107 @@
1739
1740 return U_STATUS_SUCCESS;
1741 }
1742+
1743+/***************************************
1744+ *
1745+ * Rotation Vector API
1746+ *
1747+ ***************************************/
1748+UASensorsRotationVector* ua_sensors_rotation_vector_new()
1749+{
1750+ return SensorController::instance().get(ubuntu_sensor_type_rotation_vector);
1751+}
1752+
1753+UStatus ua_sensors_rotation_vector_enable(UASensorsRotationVector* s)
1754+{
1755+ static_cast<TestSensor*>(s)->enabled = true;
1756+ return (UStatus) 0;
1757+}
1758+
1759+UStatus ua_sensors_rotation_vector_disable(UASensorsRotationVector* s)
1760+{
1761+ static_cast<TestSensor*>(s)->enabled = true;
1762+ return (UStatus) 0;}
1763+
1764+uint32_t ua_sensors_rotation_vector_get_min_delay(UASensorsRotationVector* s)
1765+{
1766+ return static_cast<TestSensor*>(s)->min_delay;
1767+}
1768+
1769+UStatus ua_sensors_rotation_vector_get_min_value(UASensorsRotationVector* s, float* value)
1770+{
1771+ if (!value)
1772+ return U_STATUS_ERROR;
1773+
1774+ *value = static_cast<TestSensor*>(s)->min_value;
1775+
1776+ return U_STATUS_SUCCESS;
1777+}
1778+
1779+UStatus ua_sensors_rotation_vector_get_max_value(UASensorsRotationVector* s, float* value)
1780+{
1781+ if (!value)
1782+ return U_STATUS_ERROR;
1783+
1784+ *value = static_cast<TestSensor*>(s)->max_value;
1785+
1786+ return U_STATUS_SUCCESS;
1787+}
1788+
1789+UStatus ua_sensors_rotation_vector_get_resolution(UASensorsRotationVector* s, float* value)
1790+{
1791+ if (!value)
1792+ return U_STATUS_ERROR;
1793+
1794+ *value = static_cast<TestSensor*>(s)->resolution;
1795+
1796+ return U_STATUS_SUCCESS;
1797+}
1798+
1799+void ua_sensors_rotation_vector_set_reading_cb(UASensorsRotationVector* s, on_rotation_vector_event_cb cb, void *ctx)
1800+{
1801+ TestSensor* sensor = static_cast<TestSensor*>(s);
1802+ sensor->on_event_cb = cb;
1803+ sensor->event_cb_context = ctx;
1804+}
1805+
1806+UStatus ua_sensors_rotation_vector_set_event_rate(UASensorsRotationVector*, uint32_t)
1807+{
1808+ return U_STATUS_SUCCESS;
1809+}
1810+
1811+// RotationVector Sensor Event
1812+uint64_t uas_rotation_vector_event_get_timestamp(UASRotationVectorEvent*)
1813+{
1814+ return 0;
1815+}
1816+
1817+UStatus uas_rotation_vector_event_get_x_axis(UASRotationVectorEvent*, float* value)
1818+{
1819+ if (!value)
1820+ return U_STATUS_ERROR;
1821+
1822+ *value = 0.f;
1823+
1824+ return U_STATUS_SUCCESS;
1825+}
1826+
1827+UStatus uas_rotation_vector_event_get_y_axis(UASRotationVectorEvent*, float* value)
1828+{
1829+ if (!value)
1830+ return U_STATUS_ERROR;
1831+
1832+ *value = 0.f;
1833+
1834+ return U_STATUS_SUCCESS;
1835+}
1836+
1837+UStatus uas_rotation_vector_event_get_z_axis(UASRotationVectorEvent*, float* value)
1838+{
1839+ if (!value)
1840+ return U_STATUS_ERROR;
1841+
1842+ *value = 0.f;
1843+
1844+ return U_STATUS_SUCCESS;
1845+}
1846
1847=== modified file 'src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp'
1848--- src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp 2016-04-04 06:59:39 +0000
1849+++ src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp 2016-04-04 06:59:39 +0000
1850@@ -23,6 +23,7 @@
1851 #include <ubuntu/application/sensors/orientation.h>
1852 #include <ubuntu/application/sensors/gyroscope.h>
1853 #include <ubuntu/application/sensors/magnetic.h>
1854+#include <ubuntu/application/sensors/rotation_vector.h>
1855
1856 #include "hybris_module.h"
1857
1858@@ -103,12 +104,29 @@
1859 IMPLEMENT_VOID_FUNCTION3(ua_sensors_gyroscope_set_reading_cb, UASensorsGyroscope*, on_gyroscope_event_cb, void*);
1860 IMPLEMENT_FUNCTION2(UStatus, ua_sensors_gyroscope_set_event_rate, UASensorsGyroscope*, uint32_t);
1861
1862+// Rotation Vector Sensor Event
1863+IMPLEMENT_CTOR0(UASensorsRotationVector*, ua_sensors_rotation_vector_new);
1864+IMPLEMENT_FUNCTION1(UStatus, ua_sensors_rotation_vector_enable, UASensorsRotationVector*);
1865+IMPLEMENT_FUNCTION1(UStatus, ua_sensors_rotation_vector_disable, UASensorsRotationVector*);
1866+IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_rotation_vector_get_min_delay, UASensorsRotationVector*);
1867+IMPLEMENT_FUNCTION2(UStatus, ua_sensors_rotation_vector_get_min_value, UASensorsRotationVector*, float*);
1868+IMPLEMENT_FUNCTION2(UStatus, ua_sensors_rotation_vector_get_max_value, UASensorsRotationVector*, float*);
1869+IMPLEMENT_FUNCTION2(UStatus, ua_sensors_rotation_vector_get_resolution, UASensorsRotationVector*, float*);
1870+IMPLEMENT_VOID_FUNCTION3(ua_sensors_rotation_vector_set_reading_cb, UASensorsRotationVector*, on_gyroscope_event_cb, void*);
1871+IMPLEMENT_FUNCTION2(UStatus, ua_sensors_rotation_vector_set_event_rate, UASensorsRotationVector*, uint32_t);
1872+
1873 // Gyroscope Sensor Event
1874 IMPLEMENT_FUNCTION1(uint64_t, uas_gyroscope_event_get_timestamp, UASGyroscopeEvent*);
1875 IMPLEMENT_FUNCTION2(UStatus, uas_gyroscope_event_get_rate_of_rotation_around_x, UASGyroscopeEvent*, float*);
1876 IMPLEMENT_FUNCTION2(UStatus, uas_gyroscope_event_get_rate_of_rotation_around_y, UASGyroscopeEvent*, float*);
1877 IMPLEMENT_FUNCTION2(UStatus, uas_gyroscope_event_get_rate_of_rotation_around_z, UASGyroscopeEvent*, float*);
1878
1879+// Rotation VectorSensor Event
1880+IMPLEMENT_FUNCTION1(uint64_t, uas_rotation_vector_event_get_timestamp, UASRotationVectorEvent*);
1881+IMPLEMENT_FUNCTION2(UStatus, uas_rotation_vector_event_get_x_axis, UASRotationVectorEvent*, float*);
1882+IMPLEMENT_FUNCTION2(UStatus, uas_rotation_vector_event_get_y_axis, UASRotationVectorEvent*, float*);
1883+IMPLEMENT_FUNCTION2(UStatus, uas_rotation_vector_event_get_z_axis, UASRotationVectorEvent*, float*);
1884+
1885 // Magnetic Field Sensor
1886 IMPLEMENT_CTOR0(UASensorsMagnetic*, ua_sensors_magnetic_new);
1887 IMPLEMENT_FUNCTION1(UStatus, ua_sensors_magnetic_enable, UASensorsMagnetic*);
1888
1889=== modified file 'src/ubuntu/application/touch/module_version.h'
1890--- src/ubuntu/application/touch/module_version.h 2015-03-25 23:01:58 +0000
1891+++ src/ubuntu/application/touch/module_version.h 2016-04-04 06:59:39 +0000
1892@@ -1,3 +1,3 @@
1893 #define MODULE_VERSION_MAJOR 3
1894-#define MODULE_VERSION_MINOR 0
1895+#define MODULE_VERSION_MINOR 1
1896 #define MODULE_VERSION_PATCH 0
1897
1898=== modified file 'src/ubuntu/application/ubuntu_application_api.cpp'
1899--- src/ubuntu/application/ubuntu_application_api.cpp 2016-04-04 06:59:39 +0000
1900+++ src/ubuntu/application/ubuntu_application_api.cpp 2016-04-04 06:59:39 +0000
1901@@ -30,6 +30,7 @@
1902 #include <ubuntu/application/sensors/haptic.h>
1903 #include <ubuntu/application/sensors/gyroscope.h>
1904 #include <ubuntu/application/sensors/magnetic.h>
1905+#include <ubuntu/application/sensors/rotation_vector.h>
1906
1907 #include <ubuntu/application/location/service.h>
1908 #include <ubuntu/application/location/heading_update.h>
1909@@ -188,6 +189,22 @@
1910 IMPLEMENT_FUNCTION2(sensors, UStatus, uas_magnetic_event_get_magnetic_field_y, UASAccelerometerEvent*, float*);
1911 IMPLEMENT_FUNCTION2(sensors, UStatus, uas_magnetic_event_get_magnetic_field_z, UASAccelerometerEvent*, float*);
1912
1913+// Rotation Vector Sensor Event
1914+IMPLEMENT_CTOR0(sensors, UASensorsRotationVector*, ua_sensors_rotation_vector_new);
1915+IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_rotation_vector_enable, UASensorsRotationVector*);
1916+IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_rotation_vector_disable, UASensorsRotationVector*);
1917+IMPLEMENT_FUNCTION1(sensors, uint32_t, ua_sensors_rotation_vector_get_min_delay, UASensorsRotationVector*);
1918+IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_rotation_vector_get_min_value, UASensorsRotationVector*, float*);
1919+IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_rotation_vector_get_max_value, UASensorsRotationVector*, float*);
1920+IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_rotation_vector_get_resolution, UASensorsRotationVector*, float*);
1921+IMPLEMENT_VOID_FUNCTION3(sensors, ua_sensors_rotation_vector_set_reading_cb, UASensorsRotationVector*, on_gyroscope_event_cb, void*);
1922+IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_rotation_vector_set_event_rate, UASensorsRotationVector*, uint32_t);
1923+
1924+IMPLEMENT_FUNCTION1(sensors, uint64_t, uas_rotation_vector_event_get_timestamp, UASRotationVectorEvent*);
1925+IMPLEMENT_FUNCTION2(sensors, UStatus, uas_rotation_vector_event_get_x_axis, UASRotationVectorEvent*, float*);
1926+IMPLEMENT_FUNCTION2(sensors, UStatus, uas_rotation_vector_event_get_y_axis, UASRotationVectorEvent*, float*);
1927+IMPLEMENT_FUNCTION2(sensors, UStatus, uas_rotation_vector_event_get_z_axis, UASRotationVectorEvent*, float*);
1928+
1929 // Location
1930
1931 IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_controller_ref, UALocationServiceController*);
1932@@ -233,7 +250,21 @@
1933 IMPLEMENT_VOID_FUNCTION1(location, ua_location_velocity_update_unref, UALocationVelocityUpdate*);
1934 IMPLEMENT_FUNCTION1(location, uint64_t, ua_location_velocity_update_get_timestamp, UALocationVelocityUpdate*);
1935 IMPLEMENT_FUNCTION1(location, double, ua_location_velocity_update_get_velocity_in_meters_per_second, UALocationVelocityUpdate*);
1936-
1937+IMPLEMENT_VOID_FUNCTION2(location, ua_location_service_set_space_vehicle_update_handler, UALocationServiceSpaceVehicleUpdateHandler, void*);
1938+IMPLEMENT_VOID_FUNCTION1(location, ua_location_space_vehicle_update_ref, UALocationSpaceVehicleUpdate*)
1939+IMPLEMENT_VOID_FUNCTION1(location, ua_location_space_vehicle_update_unref, UALocationSpaceVehicleUpdate*)
1940+IMPLEMENT_FUNCTION1(location, uint32_t, ua_location_space_vehicle_update_get_size, UALocationSpaceVehicleUpdate*)
1941+IMPLEMENT_FUNCTION2(location, UALocationSpaceVehicle*, ua_location_space_vehicle_update_at, uint32_t, UALocationSpaceVehicleUpdate*)
1942+IMPLEMENT_VOID_FUNCTION1(location, ua_location_space_vehicle_ref, UALocationSpaceVehicle*)
1943+IMPLEMENT_VOID_FUNCTION1(location, ua_location_space_vehicle_unref, UALocationSpaceVehicle*)
1944+IMPLEMENT_FUNCTION1(location, UALocationSpaceVehicleType, ua_location_space_vehicle_get_type, UALocationSpaceVehicle*)
1945+IMPLEMENT_FUNCTION1(location, uint32_t, ua_location_space_vehicle_get_id, UALocationSpaceVehicle*)
1946+IMPLEMENT_FUNCTION1(location, float, ua_location_space_vehicle_get_snr, UALocationSpaceVehicle*)
1947+IMPLEMENT_FUNCTION1(location, bool, ua_location_space_vehicle_has_almanac_data, UALocationSpaceVehicle*)
1948+IMPLEMENT_FUNCTION1(location, bool, ua_location_space_vehicle_has_ephimeris_data, UALocationSpaceVehicle*)
1949+IMPLEMENT_FUNCTION1(location, bool, ua_location_space_vehicle_is_used_in_fix, UALocationSpaceVehicle*)
1950+IMPLEMENT_FUNCTION1(location, float, ua_location_space_vehicle_azimuth_in_radians, UALocationSpaceVehicle*)
1951+IMPLEMENT_FUNCTION1(location, float, ua_location_space_vehicle_elevation_in_radians, UALocationSpaceVehicle*)
1952 // URL Dispatcher
1953
1954 IMPLEMENT_CTOR0(url_dispatcher, UAUrlDispatcherSession*, ua_url_dispatcher_session);
1955
1956=== modified file 'src/ubuntu/hardware/tests/test_gps_api.cpp'
1957--- src/ubuntu/hardware/tests/test_gps_api.cpp 2014-06-11 12:19:37 +0000
1958+++ src/ubuntu/hardware/tests/test_gps_api.cpp 2016-04-04 06:59:39 +0000
1959@@ -67,9 +67,13 @@
1960 };
1961 }
1962
1963-void gps_sb_status_cb(UHardwareGpsSvStatus* sv_info, void* context)
1964+void gps_sb_status_cb(UHardwareGpsSvStatus* status, void* context)
1965 {
1966- printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs);
1967+ printf("gps_status_cb() called:\n");
1968+ u_hardware_gps_sv_status_enumerate_svs(status, [](UHardwareGpsSvInfo* info, void*)
1969+ {
1970+ printf(" [%d] snr=%f elevation=%f azimuth=%f flags=%x \n", info->prn, info->snr, info->elevation, info->azimuth, info->flags);
1971+ }, nullptr);
1972 }
1973
1974 void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context)
1975
1976=== modified file 'src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp'
1977--- src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp 2016-01-26 13:37:51 +0000
1978+++ src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp 2016-04-04 06:59:39 +0000
1979@@ -103,6 +103,18 @@
1980 char*,
1981 int);
1982
1983+IMPLEMENT_VOID_FUNCTION3(
1984+ u_hardware_gps_sv_status_enumerate_svs,
1985+ UHardwareGpsSvStatus*,
1986+ UHardwareGpsSvEnumerator,
1987+ void*);
1988+
1989+IMPLEMENT_VOID_FUNCTION3(
1990+ u_hardware_gps_agps_set_set_id,
1991+ UHardwareGps,
1992+ UHardwareGpsAgpsSetIdType,
1993+ const char*);
1994+
1995 IMPLEMENT_OPTIONAL_FUNCTION0(
1996 UHardwareBooster*,
1997 u_hardware_booster_new,

Subscribers

People subscribed via source and target branches