Reena Lee | c3c7479 | 2009-05-18 22:34:25 -0700 | [diff] [blame] | 1 | page.title=Sensors |
| 2 | pdk.version=1.0 |
| 3 | @jd:body |
David Warren | 5c40a48 | 2009-06-05 15:11:21 -0700 | [diff] [blame^] | 4 | |
| 5 | <div id="qv-wrapper"> |
| 6 | <div id="qv"> |
| 7 | <h2>In this document</h2> |
| 8 | <a name="toc"/> |
| 9 | <ul> |
| 10 | <li><a href="#androidSensorsInterface">Interface</a></li> |
| 11 | </ul> |
| 12 | </div> |
| 13 | </div> |
| 14 | |
Reena Lee | c3c7479 | 2009-05-18 22:34:25 -0700 | [diff] [blame] | 15 | <p>Android defines a user space C abstraction interface for sensor hardware. The interface header is defined in |
| 16 | <code>hardware/libhardware/include/hardware/sensors.h</code>. |
| 17 | In order to integrate sensors with Android you need to build a shared library that implements this interface. |
| 18 | |
| 19 | The types of sensors currently supported by Android include: |
| 20 | <ul> |
| 21 | <li>Accelerometer</li> |
| 22 | <li>Magnetic Field</li> |
| 23 | <li>Orientation</li> |
| 24 | <li>Gyroscope</li> |
| 25 | <li>Light</li> |
| 26 | <li>Pressure</li> |
| 27 | <li>Temperature</li> |
| 28 | <li>Proximity</li> |
| 29 | </ul> |
| 30 | </p> |
| 31 | |
David Warren | 5c40a48 | 2009-06-05 15:11:21 -0700 | [diff] [blame^] | 32 | <a name="androidSensorBuildingDriver"></a><h3>Building a Sensor Library</h3> |
Reena Lee | c3c7479 | 2009-05-18 22:34:25 -0700 | [diff] [blame] | 33 | <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 |
| 34 | <code>libsensors.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. |
| 35 | </p |
| 36 | |
| 37 | |
David Warren | 5c40a48 | 2009-06-05 15:11:21 -0700 | [diff] [blame^] | 38 | <a name="androidSensorsInterface"></a><h3>Interface</h3> |
Reena Lee | c3c7479 | 2009-05-18 22:34:25 -0700 | [diff] [blame] | 39 | |
| 40 | |
| 41 | |
David Warren | 5c40a48 | 2009-06-05 15:11:21 -0700 | [diff] [blame^] | 42 | <p><span class="lh3"><a name="androidDoxygenNote"></a></span> |
Reena Lee | c3c7479 | 2009-05-18 22:34:25 -0700 | [diff] [blame] | 43 | |
| 44 | <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> |
| 45 | |
| 46 | |
| 47 | <iframe onLoad="resizeDoxFrameHeight();" src="sensors_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" |
| 48 | frameborder="0" style="width:100%;"></iframe> |