blob: 0d9bfde3edd404c6958bbb16d88ea4ed128e49e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "eandroidrotationsensor.h"
#include <math.h>
EAndroidRotationSensor::EAndroidRotationSensor(int type, QSensor *sensor)
: EAndroidBaseSensor(type, sensor)
{
setReading<QRotationReading>(&m_reading);
}
EAndroidRotationSensor::~EAndroidRotationSensor()
{
}
void EAndroidRotationSensor::processEvent(sensors_event_t &event)
{
m_reading.setTimestamp(event.timestamp / 1000);
float rz = -event.data[0] * 180 / M_PI;
float rx = -event.data[1] * 180 / M_PI;
float ry = event.data[2] * 180 / M_PI;
m_reading.setFromEuler(rx, ry, rz);
newReadingAvailable();
}
|