Gather sensor information from different sources. More...
Modules | |
Available eeze sensor events | |
Sensor events that are emitted from the library as ecore events. | |
Data Structures | |
struct | _Eeze_Sensor_Obj |
Typedefs | |
typedef struct _Eeze_Sensor_Obj | Eeze_Sensor_Obj |
Object for a sensor type. More... | |
Enumerations | |
enum | Eeze_Sensor_Type { EEZE_SENSOR_TYPE_ACCELEROMETER , EEZE_SENSOR_TYPE_GRAVITY , EEZE_SENSOR_TYPE_LINEAR_ACCELERATION , EEZE_SENSOR_TYPE_DEVICE_ORIENTATION , EEZE_SENSOR_TYPE_MAGNETIC , EEZE_SENSOR_TYPE_ORIENTATION , EEZE_SENSOR_TYPE_GYROSCOPE , EEZE_SENSOR_TYPE_LIGHT , EEZE_SENSOR_TYPE_PROXIMITY , EEZE_SENSOR_TYPE_MOTION_SNAP , EEZE_SENSOR_TYPE_MOTION_SHAKE , EEZE_SENSOR_TYPE_MOTION_DOUBLETAP , EEZE_SENSOR_TYPE_MOTION_PANNING , EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE , EEZE_SENSOR_TYPE_MOTION_TILT , EEZE_SENSOR_TYPE_MOTION_FACEDOWN , EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL , EEZE_SENSOR_TYPE_MOTION_SMART_ALERT , EEZE_SENSOR_TYPE_MOTION_NO_MOVE , EEZE_SENSOR_TYPE_BAROMETER , EEZE_SENSOR_TYPE_TEMPERATURE , EEZE_SENSOR_TYPE_LAST = 0xFF } |
All sensor types known by Eeze Sensor. More... | |
Functions | |
EAPI Eeze_Sensor_Obj * | eeze_sensor_new (Eeze_Sensor_Type type) |
Create sensor object to operate on. More... | |
EAPI void | eeze_sensor_free (Eeze_Sensor_Obj *sens) |
Free a sensor object. More... | |
EAPI Eina_Bool | eeze_sensor_accuracy_get (Eeze_Sensor_Obj *sens, int *accuracy) |
Get accuracy from sensor object. More... | |
EAPI Eina_Bool | eeze_sensor_xyz_get (Eeze_Sensor_Obj *sens, float *x, float *y, float *z) |
Get data from all three data properties. More... | |
EAPI Eina_Bool | eeze_sensor_xy_get (Eeze_Sensor_Obj *sens, float *x, float *y) |
Get data from first two data properties. More... | |
EAPI Eina_Bool | eeze_sensor_x_get (Eeze_Sensor_Obj *sens, float *x) |
Get the data from first data property. More... | |
EAPI Eina_Bool | eeze_sensor_timestamp_get (Eeze_Sensor_Obj *sens, double *timestamp) |
Get timestamp from sensor object. More... | |
EAPI Eina_Bool | eeze_sensor_read (Eeze_Sensor_Obj *sens) |
Read out sensor data. More... | |
EAPI Eina_Bool | eeze_sensor_async_read (Eeze_Sensor_Obj *sens, void *user_data) |
Asynchronous read out sensor data. More... | |
Gather sensor information from different sources.
Works based on plugins, with a Tizen plugin being available.
Object for a sensor type.
Keeps information about the type and holds the data for the accessor functions. As this information gets also updated by asynchronous reads it might be a good idea to check the timestamp value to see when the data has been updated. The timestamp is given as floating point value in seconds.
You are not supposed to access the raw data values from here but use the getter functions for it. Using the raw values from this struct might break your applications later if the internal structure changes.
enum Eeze_Sensor_Type |
All sensor types known by Eeze Sensor.
This list of types include real physical types like proximity or light as well as "aggregated" types like facedown or doubletap. All types with MOTION in their name can be used as real events coming from the underlying system. This is not supported on all systems.
EAPI Eeze_Sensor_Obj * eeze_sensor_new | ( | Eeze_Sensor_Type | type | ) |
Create sensor object to operate on.
type | Sensor type to create object from. |
Takes the sensor type and create an object for it to operate on. During this it also does an initial sensor data read to fill the sensor data into the object. The eeze_sensor_free function must be used to destroy the object and release its memory.
For every sensor type you want to work with this is the first thing you have to do. Create the object from the type and everything else the operates on this object.
This also takes into account what runtime modules are loaded and handles them in a given priority to pick up the best sensor source for your sensor object.
EAPI void eeze_sensor_free | ( | Eeze_Sensor_Obj * | sens | ) |
Free a sensor object.
sens | Sensor object to operate on. |
Free an sensor object when it is no longer needed. Always use this function to cleanup unused sensor objects.
EAPI Eina_Bool eeze_sensor_accuracy_get | ( | Eeze_Sensor_Obj * | sens, |
int * | accuracy | ||
) |
Get accuracy from sensor object.
sens | Sensor object to operate on. |
accuracy | Pointer to write accuracy value into. |
Access function to get the accuracy property from the sensor object. The accuracy value can have the following values and meaning: -1 Undefined accuracy 0 Bad accurancy 1 Normal accuracy 2 Good accuracy 3 Very good accuracy
References _Eeze_Sensor_Obj::accuracy, EINA_FALSE, and EINA_TRUE.
EAPI Eina_Bool eeze_sensor_xyz_get | ( | Eeze_Sensor_Obj * | sens, |
float * | x, | ||
float * | y, | ||
float * | z | ||
) |
Get data from all three data properties.
sens | Sensor object to operate on. |
x | Pointer to write first data property value into. |
y | Pointer to write second data property value into. |
z | Pointer to write third data property value into. |
Access function to get all three data properties from the sensor object. This is used for sensor types that offer all three values. Like accelerometer and magnetic.
References _Eeze_Sensor_Obj::data, EINA_FALSE, and EINA_TRUE.
EAPI Eina_Bool eeze_sensor_xy_get | ( | Eeze_Sensor_Obj * | sens, |
float * | x, | ||
float * | y | ||
) |
Get data from first two data properties.
sens | Sensor object to operate on. |
x | Pointer to write first data property value into. |
y | Pointer to write second data property value into. |
Access function to get the first two data properties from the sensor object. This is used for sensor types that offer two values. Like panning.
References _Eeze_Sensor_Obj::data, EINA_FALSE, and EINA_TRUE.
EAPI Eina_Bool eeze_sensor_x_get | ( | Eeze_Sensor_Obj * | sens, |
float * | x | ||
) |
Get the data from first data property.
sens | Sensor object to operate on. |
x | Pointer to write first data property value into. |
Access function to get the first data property from the sensor object. This is used for sensor types that only offer one value. Like light or proximity.
References _Eeze_Sensor_Obj::data, EINA_FALSE, and EINA_TRUE.
EAPI Eina_Bool eeze_sensor_timestamp_get | ( | Eeze_Sensor_Obj * | sens, |
double * | timestamp | ||
) |
Get timestamp from sensor object.
sens | Sensor object to operate on. |
timestamp | Pointer to write timestamp value into. |
Access function to get the timestamp property from the sensor object. It allows you to determine if the values have been updated since the last time you requested them. Timestamp is given as a floating point value in seconds.
References EINA_FALSE, EINA_TRUE, and _Eeze_Sensor_Obj::timestamp.
EAPI Eina_Bool eeze_sensor_read | ( | Eeze_Sensor_Obj * | sens | ) |
Read out sensor data.
sens | Sensor object to operate on. |
This function reads sensor data from the device and fills the sensor object with the data. This call is synchronous and blocks until the data is read out and updated in the sensor object. For simple applications this is fine and the easiest way to use the API. A more efficient way is to use eeze_sensor_async_read which allows the sensor readout to happen in the background and the application would check the timestamp of the data to determine how recent the data is.
References EINA_FALSE.
EAPI Eina_Bool eeze_sensor_async_read | ( | Eeze_Sensor_Obj * | sens, |
void * | user_data | ||
) |
Asynchronous read out sensor data.
sens | Sensor object to operate on. |
user_data | Data to pass to the callback function. |
This function reads sensor data from the device and fills the sensor object with the data. The read is done asynchronously and thus does not block after calling. Instead the given the application can determine how recent the values are from the timestamp value that can be accessed through eeze_sensor_timestamp_get.
This function is more efficient but needs a bit more work in the application. An easier way is to use the synchronous eeze_sensor_read functions. The downside of it is that it blocks until the data was read out from the physical sensor. That might be a long time depending on the hardware and its interface.
The extra data passed in as user_data here will be available in the user_data pointer of the sensor object when the ecore event arrives.
References EINA_FALSE.