summaryrefslogtreecommitdiffstats
path: root/src/sensors/qsensor.h
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2013-01-10 13:38:43 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-23 18:33:17 +0100
commit78ad1fabee403ac910d29bb212cf0e3b9a670708 (patch)
tree9dbfdfdab19de9666eaf2923e79d2b9141cc4eaa /src/sensors/qsensor.h
parent5700ab09b06617d73b0495d2db0696512913ba51 (diff)
Add a axes remapping feature
This allows orientable sensors like accelerometer or compass to change to adapt the reading values based on the current screen orientation. Add support for the BlackBerry backend. Change-Id: If7cfde8f20da4f677fdd13c38f7e11f2ed96bedd Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/sensors/qsensor.h')
-rw-r--r--src/sensors/qsensor.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/sensors/qsensor.h b/src/sensors/qsensor.h
index f7162753..45d1aa3c 100644
--- a/src/sensors/qsensor.h
+++ b/src/sensors/qsensor.h
@@ -80,6 +80,7 @@ class Q_SENSORS_EXPORT QSensor : public QObject
Q_OBJECT
Q_ENUMS(Feature)
+ Q_ENUMS(AxesOrientationMode)
Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier)
Q_PROPERTY(QByteArray type READ type)
Q_PROPERTY(bool connectedToBackend READ isConnectedToBackend)
@@ -94,6 +95,9 @@ class Q_SENSORS_EXPORT QSensor : public QObject
Q_PROPERTY(int error READ error NOTIFY sensorError)
Q_PROPERTY(bool alwaysOn READ isAlwaysOn WRITE setAlwaysOn NOTIFY alwaysOnChanged REVISION 1)
Q_PROPERTY(bool skipDuplicates READ skipDuplicates WRITE setSkipDuplicates NOTIFY skipDuplicatesChanged)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
#ifdef Q_QDOC
Q_PROPERTY(int maxBufferSize)
Q_PROPERTY(int efficientBufferSize)
@@ -107,9 +111,17 @@ public:
FieldOfView,
AccelerationMode,
SkipDuplicates,
+ AxesOrientation,
Reserved = 257 // Make sure at least 2 bytes are used for the enum to avoid breaking BC later
};
+ // Keep in sync with QmlSensor::AxesOrientationMode
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+
explicit QSensor(const QByteArray &type, QObject *parent = 0);
virtual ~QSensor();
@@ -159,6 +171,15 @@ public:
Q_INVOKABLE bool isFeatureSupported(Feature feature) const;
+ AxesOrientationMode axesOrientationMode() const;
+ void setAxesOrientationMode(AxesOrientationMode axesOrientationMode);
+
+ int currentOrientation() const;
+ void setCurrentOrientation(int currentOrientation);
+
+ int userOrientation() const;
+ void setUserOrientation(int userOrientation);
+
public Q_SLOTS:
// Start receiving values from the sensor
bool start();
@@ -175,6 +196,9 @@ Q_SIGNALS:
void alwaysOnChanged();
void dataRateChanged();
void skipDuplicatesChanged(bool skipDuplicates);
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
protected:
explicit QSensor(const QByteArray &type, QSensorPrivate &dd, QObject* parent = 0);