blob: 949ee6c6fd80a542e887e95066e0453e908cfb45 [file] [log] [blame] [view]
Skyler Kaufman991ae4d2011-04-07 12:30:41 -07001# Sensors #
2
3Android defines a user space C abstraction interface for sensor hardware. The interface header is defined in
4`hardware/libhardware/include/hardware/sensors.h`.
5In order to integrate sensors with Android you need to build a shared library that implements this interface.
6
7The types of sensors currently supported by Android include:
8
9- Accelerometer
10- Magnetic Field
11- Orientation
12- Gyroscope
13- Light
14- Pressure
15- Temperature
16- Proximity
17
18## Building a Sensor Library ##
19
20To implement a Sensors driver, create a shared library that implements the interface defined in `sensors.h`. You must name your shared library
21`libsensors.so` so that it will get loaded from `/system/lib` at runtime.
22
23The following stub file, `Android.mk`, ensures that `libsensors` compiles and links to the appropriate libraries:
24
25 LOCAL_PATH := $(call my-dir)
26 include $(CLEAR_VARS)
27
28 LOCAL_MODULE := sensors
29
30 LOCAL_PRELINK_MODULE := false
31
32 LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
33
34 LOCAL_SHARED_LIBRARIES := liblog
35 # include any shared library dependencies
36
37 LOCAL_SRC_FILES := sensors.c
38
39 include $(BUILD_SHARED_LIBRARY)
40
41Doxygen content is unavailable at the moment as source.android.com is deconstructed and then reconstructed. Sorry for the inconvenience!