Sensor

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Modules | Data Structures | Typedefs | Enumerations | Functions
Sensor
Eeze

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.

## 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.
EAPI void | eeze_sensor_free (Eeze_Sensor_Obj *sens)
| Free a sensor object.
EAPI Eina_Bool | eeze_sensor_accuracy_get (Eeze_Sensor_Obj *sens, int *accuracy)
| Get accuracy from sensor object.
EAPI Eina_Bool | eeze_sensor_xyz_get (Eeze_Sensor_Obj *sens, float *x, float *y, float *z)
| Get data from all three data properties.
EAPI Eina_Bool | eeze_sensor_xy_get (Eeze_Sensor_Obj *sens, float *x, float *y)
| Get data from first two data properties.
EAPI Eina_Bool | eeze_sensor_x_get (Eeze_Sensor_Obj *sens, float *x)
| Get the data from first data property.
EAPI Eina_Bool | eeze_sensor_timestamp_get (Eeze_Sensor_Obj *sens, double *timestamp)
| Get timestamp from sensor object.
EAPI Eina_Bool | eeze_sensor_read (Eeze_Sensor_Obj *sens)
| Read out sensor data.
EAPI Eina_Bool | eeze_sensor_async_read (Eeze_Sensor_Obj *sens, void *user_data)
| Asynchronous read out sensor data.

## Detailed Description

Gather sensor information from different sources.

Works based on plugins, with a Tizen plugin being available.

## Typedef Documentation

## ◆ Eeze_Sensor_Obj

Eeze_Sensor_Obj

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.

Since
  1.8

## Enumeration Type Documentation

## ◆ Eeze_Sensor_Type

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.

Since
  1.8

Enumerator
EEZE_SENSOR_TYPE_ACCELEROMETER | Accelerometer sensor.
EEZE_SENSOR_TYPE_GRAVITY | Gravity sensor.
EEZE_SENSOR_TYPE_MAGNETIC | Magnetic sensor.
EEZE_SENSOR_TYPE_ORIENTATION | Orientation sensor.
EEZE_SENSOR_TYPE_GYROSCOPE | Gyroscope sensor.
EEZE_SENSOR_TYPE_LIGHT | Light sensor.
EEZE_SENSOR_TYPE_PROXIMITY | Proximity sensor.
EEZE_SENSOR_TYPE_MOTION_SNAP | Snap motion sensor.
EEZE_SENSOR_TYPE_MOTION_SHAKE | Shake motion sensor.
EEZE_SENSOR_TYPE_MOTION_DOUBLETAP | Doubletap motion sensor.
EEZE_SENSOR_TYPE_MOTION_PANNING | Panning motion sensor.
EEZE_SENSOR_TYPE_MOTION_FACEDOWN | Facedown motion sensor.
EEZE_SENSOR_TYPE_BAROMETER | Barometer sensor.
EEZE_SENSOR_TYPE_TEMPERATURE | Temperature sensor.
EEZE_SENSOR_TYPE_LAST | Last item to mark end of enum.

## Function Documentation

## ◆ eeze_sensor_new()

EAPI Eeze_Sensor_Obj * eeze_sensor_new | ( | Eeze_Sensor_Type | type | ) |

Create sensor object to operate on.

Parameters

  type | Sensor type to create object from.

Returns
  Sensor object for the given type.

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.

Since
  1.8

## ◆ eeze_sensor_free()

EAPI void eeze_sensor_free | ( | Eeze_Sensor_Obj * | sens | ) |

Free a sensor object.

Parameters

  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.

Since
  1.8

## ◆ eeze_sensor_accuracy_get()

EAPI Eina_Bool eeze_sensor_accuracy_get | ( | Eeze_Sensor_Obj * | sens,
|  | int * | accuracy
| ) |  |

Get accuracy from sensor object.

Parameters

  sens | Sensor object to operate on.
  accuracy | Pointer to write accuracy value into.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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

Since
  1.8

References _Eeze_Sensor_Obj::accuracy, EINA_FALSE, and EINA_TRUE.

## ◆ eeze_sensor_xyz_get()

EAPI Eina_Bool eeze_sensor_xyz_get | ( | Eeze_Sensor_Obj * | sens,
|  | float * | x,
|  | float * | y,
|  | float * | z
| ) |  |

Get data from all three data properties.

Parameters

  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.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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.

Since
  1.8

References _Eeze_Sensor_Obj::data, EINA_FALSE, and EINA_TRUE.

## ◆ eeze_sensor_xy_get()

EAPI Eina_Bool eeze_sensor_xy_get | ( | Eeze_Sensor_Obj * | sens,
|  | float * | x,
|  | float * | y
| ) |  |

Get data from first two data properties.

Parameters

  sens | Sensor object to operate on.
  x | Pointer to write first data property value into.
  y | Pointer to write second data property value into.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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.

Since
  1.8

References _Eeze_Sensor_Obj::data, EINA_FALSE, and EINA_TRUE.

## ◆ eeze_sensor_x_get()

EAPI Eina_Bool eeze_sensor_x_get | ( | Eeze_Sensor_Obj * | sens,
|  | float * | x
| ) |  |

Get the data from first data property.

Parameters

  sens | Sensor object to operate on.
  x | Pointer to write first data property value into.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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.

Since
  1.8

References _Eeze_Sensor_Obj::data, EINA_FALSE, and EINA_TRUE.

## ◆ eeze_sensor_timestamp_get()

EAPI Eina_Bool eeze_sensor_timestamp_get | ( | Eeze_Sensor_Obj * | sens,
|  | double * | timestamp
| ) |  |

Get timestamp from sensor object.

Parameters

  sens | Sensor object to operate on.
  timestamp | Pointer to write timestamp value into.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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.

Since
  1.8

References EINA_FALSE, EINA_TRUE, and _Eeze_Sensor_Obj::timestamp.

## ◆ eeze_sensor_read()

EAPI Eina_Bool eeze_sensor_read | ( | Eeze_Sensor_Obj * | sens | ) |

Read out sensor data.

Parameters

  sens | Sensor object to operate on.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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.

Since
  1.8

References EINA_FALSE.

## ◆ eeze_sensor_async_read()

EAPI Eina_Bool eeze_sensor_async_read | ( | Eeze_Sensor_Obj * | sens,
|  | void * | user_data
| ) |  |

Asynchronous read out sensor data.

Parameters

  sens | Sensor object to operate on.
  user_data | Data to pass to the callback function.

Returns
  EINA_TRUE for success and EINA_FALSE for failure

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.

Since
  1.8

References EINA_FALSE.