2014-03-07 79 views
1

我的意思是TYPE_MAGNETIC_FIELD的值的源代碼在哪裏: case Sensor.TYPE_MAGNETIC_FIELD: geomagneticValues = sensorEvent.values.clone();android如何計算MAGNETIC_FIELD,?

我已經搜索了硬件文件夾中的幾乎所有文件。 可能是我錯過了該片段。 請幫助找到該源代碼。 (我認爲傳感器是使用公式所示: Btheta =(umsin(THETA)/ 4(PHI)(R^3))

+0

斜面我找到確切源代碼它們是如何計算磁場矢量? – user3056360

回答

0

見文件hardware/libhardware/include/hardware/sensors.h在AOSP代碼OEM提供傳感器庫必須提供。數據來自於驅動程序本身可能已經以這種形式出現,或者可能是其他的東西,由OEM HAL來做正確的事情,這個評論解釋了設備的傳感器庫是什麼返回。

/* * SENSOR_TYPE_GEOMAGNETIC_FIELD * trigger-mode: continuous * wake-up sensor: no * * All values are in micro-Tesla (uT) and measure the geomagnetic * field in the X, Y and Z axis. * * Returned values include calibration mechanisms such that the vector is * aligned with the magnetic declination and heading of the earth's * geomagnetic field. * * Magnetic Field sensors return sensor events for all 3 axes at a constant * rate defined by setDelay(). */

+0

着我找到確切C源頌揚他們如何計算磁場矢量? – user3056360

+0

我不確定你在問什麼。由OEM提供的驅動程序將其數據發送到由OEM提供的傳感器HAL。 HAL然後將這些數據提供給框架,如上所述。硬件和HAL依賴於設備如何達到它報告的矢量值。 –