accelerometer.h File Reference
`#include <ubuntu/status.h>`
`#include <ubuntu/visibility.h>`
`#include <ubuntu/application/sensors/event/accelerometer.h>`
Include dependency graph for accelerometer.h:

Go to the source code of this file.

## Typedefs

typedef void | UASensorsAccelerometer
| Opaque type that models the accelerometer. More...
typedef void(* | on_accelerometer_event_cb) (UASAccelerometerEvent *event, void *context)
| Callback type used by applications to subscribe to accelerometer events. More...

## Functions

UBUNTU_DLL_PUBLIC UASensorsAccelerometer * | ua_sensors_accelerometer_new ()
| Create a new object for accessing the accelerometer. More...
UBUNTU_DLL_PUBLIC UStatus | ua_sensors_accelerometer_enable (UASensorsAccelerometer *sensor)
| Enables the supplied accelerometer. More...
UBUNTU_DLL_PUBLIC UStatus | ua_sensors_accelerometer_disable (UASensorsAccelerometer *sensor)
| Disables the supplied accelerometer. More...
UBUNTU_DLL_PUBLIC uint32_t | ua_sensors_accelerometer_get_min_delay (UASensorsAccelerometer *sensor)
| Queries the minimum delay between two readings for the supplied sensor. More...
UBUNTU_DLL_PUBLIC UStatus | ua_sensors_accelerometer_get_min_value (UASensorsAccelerometer *sensor, float *value)
| Queries the minimum value that can be reported by the sensor. More...
UBUNTU_DLL_PUBLIC UStatus | ua_sensors_accelerometer_get_max_value (UASensorsAccelerometer *sensor, float *value)
| Queries the maximum value that can be reported by the sensor. More...
UBUNTU_DLL_PUBLIC UStatus | ua_sensors_accelerometer_get_resolution (UASensorsAccelerometer *sensor, float *value)
| Queries the numeric resolution supported by the sensor. More...
UBUNTU_DLL_PUBLIC void | ua_sensors_accelerometer_set_reading_cb (UASensorsAccelerometer *sensor, on_accelerometer_event_cb cb, void *ctx)
| Set the callback to be invoked whenever a new sensor reading is available. More...
UBUNTU_DLL_PUBLIC UStatus | ua_sensors_accelerometer_set_event_rate (UASensorsAccelerometer *sensor, uint32_t rate)
| Set the sensor event delivery rate in nanoseconds.. More...

## Typedef Documentation

typedef void(* on_accelerometer_event_cb) (UASAccelerometerEvent *event, void *context)

Callback type used by applications to subscribe to accelerometer events.

Definition at line 41 of file accelerometer.h.

typedef void UASensorsAccelerometer

Opaque type that models the accelerometer.

Definition at line 35 of file accelerometer.h.

## Function Documentation

UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_disable | ( | UASensorsAccelerometer * | sensor | ) |

Disables the supplied accelerometer.

Returns
  U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.

Parameters

  [in] | sensor | The sensor instance to be disabled.

UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_enable | ( | UASensorsAccelerometer * | sensor | ) |

Enables the supplied accelerometer.

Returns
  U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.

Parameters

  [in] | sensor | The sensor instance to be enabled.

UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_max_value | ( | UASensorsAccelerometer * | sensor,
|  | float * | value
| ) |  |

Queries the maximum value that can be reported by the sensor.

Returns
  The maximum value that can be reported by the sensor.

Parameters

  [in] | sensor | The sensor instance to be queried.

UBUNTU_DLL_PUBLIC uint32_t ua_sensors_accelerometer_get_min_delay | ( | UASensorsAccelerometer * | sensor | ) |

Queries the minimum delay between two readings for the supplied sensor.

Returns
  The minimum delay between two readings in [ms].

Parameters

  [in] | sensor | The sensor instance to be queried.

UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_min_value | ( | UASensorsAccelerometer * | sensor,
|  | float * | value
| ) |  |

Queries the minimum value that can be reported by the sensor.

Returns
  The minimum value that can be reported by the sensor.

Parameters

  [in] | sensor | The sensor instance to be queried.

UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_resolution | ( | UASensorsAccelerometer * | sensor,
|  | float * | value
| ) |  |

Queries the numeric resolution supported by the sensor.

Returns
  The numeric resolution supported by the sensor.

Parameters

  [in] | sensor | The sensor instance to be queried.

UBUNTU_DLL_PUBLIC UASensorsAccelerometer* ua_sensors_accelerometer_new | ( |  | ) |

Create a new object for accessing the accelerometer.

Returns
  A new instance or NULL in case of errors.

UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_set_event_rate | ( | UASensorsAccelerometer * | sensor,
|  | uint32_t | rate
| ) |  |

Set the sensor event delivery rate in nanoseconds..

Returns
  U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.

Parameters

  [in] | sensor | The sensor instance to be modified.
  [in] | rate | The new event delivery rate.

UBUNTU_DLL_PUBLIC void ua_sensors_accelerometer_set_reading_cb | ( | UASensorsAccelerometer * | sensor,
|  | on_accelerometer_event_cb | cb,
|  | void * | ctx
| ) |  |

Set the callback to be invoked whenever a new sensor reading is available.

Parameters

  [in] | sensor | The sensor instance to associate the callback with.
  [in] | cb | The callback to be invoked.
  [in] | ctx | The context supplied to the callback invocation.