summaryrefslogtreecommitdiff
path: root/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
diff options
context:
space:
mode:
authorPeng Xu <pengxu@google.com>2017-04-04 01:31:54 -0700
committerPeng Xu <pengxu@google.com>2017-04-20 23:23:53 +0000
commit4715d1734d2c60cc91ef70d409678d8eda382fde (patch)
tree4a7968a6472431119e43f4ad0ad9520fee541c44 /modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
parentc87b15a2245b6fac68bd2e259cb0f4b4efbcf045 (diff)
HID dynamic sensor: add support to three types of sensor
Implemented HID dynamic sensor using linux hidraw driver and HidUtils. Support the following cases: 1) HID Sensor spec defined accelerometer, gyroscope, magnetometer and orientation (quaternion). 2) Android defined type sensors (HID sensor custom type): ambient temperature, barometer, light and heart rate sensor. 3) Android custom type sensor (based on HID sensor custom type). Test: run tests/examples in test/ Test: test with a USB HID hardware (launchpad sensor) and marlin Bug: 37482951 Bug: 31026607 Change-Id: I9d679fb34d15324a9df1cf19647ea638fd1a0e68
Diffstat (limited to 'modules/sensors/dynamic_sensor/DynamicSensorManager.cpp')
-rw-r--r--modules/sensors/dynamic_sensor/DynamicSensorManager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
index eb4903d2..b6340524 100644
--- a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
@@ -17,6 +17,7 @@
#include "BaseDynamicSensorDaemon.h"
#include "BaseSensorObject.h"
#include "DummyDynamicAccelDaemon.h"
+#include "HidRawSensorDaemon.h"
#include "DynamicSensorManager.h"
#include <utils/Log.h>
@@ -31,6 +32,7 @@ DynamicSensorManager* DynamicSensorManager::createInstance(
int handleBase, int handleCount, SensorEventCallback *callback) {
auto m = new DynamicSensorManager(handleBase, handleBase + handleCount - 1, callback);
m->mDaemonVector.push_back(new DummyDynamicAccelDaemon(*m));
+ m->mDaemonVector.push_back(new HidRawSensorDaemon(*m));
return m;
}
@@ -107,7 +109,7 @@ int DynamicSensorManager::setDelay(int handle, nsecs_t sample_period) {
int DynamicSensorManager::flush(int handle) {
if (handle == mHandleRange.first) {
- // TODO: submit a flush complete here
+ // submit a flush complete here
static const sensors_event_t event = {
.type = SENSOR_TYPE_META_DATA,
.sensor = mHandleRange.first,