通过NDK访问Android的传感器传感器、NDK、Android

2023-09-13 00:31:56 作者:街角卖爱情

我需要读取每秒掉在Android上的加速度计约100个​​样本,并以固定的采样率。目前的SensorManager作出或两者都不是。

I need read about 100 samples per second off the accelerometer on a Android, and at a fixed sample rate. The current sensormanager does or offers neither.

我读过需要阅读的Andr​​oid传感器的真快

他似乎已经进入驱动器code这让他的生活更轻松。

He seems to have access to the driver code which made his life easier.

我很好奇,如果有人已经能够做这样的事通过NDK W / O型这种类型的知识。

I am curious if anyone has been able to do something like this through the NDK w/o that type of knowledge.

在此先感谢!

推荐答案

我已经采取了看看sensor.h,和API看起来非常有前途的;然而,如何处理与ASensorEventQueue和ASensorEventQueue_hasEvents等等一个小HOWTO将-extremely-有用。

I have taken a look at sensor.h, and the API looks very promising; however, a little howto on how to deal with the ASensorEventQueue and ASensorEventQueue_hasEvents and so forth would be -extremely- useful.

哈!更新:

这将查找你想要做什么code的例子。

This looks a code example for what you want to do.

http://developer.android.com/reference/android/app/ NativeActivity.html