sensor_event_get_xyz()

Retrieve 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)

Since:

BlackBerry 10.0.0

Arguments:

event

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

x

The pointer to the x-axis value.

y

The pointer to the y-axis value.

z

The pointer to the z-axis value.

Library:

libbps (For the qcc command, use the -l bps option to link against this library)

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, in microteslas. 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.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus