Define typical sensor sample rate in native code
Porting typical sensor sample rate (e.g. SENSOR_DELAY_UI)
defined in Java API to native code.
Change-Id: I8b59216415bc952b4e953ca6e8058beb1dd3c645
diff --git a/include/gui/SensorEventQueue.h b/include/gui/SensorEventQueue.h
index e5b9fc5..4ee7c02 100644
--- a/include/gui/SensorEventQueue.h
+++ b/include/gui/SensorEventQueue.h
@@ -53,6 +53,18 @@
enum { MAX_RECEIVE_BUFFER_EVENT_COUNT = 256 };
+ /**
+ * Typical sensor delay (sample period) in microseconds.
+ */
+ // Fastest sampling, system will bound it to minDelay
+ static constexpr int32_t SENSOR_DELAY_FASTEST = 0;
+ // Typical sample period for game, 50Hz;
+ static constexpr int32_t SENSOR_DELAY_GAME = 20000;
+ // Typical sample period for UI, 15Hz
+ static constexpr int32_t SENSOR_DELAY_UI = 66667;
+ // Default sensor sample period
+ static constexpr int32_t SENSOR_DELAY_NORMAL = 200000;
+
SensorEventQueue(const sp<ISensorEventConnection>& connection);
virtual ~SensorEventQueue();
virtual void onFirstRef();
@@ -68,6 +80,7 @@
status_t wake() const;
status_t enableSensor(Sensor const* sensor) const;
+ status_t enableSensor(Sensor const* sensor, int32_t samplingPeriodUs) const;
status_t disableSensor(Sensor const* sensor) const;
status_t setEventRate(Sensor const* sensor, nsecs_t ns) const;