Merge lp:~thomas-voss/platform-api/subscribe-to-sensors-with-buffer into lp:platform-api

Proposed by Thomas Voß
Status: Needs review
Proposed branch: lp:~thomas-voss/platform-api/subscribe-to-sensors-with-buffer
Merge into: lp:platform-api
Diff against target: 41 lines (+11/-2)
2 files modified
android/default/default_ubuntu_application_sensor.cpp (+1/-1)
android/hybris/ubuntu_application_sensors_for_hybris.cpp (+10/-1)
To merge this branch: bzr merge lp:~thomas-voss/platform-api/subscribe-to-sensors-with-buffer
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Pending
Ubuntu Phablet Team Pending
Review via email: mp+295919@code.launchpad.net

Commit message

Account for wake-up sensor setups, enabling buffering of events to prevent from events being lost.
Explicitly acknowledge events that require acknowledgement.

Description of the change

Account for wake-up sensor setups, enabling buffering of events to prevent from events being lost.
Explicitly acknowledge events that require acknowledgement.

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

Take default far threshold into account when interpreting proximity sensor readings.

Unmerged revisions

325. By Thomas Voß

Take default far threshold into account when interpreting proximity sensor readings.

324. By Thomas Voß

Account for wake-up sensor setups, enabling buffering of events to prevent from events being lost.
Explicitly acknowledge events that require acknowledgement.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'android/default/default_ubuntu_application_sensor.cpp'
2--- android/default/default_ubuntu_application_sensor.cpp 2014-09-17 23:38:05 +0000
3+++ android/default/default_ubuntu_application_sensor.cpp 2016-05-27 09:47:08 +0000
4@@ -302,7 +302,7 @@
5 {
6 auto ev = static_cast<ubuntu::application::sensors::ProximityEvent*>(event);
7
8- if (ev->get_distance() == proximity->max_value())
9+ if (ev->get_distance() >= (5.f < proximity->max_value() ? 5.f : proximity->max_value()))
10 return U_PROXIMITY_FAR;
11
12 return U_PROXIMITY_NEAR;
13
14=== modified file 'android/hybris/ubuntu_application_sensors_for_hybris.cpp'
15--- android/hybris/ubuntu_application_sensors_for_hybris.cpp 2015-01-28 09:28:24 +0000
16+++ android/hybris/ubuntu_application_sensors_for_hybris.cpp 2016-05-27 09:47:08 +0000
17@@ -124,7 +124,13 @@
18
19 int enable()
20 {
21- return sensor_event_queue->enableSensor(sensor);
22+ // See http://androidxref.com/5.1.1_r6/xref/frameworks/base/core/java/android/hardware/SensorManager.java#1581
23+ static const int32_t default_sampling_period_us{200000};
24+ static const int32_t default_report_latency_us{5000};
25+ static const int empty_flags{0};
26+
27+ return sensor_event_queue->enableSensor(
28+ sensor->getHandle(), default_sampling_period_us, default_report_latency_us, empty_flags);
29 }
30
31 int disable()
32@@ -204,6 +210,9 @@
33 if (i < 0)
34 return success_and_continue;
35
36+ // Send an ack for every wake_up sensor event that is set to WAKE_UP_SENSOR_EVENT_NEEDS_ACK.
37+ thiz->sensor_event_queue->sendAck(&event, 1);
38+
39 Sensor::Ptr sensor = thiz->sensor_registry.valueAt(i);
40
41 static ubuntu::application::sensors::SensorReading::Ptr reading(

Subscribers

People subscribed via source and target branches