通过NDK访问Android的传感器 [英] Access Android sensors via NDK

查看:480
本文介绍了通过NDK访问Android的传感器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要读取每秒掉在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

这篇关于通过NDK访问Android的传感器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆