summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensors/android/src/androidaccelerometer.h
diff options
context:
space:
mode:
authorAndrew Inwood <ainwood@blackberry.com>2014-03-13 18:58:15 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 15:27:32 +0100
commit971fc95eca1d9db93aa4bdb75793dfe83e4a97db (patch)
treecb3bc54a3d1fab5c98558c5179a6f09da4db2a46 /src/plugins/sensors/android/src/androidaccelerometer.h
parent14293dcb7002b185b49ec1ad802055eee63f2473 (diff)
Implement QAccelerometer accelerationModev5.3.0-beta1
The Qt API does not expose Linear Accel and Gravity as separate sensor types, they are different versions of QAccelerometer, accessed by modifying the accelerationMode property. The possible values are Combined, User, and Gravity, which correspond to Acceleration, Linear Acceleration, and Gravity respectively. When constructing the accelerometer backend, the accelerationMode must be queried. The backend must also connect to the accelerationModeChanged signal from the QAccelerometer. I think that the existing implementation of QSensors on Android assumes that there is a one-to-one correspondence between QSensors and AndroidSensorTypes. To fix this assumption, I promoted the m_type attribute of androidcommonsensor.h from private to protected so that a sensor backend can update the Android sensor being used. Task-number: QTBUG-30531 Change-Id: I842d2485109542f74731d179e2720ea55fa248cc Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src/plugins/sensors/android/src/androidaccelerometer.h')
-rw-r--r--src/plugins/sensors/android/src/androidaccelerometer.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/sensors/android/src/androidaccelerometer.h b/src/plugins/sensors/android/src/androidaccelerometer.h
index 31363014..4eb7471e 100644
--- a/src/plugins/sensors/android/src/androidaccelerometer.h
+++ b/src/plugins/sensors/android/src/androidaccelerometer.h
@@ -47,13 +47,18 @@
class AndroidAccelerometer : public AndroidCommonSensor<QAccelerometerReading>
{
+ Q_OBJECT
+
public:
AndroidAccelerometer(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-
+ static AndroidSensors::AndroidSensorType modeToSensor(QAccelerometer::AccelerationMode mode);
private:
void onAccuracyChanged(jint accuracy) Q_DECL_OVERRIDE;
void onSensorChanged(jlong timestamp, const jfloat *values, uint size) Q_DECL_OVERRIDE;
+private Q_SLOTS:
+ void applyAccelerationMode();
+
};
#endif // ANDROIDACCELEROMETER_H