Reena Lee | c3c7479 | 2009-05-18 22:34:25 -0700 | [diff] [blame] | 1 | page.title=Sensors |
| 2 | pdk.version=1.0 |
| 3 | @jd:body |
| 4 | |
| 5 | <a name="toc"/> |
| 6 | <div style="padding:10px"> |
| 7 | <a href="#androidSensorsIntroduction">Introduction</a><br/> |
| 8 | <a href="#androidSensorsInterface">Interface</a><br/></div></font></div> |
| 9 | |
| 10 | <a name="androidSensorsIntroduction"></a><h2>Introduction</h2> |
| 11 | |
| 12 | <p>Android defines a user space C abstraction interface for sensor hardware. The interface header is defined in |
| 13 | <code>hardware/libhardware/include/hardware/sensors.h</code>. |
| 14 | In order to integrate sensors with Android you need to build a shared library that implements this interface. |
| 15 | |
| 16 | The types of sensors currently supported by Android include: |
| 17 | <ul> |
| 18 | <li>Accelerometer</li> |
| 19 | <li>Magnetic Field</li> |
| 20 | <li>Orientation</li> |
| 21 | <li>Gyroscope</li> |
| 22 | <li>Light</li> |
| 23 | <li>Pressure</li> |
| 24 | <li>Temperature</li> |
| 25 | <li>Proximity</li> |
| 26 | </ul> |
| 27 | </p> |
| 28 | |
| 29 | <a name="androidSensorBuildingDriver"></a><h2>Building a Sensor Library</h2> |
| 30 | <p> To implement a Sensors driver, create a shared library that implements the interface defined in <code>sensors.h</code>. You must name your shared library |
| 31 | <code>libsensors.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. |
| 32 | </p |
| 33 | |
| 34 | |
| 35 | <a name="androidSensorsInterface"></a><h2>Interface</h2> |
| 36 | |
| 37 | |
| 38 | |
| 39 | <p><span class="lh2"><a name="androidDoxygenNote"></a></span> |
| 40 | |
| 41 | <p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="sensors.html">click here</a>.</p> |
| 42 | |
| 43 | |
| 44 | <iframe onLoad="resizeDoxFrameHeight();" src="sensors_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" |
| 45 | frameborder="0" style="width:100%;"></iframe> |