具有增强型接近传感器的 Android 手机
我目前使用 HTC Wildfire 手机的接近传感器。问题是,如果传感器前面 1 厘米内有物体,它只会返回布尔值。
所以,我想问市场上是否有一款带有接近传感器的 Android 手机,它能够返回实际距离值(厘米)而不是布尔值。
谢谢
I currently use the proximity sensor of an HTC Wildfire phone. The problem is that it only returns a boolean value if there is an object within 1 cm in front of the sensor.
So, I want to ask if there is an Android phone available in the market that has a proximity sensor which is able to return actual distance values (cm) instead of a boolean..
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,可以获得距手机表面的实际距离。
事实上,所有硬件传感器都提供此信息。但不幸的是,Android 中定义的传感器 API 将接近度定义为布尔值,即 NEAR(1) 或 FAR(0)。
为了从实际距离获得布尔读数,将从接近传感器硬件获得的距离与阈值进行比较。这通常在传感器 HAL 中完成。
此外,一些光/接近传感器硬件 IC 本身也提供接近布尔值。在这种情况下,阈值可在硬件中配置。硬件将获得的每个样本与内部阈值进行比较,然后报告布尔“接近度”。
无论使用哪种传感器硬件,Android(直至 v4.1“jelly-bean”)都不会将接近距离参数作为其传感器 API 的一部分公开。人们可以修改传感器 HAL 或尝试直接与接近传感器驱动程序交互(通常是 sys-fs 条目)。
Android 上的光/接近传感器的更多详细信息< /strong>。
Yes it is possible to obtain actual distance from the phone surface.
In fact ALL hardware sensors DO provide this information. But unfortunately the sensor API defined in Android defines the proximity to be a boolean i.e NEAR(1) OR FAR(0).
To get a boolean reading from the actual distance, the distance obtained from the proximity sensor hardware is compared with a threshold value. This is often done in the sensor-HAL.
Also some light/proximity sensor-hardware ICs provide a proximity boolean themselves. In this case, the threshold is configurable in the hardware. The hardware compares each sample obtained with the threshold internally and then reports the boolean "proximity".
Irrespective of the kind of sensor hardware in use, Android (upto v4.1 "jelly-bean") does NOT expose the proximity distance parameter as part of its sensor API. One can modify the sensor-HAL or try to interact with the proximity sensor driver directly (usually a sys-fs entry).
More details of Light/Proximity sensor on Android.