qtmobility/plugins/sensors/dummy/dummycommon.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
--- a/qtmobility/plugins/sensors/dummy/dummycommon.cpp	Fri Jun 11 14:26:25 2010 +0300
+++ b/qtmobility/plugins/sensors/dummy/dummycommon.cpp	Wed Jun 23 19:08:38 2010 +0300
@@ -60,9 +60,16 @@
     if (m_timerid)
         return;
 
-    int interval = 1000 / sensor()->dataRate();
-    if (interval < 0)
-        interval = 1000;
+    int dataRate = sensor()->dataRate();
+    if (dataRate == 0) {
+        if (sensor()->availableDataRates().count())
+            // Use the first available rate when -1 is chosen
+            dataRate = sensor()->availableDataRates().first().first;
+        else
+            dataRate = 1;
+    }
+
+    int interval = 1000 / dataRate;
 
     if (interval)
         m_timerid = startTimer(interval);