How to relate sensors to sensor events

20 views
Skip to first unread message

Daniel Drubin

unread,
Jul 28, 2015, 10:45:15 AM7/28/15
to android-ndk
Hi,

I am in need to relate sensor events (ASensorEvent's) to sensors (ASensor's). I've looked into several samples, but they distinguish events by their types; this is not good for us as we may have multiple sensors of the same type.
I enumerate sensors with ASensorManager_getSensorList() to get an array of sensors, then retrieve their properties and enable/disable.
When a sensor event arrives, I get ASensorEvent structure which is defined in sensor.h with remark "NOTE: Must match hardware/sensors.h" but with any good suggestion how it is related to any ASensor/ASensorRef. There's a field "int32_t sensor" in event structure that is supposed to identify relevant sensor, but no explanation what it means.

So how can I relate sensors to sensor events?

/D
Reply all
Reply to author
Forward
0 new messages