summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensors/android/src
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2019-04-02 14:00:37 +0300
committerBogDan Vatra <bogdan@kdab.com>2019-04-11 06:52:45 +0000
commit2c9fc2c1a197b84ba9ef3dc4e586a77a18c3dcc5 (patch)
tree38ac45eb44b585e47542c7b6df20088388836283 /src/plugins/sensors/android/src
parentf528104474dd74e34ea6a01da096e7c31730c01a (diff)
Say hello to Qt Android Sensors based on NDK API
Until Qt 5.9, we had to use JNI way because the NDK sensors API was introduced in API-16. Starting with Qt 5.9 we can safely use the NDK API as API_16 is the minimum API supported by Qt. Using the NDK API instead of JNI boost the performance a lot! The CPU usage dropped 2 to 4 times, from over 60% using the JNI to less than 20%. [ChangeLog][Android] Rewrite Qt Android Sensors using NDK API. Change-Id: If3e3f1e56973e2a189662912b2a6ebfbd71dee14 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/sensors/android/src')
-rw-r--r--src/plugins/sensors/android/src/androidaccelerometer.cpp100
-rw-r--r--src/plugins/sensors/android/src/androidaccelerometer.h62
-rw-r--r--src/plugins/sensors/android/src/androidcommonsensor.h86
-rw-r--r--src/plugins/sensors/android/src/androidcompass.cpp177
-rw-r--r--src/plugins/sensors/android/src/androidcompass.h74
-rw-r--r--src/plugins/sensors/android/src/androidgyroscope.cpp62
-rw-r--r--src/plugins/sensors/android/src/androidgyroscope.h55
-rw-r--r--src/plugins/sensors/android/src/androidjnisensors.cpp277
-rw-r--r--src/plugins/sensors/android/src/androidjnisensors.h87
-rw-r--r--src/plugins/sensors/android/src/androidlight.cpp60
-rw-r--r--src/plugins/sensors/android/src/androidlight.h55
-rw-r--r--src/plugins/sensors/android/src/androidmagnetometer.cpp75
-rw-r--r--src/plugins/sensors/android/src/androidmagnetometer.h55
-rw-r--r--src/plugins/sensors/android/src/androidpressure.cpp61
-rw-r--r--src/plugins/sensors/android/src/androidpressure.h56
-rw-r--r--src/plugins/sensors/android/src/androidproximity.cpp70
-rw-r--r--src/plugins/sensors/android/src/androidproximity.h57
-rw-r--r--src/plugins/sensors/android/src/androidrotation.cpp63
-rw-r--r--src/plugins/sensors/android/src/androidrotation.h54
-rw-r--r--src/plugins/sensors/android/src/androidtemperature.cpp64
-rw-r--r--src/plugins/sensors/android/src/androidtemperature.h56
-rw-r--r--src/plugins/sensors/android/src/main.cpp168
-rw-r--r--src/plugins/sensors/android/src/plugin.json1
-rw-r--r--src/plugins/sensors/android/src/src.pro39
24 files changed, 0 insertions, 1914 deletions
diff --git a/src/plugins/sensors/android/src/androidaccelerometer.cpp b/src/plugins/sensors/android/src/androidaccelerometer.cpp
deleted file mode 100644
index 2e9990b7..00000000
--- a/src/plugins/sensors/android/src/androidaccelerometer.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidaccelerometer.h"
-
-AndroidAccelerometer::AndroidAccelerometer(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QAccelerometerReading>(type, sensor)
-{
- QAccelerometer * const accelerometer = qobject_cast<QAccelerometer *>(sensor);
- if (accelerometer) {
- connect(accelerometer, SIGNAL(accelerationModeChanged(AccelerationMode)),
- this, SLOT(applyAccelerationMode()));
- }
-}
-
-void AndroidAccelerometer::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 3)
- return;
- m_reader.setTimestamp(timestamp/1000);
- // check https://developer.android.com/reference/android/hardware/SensorEvent.html#values
- m_reader.setX(values[0]);
- m_reader.setY(values[1]);
- m_reader.setZ(values[2]);
- newReadingAvailable();
-}
-
-void AndroidAccelerometer::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
-
-void AndroidAccelerometer::applyAccelerationMode()
-{
- const QAccelerometer * const accelerometer = qobject_cast<QAccelerometer *>(sensor());
- if (accelerometer) {
- stop(); //Stop previous sensor and start new one
- m_type = modeToSensor(accelerometer->accelerationMode());
- start();
- }
-}
-AndroidSensors::AndroidSensorType AndroidAccelerometer::modeToSensor(QAccelerometer::AccelerationMode mode)
-{
- AndroidSensors::AndroidSensorType type;
-
- switch (mode) {
- case QAccelerometer::Gravity:
- type = AndroidSensors::TYPE_GRAVITY;
- break;
- case QAccelerometer::User:
- type = AndroidSensors::TYPE_LINEAR_ACCELERATION;
- break;
- case QAccelerometer::Combined:
- default:
- type = AndroidSensors::TYPE_ACCELEROMETER;
- break;
- }
-
- if (type != AndroidSensors::TYPE_ACCELEROMETER && !AndroidSensors::availableSensors().contains(type))
- type = AndroidSensors::TYPE_ACCELEROMETER;
-
- return type;
-}
diff --git a/src/plugins/sensors/android/src/androidaccelerometer.h b/src/plugins/sensors/android/src/androidaccelerometer.h
deleted file mode 100644
index 9b8bf0b4..00000000
--- a/src/plugins/sensors/android/src/androidaccelerometer.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDACCELEROMETER_H
-#define ANDROIDACCELEROMETER_H
-#include <qaccelerometer.h>
-
-#include "androidcommonsensor.h"
-
-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) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-
-private Q_SLOTS:
- void applyAccelerationMode();
-
-};
-
-#endif // ANDROIDACCELEROMETER_H
diff --git a/src/plugins/sensors/android/src/androidcommonsensor.h b/src/plugins/sensors/android/src/androidcommonsensor.h
deleted file mode 100644
index bfd36db0..00000000
--- a/src/plugins/sensors/android/src/androidcommonsensor.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDCOMMONSENSOR_H
-#define ANDROIDCOMMONSENSOR_H
-
-#include <qsensorbackend.h>
-#include <qsensor.h>
-#include "androidjnisensors.h"
-
-template <typename ReaderType>
-class AndroidCommonSensor : public QSensorBackend, protected AndroidSensors::AndroidSensorsListenerInterface
-{
-public:
- AndroidCommonSensor(AndroidSensors::AndroidSensorType type, QSensor *sensor) : QSensorBackend(sensor)
- {
- setDescription(AndroidSensors::sensorDescription(type));
- setReading<ReaderType>(&m_reader);
- m_type = type;
- m_isStarted = false;
- }
-
- virtual ~AndroidCommonSensor()
- {
- if (m_isStarted)
- stop();
- }
- void start() override
- {
- if (AndroidSensors::registerListener(m_type, this, sensor()->dataRate()))
- m_isStarted = true;
- }
-
- void stop() override
- {
- if (m_isStarted) {
- m_isStarted = false;
- AndroidSensors::unregisterListener(m_type, this);
- }
- }
-
-protected:
- ReaderType m_reader;
- AndroidSensors::AndroidSensorType m_type;
-
-private:
- bool m_isStarted;
-};
-
-#endif // ANDROIDCOMMONSENSOR_H
diff --git a/src/plugins/sensors/android/src/androidcompass.cpp b/src/plugins/sensors/android/src/androidcompass.cpp
deleted file mode 100644
index 0911d901..00000000
--- a/src/plugins/sensors/android/src/androidcompass.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidcompass.h"
-
-#include <QDebug>
-#include <qmath.h>
-#include "androidjnisensors.h"
-
-
-class AndroidAccelerometerListener : public AndroidSensors::AndroidSensorsListenerInterface
-{
-public:
-
- AndroidAccelerometerListener(AndroidCompass *parent)
- : accuracy(0), m_compass(parent)
- {
- memset(reading, 0, sizeof(reading));
- }
-
- void start(int dataRate)
- {
- AndroidSensors::registerListener(AndroidSensors::TYPE_ACCELEROMETER, this, dataRate);
- }
-
- void stop()
- {
- AndroidSensors::unregisterListener(AndroidSensors::TYPE_ACCELEROMETER, this);
- }
-
- void onAccuracyChanged(jint value) override
- {
- accuracy = value;
- }
-
- void onSensorChanged(jlong /*timestamp*/, const jfloat *values, uint size) override
- {
- if (size < 3)
- return;
- reading[0] = values[0];
- reading[1] = values[1];
- reading[2] = values[2];
- m_compass->testStuff();
- }
-
- jfloat reading[3];
- jint accuracy;
-
-private:
- AndroidCompass *m_compass;
-};
-
-class AndroidMagnetometerListener : public AndroidSensors::AndroidSensorsListenerInterface
-{
-public:
- AndroidMagnetometerListener(AndroidCompass *parent)
- : accuracy(0), m_compass(parent)
- {
- memset(reading, 0, sizeof(reading));
- }
-
- void start(int dataRate)
- {
- AndroidSensors::registerListener(AndroidSensors::TYPE_MAGNETIC_FIELD, this, dataRate);
- }
-
- void stop()
- {
- AndroidSensors::unregisterListener(AndroidSensors::TYPE_MAGNETIC_FIELD, this);
- }
-
- void onAccuracyChanged(jint value) override
- {
- accuracy = value;
- }
-
- void onSensorChanged(jlong /*timestamp*/, const jfloat *values, uint size) override
- {
- if (size < 3)
- return;
- reading[0] = values[0];
- reading[1] = values[1];
- reading[2] = values[2];
- m_compass->testStuff();
- }
-
- jfloat reading[3];
- jint accuracy;
-private:
- AndroidCompass *m_compass;
-};
-
-char const * const AndroidCompass::id("android.synthetic.compass");
-
-AndroidCompass::AndroidCompass(QSensor *sensor)
- : QSensorBackend(sensor), m_accelerometerListener(0), m_magnetometerListener(0), m_isStarted(false)
-{
- setReading<QCompassReading>(&m_reading);
- m_isStarted = false;
-}
-
-AndroidCompass::~AndroidCompass()
-{
- if (m_isStarted)
- stop();
- delete m_accelerometerListener;
- delete m_magnetometerListener;
-}
-
-void AndroidCompass::start()
-{
- if (!m_accelerometerListener)
- m_accelerometerListener = new AndroidAccelerometerListener(this);
- if (!m_magnetometerListener)
- m_magnetometerListener = new AndroidMagnetometerListener(this);
- m_accelerometerListener->start(sensor()->dataRate());
- m_magnetometerListener->start(sensor()->dataRate());
-
- m_isStarted = true;
-}
-
-void AndroidCompass::stop()
-{
- if (m_isStarted) {
- m_isStarted = false;
- m_accelerometerListener->stop();
- m_magnetometerListener->stop();
- }
-}
-
-void AndroidCompass::testStuff()
-{
- if (!m_accelerometerListener || !m_magnetometerListener)
- return;
- qreal azimuth = AndroidSensors::getCompassAzimuth(m_accelerometerListener->reading, m_magnetometerListener->reading);
-
- m_reading.setAzimuth(qRadiansToDegrees(azimuth));
- const qreal accuracyValue = (m_accelerometerListener->accuracy + m_magnetometerListener->accuracy) / 6;
- m_reading.setCalibrationLevel(accuracyValue);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidcompass.h b/src/plugins/sensors/android/src/androidcompass.h
deleted file mode 100644
index 16a7c41b..00000000
--- a/src/plugins/sensors/android/src/androidcompass.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDCOMPASS_H
-#define ANDROIDCOMPASS_H
-#include <qcompass.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidAccelerometerListener;
-class AndroidMagnetometerListener;
-
-class AndroidCompass : public QSensorBackend
-{
- Q_OBJECT
-
-public:
- static char const * const id;
-
- AndroidCompass(QSensor *sensor);
- ~AndroidCompass();
-
- void start() override;
- void stop() override;
-
-private:
- AndroidAccelerometerListener *m_accelerometerListener;
- AndroidMagnetometerListener *m_magnetometerListener;
-
- QCompassReading m_reading;
- bool m_isStarted;
-
-public Q_SLOTS:
- void testStuff();
-
-};
-
-#endif // ANDROIDCOMPASS_H
diff --git a/src/plugins/sensors/android/src/androidgyroscope.cpp b/src/plugins/sensors/android/src/androidgyroscope.cpp
deleted file mode 100644
index c963761b..00000000
--- a/src/plugins/sensors/android/src/androidgyroscope.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidgyroscope.h"
-#include <QtCore/qmath.h>
-
-AndroidGyroscope::AndroidGyroscope(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QGyroscopeReading>(type, sensor)
-{}
-
-void AndroidGyroscope::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 3)
- return;
- m_reader.setTimestamp(timestamp/1000);
- // check https://developer.android.com/reference/android/hardware/SensorEvent.html#values
- m_reader.setX(qRadiansToDegrees(values[0]));
- m_reader.setY(qRadiansToDegrees(values[1]));
- m_reader.setZ(qRadiansToDegrees(values[2]));
- newReadingAvailable();
-}
-
-void AndroidGyroscope::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
diff --git a/src/plugins/sensors/android/src/androidgyroscope.h b/src/plugins/sensors/android/src/androidgyroscope.h
deleted file mode 100644
index 9dd5629d..00000000
--- a/src/plugins/sensors/android/src/androidgyroscope.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDGYROSCOPE_H
-#define ANDROIDGYROSCOPE_H
-#include <qgyroscope.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidGyroscope : public AndroidCommonSensor<QGyroscopeReading>
-{
-public:
- AndroidGyroscope(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-};
-
-#endif // ANDROIDGYROSCOPE_H
diff --git a/src/plugins/sensors/android/src/androidjnisensors.cpp b/src/plugins/sensors/android/src/androidjnisensors.cpp
deleted file mode 100644
index 5e0e4146..00000000
--- a/src/plugins/sensors/android/src/androidjnisensors.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qglobal.h>
-#include <android/log.h>
-#include <QtCore/QReadWriteLock>
-#include <QtCore/QHash>
-
-#include "androidjnisensors.h"
-
-static JavaVM *javaVM = 0;
-jclass sensorsClass;
-
-static jmethodID getSensorListMethodId;
-static jmethodID registerSensorMethodId;
-static jmethodID unregisterSensorMethodId;
-static jmethodID getSensorDescriptionMethodId;
-static jmethodID getSensorMaximumRangeMethodId;
-static jmethodID getCompassAzimuthId;
-
-static QHash<int, QList<AndroidSensors::AndroidSensorsListenerInterface *> > listenersHash;
-QReadWriteLock listenersLocker;
-enum {
- SENSOR_DELAY_FASTEST = 0,
- SENSOR_DELAY_GAME = 1,
- SENSOR_DELAY_NORMAL = 3,
- SENSOR_DELAY_UI =2
-};
-namespace AndroidSensors
-{
- struct AttachedJNIEnv
- {
- AttachedJNIEnv()
- {
- attached = false;
- if (javaVM->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) < 0) {
- if (javaVM->AttachCurrentThread(&jniEnv, NULL) < 0) {
- __android_log_print(ANDROID_LOG_ERROR, "Qt", "AttachCurrentThread failed");
- jniEnv = 0;
- return;
- }
- attached = true;
- }
- }
-
- ~AttachedJNIEnv()
- {
- if (attached)
- javaVM->DetachCurrentThread();
- }
- bool attached;
- JNIEnv *jniEnv;
- };
-
- QVector<AndroidSensorType> availableSensors()
- {
- QVector<AndroidSensorType> ret;
- AttachedJNIEnv aenv;
- if (!aenv.jniEnv)
- return ret;
- jintArray jsensors = static_cast<jintArray>(aenv.jniEnv->CallStaticObjectMethod(sensorsClass,
- getSensorListMethodId));
- jint *sensors = aenv.jniEnv->GetIntArrayElements(jsensors, 0);
- const uint sz = aenv.jniEnv->GetArrayLength(jsensors);
- for (uint i = 0; i < sz; i++)
- ret.push_back(AndroidSensorType(sensors[i]));
- aenv.jniEnv->ReleaseIntArrayElements(jsensors, sensors, 0);
- return ret;
- }
-
- QString sensorDescription(AndroidSensorType sensor)
- {
- AttachedJNIEnv aenv;
- if (!aenv.jniEnv)
- return QString();
- jstring jstr = static_cast<jstring>(aenv.jniEnv->CallStaticObjectMethod(sensorsClass,
- getSensorDescriptionMethodId,
- jint(sensor)));
- if (!jstr)
- return QString();
- const jchar *pstr = aenv.jniEnv->GetStringChars(jstr, 0);
- QString ret(reinterpret_cast<const QChar *>(pstr), aenv.jniEnv->GetStringLength(jstr));
- aenv.jniEnv->ReleaseStringChars(jstr, pstr);
- aenv.jniEnv->DeleteLocalRef(jstr);
- return ret;
- }
-
- qreal sensorMaximumRange(AndroidSensorType sensor)
- {
- AttachedJNIEnv aenv;
- if (!aenv.jniEnv)
- return 0;
- jfloat range = aenv.jniEnv->CallStaticFloatMethod(sensorsClass, getSensorMaximumRangeMethodId, jint(sensor));
- return range;
- }
-
- bool registerListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener, int dataRate)
- {
- listenersLocker.lockForWrite();
- bool startService = listenersHash[sensor].empty();
- listenersHash[sensor].push_back(listener);
- listenersLocker.unlock();
- if (startService) {
- AttachedJNIEnv aenv;
- if (!aenv.jniEnv)
- return false;
- int rate = dataRate > 0 ? 1000000/dataRate : SENSOR_DELAY_GAME;
- return aenv.jniEnv->CallStaticBooleanMethod(sensorsClass,
- registerSensorMethodId,
- jint(sensor),
- jint(rate));
- }
- return true;
- }
-
- bool unregisterListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener)
- {
- listenersLocker.lockForWrite();
- listenersHash[sensor].removeOne(listener);
- bool stopService = listenersHash[sensor].empty();
- if (stopService)
- listenersHash.remove(sensor);
- listenersLocker.unlock();
- if (stopService) {
- AttachedJNIEnv aenv;
- if (!aenv.jniEnv)
- return false;
- return aenv.jniEnv->CallStaticBooleanMethod(sensorsClass, unregisterSensorMethodId, jint(sensor));
- }
- return true;
- }
-
- qreal getCompassAzimuth(jfloat *accelerometerReading, jfloat *magnetometerReading)
- {
- AttachedJNIEnv aenv;
- if (!aenv.jniEnv)
- return 0.0;
- return aenv.jniEnv->CallStaticFloatMethod(sensorsClass, getCompassAzimuthId,
- accelerometerReading[0],
- accelerometerReading[1],
- accelerometerReading[2],
- magnetometerReading[0],
- magnetometerReading[1],
- magnetometerReading[2]);
- }
-}
-
-static const char logTag[] = "Qt";
-static const char classErrorMsg[] = "Can't find class \"%s\"";
-static const char methodErrorMsg[] = "Can't find method \"%s%s\"";
-
-static void accuracyChanged(JNIEnv * /*env*/, jobject /*thiz*/, jint sensor, jint accuracy)
-{
- listenersLocker.lockForRead();
- foreach (AndroidSensors::AndroidSensorsListenerInterface *listener, listenersHash[sensor])
- listener->onAccuracyChanged(accuracy);
- listenersLocker.unlock();
-}
-
-static void sensorChanged(JNIEnv *env, jobject /*thiz*/, jint sensor, jlong timeStamp, jfloatArray array)
-{
- uint size = env->GetArrayLength(array);
- jfloat *values = env->GetFloatArrayElements(array, 0);
- listenersLocker.lockForRead();
- foreach (AndroidSensors::AndroidSensorsListenerInterface *listener, listenersHash[sensor])
- listener->onSensorChanged(timeStamp, values, size);
- listenersLocker.unlock();
- env->ReleaseFloatArrayElements(array, values, JNI_ABORT); // don't copy back the elements
-
-}
-
-static JNINativeMethod methods[] = {
- {"accuracyChanged", "(II)V", (void *)accuracyChanged},
- {"sensorChanged", "(IJ[F)V", (void *)sensorChanged}
-};
-
-#define FIND_AND_CHECK_CLASS(CLASS_NAME) \
-clazz = env->FindClass(CLASS_NAME); \
-if (!clazz) { \
- __android_log_print(ANDROID_LOG_FATAL, logTag, classErrorMsg, CLASS_NAME); \
- return JNI_FALSE; \
-}
-
-#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
-VAR = env->GetStaticMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
-if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, logTag, methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE); \
- return JNI_FALSE; \
-}
-
-static bool registerNatives(JNIEnv *env)
-{
- jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/sensors/QtSensors");
- sensorsClass = static_cast<jclass>(env->NewGlobalRef(clazz));
-
- if (env->RegisterNatives(sensorsClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "RegisterNatives failed");
- return JNI_FALSE;
- }
-
- GET_AND_CHECK_STATIC_METHOD(getSensorListMethodId, sensorsClass, "getSensorList", "()[I");
- GET_AND_CHECK_STATIC_METHOD(registerSensorMethodId, sensorsClass, "registerSensor", "(II)Z");
- GET_AND_CHECK_STATIC_METHOD(unregisterSensorMethodId, sensorsClass, "unregisterSensor", "(I)Z");
- GET_AND_CHECK_STATIC_METHOD(getSensorDescriptionMethodId, sensorsClass, "getSensorDescription", "(I)Ljava/lang/String;");
- GET_AND_CHECK_STATIC_METHOD(getSensorMaximumRangeMethodId, sensorsClass, "getSensorMaximumRange", "(I)F");
- GET_AND_CHECK_STATIC_METHOD(getCompassAzimuthId, sensorsClass, "getCompassAzimuth", "(FFFFFF)F");
-
- return true;
-}
-
-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;
- } UnionJNIEnvToVoid;
-
- __android_log_print(ANDROID_LOG_INFO, logTag, "Sensors start");
- UnionJNIEnvToVoid uenv;
- uenv.venv = NULL;
- javaVM = 0;
-
- if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "GetEnv failed");
- return -1;
- }
- JNIEnv *env = uenv.nativeEnvironment;
- if (!registerNatives(env)) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "registerNatives failed");
- return -1;
- }
-
- javaVM = vm;
- return JNI_VERSION_1_4;
-}
diff --git a/src/plugins/sensors/android/src/androidjnisensors.h b/src/plugins/sensors/android/src/androidjnisensors.h
deleted file mode 100644
index 8aee4fcf..00000000
--- a/src/plugins/sensors/android/src/androidjnisensors.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDJNISENSORS_H
-#define ANDROIDJNISENSORS_H
-
-#include <jni.h>
-
-#include <QtCore/QVector>
-#include <QtCore/QString>
-
-namespace AndroidSensors
-{
- // must be in sync with https://developer.android.com/reference/android/hardware/Sensor.html#TYPE_ACCELEROMETER
- enum AndroidSensorType
- {
- TYPE_ACCELEROMETER = 1,
- TYPE_AMBIENT_TEMPERATURE = 13, //Added in API level 14
- TYPE_GAME_ROTATION_VECTOR = 15, //Added in API level 18
- TYPE_GRAVITY = 9,
- TYPE_GYROSCOPE = 4,
- TYPE_GYROSCOPE_UNCALIBRATED = 16, //Added in API level 18
- TYPE_LIGHT = 5,
- TYPE_LINEAR_ACCELERATION = 10,
- TYPE_MAGNETIC_FIELD = 2,
- TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14, //Added in API level 18
- TYPE_ORIENTATION = 3, //This constant was deprecated in API level 8. use SensorManager.getOrientation() instead.
- TYPE_PRESSURE = 6,
- TYPE_PROXIMITY = 8,
- TYPE_RELATIVE_HUMIDITY = 12, //Added in API level 14
- TYPE_ROTATION_VECTOR = 11,
- TYPE_SIGNIFICANT_MOTION = 17, //Added in API level 18
- TYPE_TEMPERATURE = 7 //This constant was deprecated in API level 14. use Sensor.TYPE_AMBIENT_TEMPERATURE instead.
- };
-
- struct AndroidSensorsListenerInterface
- {
- virtual ~AndroidSensorsListenerInterface() {}
- virtual void onAccuracyChanged(jint accuracy) = 0;
- virtual void onSensorChanged(jlong timestamp, const jfloat *values, uint size) = 0;
- };
-
- QVector<AndroidSensorType> availableSensors();
- QString sensorDescription(AndroidSensorType sensor);
- qreal sensorMaximumRange(AndroidSensorType sensor);
- bool registerListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener, int dataRate = 0);
- bool unregisterListener(AndroidSensorType sensor, AndroidSensorsListenerInterface *listener);
- qreal getCompassAzimuth(jfloat *accelerometerReading, jfloat *magnetometerReading);
-}
-
-#endif // ANDROIDJNISENSORS_H
diff --git a/src/plugins/sensors/android/src/androidlight.cpp b/src/plugins/sensors/android/src/androidlight.cpp
deleted file mode 100644
index 1059670b..00000000
--- a/src/plugins/sensors/android/src/androidlight.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidlight.h"
-
-AndroidLight::AndroidLight(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QLightReading>(type, sensor)
-{}
-
-
-void AndroidLight::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
-
-void AndroidLight::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 1)
- return;
- m_reader.setTimestamp(timestamp/1000);
- // check https://developer.android.com/reference/android/hardware/SensorEvent.html#values
- m_reader.setLux(values[0]);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidlight.h b/src/plugins/sensors/android/src/androidlight.h
deleted file mode 100644
index 3c94c138..00000000
--- a/src/plugins/sensors/android/src/androidlight.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDLIGHT_H
-#define ANDROIDLIGHT_H
-#include <qlightsensor.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidLight : public AndroidCommonSensor<QLightReading>
-{
-public:
- AndroidLight(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-};
-
-#endif // ANDROIDLIGHT_H
diff --git a/src/plugins/sensors/android/src/androidmagnetometer.cpp b/src/plugins/sensors/android/src/androidmagnetometer.cpp
deleted file mode 100644
index fcde4cf5..00000000
--- a/src/plugins/sensors/android/src/androidmagnetometer.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidmagnetometer.h"
-
-enum AndroidSensorStatus
-{
- SENSOR_STATUS_UNRELIABLE = 0,
- SENSOR_STATUS_ACCURACY_LOW = 1,
- SENSOR_STATUS_ACCURACY_MEDIUM = 2,
- SENSOR_STATUS_ACCURACY_HIGH = 3,
-};
-
-AndroidMagnetometer::AndroidMagnetometer(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- :AndroidCommonSensor<QMagnetometerReading>(type, sensor)
-{}
-
-void AndroidMagnetometer::onAccuracyChanged(jint accuracy)
-{
- // Expected range is [0, 3]
- if (accuracy < SENSOR_STATUS_UNRELIABLE || accuracy > SENSOR_STATUS_ACCURACY_HIGH) {
- qWarning("Unable to get sensor accuracy. Unexpected value: %d", accuracy);
- return;
- }
-
- m_reader.setCalibrationLevel(accuracy / qreal(3.0));
-}
-
-void AndroidMagnetometer::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size<3)
- return;
- m_reader.setTimestamp(timestamp/1000);
- // check https://developer.android.com/reference/android/hardware/SensorEvent.html#values
- m_reader.setX(values[0]/1e6);
- m_reader.setY(values[1]/1e6);
- m_reader.setZ(values[2]/1e6);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidmagnetometer.h b/src/plugins/sensors/android/src/androidmagnetometer.h
deleted file mode 100644
index 1b6a4359..00000000
--- a/src/plugins/sensors/android/src/androidmagnetometer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDMAGNETOMETER_H
-#define ANDROIDMAGNETOMETER_H
-#include <qmagnetometer.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidMagnetometer : public AndroidCommonSensor<QMagnetometerReading>
-{
-public:
- AndroidMagnetometer(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-};
-
-#endif // ANDROIDMAGNETOMETER_H
diff --git a/src/plugins/sensors/android/src/androidpressure.cpp b/src/plugins/sensors/android/src/androidpressure.cpp
deleted file mode 100644
index 0c9a026d..00000000
--- a/src/plugins/sensors/android/src/androidpressure.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidpressure.h"
-
-AndroidPressure::AndroidPressure(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QPressureReading>(type, sensor)
-{}
-
-
-void AndroidPressure::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
-
-void AndroidPressure::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 1)
- return;
- m_reader.setTimestamp(timestamp/1000);
- // check https://developer.android.com/reference/android/hardware/SensorEvent.html#values
- m_reader.setPressure(values[0]*100); //Android uses hPa, we use Pa
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidpressure.h b/src/plugins/sensors/android/src/androidpressure.h
deleted file mode 100644
index dbb59c1b..00000000
--- a/src/plugins/sensors/android/src/androidpressure.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDPRESSURE_H
-#define ANDROIDPRESSURE_H
-#include <qpressuresensor.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidPressure : public AndroidCommonSensor<QPressureReading>
-{
-public:
- AndroidPressure(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-};
-
-#endif // ANDROIDPRESSURE_H
diff --git a/src/plugins/sensors/android/src/androidproximity.cpp b/src/plugins/sensors/android/src/androidproximity.cpp
deleted file mode 100644
index 27c5891c..00000000
--- a/src/plugins/sensors/android/src/androidproximity.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidproximity.h"
-#include "androidjnisensors.h"
-
-AndroidProximity::AndroidProximity(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QProximityReading>(type, sensor)
-{
- m_maximumRange = AndroidSensors::sensorMaximumRange(type);
-
- // if we can't get the range, we arbitrarily define anything closer than 10 cm as "close"
- if (m_maximumRange <= 0)
- m_maximumRange = 10.0;
-}
-
-
-void AndroidProximity::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
-
-void AndroidProximity::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 1)
- return;
- m_reader.setTimestamp(timestamp/1000);
-
- qreal reading = values[0];
- bool close = (reading < m_maximumRange);
- m_reader.setClose(close);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidproximity.h b/src/plugins/sensors/android/src/androidproximity.h
deleted file mode 100644
index 5a3110c2..00000000
--- a/src/plugins/sensors/android/src/androidproximity.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDPROXIMITY_H
-#define ANDROIDPROXIMITY_H
-#include <qproximitysensor.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidProximity : public AndroidCommonSensor<QProximityReading>
-{
-public:
- AndroidProximity(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
- qreal m_maximumRange;
-};
-
-#endif // ANDROIDPROXIMITY_H
diff --git a/src/plugins/sensors/android/src/androidrotation.cpp b/src/plugins/sensors/android/src/androidrotation.cpp
deleted file mode 100644
index f7d02257..00000000
--- a/src/plugins/sensors/android/src/androidrotation.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidrotation.h"
-#include <QtCore/qmath.h>
-
-AndroidRotation::AndroidRotation(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QRotationReading>(type, sensor)
-{}
-
-void AndroidRotation::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
-
-void AndroidRotation::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 3)
- return;
- m_reader.setTimestamp(timestamp/1000);
-
- float rz = -qRadiansToDegrees(values[0]);
- float rx = -qRadiansToDegrees(values[1]);
- float ry = qRadiansToDegrees(values[2]);
- m_reader.setFromEuler(rx, ry, rz);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidrotation.h b/src/plugins/sensors/android/src/androidrotation.h
deleted file mode 100644
index 0fe90a61..00000000
--- a/src/plugins/sensors/android/src/androidrotation.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDROTATION_H
-#define ANDROIDROTATION_H
-#include <qrotationsensor.h>
-
-#include "androidcommonsensor.h"
-class AndroidRotation : public AndroidCommonSensor<QRotationReading>
-{
-public:
- AndroidRotation(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-};
-
-#endif // ANDROIDROTATION_H
diff --git a/src/plugins/sensors/android/src/androidtemperature.cpp b/src/plugins/sensors/android/src/androidtemperature.cpp
deleted file mode 100644
index 3a9e1f51..00000000
--- a/src/plugins/sensors/android/src/androidtemperature.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidtemperature.h"
-
-AndroidTemperature::AndroidTemperature(AndroidSensors::AndroidSensorType type, QSensor *sensor)
- : AndroidCommonSensor<QAmbientTemperatureReading>(type, sensor)
-{}
-
-
-void AndroidTemperature::onAccuracyChanged(jint accuracy)
-{
- Q_UNUSED(accuracy)
-}
-
-void AndroidTemperature::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
-{
- if (size < 1)
- return;
- m_reader.setTimestamp(timestamp/1000);
-
- // TODO: I was unable to test this since the devices I was testing this with did not have
- // a temperature sensor. Verify that this works and check that the units are correct.
-
- m_reader.setTemperature(values[0]);
- newReadingAvailable();
-}
diff --git a/src/plugins/sensors/android/src/androidtemperature.h b/src/plugins/sensors/android/src/androidtemperature.h
deleted file mode 100644
index 1640033b..00000000
--- a/src/plugins/sensors/android/src/androidtemperature.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDTEMPERATURE_H
-#define ANDROIDTEMPERATURE_H
-#include <qambienttemperaturesensor.h>
-
-#include "androidcommonsensor.h"
-
-class AndroidTemperature : public AndroidCommonSensor<QAmbientTemperatureReading>
-{
-public:
- AndroidTemperature(AndroidSensors::AndroidSensorType type, QSensor *sensor);
-private:
- void onAccuracyChanged(jint accuracy) override;
- void onSensorChanged(jlong timestamp, const jfloat *values, uint size) override;
-};
-
-#endif // ANDROIDTEMPERATURE_H
diff --git a/src/plugins/sensors/android/src/main.cpp b/src/plugins/sensors/android/src/main.cpp
deleted file mode 100644
index fc80a273..00000000
--- a/src/plugins/sensors/android/src/main.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qplugin.h>
-#include <qsensorplugin.h>
-#include <qsensorbackend.h>
-#include <qsensormanager.h>
-#include <qaccelerometer.h>
-#include <qcompass.h>
-#include "androidaccelerometer.h"
-#include "androidcompass.h"
-#include "androidgyroscope.h"
-#include "androidlight.h"
-#include "androidmagnetometer.h"
-#include "androidpressure.h"
-#include "androidproximity.h"
-#include "androidrotation.h"
-#include "androidtemperature.h"
-
-using namespace AndroidSensors;
-
-class AndroidSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-public:
- void registerSensors() override
- {
- bool accelerometer = false;
- bool magnetometer = false;
- foreach (AndroidSensorType sensor, availableSensors()) {
- switch (sensor) {
- case TYPE_ACCELEROMETER:
- QSensorManager::registerBackend(QAccelerometer::type, QByteArray::number(sensor), this);
- accelerometer = true;
- break;
- case TYPE_AMBIENT_TEMPERATURE:
- case TYPE_TEMPERATURE:
- QSensorManager::registerBackend(QAmbientTemperatureSensor::type, QByteArray::number(sensor), this);
- break;
- case TYPE_GRAVITY:
- break; // add the gravity sensor backend
- case TYPE_GYROSCOPE:
- QSensorManager::registerBackend(QGyroscope::type, QByteArray::number(sensor), this);
- break;
- case TYPE_LIGHT:
- QSensorManager::registerBackend(QLightSensor::type, QByteArray::number(sensor), this);
- break; // add the light sensor backend
- case TYPE_LINEAR_ACCELERATION:
- break; // add the linear acceleration sensor backend
- case TYPE_MAGNETIC_FIELD:
- QSensorManager::registerBackend(QMagnetometer::type, QByteArray::number(sensor), this);
- magnetometer = true;
- break;
- case TYPE_ORIENTATION:
- break; // add the orientation sensor backend
- case TYPE_PRESSURE:
- QSensorManager::registerBackend(QPressureSensor::type, QByteArray::number(sensor), this);
- break;
- case TYPE_PROXIMITY:
- QSensorManager::registerBackend(QProximitySensor::type, QByteArray::number(sensor), this);
- break;
- case TYPE_RELATIVE_HUMIDITY:
- break; // add the relative humidity sensor backend
- case TYPE_ROTATION_VECTOR:
- QSensorManager::registerBackend(QRotationSensor::type, QByteArray::number(sensor), this);
- break;
-
- case TYPE_GAME_ROTATION_VECTOR:
- case TYPE_GYROSCOPE_UNCALIBRATED:
- case TYPE_MAGNETIC_FIELD_UNCALIBRATED:
- case TYPE_SIGNIFICANT_MOTION:
- break; // add backends for API level 18 sensors
- }
- }
- if (accelerometer && magnetometer)
- QSensorManager::registerBackend(QCompass::type, AndroidCompass::id, this);
- }
-
- QSensorBackend *createBackend(QSensor *sensor) override
- {
- if (sensor->identifier() == AndroidCompass::id)
- return new AndroidCompass(sensor);
-
- AndroidSensorType type = static_cast<AndroidSensorType>(sensor->identifier().toInt());
- switch (type) {
- case TYPE_ACCELEROMETER: {
- QAccelerometer * const accelerometer = qobject_cast<QAccelerometer *>(sensor);
- AndroidSensors::AndroidSensorType type
- = accelerometer ? AndroidAccelerometer::modeToSensor(accelerometer->accelerationMode())
- : AndroidSensors::TYPE_ACCELEROMETER;
- return new AndroidAccelerometer(type, sensor);
- }
- case TYPE_AMBIENT_TEMPERATURE:
- case TYPE_TEMPERATURE:
- return new AndroidTemperature(type, sensor);
- case TYPE_GRAVITY:
- break; // add the gravity sensor backend
- case TYPE_GYROSCOPE:
- return new AndroidGyroscope(type, sensor);
- case TYPE_LIGHT:
- return new AndroidLight(type, sensor);
- case TYPE_LINEAR_ACCELERATION:
- break; // add the linear acceleration sensor backend
- case TYPE_MAGNETIC_FIELD:
- return new AndroidMagnetometer(type, sensor);
- case TYPE_ORIENTATION:
- break; // add the orientation sensor backend
- case TYPE_PRESSURE:
- return new AndroidPressure(type, sensor);
- case TYPE_PROXIMITY:
- return new AndroidProximity(type, sensor);
- case TYPE_RELATIVE_HUMIDITY:
- break; // add the relative humidity sensor backend
- case TYPE_ROTATION_VECTOR:
- return new AndroidRotation(type, sensor);
-
- case TYPE_GAME_ROTATION_VECTOR:
- case TYPE_GYROSCOPE_UNCALIBRATED:
- case TYPE_MAGNETIC_FIELD_UNCALIBRATED:
- case TYPE_SIGNIFICANT_MOTION:
- break; // add backends for API level 18 sensors
- }
- return 0;
- }
-};
-
-Q_IMPORT_PLUGIN (AndroidSensorPlugin) // automatically register the plugin
-
-#include "main.moc"
-
diff --git a/src/plugins/sensors/android/src/plugin.json b/src/plugins/sensors/android/src/plugin.json
deleted file mode 100644
index ef0cbb62..00000000
--- a/src/plugins/sensors/android/src/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "android" ] }
diff --git a/src/plugins/sensors/android/src/src.pro b/src/plugins/sensors/android/src/src.pro
deleted file mode 100644
index 8366944c..00000000
--- a/src/plugins/sensors/android/src/src.pro
+++ /dev/null
@@ -1,39 +0,0 @@
-TARGET = qtsensors_android
-
-QT = sensors core
-
-# STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp
-# Yes, the plugin imports itself statically
-DEFINES += QT_STATICPLUGIN
-
-HEADERS = \
- androidjnisensors.h \
- androidaccelerometer.h \
- androidcompass.h \
- androidcommonsensor.h \
- androidgyroscope.h \
- androidmagnetometer.h \
- androidpressure.h \
- androidproximity.h \
- androidrotation.h \
- androidtemperature.h \
- androidlight.h
-
-SOURCES = \
- main.cpp \
- androidjnisensors.cpp \
- androidaccelerometer.cpp \
- androidcompass.cpp \
- androidgyroscope.cpp \
- androidmagnetometer.cpp \
- androidpressure.cpp \
- androidproximity.cpp \
- androidrotation.cpp \
- androidtemperature.cpp \
- androidlight.cpp
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = QCounterGesturePlugin
-load(qt_plugin)