summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@digia.com>2014-08-08 10:30:16 +0200
committerMaurice Kalinowski <maurice.kalinowski@digia.com>2014-08-08 13:34:18 +0200
commitb11494a1e51aba86ce945911ffbdc693a7eabff6 (patch)
treea3f71d0fa00c4e40aa0a1aec72fdaf063746e840
parent4383fa5df7a220670e0ae6567e56b8a5809d0704 (diff)
downloadqtsensors-b11494a1e51aba86ce945911ffbdc693a7eabff6.tar.gz
qtsensors-b11494a1e51aba86ce945911ffbdc693a7eabff6.tar.bz2
qtsensors-b11494a1e51aba86ce945911ffbdc693a7eabff6.zip
Set dataRates for sensors
Some sensors need to set a dataRate in which they are providing values. Values are in Hz, hence the conversion and defaults to 1Hz like on other backends as well. Task-number: QTBUG-40664 Change-Id: I980155f9b4b2772e8420df4b51e8ebb5cdea6037 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
-rw-r--r--src/plugins/sensors/winrt/winrtaccelerometer.cpp3
-rw-r--r--src/plugins/sensors/winrt/winrtambientlightsensor.cpp3
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.cpp3
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.cpp3
-rw-r--r--src/plugins/sensors/winrt/winrtrotationsensor.cpp3
5 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.cpp b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
index 16261c6..7029f11 100644
--- a/src/plugins/sensors/winrt/winrtaccelerometer.cpp
+++ b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
@@ -145,6 +145,9 @@ WinRtAccelerometer::WinRtAccelerometer(QSensor *sensor)
return;
}
+ addDataRate(1, 1000 / d->minimumReportInterval); // dataRate in Hz
+ sensor->setDataRate(1);
+
setReading<QAccelerometerReading>(&d->reading);
}
diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
index 33bbac1..1164c9a 100644
--- a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
@@ -144,6 +144,9 @@ WinRtAmbientLightSensor::WinRtAmbientLightSensor(QSensor *sensor)
return;
}
+ addDataRate(1, 1000 / d->minimumReportInterval); // dataRate in Hz
+ sensor->setDataRate(1);
+
setReading<QAmbientLightReading>(&d->reading);
}
diff --git a/src/plugins/sensors/winrt/winrtcompass.cpp b/src/plugins/sensors/winrt/winrtcompass.cpp
index c2b7240..9a3a150 100644
--- a/src/plugins/sensors/winrt/winrtcompass.cpp
+++ b/src/plugins/sensors/winrt/winrtcompass.cpp
@@ -164,6 +164,9 @@ WinRtCompass::WinRtCompass(QSensor *sensor)
return;
}
+ addDataRate(1, 1000 / d->minimumReportInterval); // dataRate in Hz
+ sensor->setDataRate(1);
+
setReading<QCompassReading>(&d->reading);
}
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.cpp b/src/plugins/sensors/winrt/winrtgyroscope.cpp
index 1e729a1..471ea7d 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.cpp
+++ b/src/plugins/sensors/winrt/winrtgyroscope.cpp
@@ -142,6 +142,9 @@ WinRtGyroscope::WinRtGyroscope(QSensor *sensor)
return;
}
+ addDataRate(1, 1000 / d->minimumReportInterval); // dataRate in Hz
+ sensor->setDataRate(1);
+
setReading<QGyroscopeReading>(&d->reading);
}
diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.cpp b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
index 576545e..2e78601 100644
--- a/src/plugins/sensors/winrt/winrtrotationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
@@ -140,6 +140,9 @@ WinRtRotationSensor::WinRtRotationSensor(QSensor *sensor)
return;
}
+ addDataRate(1, 1000 / d->minimumReportInterval); // dataRate in Hz
+ sensor->setDataRate(1);
+
setReading<QRotationReading>(&d->reading);
}