sensor_event_get_xyz()

Get the x, y, and z data values from a sensor event.

Synopsis:

#include <bps/sensor.h>
 
BPS_API int sensor_event_get_xyz(bps_event_t *event, float *x, float *y, float *z)

Arguments:

event
The sensor event to get the x, y, and z data values from.
x
The x-axis value.
y
The y-axis value.
z
The z-axis value.

Library:

libbps

Description:

The sensor_event_get_xyz() function gets the data values of the x-axis, y-axis, and z-axis from the specified sensor event. The sensor event that you pass to this function must be SENSOR_ACCELEROMETER_READING, SENSOR_MAGNETOMETER_READING, SENSOR_GYROSCOPE_READING, SENSOR_LINEAR_ACCEL_READING, or SENSOR_GRAVITY_READING, because these are the only sensor events with x, y, and z data components.

The units that are used for x, y, and z depend on which sensor event was passed in. For accelerometer and linear accelerometer events, the values are in G forces. For magnetometer events, the values indicate the strength of the magnetic field along a particular vector. For gyroscope events, the values are in radians per second. For gravity events, the values are in meters per seconds squared (m/s^2).

Returns:

BPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise.