2012-03-23 21:19:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 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.
|
|
|
|
*/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* @addtogroup Sensor
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file sensor.h
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
|
|
|
|
#ifndef ANDROID_SENSOR_H
|
|
|
|
#define ANDROID_SENSOR_H
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
*
|
|
|
|
* IMPORTANT NOTICE:
|
|
|
|
*
|
|
|
|
* This file is part of Android's set of stable system headers
|
|
|
|
* exposed by the Android NDK (Native Development Kit).
|
|
|
|
*
|
|
|
|
* Third-party source AND binary code relies on the definitions
|
|
|
|
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
|
|
|
*
|
|
|
|
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
|
|
|
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
|
|
|
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
|
|
|
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
|
|
|
*/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Structures and functions to receive and process sensor events in
|
|
|
|
* native code.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <android/looper.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Sensor types.
|
2012-03-23 21:19:36 +00:00
|
|
|
* (keep in sync with hardware/sensor.h)
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASENSOR_TYPE_ACCELEROMETER}
|
|
|
|
* reporting-mode: continuous
|
|
|
|
*
|
|
|
|
* All values are in SI units (m/s^2) and measure the acceleration of the
|
|
|
|
* device minus the force of gravity.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_TYPE_ACCELEROMETER = 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASENSOR_TYPE_MAGNETIC_FIELD}
|
|
|
|
* reporting-mode: continuous
|
|
|
|
*
|
|
|
|
* All values are in micro-Tesla (uT) and measure the geomagnetic
|
|
|
|
* field in the X, Y and Z axis.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_TYPE_MAGNETIC_FIELD = 2,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASENSOR_TYPE_GYROSCOPE}
|
|
|
|
* reporting-mode: continuous
|
|
|
|
*
|
|
|
|
* All values are in radians/second and measure the rate of rotation
|
|
|
|
* around the X, Y and Z axis.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_TYPE_GYROSCOPE = 4,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASENSOR_TYPE_LIGHT}
|
|
|
|
* reporting-mode: on-change
|
|
|
|
*
|
|
|
|
* The light sensor value is returned in SI lux units.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_TYPE_LIGHT = 5,
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASENSOR_TYPE_PROXIMITY}
|
|
|
|
* reporting-mode: on-change
|
|
|
|
*
|
|
|
|
* The proximity sensor which turns the screen off and back on during calls is the
|
|
|
|
* wake-up proximity sensor. Implement wake-up proximity sensor before implementing
|
|
|
|
* a non wake-up proximity sensor. For the wake-up proximity sensor set the flag
|
|
|
|
* SENSOR_FLAG_WAKE_UP.
|
|
|
|
* The value corresponds to the distance to the nearest object in centimeters.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_TYPE_PROXIMITY = 8
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* Sensor accuracy measure.
|
2012-03-23 21:19:36 +00:00
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** no contact */
|
2014-05-23 00:15:08 +00:00
|
|
|
ASENSOR_STATUS_NO_CONTACT = -1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** unreliable */
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_STATUS_UNRELIABLE = 0,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** low accuracy */
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_STATUS_ACCURACY_LOW = 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** medium accuracy */
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_STATUS_ACCURACY_MEDIUM = 2,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** high accuracy */
|
2012-03-23 21:19:36 +00:00
|
|
|
ASENSOR_STATUS_ACCURACY_HIGH = 3
|
|
|
|
};
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-06-04 02:19:57 +00:00
|
|
|
* Sensor Reporting Modes.
|
|
|
|
*/
|
|
|
|
enum {
|
2015-03-28 00:15:43 +00:00
|
|
|
/** continuous reporting */
|
2014-06-04 02:19:57 +00:00
|
|
|
AREPORTING_MODE_CONTINUOUS = 0,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** reporting on change */
|
2014-06-04 02:19:57 +00:00
|
|
|
AREPORTING_MODE_ON_CHANGE = 1,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** on shot reporting */
|
2014-06-04 02:19:57 +00:00
|
|
|
AREPORTING_MODE_ONE_SHOT = 2,
|
2015-03-28 00:15:43 +00:00
|
|
|
/** special trigger reporting */
|
2014-06-04 02:19:57 +00:00
|
|
|
AREPORTING_MODE_SPECIAL_TRIGGER = 3
|
|
|
|
};
|
|
|
|
|
2012-03-23 21:19:36 +00:00
|
|
|
/*
|
|
|
|
* A few useful constants
|
|
|
|
*/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Earth's gravity in m/s^2 */
|
2012-03-23 21:19:36 +00:00
|
|
|
#define ASENSOR_STANDARD_GRAVITY (9.80665f)
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Maximum magnetic field on Earth's surface in uT */
|
2012-03-23 21:19:36 +00:00
|
|
|
#define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f)
|
2015-03-28 00:15:43 +00:00
|
|
|
/** Minimum magnetic field on Earth's surface in uT*/
|
2012-03-23 21:19:36 +00:00
|
|
|
#define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f)
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* A sensor event.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* NOTE: Must match hardware/sensors.h */
|
|
|
|
typedef struct ASensorVector {
|
|
|
|
union {
|
|
|
|
float v[3];
|
|
|
|
struct {
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
float z;
|
|
|
|
};
|
|
|
|
struct {
|
|
|
|
float azimuth;
|
|
|
|
float pitch;
|
|
|
|
float roll;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
int8_t status;
|
|
|
|
uint8_t reserved[3];
|
|
|
|
} ASensorVector;
|
|
|
|
|
2013-06-27 19:04:23 +00:00
|
|
|
typedef struct AMetaDataEvent {
|
|
|
|
int32_t what;
|
|
|
|
int32_t sensor;
|
|
|
|
} AMetaDataEvent;
|
|
|
|
|
|
|
|
typedef struct AUncalibratedEvent {
|
|
|
|
union {
|
|
|
|
float uncalib[3];
|
|
|
|
struct {
|
|
|
|
float x_uncalib;
|
|
|
|
float y_uncalib;
|
|
|
|
float z_uncalib;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
float bias[3];
|
|
|
|
struct {
|
|
|
|
float x_bias;
|
|
|
|
float y_bias;
|
|
|
|
float z_bias;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} AUncalibratedEvent;
|
|
|
|
|
2014-05-23 00:15:08 +00:00
|
|
|
typedef struct AHeartRateEvent {
|
|
|
|
float bpm;
|
|
|
|
int8_t status;
|
|
|
|
} AHeartRateEvent;
|
|
|
|
|
2012-03-23 21:19:36 +00:00
|
|
|
/* NOTE: Must match hardware/sensors.h */
|
|
|
|
typedef struct ASensorEvent {
|
|
|
|
int32_t version; /* sizeof(struct ASensorEvent) */
|
|
|
|
int32_t sensor;
|
|
|
|
int32_t type;
|
|
|
|
int32_t reserved0;
|
|
|
|
int64_t timestamp;
|
|
|
|
union {
|
2013-07-03 23:20:57 +00:00
|
|
|
union {
|
|
|
|
float data[16];
|
|
|
|
ASensorVector vector;
|
|
|
|
ASensorVector acceleration;
|
|
|
|
ASensorVector magnetic;
|
|
|
|
float temperature;
|
|
|
|
float distance;
|
|
|
|
float light;
|
|
|
|
float pressure;
|
2013-06-27 19:04:23 +00:00
|
|
|
float relative_humidity;
|
|
|
|
AUncalibratedEvent uncalibrated_gyro;
|
|
|
|
AUncalibratedEvent uncalibrated_magnetic;
|
|
|
|
AMetaDataEvent meta_data;
|
2014-05-23 00:15:08 +00:00
|
|
|
AHeartRateEvent heart_rate;
|
2013-07-03 23:20:57 +00:00
|
|
|
};
|
|
|
|
union {
|
|
|
|
uint64_t data[8];
|
|
|
|
uint64_t step_counter;
|
|
|
|
} u64;
|
2012-03-23 21:19:36 +00:00
|
|
|
};
|
2014-02-12 02:58:52 +00:00
|
|
|
|
|
|
|
uint32_t flags;
|
|
|
|
int32_t reserved1[3];
|
2012-03-23 21:19:36 +00:00
|
|
|
} ASensorEvent;
|
|
|
|
|
|
|
|
struct ASensorManager;
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASensorManager} is an opaque type to manage sensors and
|
|
|
|
* events queues.
|
|
|
|
*
|
|
|
|
* {@link ASensorManager} is a singleton that can be obtained using
|
|
|
|
* ASensorManager_getInstance().
|
|
|
|
*
|
|
|
|
* This file provides a set of functions that uses {@link
|
|
|
|
* ASensorManager} to access and list hardware sensors, and
|
|
|
|
* create and destroy event queues:
|
|
|
|
* - ASensorManager_getSensorList()
|
|
|
|
* - ASensorManager_getDefaultSensor()
|
|
|
|
* - ASensorManager_getDefaultSensorEx()
|
|
|
|
* - ASensorManager_createEventQueue()
|
|
|
|
* - ASensorManager_destroyEventQueue()
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
typedef struct ASensorManager ASensorManager;
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
|
2012-03-23 21:19:36 +00:00
|
|
|
struct ASensorEventQueue;
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASensorEventQueue} is an opaque type that provides access to
|
|
|
|
* {@link ASensorEvent} from hardware sensors.
|
|
|
|
*
|
|
|
|
* A new {@link ASensorEventQueue} can be obtained using ASensorManager_createEventQueue().
|
|
|
|
*
|
|
|
|
* This file provides a set of functions to enable and disable
|
|
|
|
* sensors, check and get events, and set event rates on a {@link
|
|
|
|
* ASensorEventQueue}.
|
|
|
|
* - ASensorEventQueue_enableSensor()
|
|
|
|
* - ASensorEventQueue_disableSensor()
|
|
|
|
* - ASensorEventQueue_hasEvents()
|
|
|
|
* - ASensorEventQueue_getEvents()
|
|
|
|
* - ASensorEventQueue_setEventRate()
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
typedef struct ASensorEventQueue ASensorEventQueue;
|
|
|
|
|
|
|
|
struct ASensor;
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASensor} is an opaque type that provides information about
|
|
|
|
* an hardware sensors.
|
|
|
|
*
|
|
|
|
* A {@link ASensor} pointer can be obtained using
|
|
|
|
* ASensorManager_getDefaultSensor(),
|
|
|
|
* ASensorManager_getDefaultSensorEx() or from a {@link ASensorList}.
|
|
|
|
*
|
|
|
|
* This file provides a set of functions to access properties of a
|
|
|
|
* {@link ASensor}:
|
|
|
|
* - ASensor_getName()
|
|
|
|
* - ASensor_getVendor()
|
|
|
|
* - ASensor_getType()
|
|
|
|
* - ASensor_getResolution()
|
|
|
|
* - ASensor_getMinDelay()
|
|
|
|
* - ASensor_getFifoMaxEventCount()
|
|
|
|
* - ASensor_getFifoReservedEventCount()
|
|
|
|
* - ASensor_getStringType()
|
|
|
|
* - ASensor_getReportingMode()
|
|
|
|
* - ASensor_isWakeUpSensor()
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
typedef struct ASensor ASensor;
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASensorRef} is a type for constant pointers to {@link ASensor}.
|
|
|
|
*
|
|
|
|
* This is used to define entry in {@link ASensorList} arrays.
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
typedef ASensor const* ASensorRef;
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
|
|
|
* {@link ASensorList} is an array of reference to {@link ASensor}.
|
|
|
|
*
|
|
|
|
* A {@link ASensorList} can be initialized using ASensorManager_getSensorList().
|
|
|
|
*/
|
2012-03-23 21:19:36 +00:00
|
|
|
typedef ASensorRef const* ASensorList;
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2015-05-07 17:50:59 +00:00
|
|
|
* Get a reference to the sensor manager. ASensorManager is a singleton
|
|
|
|
* per package as different packages may have access to different sensors.
|
|
|
|
*
|
|
|
|
* Deprecated: Use ASensorManager_getInstanceForPackage(const char*) instead.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* ASensorManager* sensorManager = ASensorManager_getInstance();
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
__attribute__ ((deprecated)) ASensorManager* ASensorManager_getInstance();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a reference to the sensor manager. ASensorManager is a singleton
|
|
|
|
* per package as different packages may have access to different sensors.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* ASensorManager* sensorManager = ASensorManager_getInstanceForPackage("foo.bar.baz");
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
ASensorManager* ASensorManager_getInstanceForPackage(const char* packageName);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns the list of available sensors.
|
|
|
|
*/
|
|
|
|
int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns the default sensor for the given type, or NULL if no sensor
|
2014-08-05 21:53:07 +00:00
|
|
|
* of that type exists.
|
2012-03-23 21:19:36 +00:00
|
|
|
*/
|
|
|
|
ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-08-05 21:53:07 +00:00
|
|
|
* Returns the default sensor with the given type and wakeUp properties or NULL if no sensor
|
|
|
|
* of this type and wakeUp properties exists.
|
|
|
|
*/
|
|
|
|
ASensor const* ASensorManager_getDefaultSensorEx(ASensorManager* manager, int type,
|
|
|
|
bool wakeUp);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Creates a new sensor event queue and associate it with a looper.
|
2015-03-28 00:15:43 +00:00
|
|
|
*
|
|
|
|
* "ident" is a identifier for the events that will be returned when
|
|
|
|
* calling ALooper_pollOnce(). The identifier must be >= 0, or
|
|
|
|
* ALOOPER_POLL_CALLBACK if providing a non-NULL callback.
|
2012-03-23 21:19:36 +00:00
|
|
|
*/
|
|
|
|
ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager,
|
|
|
|
ALooper* looper, int ident, ALooper_callbackFunc callback, void* data);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Destroys the event queue and free all resources associated to it.
|
|
|
|
*/
|
|
|
|
int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue);
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Enable the selected sensor. Returns a negative error code on failure.
|
|
|
|
*/
|
|
|
|
int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Disable the selected sensor. Returns a negative error code on failure.
|
|
|
|
*/
|
|
|
|
int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Sets the delivery rate of events in microseconds for the given sensor.
|
|
|
|
* Note that this is a hint only, generally event will arrive at a higher
|
|
|
|
* rate. It is an error to set a rate inferior to the value returned by
|
|
|
|
* ASensor_getMinDelay().
|
|
|
|
* Returns a negative error code on failure.
|
|
|
|
*/
|
|
|
|
int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns true if there are one or more events available in the
|
|
|
|
* sensor queue. Returns 1 if the queue has events; 0 if
|
|
|
|
* it does not have events; and a negative value if there is an error.
|
|
|
|
*/
|
|
|
|
int ASensorEventQueue_hasEvents(ASensorEventQueue* queue);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns the next available events from the queue. Returns a negative
|
|
|
|
* value if no events are available or an error has occurred, otherwise
|
|
|
|
* the number of events returned.
|
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
* ASensorEvent event;
|
|
|
|
* ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1);
|
|
|
|
*
|
|
|
|
* ASensorEvent eventBuffer[8];
|
|
|
|
* ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8);
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue,
|
|
|
|
ASensorEvent* events, size_t count);
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns this sensor's name (non localized)
|
|
|
|
*/
|
|
|
|
const char* ASensor_getName(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns this sensor's vendor's name (non localized)
|
|
|
|
*/
|
|
|
|
const char* ASensor_getVendor(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Return this sensor's type
|
|
|
|
*/
|
|
|
|
int ASensor_getType(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns this sensors's resolution
|
|
|
|
*/
|
|
|
|
float ASensor_getResolution(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2012-03-23 21:19:36 +00:00
|
|
|
* Returns the minimum delay allowed between events in microseconds.
|
|
|
|
* A value of zero means that this sensor doesn't report events at a
|
|
|
|
* constant rate, but rather only when a new data is available.
|
|
|
|
*/
|
|
|
|
int ASensor_getMinDelay(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-04-07 22:52:37 +00:00
|
|
|
* Returns the maximum size of batches for this sensor. Batches will often be
|
|
|
|
* smaller, as the hardware fifo might be used for other sensors.
|
|
|
|
*/
|
|
|
|
int ASensor_getFifoMaxEventCount(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-04-07 22:52:37 +00:00
|
|
|
* Returns the hardware batch fifo size reserved to this sensor.
|
|
|
|
*/
|
|
|
|
int ASensor_getFifoReservedEventCount(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-04-07 22:52:37 +00:00
|
|
|
* Returns this sensor's string type.
|
|
|
|
*/
|
|
|
|
const char* ASensor_getStringType(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-06-04 02:19:57 +00:00
|
|
|
* Returns the reporting mode for this sensor. One of AREPORTING_MODE_* constants.
|
|
|
|
*/
|
|
|
|
int ASensor_getReportingMode(ASensor const* sensor);
|
|
|
|
|
2015-03-28 00:15:43 +00:00
|
|
|
/**
|
2014-08-05 21:53:07 +00:00
|
|
|
* Returns true if this is a wake up sensor, false otherwise.
|
|
|
|
*/
|
|
|
|
bool ASensor_isWakeUpSensor(ASensor const* sensor);
|
|
|
|
|
2012-03-23 21:19:36 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // ANDROID_SENSOR_H
|
2015-03-28 00:15:43 +00:00
|
|
|
|
|
|
|
/** @} */
|