summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-02 10:31:22 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-02 10:31:22 +0200
commitb421290b67507cfe125db206f378fc1b38eaae4e (patch)
treec3545d82d65b3b207e80446013f0499ddf0617f8 /src/plugins
parent614326721259f1424981444ec84b6b9f4d6400ef (diff)
parentbeac0b2e3ea4b292f0473c00bcf68d75360f89ef (diff)
downloadqtsensors-b421290b67507cfe125db206f378fc1b38eaae4e.tar.gz
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: .qmake.conf Change-Id: I4be6cbe9e4ac981f46b3c45d271cac5c7fc677cb
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp11
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h2
-rw-r--r--src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java6
-rw-r--r--src/plugins/sensors/android/src/androidjnisensors.cpp5
-rw-r--r--src/plugins/sensors/dummy/dummy.pro2
-rw-r--r--src/plugins/sensors/simulator/simulatoraccelerometer.cpp2
-rw-r--r--src/plugins/sensors/simulator/simulatorambientlightsensor.cpp2
-rw-r--r--src/plugins/sensors/simulator/simulatorcompass.cpp2
-rw-r--r--src/plugins/sensors/simulator/simulatorirproximitysensor.cpp2
-rw-r--r--src/plugins/sensors/simulator/simulatorlightsensor.cpp2
-rw-r--r--src/plugins/sensors/simulator/simulatormagnetometer.cpp2
-rw-r--r--src/plugins/sensors/simulator/simulatorproximitysensor.cpp2
12 files changed, 23 insertions, 17 deletions
diff --git a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
index be26522..6bb65e9 100644
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
@@ -42,9 +42,13 @@
QT_BEGIN_NAMESPACE
-QCoverSensorGestureRecognizer::QCoverSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- orientationReading(0), proximityReading(0),active(0), detecting(0)
+QCoverSensorGestureRecognizer::QCoverSensorGestureRecognizer(QObject *parent)
+ : QSensorGestureRecognizer(parent),
+ orientationReading(0),
+ proximityReading(0),
+ timer(0),
+ active(0),
+ detecting(0)
{
}
@@ -120,7 +124,6 @@ void QCoverSensorGestureRecognizer::proximityChanged(QProximityReading *reading)
detecting = true;
}
}
- lastTs = reading->timestamp();
}
void QCoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
diff --git a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
index e7ca3ab..1478e70 100644
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
+++ b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
@@ -76,10 +76,8 @@ private:
bool proximityReading;
QTimer *timer;
- QtSensorGestureSensorHandler *handler;
bool active;
bool detecting;
- qreal lastTs;
};
QT_END_NAMESPACE
diff --git a/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java b/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java
index 75f2e93..3067d40 100644
--- a/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java
+++ b/src/plugins/sensors/android/jar/src/org/qtproject/qt5/android/sensors/QtSensors.java
@@ -42,7 +42,7 @@ package org.qtproject.qt5.android.sensors;
import java.util.HashSet;
import java.util.List;
-import android.app.Activity;
+import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@@ -58,10 +58,10 @@ public class QtSensors implements SensorEventListener
static SensorManager m_sensorManager = null;
static SparseArray<Sensor> m_registeredSensors = new SparseArray<Sensor>();
static Object m_syncObject = new Object();
- static public void setActivity(Activity activity, Object acitvityDelegate)
+ static public void setContext(Context context)
{
try {
- m_sensorManager = (SensorManager)activity.getSystemService(Activity.SENSOR_SERVICE);
+ m_sensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
} catch(Exception e) {
e.printStackTrace();
}
diff --git a/src/plugins/sensors/android/src/androidjnisensors.cpp b/src/plugins/sensors/android/src/androidjnisensors.cpp
index 67fe907..5e0e414 100644
--- a/src/plugins/sensors/android/src/androidjnisensors.cpp
+++ b/src/plugins/sensors/android/src/androidjnisensors.cpp
@@ -247,6 +247,11 @@ static bool registerNatives(JNIEnv *env)
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
{
+ static bool initialized = false;
+ if (initialized)
+ return JNI_VERSION_1_6;
+ initialized = true;
+
typedef union {
JNIEnv *nativeEnvironment;
void *venv;
diff --git a/src/plugins/sensors/dummy/dummy.pro b/src/plugins/sensors/dummy/dummy.pro
index b4ef2fd..6eab491 100644
--- a/src/plugins/sensors/dummy/dummy.pro
+++ b/src/plugins/sensors/dummy/dummy.pro
@@ -12,7 +12,7 @@ SOURCES += dummycommon.cpp\
OTHER_FILES = plugin.json
-unix:!mac:!qnx:!android:LIBS+=-lrt
+unix:!darwin:!qnx:!android:!openbsd: LIBS += -lrt
PLUGIN_TYPE = sensors
PLUGIN_CLASS_NAME = dummySensorPlugin
diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp
index 9d2c929..481128f 100644
--- a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp
+++ b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp
@@ -54,7 +54,7 @@ void SimulatorAccelerometer::poll()
QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData;
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.x() != data.x
diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp
index fa6f487..177684f 100644
--- a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp
+++ b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp
@@ -76,7 +76,7 @@ void SimulatorAmbientLightSensor::poll()
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.lightLevel() != convertedLightLevel) {
diff --git a/src/plugins/sensors/simulator/simulatorcompass.cpp b/src/plugins/sensors/simulator/simulatorcompass.cpp
index a64f3a1..fc68c51 100644
--- a/src/plugins/sensors/simulator/simulatorcompass.cpp
+++ b/src/plugins/sensors/simulator/simulatorcompass.cpp
@@ -54,7 +54,7 @@ void SimulatorCompass::poll()
QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData;
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.azimuth() != data.azimuth
diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp
index 0259437..4499128 100644
--- a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp
+++ b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp
@@ -54,7 +54,7 @@ void SimulatorIRProximitySensor::poll()
QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData;
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.reflectance() != data.irProximity) {
diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.cpp b/src/plugins/sensors/simulator/simulatorlightsensor.cpp
index bdcfadf..40d9edb 100644
--- a/src/plugins/sensors/simulator/simulatorlightsensor.cpp
+++ b/src/plugins/sensors/simulator/simulatorlightsensor.cpp
@@ -54,7 +54,7 @@ void SimulatorLightSensor::poll()
QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData;
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.lux() != data.lux) {
diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.cpp b/src/plugins/sensors/simulator/simulatormagnetometer.cpp
index c3f2c8a..64a3177 100644
--- a/src/plugins/sensors/simulator/simulatormagnetometer.cpp
+++ b/src/plugins/sensors/simulator/simulatormagnetometer.cpp
@@ -54,7 +54,7 @@ void SimulatorMagnetometer::poll()
QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData;
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.x() != data.x
diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp
index 74a35f6..b443095 100644
--- a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp
+++ b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp
@@ -54,7 +54,7 @@ void SimulatorProximitySensor::poll()
QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData;
quint64 newTimestamp;
if (!data.timestamp.isValid())
- newTimestamp = QDateTime::currentDateTime().toTime_t();
+ newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
else
newTimestamp = data.timestamp.toTime_t();
if (m_reading.close() != data.close) {