summaryrefslogtreecommitdiffstats
path: root/include/hardware
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commitd6054a36475b5ff502b4af78f7d272a713c1a8e7 (patch)
tree15482ee71b318f54f288240adce0b59febf76bc7 /include/hardware
downloadhardware_libhardware-d6054a36475b5ff502b4af78f7d272a713c1a8e7.zip
hardware_libhardware-d6054a36475b5ff502b4af78f7d272a713c1a8e7.tar.gz
hardware_libhardware-d6054a36475b5ff502b4af78f7d272a713c1a8e7.tar.bz2
Initial Contribution
Diffstat (limited to 'include/hardware')
-rw-r--r--include/hardware/AudioHardwareInterface.h214
-rw-r--r--include/hardware/IMountService.h63
-rw-r--r--include/hardware/flashlight.h32
-rw-r--r--include/hardware/gps.h218
-rw-r--r--include/hardware/led.h43
-rw-r--r--include/hardware/power.h60
-rw-r--r--include/hardware/qemu_tracing.h33
-rw-r--r--include/hardware/sensors.h243
-rw-r--r--include/hardware/uevent.h31
-rw-r--r--include/hardware/vibrator.h42
-rw-r--r--include/hardware/wifi.h153
11 files changed, 1132 insertions, 0 deletions
diff --git a/include/hardware/AudioHardwareInterface.h b/include/hardware/AudioHardwareInterface.h
new file mode 100644
index 0000000..febc86a
--- /dev/null
+++ b/include/hardware/AudioHardwareInterface.h
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_HARDWARE_INTERFACE_H
+#define ANDROID_AUDIO_HARDWARE_INTERFACE_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+#include <utils/Vector.h>
+#include <utils/String16.h>
+
+#include <media/IAudioFlinger.h>
+#include "media/AudioSystem.h"
+
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+/**
+ * This is the abstraction interface for the audio output hardware. It provides
+ * information about various properties of the audio output hardware driver.
+ */
+class AudioStreamOut {
+public:
+ virtual ~AudioStreamOut() = 0;
+
+ /** return audio sampling rate in hz - eg. 44100 */
+ virtual uint32_t sampleRate() const = 0;
+
+ /** returns size of output buffer - eg. 4800 */
+ virtual size_t bufferSize() const = 0;
+
+ /**
+ * return number of output audio channels.
+ * Acceptable values are 1 (mono) or 2 (stereo)
+ */
+ virtual int channelCount() const = 0;
+
+ /**
+ * return audio format in 8bit or 16bit PCM format -
+ * eg. AudioSystem:PCM_16_BIT
+ */
+ virtual int format() const = 0;
+
+ /**
+ * This method can be used in situations where audio mixing is done in the
+ * hardware. It is a direct interface to the hardware to set the volume as
+ * as opposed to controlling this via the framework. It could be multiple
+ * PCM outputs or hardware accelerated codecs such as MP3 or AAC
+ */
+ virtual status_t setVolume(float volume) = 0;
+
+ /** write audio buffer to driver. Returns number of bytes written */
+ virtual ssize_t write(const void* buffer, size_t bytes) = 0;
+
+ /** dump the state of the audio output device */
+ virtual status_t dump(int fd, const Vector<String16>& args) = 0;
+};
+
+/**
+ * This is the abstraction interface for the audio input hardware. It defines
+ * the various properties of the audio hardware input driver.
+ */
+class AudioStreamIn {
+public:
+ virtual ~AudioStreamIn() = 0;
+
+ /** return the input buffer size allowed by audio driver */
+ virtual size_t bufferSize() const = 0;
+
+ /** return the number of audio input channels */
+ virtual int channelCount() const = 0;
+
+ /**
+ * return audio format in 8bit or 16bit PCM format -
+ * eg. AudioSystem:PCM_16_BIT
+ */
+ virtual int format() const = 0;
+
+ /** set the input gain for the audio driver. This method is for
+ * for future use */
+ virtual status_t setGain(float gain) = 0;
+
+ /** read audio buffer in from audio driver */
+ virtual ssize_t read(void* buffer, ssize_t bytes) = 0;
+
+ /** dump the state of the audio input device */
+ virtual status_t dump(int fd, const Vector<String16>& args) = 0;
+};
+
+/**
+ * This defines the interface to the audio hardware abstraction layer. It
+ * supports setting and getting parameters, selecting audio routing paths and
+ * defining input and output streams.
+ *
+ * AudioFlinger initializes the audio hardware and immediately opens an output
+ * stream. Audio routing can be set to output to handset, speaker, bluetooth or
+ * headset.
+ *
+ * The audio input stream is initialized when AudioFlinger is called to carry
+ * out a record operation.
+ */
+class AudioHardwareInterface
+{
+public:
+ AudioHardwareInterface();
+ virtual ~AudioHardwareInterface() { }
+
+ /**
+ * check to see if the audio hardware interface has been initialized.
+ * return status based on values defined in include/utils/Errors.h
+ */
+ virtual status_t initCheck() = 0;
+
+ /**
+ * put the audio hardware into standby mode to conserve power. Returns
+ * status based on include/utils/Errors.h
+ */
+ virtual status_t standby() = 0;
+
+ /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
+ virtual status_t setVoiceVolume(float volume) = 0;
+
+ /**
+ * set the audio volume for all audio activities other than voice call.
+ * Range between 0.0 and 1.0. IF any value other than NO_ERROR is returned,
+ * the software mixer will emulate this capability.
+ */
+ virtual status_t setMasterVolume(float volume) = 0;
+
+ /**
+ * Audio routing methods. Routes defined in include/hardware/AudioSystem.h.
+ * Audio routes can be (ROUTE_EARPIECE | ROUTE_SPEAKER | ROUTE_BLUETOOTH
+ * | ROUTE_HEADSET)
+ *
+ * setRouting sets the routes for a mode. This is called at startup. It is
+ * also called when a new device is connected, such as a wired headset is
+ * plugged in or a Bluetooth headset is paired
+ */
+ virtual status_t setRouting(int mode, uint32_t routes);
+
+ virtual status_t getRouting(int mode, uint32_t* routes);
+
+ /**
+ * setMode is called when the audio mode changes. NORMAL mode is for
+ * standard audio playback, RINGTONE when a ringtone is playing and IN_CALL
+ * when a call is in progress.
+ */
+ virtual status_t setMode(int mode);
+ virtual status_t getMode(int* mode);
+
+ // mic mute
+ virtual status_t setMicMute(bool state) = 0;
+ virtual status_t getMicMute(bool* state) = 0;
+
+ // Temporary interface, do not use
+ // TODO: Replace with a more generic key:value get/set mechanism
+ virtual status_t setParameter(const char* key, const char* value);
+
+ /** This method creates and opens the audio hardware output stream */
+ virtual AudioStreamOut* openOutputStream(
+ int format=0,
+ int channelCount=0,
+ uint32_t sampleRate=0) = 0;
+
+ /** This method creates and opens the audio hardware input stream */
+ virtual AudioStreamIn* openInputStream(
+ int format,
+ int channelCount,
+ uint32_t sampleRate) = 0;
+
+ /**This method dumps the state of the audio hardware */
+ virtual status_t dumpState(int fd, const Vector<String16>& args);
+
+ static AudioHardwareInterface* create();
+
+protected:
+ /**
+ * doRouting actually initiates the routing to occur. A call to setRouting
+ * or setMode may result in a routing change. The generic logic will call
+ * doRouting when required. If the device has any special requirements these
+ * methods can be overriden.
+ */
+ virtual status_t doRouting() = 0;
+
+ virtual status_t dump(int fd, const Vector<String16>& args) = 0;
+
+ int mMode;
+ uint32_t mRoutes[AudioSystem::NUM_MODES];
+};
+
+// ----------------------------------------------------------------------------
+
+extern "C" AudioHardwareInterface* createAudioHardware(void);
+
+}; // namespace android
+
+#endif // ANDROID_AUDIO_HARDWARE_INTERFACE_H
diff --git a/include/hardware/IMountService.h b/include/hardware/IMountService.h
new file mode 100644
index 0000000..6737dcf
--- /dev/null
+++ b/include/hardware/IMountService.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+#ifndef ANDROID_HARDWARE_IMOUNTSERVICE_H
+#define ANDROID_HARDWARE_IMOUNTSERVICE_H
+
+#include <utils/IInterface.h>
+#include <utils/String16.h>
+
+namespace android {
+
+// ----------------------------------------------------------------------
+
+class IMountService : public IInterface
+{
+public:
+ DECLARE_META_INTERFACE(MountService);
+
+ /**
+ * Is mass storage support enabled?
+ */
+ virtual bool getMassStorageEnabled() = 0;
+
+ /**
+ * Enable or disable mass storage support.
+ */
+ virtual void setMassStorageEnabled(bool enabled) = 0;
+
+ /**
+ * Is mass storage connected?
+ */
+ virtual bool getMassStorageConnected() = 0;
+
+ /**
+ * Mount external storage at given mount point.
+ */
+ virtual void mountMedia(String16 mountPoint) = 0;
+
+ /**
+ * Safely unmount external storage at given mount point.
+ */
+ virtual void unmountMedia(String16 mountPoint) = 0;
+};
+
+// ----------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_HARDWARE_IMOUNTSERVICE_H
diff --git a/include/hardware/flashlight.h b/include/hardware/flashlight.h
new file mode 100644
index 0000000..d372307
--- /dev/null
+++ b/include/hardware/flashlight.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_FLASHLIGHT_H
+#define _HARDWARE_FLASHLIGHT_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+int get_flashlight_enabled();
+int set_flashlight_enabled(int on);
+int enable_camera_flash(int milliseconds);
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_FLASHLIGHT_H
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
new file mode 100644
index 0000000..54b50a5
--- /dev/null
+++ b/include/hardware/gps.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_GPS_H
+#define _HARDWARE_GPS_H
+
+#include <stdint.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/** milliseconds since January 1, 1970 */
+typedef int64_t GpsUtcTime;
+
+/** maximum number of Space Vehicles for gps_sv_status_callback */
+#define GPS_MAX_SVS 32
+
+
+typedef uint16_t GpsPositionMode;
+#define GPS_POSITION_MODE_STANDALONE 0
+#define GPS_POSITION_MODE_MS_BASED 1
+#define GPS_POSITION_MODE_MS_ASSISTED 2
+
+typedef uint16_t GpsStatusValue;
+// IMPORTANT - these symbols here must match constants in GpsLocationProvider.java
+#define GPS_STATUS_NONE 0
+#define GPS_STATUS_SESSION_BEGIN 1
+#define GPS_STATUS_SESSION_END 2
+#define GPS_STATUS_ENGINE_ON 3
+#define GPS_STATUS_ENGINE_OFF 4
+
+typedef uint16_t GpsLocationFlags;
+// IMPORTANT - these symbols here must match constants in GpsLocationProvider.java
+#define GPS_LOCATION_HAS_LAT_LONG 0x0001
+#define GPS_LOCATION_HAS_ALTITUDE 0x0002
+#define GPS_LOCATION_HAS_SPEED 0x0004
+#define GPS_LOCATION_HAS_BEARING 0x0008
+#define GPS_LOCATION_HAS_ACCURACY 0x0010
+
+typedef uint16_t GpsAidingData;
+// IMPORTANT - these symbols here must match constants in GpsLocationProvider.java
+#define GPS_DELETE_EPHEMERIS 0x0001
+#define GPS_DELETE_ALMANAC 0x0002
+#define GPS_DELETE_POSITION 0x0004
+#define GPS_DELETE_TIME 0x0008
+#define GPS_DELETE_IONO 0x0010
+#define GPS_DELETE_UTC 0x0020
+#define GPS_DELETE_HEALTH 0x0040
+#define GPS_DELETE_SVDIR 0x0080
+#define GPS_DELETE_SVSTEER 0x0100
+#define GPS_DELETE_SADATA 0x0200
+#define GPS_DELETE_RTI 0x0400
+#define GPS_DELETE_CELLDB_INFO 0x8000
+#define GPS_DELETE_ALL 0xFFFF
+
+/**
+ * names for GPS XTRA interface
+ */
+#define GPS_XTRA_INTERFACE "gps-xtra"
+
+/**
+ * names for GPS supplemental interface
+ * TODO: Remove not used.
+ */
+#define GPS_SUPL_INTERFACE "gps-supl"
+
+/** The location */
+typedef struct {
+ /** contains GpsLocationFlags bits */
+ uint16_t flags;
+ double latitude;
+ double longitude;
+ double altitude;
+ float speed;
+ float bearing;
+ float accuracy;
+ GpsUtcTime timestamp;
+} GpsLocation;
+
+/** The status */
+typedef struct {
+ GpsStatusValue status;
+} GpsStatus;
+
+/** Space Vehicle info */
+typedef struct {
+ int prn;
+ float snr;
+ float elevation;
+ float azimuth;
+} GpsSvInfo;
+
+/** Space Vehicle status */
+typedef struct {
+ /** number of SVs currently visible */
+ int num_svs;
+
+ /** Array of space vehicle info */
+ GpsSvInfo sv_list[GPS_MAX_SVS];
+
+ /** bit mask indicating which SVs have ephemeris data */
+ uint32_t ephemeris_mask;
+
+ /** bit mask indicating which SVs have almanac data */
+ uint32_t almanac_mask;
+
+ /**
+ * bit mask indicating which SVs were used for
+ * computing the most recent position fix
+ */
+ uint32_t used_in_fix_mask;
+} GpsSvStatus;
+
+/** Callback with location information */
+typedef void (* gps_location_callback)(GpsLocation* location);
+
+/** Callback with the status information */
+typedef void (* gps_status_callback)(GpsStatus* status);
+
+/** Callback with the space vehicle status information */
+typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
+
+/** GPS call back structure */
+typedef struct {
+ gps_location_callback location_cb;
+ gps_status_callback status_cb;
+ gps_sv_status_callback sv_status_cb;
+} GpsCallbacks;
+
+
+/** Standard GPS interface */
+typedef struct {
+ /**
+ * Open the interface and provide the callback routines
+ * to the implemenation of this interface.
+ */
+ int (*init)( GpsCallbacks* callbacks );
+
+ /** Start navigating */
+ int (*start)( void );
+
+ /** Stop navigating */
+ int (*stop)( void );
+
+ /** Set requested frequency of fixes in seconds */
+ void (*set_fix_frequency)( int frequency );
+
+ /** Close the interface */
+ void (*cleanup)( void );
+
+ /** Inject the current time */
+ int (*inject_time)(GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+
+ /**
+ * The next call to start will not use the information
+ * defined in the flags. GPS_DELETE_ALL is passed for
+ * a cold start.
+ */
+ void (*delete_aiding_data)(GpsAidingData flags);
+
+ /**
+ * fix_frequency is time between fixes in seconds.
+ * set fix_frequency to zero for a single shot fix.
+ */
+ int (*set_position_mode)(GpsPositionMode mode, int fix_frequency);
+
+ /** Get a pointer to extension information. */
+ const void* (*get_extension)(const char* name);
+} GpsInterface;
+
+/** The download request callback routine. */
+typedef void (* gps_xtra_download_request)();
+
+/** The download request callback structure. */
+typedef struct {
+ gps_xtra_download_request download_request_cb;
+} GpsXtraCallbacks;
+
+/** Extended interface for XTRA support. */
+typedef struct {
+ int (*init)( GpsXtraCallbacks* callbacks );
+ int (*inject_xtra_data)( char* data, int length );
+} GpsXtraInterface;
+
+/** returns the hardware GPS interface. */
+const GpsInterface* gps_get_hardware_interface();
+
+/**
+ * returns the qemu hardware interface GPS interface.
+ */
+const GpsInterface* gps_get_qemu_interface();
+
+/**
+ * returns the default GPS interface,
+ * implemented in lib/hardware/gps.cpp.
+ */
+const GpsInterface* gps_get_interface();
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_GPS_H
diff --git a/include/hardware/led.h b/include/hardware/led.h
new file mode 100644
index 0000000..d7b2363
--- /dev/null
+++ b/include/hardware/led.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_LED_H
+#define _HARDWARE_LED_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Change the state of the led
+ *
+ * To turn on the led; Alpha != 0 and RBG != 0, onMS == 0 && offMS == 0.
+ * To blink the led; Alpha != 0 and RBG != 0, onMS != 0 && offMS != 0.
+ * To turn off the led; Alpha == 0 or RGB == 0.
+ *
+ * @param colorARGB the is color, Alpha=31:24, Red=23:16 Green=15:8 Blue=7:0
+ * @param onMS is the time on in milli-seconds
+ * @param offMS is the time off in milli-seconds
+ *
+ * @return 0 if successful
+ */
+int set_led_state(unsigned colorARGB, int onMS, int offMS);
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_LED_H
diff --git a/include/hardware/power.h b/include/hardware/power.h
new file mode 100644
index 0000000..993bca5
--- /dev/null
+++ b/include/hardware/power.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_POWER_H
+#define _HARDWARE_POWER_H
+
+#include <stdint.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+enum {
+ PARTIAL_WAKE_LOCK = 1, // the cpu stays on, but the screen is off
+ FULL_WAKE_LOCK = 2 // the screen is also on
+};
+
+// while you have a lock held, the device will stay on at least at the
+// level you request.
+int acquire_wake_lock(int lock, const char* id);
+int release_wake_lock(const char* id);
+
+
+enum {
+ KEYBOARD_LIGHT = 0x00000001,
+ SCREEN_LIGHT = 0x00000002,
+ BUTTON_LIGHT = 0x00000004,
+};
+
+// set the lights identified in mask to the brightness specified
+// in value. for example
+// set_light_brightness(SCREEN_LIGHT | KEYBOARD_LIGHT, 200);
+// sets the screen and keyboard lights to brightness 200
+int set_light_brightness(unsigned int mask, unsigned int brightness);
+
+// true if you want the screen on, false if you want it off
+int set_screen_state(int on);
+
+// set how long to stay awake after the last user activity in seconds
+int set_last_user_activity_timeout(int64_t delay);
+
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_POWER_H
diff --git a/include/hardware/qemu_tracing.h b/include/hardware/qemu_tracing.h
new file mode 100644
index 0000000..645a0be
--- /dev/null
+++ b/include/hardware/qemu_tracing.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_QEMU_TRACING_H
+#define _HARDWARE_QEMU_TRACING_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+int qemu_start_tracing();
+int qemu_stop_tracing();
+int qemu_add_mapping(unsigned int addr, const char *name);
+int qemu_remove_mapping(unsigned int addr);
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_QEMU_TRACING_H
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
new file mode 100644
index 0000000..19fd72c
--- /dev/null
+++ b/include/hardware/sensors.h
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_SENSORS_H
+#define _HARDWARE_SENSORS_H
+
+#include <stdint.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Sensor IDs must be a power of two and
+ * must match values in SensorManager.java
+ */
+
+#define SENSORS_ORIENTATION 0x00000001
+#define SENSORS_ACCELERATION 0x00000002
+#define SENSORS_TEMPERATURE 0x00000004
+#define SENSORS_MAGNETIC_FIELD 0x00000008
+#define SENSORS_LIGHT 0x00000010
+#define SENSORS_PROXIMITY 0x00000020
+#define SENSORS_TRICORDER 0x00000040
+#define SENSORS_ORIENTATION_RAW 0x00000080
+#define SENSORS_MASK 0x000000FF
+
+/**
+ * Values returned by the accelerometer in various locations in the universe.
+ * all values are in SI units (m/s^2)
+ */
+
+#define GRAVITY_SUN (275.0f)
+#define GRAVITY_MERCURY (3.70f)
+#define GRAVITY_VENUS (8.87f)
+#define GRAVITY_EARTH (9.80665f)
+#define GRAVITY_MOON (1.6f)
+#define GRAVITY_MARS (3.71f)
+#define GRAVITY_JUPITER (23.12f)
+#define GRAVITY_SATURN (8.96f)
+#define GRAVITY_URANUS (8.69f)
+#define GRAVITY_NEPTUN (11.0f)
+#define GRAVITY_PLUTO (0.6f)
+#define GRAVITY_DEATH_STAR_I (0.000000353036145f)
+#define GRAVITY_THE_ISLAND (4.815162342f)
+
+/** Maximum magnetic field on Earth's surface */
+#define MAGNETIC_FIELD_EARTH_MAX (60.0f)
+
+/** Minimum magnetic field on Earth's surface */
+#define MAGNETIC_FIELD_EARTH_MIN (30.0f)
+
+/**
+ * Various luminance values during the day (lux)
+ */
+
+#define LIGHT_SUNLIGHT_MAX (120000.0f)
+#define LIGHT_SUNLIGHT (110000.0f)
+#define LIGHT_SHADE (20000.0f)
+#define LIGHT_OVERCAST (10000.0f)
+#define LIGHT_SUNRISE (400.0f)
+#define LIGHT_CLOUDY (100.0f)
+
+/*
+ * Various luminance values during the night (lux)
+ */
+
+#define LIGHT_FULLMOON (0.25f)
+#define LIGHT_NO_MOON (0.001f)
+
+/**
+ * status of each sensor
+ */
+
+#define SENSOR_STATUS_UNRELIABLE 0
+#define SENSOR_STATUS_ACCURACY_LOW 1
+#define SENSOR_STATUS_ACCURACY_MEDIUM 2
+#define SENSOR_STATUS_ACCURACY_HIGH 3
+
+/**
+ * Definition of the axis
+ *
+ * This API is relative to the screen of the device in its default orientation,
+ * that is, if the device can be used in portrait or landscape, this API
+ * is only relative to the NATURAL orientation of the screen. In other words,
+ * the axis are not swapped when the device's screen orientation changes.
+ * Higher level services /may/ perform this transformation.
+ *
+ * -x +x
+ * ^
+ * |
+ * +-----------+--> +y
+ * | |
+ * | |
+ * | |
+ * | | / -z
+ * | | /
+ * | | /
+ * +-----------+/
+ * | o O o /
+ * +----------/+ -y
+ * /
+ * /
+ * |/ +z
+ *
+ */
+typedef struct {
+ union {
+ float v[3];
+ struct {
+ float x;
+ float y;
+ float z;
+ };
+ struct {
+ float yaw;
+ float pitch;
+ float roll;
+ };
+ };
+ int8_t status;
+ uint8_t reserved[3];
+} sensors_vec_t;
+
+/**
+ * Union of the various types of sensor data
+ * that can be returned.
+ */
+typedef struct {
+ /* sensor identifier */
+ int sensor;
+
+ union {
+ /* x,y,z values of the given sensor */
+ sensors_vec_t vector;
+
+ /* orientation values are in degres */
+ sensors_vec_t orientation;
+
+ /* acceleration values are in meter per second per second (m/s^2) */
+ sensors_vec_t acceleration;
+
+ /* magnetic vector values are in micro-Tesla (uT) */
+ sensors_vec_t magnetic;
+
+ /* temperature is in degres C */
+ float temperature;
+ };
+
+ /* time is in nanosecond */
+ int64_t time;
+
+ uint32_t reserved;
+} sensors_data_t;
+
+/**
+ * Initialize the module. This is the first entry point
+ * called and typically initializes the hardware.
+ *
+ * @return bit map of available sensors defined by
+ * the constants SENSORS_XXXX.
+ */
+uint32_t sensors_control_init();
+
+/**
+ * Returns the fd which will be the parameter to
+ * sensors_data_open. The caller takes ownership
+ * of this fd.
+ *
+ * @return a fd if successful, < 0 on error
+ */
+int sensors_control_open();
+
+/** Activate/deactiveate one or more of the sensors.
+ *
+ * @param sensors is a bitmask of the sensors to change.
+ * @param mask is a bitmask for enabling/disabling sensors.
+ *
+ * @return bitmask of SENSORS_XXXX indicating which sensors are enabled
+ */
+uint32_t sensors_control_activate(uint32_t sensors, uint32_t mask);
+
+/**
+ * Set the delay between sensor events in ms
+ *
+ * @return 0 if successful, < 0 on error
+ */
+int sensors_control_delay(int32_t ms);
+
+/**
+ * Prepare to read sensor data.
+ *
+ * This routiune does NOT take ownership of the fd
+ * and must not close it. Typcially this routine would
+ * use a duplicate of the fd parameter.
+ *
+ * @param fd from sensors_control_open.
+ *
+ * @return 0 if successful, < 0 on error
+ */
+int sensors_data_open(int fd);
+
+/**
+ * Caller has completed using the sensor data.
+ * The caller will not be blocked in sensors_data_poll
+ * when this routine is called.
+ *
+ * @return 0 if successful, < 0 on error
+ */
+int sensors_data_close();
+
+/**
+ * Return sensor data for one of the enabled sensors.
+ *
+ * @return SENSOR_XXXX for the returned data, -1 on error
+ * */
+int sensors_data_poll(sensors_data_t* data, uint32_t sensors_of_interest);
+
+/**
+ * @return bit map of available sensors defined by
+ * the constants SENSORS_XXXX.
+ */
+uint32_t sensors_data_get_sensors();
+
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_SENSORS_H
diff --git a/include/hardware/uevent.h b/include/hardware/uevent.h
new file mode 100644
index 0000000..7a5ce58
--- /dev/null
+++ b/include/hardware/uevent.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_UEVENT_H
+#define _HARDWARE_UEVENT_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+int uevent_init();
+int uevent_next_event(char* buffer, int buffer_length);
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_UEVENT_H
diff --git a/include/hardware/vibrator.h b/include/hardware/vibrator.h
new file mode 100644
index 0000000..5245aeb
--- /dev/null
+++ b/include/hardware/vibrator.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HARDWARE_VIBRATOR_H
+#define _HARDWARE_VIBRATOR_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Turn on vibrator
+ *
+ * @return 0 if successful, -1 if error
+ */
+int vibrator_on();
+
+/**
+ * Turn off vibrator
+ *
+ * @return 0 if successful, -1 if error
+ */
+int vibrator_off();
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // _HARDWARE_VIBRATOR_H
diff --git a/include/hardware/wifi.h b/include/hardware/wifi.h
new file mode 100644
index 0000000..0b1acdc
--- /dev/null
+++ b/include/hardware/wifi.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _WIFI_H
+#define _WIFI_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Load the wifi driver.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+int wifi_load_driver();
+
+/**
+ * Unload the wifi driver.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+int wifi_unload_driver();
+
+/**
+ * Start supplicant.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+int wifi_start_supplicant();
+
+/**
+ * Stop supplicant.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+int wifi_stop_supplicant();
+
+/**
+ * Open a connection to supplicant.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+int wifi_connect_to_supplicant();
+
+/**
+ * Close connection supplicant.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+void wifi_close_supplicant_connection();
+
+/**
+ * Do a blocking call to get a wifi event and
+ * return a string representing a wifi event
+ * when it occurs.
+ *
+ * @param buf is the buffer that receives the event
+ * @param len is the maximum length of the buffer
+ *
+ * @returns number of bytes in buffer, 0 if no
+ * event, for instance no connection, < 0 if an
+ * error.
+ */
+int wifi_wait_for_event(char *buf, size_t len);
+
+/**
+ * Issue a command to the wifi driver.
+ *
+ * see \link http://hostap.epitest.fi/wpa_supplicant/devel/ctrl_iface_page.html
+ * for the list of the standard commands. Android has extended these to include
+ * support for sending commands to the driver:
+ *
+ *------------------------------------------------------------------------------
+ * command form of response processing
+ * Summary of the command
+ *------------------------------------------------------------------------------
+ * "DRIVER START" -> "OK" if successful -> "OK" ? true : false
+ * Turn on WiFi Hardware
+ *
+ * "DRIVER STOP" -> "OK" if successful -> "OK" ? true : false
+ * Turn off WiFi Hardware
+ *
+ * "DRIVER RSSI" -> "<ssid> Rssi xx" -> "%*s %*s %d", &rssi
+ * Return received signal strength indicator in -db for current AP
+ *
+ * "DRIVER LINKSPEED" -> "LinkSpeed xx" -> "%*s %d", &linkspd
+ * Return link speed in MBPS
+ *
+ * "DRIVER MACADDR" -> "Macaddr = xx.xx.xx.xx.xx.xx" -> "%*s = %s", &macadr
+ * Return mac address of the station
+ *
+ * "DRIVER SCAN-ACTIVE" -> "OK" if successful -> "OK" ? true : false
+ * Set scan type to active
+ *
+ * "DRIVER SCAN-PASSIVE" -> "OK" if successful -> "OK" ? true : false
+ * Set scan type to passive
+ *------------------------------------------------------------------------------
+ *
+ * See libs/android_runtime/android_net_wifi_Wifi.cpp for more information
+ * on how these and other commands invoked.
+ *
+ * @param command is the string command
+ * @param reply is a buffer to receive a reply string
+ * @param reply_len on entry is the maximum length of
+ * reply buffer and on exit the number of
+ * bytes in the reply buffer.
+ *
+ * @return 0 if successful, < 0 if an error.
+ */
+int wifi_command(const char *command, char *reply, size_t *reply_len);
+
+/**
+ * Issues a dhcp request returning the acquired
+ * information. All IPV4 addresses/mask are in
+ * network byte order.
+ *
+ * @param ipaddr return the assigned IPV4 address
+ * @param gateway return the gateway being used
+ * @param mask return the IPV4 mask
+ * @param dns1 return the IPV4 address of a dns server
+ * @param dns2 return the IPV4 address of a dns server
+ * @param serverAddress return the IPV4 address of dhcp server
+ * @param lease return the length of lease in seconds.
+ *
+ * @return 0 if successful, < 0 if error.
+ */
+int do_dhcp_request(int *ipaddr, int *gateway, int *mask,
+ int *dns1, int *dns2, int *server, int *lease);
+
+/**
+ * Return the error string of the last do_dhcp_request.
+ */
+const char *get_dhcp_error_string();
+
+#if __cplusplus
+}; // extern "C"
+#endif
+
+#endif // _WIFI_H