在iOS中访问环境光传感器 [英] Accessing the ambient light sensor in iOS
问题描述
我正在开展一个真正需要访问环境光传感器的项目。
I'm working on a project in which it is really necessary to access the ambient light sensor.
我在Google和Stackoverflow中搜索了很多,但找不到任何有用的信息。甚至可以这样做吗?
I searched a lot in Google and Stackoverflow, but couldn't find any useful information. Is it even possible to do so?
我还尝试通过计算相机输入的亮度来计算环境光值,但结果并不精确,因为相机会对图像进行大量调整,这会使结果失真。
I also tried to calculate the ambient light value by calculating the brightness out of the camera input, but the results aren't really precise, as the camera makes lot's of adjustments to the images, which distort the results.
推荐答案
要读取环境光线传感器数据,你需要在IOKit框架中使用IOHID(参考)
To read the ambient light sensor data, you need to use IOHID in the IOKit framework (Reference)
http://iphonedevwiki.net/index.php/AppleISL29003
http://iphonedevwiki.net/index.php/IOKit.framework
这篇关于在iOS中访问环境光传感器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!