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

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

问题描述

我需要以固定采样率从 Android 上的加速度计每秒读取大约 100 个样本.当前的传感器管理器不提供或不提供.

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.

我已经阅读了需要非常快速地阅读安卓传感器

他似乎可以访问驱动程序代码,这让他的生活更轻松.

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

我很好奇是否有人能够通过 NDK 在没有此类知识的情况下做这样的事情.

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 等的一些方法将非常有用.

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.

哈!更新:

这看起来是您想要执行的操作的代码示例.

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天全站免登陆